drivers/media/dvb-frontends/stv090x.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/stv090x.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/stv090x.c- Extension
.c- Size
- 141526 bytes
- Lines
- 5103
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/init.hlinux/kernel.hlinux/module.hlinux/string.hlinux/slab.hlinux/mutex.hlinux/dvb/frontend.hmedia/dvb_frontend.hstv6110x.hstv090x_reg.hstv090x.hstv090x_priv.h
Detected Declarations
struct stv090x_devfunction remove_devfunction comp2function stv090x_read_regfunction stv090x_write_regsfunction stv090x_write_regfunction stv090x_tuner_i2c_lockfunction stv090x_tuner_i2c_unlockfunction stv090x_i2c_gate_ctrlfunction stv090x_get_lock_tmgfunction stv090x_set_sratefunction stv090x_set_max_sratefunction stv090x_set_min_sratefunction stv090x_car_widthfunction stv090x_set_vit_thacqfunction stv090x_set_vit_thtracqfunction stv090x_set_viterbifunction stv090x_stop_modcodfunction stv090x_activate_modcodfunction stv090x_activate_modcod_singlefunction stv090x_vitclk_ctlfunction stv090x_dvbs_track_crlfunction stv090x_delivery_searchfunction stv090x_start_searchfunction stv090x_get_agc2_min_levelfunction stv090x_get_sratefunction stv090x_srate_srch_coarsefunction stv090x_srate_srch_finefunction stv090x_get_dmdlockfunction stv090x_blind_searchfunction stv090x_chk_tmgfunction stv090x_get_coldlockfunction stv090x_get_loop_paramsfunction stv090x_chk_signalfunction stv090x_search_car_loopfunction stv090x_sw_algofunction stv090x_get_stdfunction stv090x_get_car_freqfunction stv090x_get_viterbifunction stv090x_get_sig_paramsfunction stv090x_get_tmgoffstfunction stv090x_optimize_carloopfunction stv090x_optimize_carloop_shortfunction stv090x_optimize_trackfunction stv090x_get_feclockfunction stv090x_get_lockfunction stv090x_set_s2rollofffunction stv090x_algo
Annotated Snippet
struct stv090x_dev {
/* pointer for internal params, one for each pair of demods */
struct stv090x_internal *internal;
struct stv090x_dev *next_dev;
};
/* first internal params */
static struct stv090x_dev *stv090x_first_dev;
/* find chip by i2c adapter and i2c address */
static struct stv090x_dev *find_dev(struct i2c_adapter *i2c_adap,
u8 i2c_addr)
{
struct stv090x_dev *temp_dev = stv090x_first_dev;
/*
Search of the last stv0900 chip or
find it by i2c adapter and i2c address */
while ((temp_dev != NULL) &&
((temp_dev->internal->i2c_adap != i2c_adap) ||
(temp_dev->internal->i2c_addr != i2c_addr))) {
temp_dev = temp_dev->next_dev;
}
return temp_dev;
}
/* deallocating chip */
static void remove_dev(struct stv090x_internal *internal)
{
struct stv090x_dev *prev_dev = stv090x_first_dev;
struct stv090x_dev *del_dev = find_dev(internal->i2c_adap,
internal->i2c_addr);
if (del_dev != NULL) {
if (del_dev == stv090x_first_dev) {
stv090x_first_dev = del_dev->next_dev;
} else {
while (prev_dev->next_dev != del_dev)
prev_dev = prev_dev->next_dev;
prev_dev->next_dev = del_dev->next_dev;
}
kfree(del_dev);
}
}
/* allocating new chip */
static struct stv090x_dev *append_internal(struct stv090x_internal *internal)
{
struct stv090x_dev *new_dev;
struct stv090x_dev *temp_dev;
new_dev = kmalloc_obj(struct stv090x_dev);
if (new_dev != NULL) {
new_dev->internal = internal;
new_dev->next_dev = NULL;
/* append to list */
if (stv090x_first_dev == NULL) {
stv090x_first_dev = new_dev;
} else {
temp_dev = stv090x_first_dev;
while (temp_dev->next_dev != NULL)
temp_dev = temp_dev->next_dev;
temp_dev->next_dev = new_dev;
}
}
return new_dev;
}
/* DVBS1 and DSS C/N Lookup table */
static const struct stv090x_tab stv090x_s1cn_tab[] = {
{ 0, 8917 }, /* 0.0dB */
{ 5, 8801 }, /* 0.5dB */
{ 10, 8667 }, /* 1.0dB */
{ 15, 8522 }, /* 1.5dB */
{ 20, 8355 }, /* 2.0dB */
{ 25, 8175 }, /* 2.5dB */
{ 30, 7979 }, /* 3.0dB */
{ 35, 7763 }, /* 3.5dB */
{ 40, 7530 }, /* 4.0dB */
{ 45, 7282 }, /* 4.5dB */
{ 50, 7026 }, /* 5.0dB */
{ 55, 6781 }, /* 5.5dB */
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/module.h`, `linux/string.h`, `linux/slab.h`, `linux/mutex.h`, `linux/dvb/frontend.h`, `media/dvb_frontend.h`.
- Detected declarations: `struct stv090x_dev`, `function remove_dev`, `function comp2`, `function stv090x_read_reg`, `function stv090x_write_regs`, `function stv090x_write_reg`, `function stv090x_tuner_i2c_lock`, `function stv090x_tuner_i2c_unlock`, `function stv090x_i2c_gate_ctrl`, `function stv090x_get_lock_tmg`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.