drivers/media/usb/dvb-usb-v2/rtl28xxu.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/dvb-usb-v2/rtl28xxu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/dvb-usb-v2/rtl28xxu.c- Extension
.c- Size
- 52730 bytes
- Lines
- 2014
- Domain
- Driver Families
- Bucket
- drivers/media
- Inferred role
- Driver Families: implementation source
- Status
- source 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
rtl28xxu.h
Detected Declarations
function rtl28xxu_ctrl_msgfunction rtl28xxu_wr_regsfunction rtl28xxu_rd_regsfunction rtl28xxu_wr_regfunction rtl28xxu_rd_regfunction rtl28xxu_wr_reg_maskfunction rtl28xxu_i2c_xferfunction rtl28xxu_i2c_funcfunction rtl2831u_read_configfunction rtl2832u_read_configfunction rtl28xxu_read_configfunction rtl28xxu_identify_statefunction rtl2831u_frontend_attachfunction rtl2832u_fc0012_tuner_callbackfunction rtl2832u_tua9001_tuner_callbackfunction rtl2832u_frontend_callbackfunction rtl2832u_frontend_attachfunction rtl28xxu_frontend_attachfunction rtl28xxu_frontend_detachfunction rtl2831u_tuner_attachfunction rtl2832u_tuner_attachfunction rtl28xxu_tuner_attachfunction rtl28xxu_tuner_detachfunction rtl28xxu_initfunction rtl2831u_power_ctrlfunction rtl2832u_power_ctrlfunction rtl28xxu_power_ctrlfunction rtl28xxu_frontend_ctrlfunction rtl2831u_rc_queryfunction rtl2831u_get_rc_configfunction rtl2832u_rc_queryfunction rtl2832u_get_rc_configfunction rtl28xxu_get_rc_configfunction rtl28xxu_pid_filter_ctrlfunction rtl28xxu_pid_filter
Annotated Snippet
if (msg[0].len > 24 || msg[1].len > 24) {
/* TODO: check msg[0].len max */
ret = -EOPNOTSUPP;
goto err_mutex_unlock;
} else if (msg[0].addr == 0x10) {
if (msg[0].len < 1 || msg[1].len < 1) {
ret = -EOPNOTSUPP;
goto err_mutex_unlock;
}
/* method 1 - integrated demod */
if (msg[0].buf[0] == 0x00) {
/* return demod page from driver cache */
msg[1].buf[0] = dev->page;
ret = 0;
} else {
req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1);
req.index = CMD_DEMOD_RD | dev->page;
req.size = msg[1].len;
req.data = &msg[1].buf[0];
ret = rtl28xxu_ctrl_msg(d, &req);
}
} else if (msg[0].len < 2) {
if (msg[0].len < 1) {
ret = -EOPNOTSUPP;
goto err_mutex_unlock;
}
/* method 2 - old I2C */
req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1);
req.index = CMD_I2C_RD;
req.size = msg[1].len;
req.data = &msg[1].buf[0];
ret = rtl28xxu_ctrl_msg(d, &req);
} else {
/* method 3 - new I2C */
req.value = (msg[0].addr << 1);
req.index = CMD_I2C_DA_WR;
req.size = msg[0].len;
req.data = msg[0].buf;
ret = rtl28xxu_ctrl_msg(d, &req);
if (ret)
goto err_mutex_unlock;
req.value = (msg[0].addr << 1);
req.index = CMD_I2C_DA_RD;
req.size = msg[1].len;
req.data = msg[1].buf;
ret = rtl28xxu_ctrl_msg(d, &req);
}
} else if (num == 1 && !(msg[0].flags & I2C_M_RD)) {
if (msg[0].len > 22) {
/* TODO: check msg[0].len max */
ret = -EOPNOTSUPP;
goto err_mutex_unlock;
} else if (msg[0].addr == 0x10) {
if (msg[0].len < 1) {
ret = -EOPNOTSUPP;
goto err_mutex_unlock;
}
/* method 1 - integrated demod */
if (msg[0].buf[0] == 0x00) {
if (msg[0].len < 2) {
ret = -EOPNOTSUPP;
goto err_mutex_unlock;
}
/* save demod page for later demod access */
dev->page = msg[0].buf[1];
ret = 0;
} else {
req.value = (msg[0].buf[0] << 8) |
(msg[0].addr << 1);
req.index = CMD_DEMOD_WR | dev->page;
req.size = msg[0].len-1;
req.data = &msg[0].buf[1];
ret = rtl28xxu_ctrl_msg(d, &req);
}
} else if ((msg[0].len < 23) && (!dev->new_i2c_write)) {
if (msg[0].len < 1) {
ret = -EOPNOTSUPP;
goto err_mutex_unlock;
}
/* method 2 - old I2C */
req.value = (msg[0].buf[0] << 8) | (msg[0].addr << 1);
req.index = CMD_I2C_WR;
req.size = msg[0].len-1;
req.data = &msg[0].buf[1];
ret = rtl28xxu_ctrl_msg(d, &req);
} else {
/* method 3 - new I2C */
req.value = (msg[0].addr << 1);
req.index = CMD_I2C_DA_WR;
Annotation
- Immediate include surface: `rtl28xxu.h`.
- Detected declarations: `function rtl28xxu_ctrl_msg`, `function rtl28xxu_wr_regs`, `function rtl28xxu_rd_regs`, `function rtl28xxu_wr_reg`, `function rtl28xxu_rd_reg`, `function rtl28xxu_wr_reg_mask`, `function rtl28xxu_i2c_xfer`, `function rtl28xxu_i2c_func`, `function rtl2831u_read_config`, `function rtl2832u_read_config`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.