drivers/media/dvb-frontends/tda10048.c

Source file repositories/reference/linux-study-clean/drivers/media/dvb-frontends/tda10048.c

File Facts

System
Linux kernel
Corpus path
drivers/media/dvb-frontends/tda10048.c
Extension
.c
Size
29096 bytes
Lines
1185
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct tda10048_state {

	struct i2c_adapter *i2c;

	/* We'll cache and update the attach config settings */
	struct tda10048_config config;
	struct dvb_frontend frontend;

	int fwloaded;

	u32 freq_if_hz;
	u32 xtal_hz;
	u32 pll_mfactor;
	u32 pll_nfactor;
	u32 pll_pfactor;
	u32 sample_freq;

	u32 bandwidth;
};

static struct init_tab {
	u8	reg;
	u16	data;
} init_tab[] = {
	{ TDA10048_CONF_PLL1, 0x08 },
	{ TDA10048_CONF_ADC_2, 0x00 },
	{ TDA10048_CONF_C4_1, 0x00 },
	{ TDA10048_CONF_PLL1, 0x0f },
	{ TDA10048_CONF_PLL2, 0x0a },
	{ TDA10048_CONF_PLL3, 0x43 },
	{ TDA10048_FREQ_PHY2_LSB, 0x02 },
	{ TDA10048_FREQ_PHY2_MSB, 0x0a },
	{ TDA10048_TIME_WREF_LSB, 0xbd },
	{ TDA10048_TIME_WREF_MID1, 0xe4 },
	{ TDA10048_TIME_WREF_MID2, 0xa8 },
	{ TDA10048_TIME_WREF_MSB, 0x02 },
	{ TDA10048_TIME_INVWREF_LSB, 0x04 },
	{ TDA10048_TIME_INVWREF_MSB, 0x06 },
	{ TDA10048_CONF_C4_1, 0x00 },
	{ TDA10048_CONF_C1_1, 0xa8 },
	{ TDA10048_AGC_CONF, 0x16 },
	{ TDA10048_CONF_C1_3, 0x0b },
	{ TDA10048_AGC_TUN_MIN, 0x00 },
	{ TDA10048_AGC_TUN_MAX, 0xff },
	{ TDA10048_AGC_IF_MIN, 0x00 },
	{ TDA10048_AGC_IF_MAX, 0xff },
	{ TDA10048_AGC_THRESHOLD_MSB, 0x00 },
	{ TDA10048_AGC_THRESHOLD_LSB, 0x70 },
	{ TDA10048_CVBER_CTRL, 0x38 },
	{ TDA10048_AGC_GAINS, 0x12 },
	{ TDA10048_CONF_XO, 0x00 },
	{ TDA10048_CONF_TS1, 0x07 },
	{ TDA10048_IC_MODE, 0x00 },
	{ TDA10048_CONF_TS2, 0xc0 },
	{ TDA10048_CONF_TRISTATE1, 0x21 },
	{ TDA10048_CONF_TRISTATE2, 0x00 },
	{ TDA10048_CONF_POLARITY, 0x00 },
	{ TDA10048_CONF_C4_2, 0x04 },
	{ TDA10048_CONF_ADC, 0x60 },
	{ TDA10048_CONF_ADC_2, 0x10 },
	{ TDA10048_CONF_ADC, 0x60 },
	{ TDA10048_CONF_ADC_2, 0x00 },
	{ TDA10048_CONF_C1_1, 0xa8 },
	{ TDA10048_UNCOR_CTRL, 0x00 },
	{ TDA10048_CONF_C4_2, 0x04 },
};

static struct pll_tab {
	u32	clk_freq_khz;
	u32	if_freq_khz;
} pll_tab[] = {
	{ TDA10048_CLK_4000,  TDA10048_IF_36130 },
	{ TDA10048_CLK_16000, TDA10048_IF_3300 },
	{ TDA10048_CLK_16000, TDA10048_IF_3500 },
	{ TDA10048_CLK_16000, TDA10048_IF_3800 },
	{ TDA10048_CLK_16000, TDA10048_IF_4000 },
	{ TDA10048_CLK_16000, TDA10048_IF_4300 },
	{ TDA10048_CLK_16000, TDA10048_IF_4500 },
	{ TDA10048_CLK_16000, TDA10048_IF_5000 },
	{ TDA10048_CLK_16000, TDA10048_IF_36130 },
};

static int tda10048_writereg(struct tda10048_state *state, u8 reg, u8 data)
{
	struct tda10048_config *config = &state->config;
	int ret;
	u8 buf[] = { reg, data };
	struct i2c_msg msg = {
		.addr = config->demod_address,
		.flags = 0, .buf = buf, .len = 2 };

Annotation

Implementation Notes