drivers/media/dvb-frontends/lgdt3305.c
Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/lgdt3305.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/dvb-frontends/lgdt3305.c- Extension
.c- Size
- 31233 bytes
- Lines
- 1203
- 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
asm/div64.hlinux/dvb/frontend.hlinux/slab.hlinux/int_log.hlgdt3305.h
Detected Declarations
struct lgdt3305_statestruct lgdt3305_regfunction lgdt3305_write_regfunction lgdt3305_read_regfunction lgdt3305_set_reg_bitfunction lgdt3305_write_regsfunction lgdt3305_soft_resetfunction lgdt3305_mpeg_modefunction lgdt3305_mpeg_mode_polarityfunction lgdt3305_set_modulationfunction lgdt3305_set_filter_extensionfunction lgdt3305_passband_digital_agcfunction lgdt3305_rfagc_loopfunction lgdt3305_agc_setupfunction lgdt3305_set_agc_power_reffunction lgdt3305_spectral_inversionfunction lgdt3305_set_iffunction lgdt3305_i2c_gate_ctrlfunction lgdt3305_sleepfunction lgdt3305_initfunction lgdt3304_set_parametersfunction lgdt3305_set_parametersfunction lgdt3305_get_frontendfunction lgdt3305_read_cr_lock_statusfunction lgdt3305_read_fec_lock_statusfunction lgdt3305_read_statusfunction calculate_snrfunction lgdt3305_read_snrfunction lgdt3305_read_signal_strengthfunction lgdt3305_read_berfunction lgdt3305_read_ucblocksfunction lgdt3305_get_tune_settingsfunction lgdt3305_releaseexport lgdt3305_attach
Annotated Snippet
struct lgdt3305_state {
struct i2c_adapter *i2c_adap;
const struct lgdt3305_config *cfg;
struct dvb_frontend frontend;
enum fe_modulation current_modulation;
u32 current_frequency;
u32 snr;
};
/* ------------------------------------------------------------------------ */
/* FIXME: verify & document the LGDT3304 registers */
#define LGDT3305_GEN_CTRL_1 0x0000
#define LGDT3305_GEN_CTRL_2 0x0001
#define LGDT3305_GEN_CTRL_3 0x0002
#define LGDT3305_GEN_STATUS 0x0003
#define LGDT3305_GEN_CONTROL 0x0007
#define LGDT3305_GEN_CTRL_4 0x000a
#define LGDT3305_DGTL_AGC_REF_1 0x0012
#define LGDT3305_DGTL_AGC_REF_2 0x0013
#define LGDT3305_CR_CTR_FREQ_1 0x0106
#define LGDT3305_CR_CTR_FREQ_2 0x0107
#define LGDT3305_CR_CTR_FREQ_3 0x0108
#define LGDT3305_CR_CTR_FREQ_4 0x0109
#define LGDT3305_CR_MSE_1 0x011b
#define LGDT3305_CR_MSE_2 0x011c
#define LGDT3305_CR_LOCK_STATUS 0x011d
#define LGDT3305_CR_CTRL_7 0x0126
#define LGDT3305_AGC_POWER_REF_1 0x0300
#define LGDT3305_AGC_POWER_REF_2 0x0301
#define LGDT3305_AGC_DELAY_PT_1 0x0302
#define LGDT3305_AGC_DELAY_PT_2 0x0303
#define LGDT3305_RFAGC_LOOP_FLTR_BW_1 0x0306
#define LGDT3305_RFAGC_LOOP_FLTR_BW_2 0x0307
#define LGDT3305_IFBW_1 0x0308
#define LGDT3305_IFBW_2 0x0309
#define LGDT3305_AGC_CTRL_1 0x030c
#define LGDT3305_AGC_CTRL_4 0x0314
#define LGDT3305_EQ_MSE_1 0x0413
#define LGDT3305_EQ_MSE_2 0x0414
#define LGDT3305_EQ_MSE_3 0x0415
#define LGDT3305_PT_MSE_1 0x0417
#define LGDT3305_PT_MSE_2 0x0418
#define LGDT3305_PT_MSE_3 0x0419
#define LGDT3305_FEC_BLOCK_CTRL 0x0504
#define LGDT3305_FEC_LOCK_STATUS 0x050a
#define LGDT3305_FEC_PKT_ERR_1 0x050c
#define LGDT3305_FEC_PKT_ERR_2 0x050d
#define LGDT3305_TP_CTRL_1 0x050e
#define LGDT3305_BERT_PERIOD 0x0801
#define LGDT3305_BERT_ERROR_COUNT_1 0x080a
#define LGDT3305_BERT_ERROR_COUNT_2 0x080b
#define LGDT3305_BERT_ERROR_COUNT_3 0x080c
#define LGDT3305_BERT_ERROR_COUNT_4 0x080d
static int lgdt3305_write_reg(struct lgdt3305_state *state, u16 reg, u8 val)
{
int ret;
u8 buf[] = { reg >> 8, reg & 0xff, val };
struct i2c_msg msg = {
.addr = state->cfg->i2c_addr, .flags = 0,
.buf = buf, .len = 3,
};
lg_reg("reg: 0x%04x, val: 0x%02x\n", reg, val);
ret = i2c_transfer(state->i2c_adap, &msg, 1);
if (ret != 1) {
lg_err("error (addr %02x %02x <- %02x, err = %i)\n",
msg.buf[0], msg.buf[1], msg.buf[2], ret);
if (ret < 0)
return ret;
else
return -EREMOTEIO;
}
return 0;
}
static int lgdt3305_read_reg(struct lgdt3305_state *state, u16 reg, u8 *val)
{
int ret;
u8 reg_buf[] = { reg >> 8, reg & 0xff };
struct i2c_msg msg[] = {
{ .addr = state->cfg->i2c_addr,
.flags = 0, .buf = reg_buf, .len = 2 },
{ .addr = state->cfg->i2c_addr,
Annotation
- Immediate include surface: `asm/div64.h`, `linux/dvb/frontend.h`, `linux/slab.h`, `linux/int_log.h`, `lgdt3305.h`.
- Detected declarations: `struct lgdt3305_state`, `struct lgdt3305_reg`, `function lgdt3305_write_reg`, `function lgdt3305_read_reg`, `function lgdt3305_set_reg_bit`, `function lgdt3305_write_regs`, `function lgdt3305_soft_reset`, `function lgdt3305_mpeg_mode`, `function lgdt3305_mpeg_mode_polarity`, `function lgdt3305_set_modulation`.
- 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.