drivers/media/dvb-frontends/cx24116.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/cx24116.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/cx24116.c- Extension
.c- Size
- 40309 bytes
- Lines
- 1498
- 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/moduleparam.hlinux/init.hlinux/firmware.hmedia/dvb_frontend.hcx24116.h
Detected Declarations
struct cx24116_tuningstruct cx24116_cmdstruct cx24116_stateenum cmdsfunction cx24116_writeregfunction cx24116_writeregNfunction cx24116_readregfunction cx24116_set_inversionfunction cx24116_lookup_fecmodfunction cx24116_set_fecfunction cx24116_set_symbolratefunction cx24116_firmware_ondemandfunction cx24116_cmd_executefunction cx24116_load_firmwarefunction cx24116_read_statusfunction cx24116_read_berfunction cx24116_read_signal_strengthfunction cx24116_read_snr_pctfunction cx24116_read_snr_esnofunction cx24116_read_snrfunction cx24116_read_ucblocksfunction cx24116_clone_paramsfunction cx24116_wait_for_lnbfunction cx24116_set_voltagefunction cx24116_set_tonefunction cx24116_diseqc_initfunction cx24116_send_diseqc_msgfunction cx24116_diseqc_send_burstfunction cx24116_releasefunction cx24116_initfefunction cx24116_sleepfunction cx24116_set_frontendfunction cx24116_tunefunction cx24116_get_algoexport cx24116_attach
Annotated Snippet
struct cx24116_tuning {
u32 frequency;
u32 symbol_rate;
enum fe_spectral_inversion inversion;
enum fe_code_rate fec;
enum fe_delivery_system delsys;
enum fe_modulation modulation;
enum fe_pilot pilot;
enum fe_rolloff rolloff;
/* Demod values */
u8 fec_val;
u8 fec_mask;
u8 inversion_val;
u8 pilot_val;
u8 rolloff_val;
};
/* Basic commands that are sent to the firmware */
struct cx24116_cmd {
u8 len;
u8 args[CX24116_ARGLEN];
};
struct cx24116_state {
struct i2c_adapter *i2c;
const struct cx24116_config *config;
struct dvb_frontend frontend;
struct cx24116_tuning dcur;
struct cx24116_tuning dnxt;
u8 skip_fw_load;
u8 burst;
struct cx24116_cmd dsec_cmd;
};
static int cx24116_writereg(struct cx24116_state *state, int reg, int data)
{
u8 buf[] = { reg, data };
struct i2c_msg msg = { .addr = state->config->demod_address,
.flags = 0, .buf = buf, .len = 2 };
int err;
if (debug > 1)
printk("cx24116: %s: write reg 0x%02x, value 0x%02x\n",
__func__, reg, data);
err = i2c_transfer(state->i2c, &msg, 1);
if (err != 1) {
printk(KERN_ERR "%s: writereg error(err == %i, reg == 0x%02x, value == 0x%02x)\n",
__func__, err, reg, data);
return -EREMOTEIO;
}
return 0;
}
/* Bulk byte writes to a single I2C address, for 32k firmware load */
static int cx24116_writeregN(struct cx24116_state *state, int reg,
const u8 *data, u16 len)
{
int ret;
struct i2c_msg msg;
u8 *buf;
buf = kmalloc(len + 1, GFP_KERNEL);
if (!buf)
return -ENOMEM;
*(buf) = reg;
memcpy(buf + 1, data, len);
msg.addr = state->config->demod_address;
msg.flags = 0;
msg.buf = buf;
msg.len = len + 1;
if (debug > 1)
printk(KERN_INFO "cx24116: %s: write regN 0x%02x, len = %d\n",
__func__, reg, len);
ret = i2c_transfer(state->i2c, &msg, 1);
if (ret != 1) {
printk(KERN_ERR "%s: writereg error(err == %i, reg == 0x%02x\n",
__func__, ret, reg);
ret = -EREMOTEIO;
}
Annotation
- Immediate include surface: `linux/slab.h`, `linux/kernel.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/firmware.h`, `media/dvb_frontend.h`, `cx24116.h`.
- Detected declarations: `struct cx24116_tuning`, `struct cx24116_cmd`, `struct cx24116_state`, `enum cmds`, `function cx24116_writereg`, `function cx24116_writeregN`, `function cx24116_readreg`, `function cx24116_set_inversion`, `function cx24116_lookup_fecmod`, `function cx24116_set_fec`.
- 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.