drivers/media/dvb-frontends/cx24113.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/cx24113.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/cx24113.c- Extension
.c- Size
- 14030 bytes
- Lines
- 602
- 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.hmedia/dvb_frontend.hcx24113.h
Detected Declarations
struct cx24113_statefunction cx24113_writeregfunction cx24113_readregfunction cx24113_set_parametersfunction cx24113_set_gain_settingsfunction cx24113_set_Freffunction cx24113_enablefunction cx24113_set_bandwidthfunction cx24113_set_clk_inversionfunction cx24113_get_statusfunction cx24113_set_ref_divfunction cx24113_calc_pll_nffunction cx24113_set_nfrfunction cx24113_set_frequencyfunction cx24113_initfunction cx24113_set_paramsfunction cx24113_agc_callbackfunction cx24113_get_frequencyfunction cx24113_releaseexport cx24113_agc_callbackexport cx24113_attach
Annotated Snippet
struct cx24113_state {
struct i2c_adapter *i2c;
const struct cx24113_config *config;
#define REV_CX24113 0x23
u8 rev;
u8 ver;
u8 icp_mode:1;
#define ICP_LEVEL1 0
#define ICP_LEVEL2 1
#define ICP_LEVEL3 2
#define ICP_LEVEL4 3
u8 icp_man:2;
u8 icp_auto_low:2;
u8 icp_auto_mlow:2;
u8 icp_auto_mhi:2;
u8 icp_auto_hi:2;
u8 icp_dig;
#define LNA_MIN_GAIN 0
#define LNA_MID_GAIN 1
#define LNA_MAX_GAIN 2
u8 lna_gain:2;
u8 acp_on:1;
u8 vco_mode:2;
u8 vco_shift:1;
#define VCOBANDSEL_6 0x80
#define VCOBANDSEL_5 0x01
#define VCOBANDSEL_4 0x02
#define VCOBANDSEL_3 0x04
#define VCOBANDSEL_2 0x08
#define VCOBANDSEL_1 0x10
u8 vco_band;
#define VCODIV4 4
#define VCODIV2 2
u8 vcodiv;
u8 bs_delay:4;
u16 bs_freqcnt:13;
u16 bs_rdiv;
u8 prescaler_mode:1;
u8 rfvga_bias_ctrl;
s16 tuner_gain_thres;
u8 gain_level;
u32 frequency;
u8 refdiv;
u8 Fwindow_enabled;
};
static int cx24113_writereg(struct cx24113_state *state, int reg, int data)
{
u8 buf[] = { reg, data };
struct i2c_msg msg = { .addr = state->config->i2c_addr,
.flags = 0, .buf = buf, .len = 2 };
int err = i2c_transfer(state->i2c, &msg, 1);
if (err != 1) {
printk(KERN_DEBUG "%s: writereg error(err == %i, reg == 0x%02x, data == 0x%02x)\n",
__func__, err, reg, data);
return err;
}
return 0;
}
static int cx24113_readreg(struct cx24113_state *state, u8 reg)
{
int ret;
u8 b;
struct i2c_msg msg[] = {
{ .addr = state->config->i2c_addr,
.flags = 0, .buf = ®, .len = 1 },
{ .addr = state->config->i2c_addr,
.flags = I2C_M_RD, .buf = &b, .len = 1 }
};
ret = i2c_transfer(state->i2c, msg, 2);
if (ret != 2) {
printk(KERN_DEBUG "%s: reg=0x%x (error=%d)\n",
__func__, reg, ret);
Annotation
- Immediate include surface: `linux/slab.h`, `linux/kernel.h`, `linux/module.h`, `linux/init.h`, `media/dvb_frontend.h`, `cx24113.h`.
- Detected declarations: `struct cx24113_state`, `function cx24113_writereg`, `function cx24113_readreg`, `function cx24113_set_parameters`, `function cx24113_set_gain_settings`, `function cx24113_set_Fref`, `function cx24113_enable`, `function cx24113_set_bandwidth`, `function cx24113_set_clk_inversion`, `function cx24113_get_status`.
- 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.