drivers/media/dvb-frontends/mxl692.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/mxl692.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/mxl692.c- Extension
.c- Size
- 35316 bytes
- Lines
- 1369
- 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
linux/mutex.hlinux/i2c-mux.hlinux/string.hlinux/firmware.hmxl692.hmxl692_defs.h
Detected Declarations
struct mxl692_devfunction mxl692_i2c_writefunction mxl692_i2c_readfunction convert_endianfunction convert_endian_nfunction mxl692_tx_swapfunction mxl692_rx_swapfunction mxl692_checksumfunction mxl692_validate_fw_headerfunction mxl692_write_fw_blockfunction mxl692_memwritefunction mxl692_memreadfunction mxl692_opwritefunction mxl692_opreadfunction mxl692_i2c_writereadfunction mxl692_fwdownloadfunction mxl692_get_versionsfunction mxl692_resetfunction mxl692_config_regulatorsfunction mxl692_config_xtalfunction mxl692_powermodefunction mxl692_initfunction mxl692_sleepfunction mxl692_set_frontendfunction mxl692_get_frontendfunction mxl692_read_snrfunction mxl692_read_ber_ucbfunction mxl692_read_statusfunction mxl692_probefunction mxl692_remove
Annotated Snippet
struct mxl692_dev {
struct dvb_frontend fe;
struct i2c_client *i2c_client;
struct mutex i2c_lock; /* i2c command mutex */
enum MXL_EAGLE_DEMOD_TYPE_E demod_type;
enum MXL_EAGLE_POWER_MODE_E power_mode;
u32 current_frequency;
int device_type;
int seqnum;
int init_done;
};
static int mxl692_i2c_write(struct mxl692_dev *dev, u8 *buffer, u16 buf_len)
{
int ret = 0;
struct i2c_msg msg = {
.addr = dev->i2c_client->addr,
.flags = 0,
.buf = buffer,
.len = buf_len
};
ret = i2c_transfer(dev->i2c_client->adapter, &msg, 1);
if (ret != 1)
dev_dbg(&dev->i2c_client->dev, "i2c write error!\n");
return ret;
}
static int mxl692_i2c_read(struct mxl692_dev *dev, u8 *buffer, u16 buf_len)
{
int ret = 0;
struct i2c_msg msg = {
.addr = dev->i2c_client->addr,
.flags = I2C_M_RD,
.buf = buffer,
.len = buf_len
};
ret = i2c_transfer(dev->i2c_client->adapter, &msg, 1);
if (ret != 1)
dev_dbg(&dev->i2c_client->dev, "i2c read error!\n");
return ret;
}
static int convert_endian(u32 size, u8 *d)
{
u32 i;
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;
}
return size;
}
static int convert_endian_n(int n, u32 size, u8 *d)
{
int i, count = 0;
for (i = 0; i < n; i += size)
count += convert_endian(size, d + i);
return count;
}
static void mxl692_tx_swap(enum MXL_EAGLE_OPCODE_E opcode, u8 *buffer)
Annotation
- Immediate include surface: `linux/mutex.h`, `linux/i2c-mux.h`, `linux/string.h`, `linux/firmware.h`, `mxl692.h`, `mxl692_defs.h`.
- Detected declarations: `struct mxl692_dev`, `function mxl692_i2c_write`, `function mxl692_i2c_read`, `function convert_endian`, `function convert_endian_n`, `function mxl692_tx_swap`, `function mxl692_rx_swap`, `function mxl692_checksum`, `function mxl692_validate_fw_header`, `function mxl692_write_fw_block`.
- 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.