drivers/media/dvb-frontends/zl10353.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/zl10353.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/zl10353.c- Extension
.c- Size
- 15612 bytes
- Lines
- 669
- 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/init.hlinux/delay.hlinux/string.hlinux/slab.hasm/div64.hmedia/dvb_frontend.hzl10353_priv.hzl10353.h
Detected Declarations
struct zl10353_statefunction zl10353_single_writefunction zl10353_writefunction zl10353_read_registerfunction zl10353_dump_regsfunction zl10353_calc_nominal_ratefunction zl10353_calc_input_freqfunction zl10353_sleepfunction zl10353_set_parametersfunction zl10353_get_parametersfunction zl10353_read_statusfunction zl10353_read_berfunction zl10353_read_signal_strengthfunction zl10353_read_snrfunction zl10353_read_ucblocksfunction zl10353_get_tune_settingsfunction zl10353_initfunction zl10353_read_registerfunction zl10353_i2c_gate_ctrlfunction zl10353_releaseexport zl10353_attach
Annotated Snippet
struct zl10353_state {
struct i2c_adapter *i2c;
struct dvb_frontend frontend;
struct zl10353_config config;
u32 bandwidth;
u32 ucblocks;
u32 frequency;
};
static int debug;
#define dprintk(args...) \
do { \
if (debug) printk(KERN_DEBUG "zl10353: " args); \
} while (0)
static int debug_regs;
static int zl10353_single_write(struct dvb_frontend *fe, u8 reg, u8 val)
{
struct zl10353_state *state = fe->demodulator_priv;
u8 buf[2] = { reg, val };
struct i2c_msg msg = { .addr = state->config.demod_address, .flags = 0,
.buf = buf, .len = 2 };
int err = i2c_transfer(state->i2c, &msg, 1);
if (err != 1) {
printk("zl10353: write to reg %x failed (err = %d)!\n", reg, err);
return err;
}
return 0;
}
static int zl10353_write(struct dvb_frontend *fe, const u8 ibuf[], int ilen)
{
int err, i;
for (i = 0; i < ilen - 1; i++)
if ((err = zl10353_single_write(fe, ibuf[0] + i, ibuf[i + 1])))
return err;
return 0;
}
static int zl10353_read_register(struct zl10353_state *state, u8 reg)
{
int ret;
u8 b0[1] = { reg };
u8 b1[1] = { 0 };
struct i2c_msg msg[2] = { { .addr = state->config.demod_address,
.flags = 0,
.buf = b0, .len = 1 },
{ .addr = state->config.demod_address,
.flags = I2C_M_RD,
.buf = b1, .len = 1 } };
ret = i2c_transfer(state->i2c, msg, 2);
if (ret != 2) {
printk("%s: readreg error (reg=%d, ret==%i)\n",
__func__, reg, ret);
return ret;
}
return b1[0];
}
static void zl10353_dump_regs(struct dvb_frontend *fe)
{
struct zl10353_state *state = fe->demodulator_priv;
int ret;
u8 reg;
/* Dump all registers. */
for (reg = 0; ; reg++) {
if (reg % 16 == 0) {
if (reg)
printk(KERN_CONT "\n");
printk(KERN_DEBUG "%02x:", reg);
}
ret = zl10353_read_register(state, reg);
if (ret >= 0)
printk(KERN_CONT " %02x", (u8)ret);
else
printk(KERN_CONT " --");
if (reg == 0xff)
break;
}
printk(KERN_CONT "\n");
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/init.h`, `linux/delay.h`, `linux/string.h`, `linux/slab.h`, `asm/div64.h`, `media/dvb_frontend.h`.
- Detected declarations: `struct zl10353_state`, `function zl10353_single_write`, `function zl10353_write`, `function zl10353_read_register`, `function zl10353_dump_regs`, `function zl10353_calc_nominal_rate`, `function zl10353_calc_input_freq`, `function zl10353_sleep`, `function zl10353_set_parameters`, `function zl10353_get_parameters`.
- 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.