drivers/media/dvb-frontends/cx24123.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/cx24123.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/cx24123.c- Extension
.c- Size
- 29142 bytes
- Lines
- 1140
- 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/slab.hlinux/kernel.hlinux/module.hlinux/init.hasm/div64.hmedia/dvb_frontend.hcx24123.h
Detected Declarations
struct cx24123_statefunction cx24123_i2c_writeregfunction cx24123_i2c_readregfunction cx24123_set_inversionfunction cx24123_get_inversionfunction cx24123_set_fecfunction cx24123_get_fecfunction cx24123_int_log2function cx24123_set_symbolratefunction cx24123_pll_calculatefunction cx24123_pll_writeregfunction cx24123_pll_tunefunction cx24123_repeater_modefunction cx24123_initfefunction cx24123_set_voltagefunction cx24123_wait_for_diseqcfunction cx24123_send_diseqc_msgfunction cx24123_diseqc_send_burstfunction cx24123_read_statusfunction cx24123_read_berfunction cx24123_read_signal_strengthfunction cx24123_read_snrfunction cx24123_set_frontendfunction cx24123_get_frontendfunction cx24123_set_tonefunction cx24123_tunefunction cx24123_get_algofunction cx24123_releasefunction cx24123_tuner_i2c_tuner_xferfunction cx24123_tuner_i2c_funcfunction cx24123_get_tuner_i2c_adapterexport cx24123_get_tuner_i2c_adapterexport cx24123_attach
Annotated Snippet
struct cx24123_state {
struct i2c_adapter *i2c;
const struct cx24123_config *config;
struct dvb_frontend frontend;
/* Some PLL specifics for tuning */
u32 VCAarg;
u32 VGAarg;
u32 bandselectarg;
u32 pllarg;
u32 FILTune;
struct i2c_adapter tuner_i2c_adapter;
u8 demod_rev;
/* The Demod/Tuner can't easily provide these, we cache them */
u32 currentfreq;
u32 currentsymbolrate;
};
/* Various tuner defaults need to be established for a given symbol rate Sps */
static struct cx24123_AGC_val {
u32 symbolrate_low;
u32 symbolrate_high;
u32 VCAprogdata;
u32 VGAprogdata;
u32 FILTune;
} cx24123_AGC_vals[] =
{
{
.symbolrate_low = 1000000,
.symbolrate_high = 4999999,
/* the specs recommend other values for VGA offsets,
but tests show they are wrong */
.VGAprogdata = (1 << 19) | (0x180 << 9) | 0x1e0,
.VCAprogdata = (2 << 19) | (0x07 << 9) | 0x07,
.FILTune = 0x27f /* 0.41 V */
},
{
.symbolrate_low = 5000000,
.symbolrate_high = 14999999,
.VGAprogdata = (1 << 19) | (0x180 << 9) | 0x1e0,
.VCAprogdata = (2 << 19) | (0x07 << 9) | 0x1f,
.FILTune = 0x317 /* 0.90 V */
},
{
.symbolrate_low = 15000000,
.symbolrate_high = 45000000,
.VGAprogdata = (1 << 19) | (0x100 << 9) | 0x180,
.VCAprogdata = (2 << 19) | (0x07 << 9) | 0x3f,
.FILTune = 0x145 /* 2.70 V */
},
};
/*
* Various tuner defaults need to be established for a given frequency kHz.
* fixme: The bounds on the bands do not match the doc in real life.
* fixme: Some of them have been moved, other might need adjustment.
*/
static struct cx24123_bandselect_val {
u32 freq_low;
u32 freq_high;
u32 VCOdivider;
u32 progdata;
} cx24123_bandselect_vals[] =
{
/* band 1 */
{
.freq_low = 950000,
.freq_high = 1074999,
.VCOdivider = 4,
.progdata = (0 << 19) | (0 << 9) | 0x40,
},
/* band 2 */
{
.freq_low = 1075000,
.freq_high = 1177999,
.VCOdivider = 4,
.progdata = (0 << 19) | (0 << 9) | 0x80,
},
/* band 3 */
{
.freq_low = 1178000,
.freq_high = 1295999,
.VCOdivider = 2,
.progdata = (0 << 19) | (1 << 9) | 0x01,
Annotation
- Immediate include surface: `linux/slab.h`, `linux/kernel.h`, `linux/module.h`, `linux/init.h`, `asm/div64.h`, `media/dvb_frontend.h`, `cx24123.h`.
- Detected declarations: `struct cx24123_state`, `function cx24123_i2c_writereg`, `function cx24123_i2c_readreg`, `function cx24123_set_inversion`, `function cx24123_get_inversion`, `function cx24123_set_fec`, `function cx24123_get_fec`, `function cx24123_int_log2`, `function cx24123_set_symbolrate`, `function cx24123_pll_calculate`.
- 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.