drivers/media/dvb-frontends/stv0900_core.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/stv0900_core.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/stv0900_core.c- Extension
.c- Size
- 50441 bytes
- Lines
- 1965
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/kernel.hlinux/module.hlinux/string.hlinux/slab.hlinux/i2c.hstv0900.hstv0900_reg.hstv0900_priv.hstv0900_init.h
Detected Declarations
struct stv0900_inodefunction remove_inodefunction ge2compfunction stv0900_write_regfunction stv0900_read_regfunction extract_mask_posfunction stv0900_write_bitsfunction stv0900_get_bitsfunction stv0900_initializefunction stv0900_get_mclk_freqfunction stv0900_set_mclkfunction stv0900_get_err_countfunction stv0900_i2c_gate_ctrlfunction stv0900_set_ts_parallel_serialfunction stv0900_set_tunerfunction stv0900_set_bandwidthfunction stv0900_get_freq_autofunction stv0900_set_tuner_autofunction stv0900_get_rf_levelfunction stv0900_read_signal_strengthfunction stv0900_carr_get_qualityfunction stv0900_read_ucblocksfunction stv0900_read_snrfunction stv0900_get_berfunction stv0900_read_berfunction stv0900_get_demod_lockfunction stv0900_stop_all_s2_modcodfunction stv0900_activate_s2_modcodfunction stv0900_activate_s2_modcod_singlefunction stv0900_frontend_algofunction stv0900_start_searchfunction stv0900_get_optim_carr_loopfunction stv0900_get_optim_short_carr_loopfunction stv0900_st_dvbs2_singlefunction stv0900_init_internalfunction stv0900_statusfunction stv0900_set_misfunction stv0900_searchfunction stv0900_read_statusfunction stv0900_stop_tsfunction stv0900_diseqc_initfunction stv0900_initfunction stv0900_diseqc_sendfunction stv0900_send_master_cmdfunction stv0900_send_burstfunction stv0900_recv_slave_replyfunction stv0900_set_tonefunction stv0900_release
Annotated Snippet
struct stv0900_inode {
/* pointer for internal params, one for each pair of demods */
struct stv0900_internal *internal;
struct stv0900_inode *next_inode;
};
/* first internal params */
static struct stv0900_inode *stv0900_first_inode;
/* find chip by i2c adapter and i2c address */
static struct stv0900_inode *find_inode(struct i2c_adapter *i2c_adap,
u8 i2c_addr)
{
struct stv0900_inode *temp_chip = stv0900_first_inode;
if (temp_chip != NULL) {
/*
Search of the last stv0900 chip or
find it by i2c adapter and i2c address */
while ((temp_chip != NULL) &&
((temp_chip->internal->i2c_adap != i2c_adap) ||
(temp_chip->internal->i2c_addr != i2c_addr)))
temp_chip = temp_chip->next_inode;
}
return temp_chip;
}
/* deallocating chip */
static void remove_inode(struct stv0900_internal *internal)
{
struct stv0900_inode *prev_node = stv0900_first_inode;
struct stv0900_inode *del_node = find_inode(internal->i2c_adap,
internal->i2c_addr);
if (del_node != NULL) {
if (del_node == stv0900_first_inode) {
stv0900_first_inode = del_node->next_inode;
} else {
while (prev_node->next_inode != del_node)
prev_node = prev_node->next_inode;
if (del_node->next_inode == NULL)
prev_node->next_inode = NULL;
else
prev_node->next_inode =
prev_node->next_inode->next_inode;
}
kfree(del_node);
}
}
/* allocating new chip */
static struct stv0900_inode *append_internal(struct stv0900_internal *internal)
{
struct stv0900_inode *new_node = stv0900_first_inode;
if (new_node == NULL) {
new_node = kmalloc_obj(struct stv0900_inode);
stv0900_first_inode = new_node;
} else {
while (new_node->next_inode != NULL)
new_node = new_node->next_inode;
new_node->next_inode = kmalloc_obj(struct stv0900_inode);
if (new_node->next_inode != NULL)
new_node = new_node->next_inode;
else
new_node = NULL;
}
if (new_node != NULL) {
new_node->internal = internal;
new_node->next_inode = NULL;
}
return new_node;
}
s32 ge2comp(s32 a, s32 width)
{
if (width == 32)
return a;
else
return (a >= (1 << (width - 1))) ? (a - (1 << width)) : a;
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/string.h`, `linux/slab.h`, `linux/i2c.h`, `stv0900.h`, `stv0900_reg.h`, `stv0900_priv.h`.
- Detected declarations: `struct stv0900_inode`, `function remove_inode`, `function ge2comp`, `function stv0900_write_reg`, `function stv0900_read_reg`, `function extract_mask_pos`, `function stv0900_write_bits`, `function stv0900_get_bits`, `function stv0900_initialize`, `function stv0900_get_mclk_freq`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.