drivers/media/dvb-frontends/zl10039.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/zl10039.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/zl10039.c- Extension
.c- Size
- 6633 bytes
- Lines
- 305
- 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/module.hlinux/init.hlinux/string.hlinux/slab.hlinux/dvb/frontend.hmedia/dvb_frontend.hzl10039.h
Detected Declarations
struct zl10039_stateenum zl10039_model_idenum zl10039_reg_addrfunction zl10039_readfunction zl10039_writefunction zl10039_readregfunction zl10039_writeregfunction zl10039_initfunction zl10039_sleepfunction zl10039_set_paramsfunction zl10039_releaseexport zl10039_attach
Annotated Snippet
struct zl10039_state {
struct i2c_adapter *i2c;
u8 i2c_addr;
u8 id;
};
enum zl10039_reg_addr {
PLL0 = 0,
PLL1,
PLL2,
PLL3,
RFFE,
BASE0,
BASE1,
BASE2,
LO0,
LO1,
LO2,
LO3,
LO4,
LO5,
LO6,
GENERAL
};
static int zl10039_read(const struct zl10039_state *state,
const enum zl10039_reg_addr reg, u8 *buf,
const size_t count)
{
u8 regbuf[] = { reg };
struct i2c_msg msg[] = {
{/* Write register address */
.addr = state->i2c_addr,
.flags = 0,
.buf = regbuf,
.len = 1,
}, {/* Read count bytes */
.addr = state->i2c_addr,
.flags = I2C_M_RD,
.buf = buf,
.len = count,
},
};
dprintk("%s\n", __func__);
if (i2c_transfer(state->i2c, msg, 2) != 2) {
dprintk("%s: i2c read error\n", __func__);
return -EREMOTEIO;
}
return 0; /* Success */
}
static int zl10039_write(struct zl10039_state *state,
const enum zl10039_reg_addr reg, const u8 *src,
const size_t count)
{
u8 buf[MAX_XFER_SIZE];
struct i2c_msg msg = {
.addr = state->i2c_addr,
.flags = 0,
.buf = buf,
.len = count + 1,
};
if (1 + count > sizeof(buf)) {
printk(KERN_WARNING
"%s: i2c wr reg=%04x: len=%zu is too big!\n",
KBUILD_MODNAME, reg, count);
return -EINVAL;
}
dprintk("%s\n", __func__);
/* Write register address and data in one go */
buf[0] = reg;
memcpy(&buf[1], src, count);
if (i2c_transfer(state->i2c, &msg, 1) != 1) {
dprintk("%s: i2c write error\n", __func__);
return -EREMOTEIO;
}
return 0; /* Success */
}
static inline int zl10039_readreg(struct zl10039_state *state,
const enum zl10039_reg_addr reg, u8 *val)
{
return zl10039_read(state, reg, val, 1);
}
Annotation
- Immediate include surface: `linux/module.h`, `linux/init.h`, `linux/string.h`, `linux/slab.h`, `linux/dvb/frontend.h`, `media/dvb_frontend.h`, `zl10039.h`.
- Detected declarations: `struct zl10039_state`, `enum zl10039_model_id`, `enum zl10039_reg_addr`, `function zl10039_read`, `function zl10039_write`, `function zl10039_readreg`, `function zl10039_writereg`, `function zl10039_init`, `function zl10039_sleep`, `function zl10039_set_params`.
- 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.