drivers/media/usb/dvb-usb-v2/ec168.c
Source file repositories/reference/linux-study-clean/drivers/media/usb/dvb-usb-v2/ec168.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/usb/dvb-usb-v2/ec168.c- Extension
.c- Size
- 8964 bytes
- Lines
- 379
- 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.
- 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
ec168.hec100.hmxl5005s.h
Detected Declarations
function ec168_ctrl_msgfunction ec168_i2c_xferfunction ec168_i2c_funcfunction ec168_identify_statefunction ec168_download_firmwarefunction ec168_ec100_frontend_attachfunction ec168_mxl5003s_tuner_attachfunction ec168_streaming_ctrl
Annotated Snippet
if (num > i + 1 && (msg[i+1].flags & I2C_M_RD)) {
if (msg[i].addr == ec168_ec100_config.demod_address) {
if (msg[i].len < 1) {
i = -EOPNOTSUPP;
break;
}
req.cmd = READ_DEMOD;
req.value = 0;
req.index = 0xff00 + msg[i].buf[0]; /* reg */
req.size = msg[i+1].len; /* bytes to read */
req.data = &msg[i+1].buf[0];
ret = ec168_ctrl_msg(d, &req);
i += 2;
} else {
dev_err(&d->udev->dev, "%s: I2C read not " \
"implemented\n",
KBUILD_MODNAME);
ret = -EOPNOTSUPP;
i += 2;
}
} else {
if (msg[i].addr == ec168_ec100_config.demod_address) {
if (msg[i].len < 1) {
i = -EOPNOTSUPP;
break;
}
req.cmd = WRITE_DEMOD;
req.value = msg[i].buf[1]; /* val */
req.index = 0xff00 + msg[i].buf[0]; /* reg */
req.size = 0;
req.data = NULL;
ret = ec168_ctrl_msg(d, &req);
i += 1;
} else {
if (msg[i].len < 1) {
i = -EOPNOTSUPP;
break;
}
req.cmd = WRITE_I2C;
req.value = msg[i].buf[0]; /* val */
req.index = 0x0100 + msg[i].addr; /* I2C addr */
req.size = msg[i].len-1;
req.data = &msg[i].buf[1];
ret = ec168_ctrl_msg(d, &req);
i += 1;
}
}
if (ret)
goto error;
}
ret = i;
error:
mutex_unlock(&d->i2c_mutex);
return ret;
}
static u32 ec168_i2c_func(struct i2c_adapter *adapter)
{
return I2C_FUNC_I2C;
}
static const struct i2c_algorithm ec168_i2c_algo = {
.master_xfer = ec168_i2c_xfer,
.functionality = ec168_i2c_func,
};
/* Callbacks for DVB USB */
static int ec168_identify_state(struct dvb_usb_device *d, const char **name)
{
int ret;
u8 reply;
struct ec168_req req = {GET_CONFIG, 0, 1, sizeof(reply), &reply};
dev_dbg(&d->udev->dev, "%s:\n", __func__);
ret = ec168_ctrl_msg(d, &req);
if (ret)
goto error;
dev_dbg(&d->udev->dev, "%s: reply=%02x\n", __func__, reply);
if (reply == 0x01)
ret = WARM;
else
ret = COLD;
return ret;
error:
dev_dbg(&d->udev->dev, "%s: failed=%d\n", __func__, ret);
Annotation
- Immediate include surface: `ec168.h`, `ec100.h`, `mxl5005s.h`.
- Detected declarations: `function ec168_ctrl_msg`, `function ec168_i2c_xfer`, `function ec168_i2c_func`, `function ec168_identify_state`, `function ec168_download_firmware`, `function ec168_ec100_frontend_attach`, `function ec168_mxl5003s_tuner_attach`, `function ec168_streaming_ctrl`.
- 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.
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.