drivers/media/dvb-frontends/lgdt330x.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/lgdt330x.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/lgdt330x.c- Extension
.c- Size
- 26057 bytes
- Lines
- 1007
- 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/kernel.hlinux/module.hlinux/init.hlinux/delay.hlinux/string.hlinux/slab.hasm/byteorder.hmedia/dvb_frontend.hlinux/int_log.hlgdt330x_priv.hlgdt330x.h
Detected Declarations
struct lgdt330x_statefunction i2c_write_demod_bytesfunction registerfunction lgdt3302_sw_resetfunction lgdt3303_sw_resetfunction lgdt330x_sw_resetfunction lgdt330x_initfunction lgdt330x_read_ucblocksfunction lgdt330x_set_parametersfunction lgdt330x_get_frontendfunction estimationfunction lgdt3302_read_snrfunction lgdt3303_read_snrfunction lgdt330x_read_snrfunction lgdt330x_read_signal_strengthfunction lgdt3302_read_statusfunction lgdt3303_read_statusfunction lgdt330x_get_tune_settingsfunction lgdt330x_releasefunction lgdt330x_probefunction lgdt330x_removeexport lgdt330x_attach
Annotated Snippet
struct lgdt330x_state {
struct i2c_client *client;
/* Configuration settings */
struct lgdt330x_config config;
struct dvb_frontend frontend;
/* Demodulator private data */
enum fe_modulation current_modulation;
u32 snr; /* Result of last SNR calculation */
u16 ucblocks;
unsigned long last_stats_time;
/* Tuner private data */
u32 current_frequency;
};
static int i2c_write_demod_bytes(struct lgdt330x_state *state,
const u8 *buf, /* data bytes to send */
int len /* number of bytes to send */)
{
int i;
int err;
for (i = 0; i < len - 1; i += 2) {
err = i2c_master_send(state->client, buf, 2);
if (err != 2) {
dev_warn(&state->client->dev,
"%s: error (addr %02x <- %02x, err = %i)\n",
__func__, buf[0], buf[1], err);
if (err < 0)
return err;
else
return -EREMOTEIO;
}
buf += 2;
}
return 0;
}
/*
* This routine writes the register (reg) to the demod bus
* then reads the data returned for (len) bytes.
*/
static int i2c_read_demod_bytes(struct lgdt330x_state *state,
enum I2C_REG reg, u8 *buf, int len)
{
u8 wr[] = { reg };
struct i2c_msg msg[] = {
{
.addr = state->client->addr,
.flags = 0,
.buf = wr,
.len = 1
}, {
.addr = state->client->addr,
.flags = I2C_M_RD,
.buf = buf,
.len = len
},
};
int ret;
ret = i2c_transfer(state->client->adapter, msg, 2);
if (ret != 2) {
dev_warn(&state->client->dev,
"%s: addr 0x%02x select 0x%02x error (ret == %i)\n",
__func__, state->client->addr, reg, ret);
if (ret >= 0)
ret = -EIO;
} else {
ret = 0;
}
return ret;
}
/* Software reset */
static int lgdt3302_sw_reset(struct lgdt330x_state *state)
{
u8 reset[] = {
IRQ_MASK,
/*
* bit 6 is active low software reset
* bits 5-0 are 1 to mask interrupts
*/
0x00
};
int ret;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/module.h`, `linux/init.h`, `linux/delay.h`, `linux/string.h`, `linux/slab.h`, `asm/byteorder.h`, `media/dvb_frontend.h`.
- Detected declarations: `struct lgdt330x_state`, `function i2c_write_demod_bytes`, `function register`, `function lgdt3302_sw_reset`, `function lgdt3303_sw_reset`, `function lgdt330x_sw_reset`, `function lgdt330x_init`, `function lgdt330x_read_ucblocks`, `function lgdt330x_set_parameters`, `function lgdt330x_get_frontend`.
- 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.