drivers/media/dvb-frontends/mxl5xx.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/mxl5xx.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/mxl5xx.c- Extension
.c- Size
- 53901 bytes
- Lines
- 1886
- 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.
- 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
linux/kernel.hlinux/module.hlinux/moduleparam.hlinux/init.hlinux/delay.hlinux/firmware.hlinux/i2c.hlinux/mutex.hlinux/vmalloc.hasm/div64.hlinux/unaligned.hmedia/dvb_frontend.hmxl5xx.hmxl5xx_regs.hmxl5xx_defs.h
Detected Declarations
struct mxl_basestruct mxlfunction convert_endianfunction i2c_writefunction i2c_readfunction i2creadfunction i2cwritefunction read_register_unlockedfunction send_commandfunction write_registerfunction write_firmware_blockfunction read_registerfunction read_register_blockfunction read_by_mnemonicfunction update_by_mnemonicfunction firmware_is_alivefunction initfunction releasefunction get_algofunction gold2rootfunction cfg_scramblerfunction cfg_demod_abort_tunefunction send_master_cmdfunction set_parametersfunction sleepfunction list_for_each_entryfunction read_snrfunction read_berfunction read_signal_strengthfunction read_statusfunction tunefunction conv_fecfunction get_frontendfunction set_inputfunction cfg_dev_xtalfunction get_big_endianfunction write_fw_segmentfunction do_firmware_downloadfunction check_fwfunction firmware_downloadfunction cfg_ts_pad_muxfunction set_drive_strengthfunction enable_tunerfunction config_tsfunction config_muxfunction load_fwfunction validate_skufunction get_fwinfo
Annotated Snippet
struct mxl_base {
struct list_head mxllist;
struct list_head mxls;
u8 adr;
struct i2c_adapter *i2c;
u32 count;
u32 type;
u32 sku_type;
u32 chipversion;
u32 clock;
u32 fwversion;
u8 *ts_map;
u8 can_clkout;
u8 chan_bond;
u8 demod_num;
u8 tuner_num;
unsigned long next_tune;
struct mutex i2c_lock;
struct mutex status_lock;
struct mutex tune_lock;
u8 buf[MXL_HYDRA_OEM_MAX_CMD_BUFF_LEN];
u32 cmd_size;
u8 cmd_data[MAX_CMD_DATA];
};
struct mxl {
struct list_head mxl;
struct mxl_base *base;
struct dvb_frontend fe;
struct device *i2cdev;
u32 demod;
u32 tuner;
u32 tuner_in_use;
u8 xbar[3];
unsigned long tune_time;
};
static void convert_endian(u8 flag, u32 size, u8 *d)
{
u32 i;
if (!flag)
return;
for (i = 0; i < (size & ~3); i += 4) {
d[i + 0] ^= d[i + 3];
d[i + 3] ^= d[i + 0];
d[i + 0] ^= d[i + 3];
d[i + 1] ^= d[i + 2];
d[i + 2] ^= d[i + 1];
d[i + 1] ^= d[i + 2];
}
switch (size & 3) {
case 0:
case 1:
/* do nothing */
break;
case 2:
d[i + 0] ^= d[i + 1];
d[i + 1] ^= d[i + 0];
d[i + 0] ^= d[i + 1];
break;
case 3:
d[i + 0] ^= d[i + 2];
d[i + 2] ^= d[i + 0];
d[i + 0] ^= d[i + 2];
break;
}
}
static int i2c_write(struct i2c_adapter *adap, u8 adr,
u8 *data, u32 len)
{
struct i2c_msg msg = {.addr = adr, .flags = 0,
.buf = data, .len = len};
return (i2c_transfer(adap, &msg, 1) == 1) ? 0 : -1;
}
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/delay.h`, `linux/firmware.h`, `linux/i2c.h`, `linux/mutex.h`.
- Detected declarations: `struct mxl_base`, `struct mxl`, `function convert_endian`, `function i2c_write`, `function i2c_read`, `function i2cread`, `function i2cwrite`, `function read_register_unlocked`, `function send_command`, `function write_register`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: integration 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.