drivers/media/dvb-frontends/cx24117.c

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

File Facts

System
Linux kernel
Corpus path
drivers/media/dvb-frontends/cx24117.c
Extension
.c
Size
42813 bytes
Lines
1655
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 cx24117_tuning {
	u32 frequency;
	u32 symbol_rate;
	enum fe_spectral_inversion inversion;
	enum fe_code_rate fec;

	enum fe_delivery_system delsys;
	enum fe_modulation modulation;
	enum fe_pilot pilot;
	enum fe_rolloff rolloff;

	/* Demod values */
	u8 fec_val;
	u8 fec_mask;
	u8 inversion_val;
	u8 pilot_val;
	u8 rolloff_val;
};

/* Basic commands that are sent to the firmware */
struct cx24117_cmd {
	u8 len;
	u8 args[CX24117_ARGLEN];
};

/* common to both fe's */
struct cx24117_priv {
	u8 demod_address;
	struct i2c_adapter *i2c;
	u8 skip_fw_load;
	struct mutex fe_lock;

	/* Used for sharing this struct between demods */
	struct tuner_i2c_props i2c_props;
	struct list_head hybrid_tuner_instance_list;
};

/* one per each fe */
struct cx24117_state {
	struct cx24117_priv *priv;
	struct dvb_frontend frontend;

	struct cx24117_tuning dcur;
	struct cx24117_tuning dnxt;
	struct cx24117_cmd dsec_cmd;

	int demod;
};

/* modfec (modulation and FEC) lookup table */
/* Check cx24116.c for a detailed description of each field */
static struct cx24117_modfec {
	enum fe_delivery_system delivery_system;
	enum fe_modulation modulation;
	enum fe_code_rate fec;
	u8 mask;	/* In DVBS mode this is used to autodetect */
	u8 val;		/* Passed to the firmware to indicate mode selection */
} cx24117_modfec_modes[] = {
	/* QPSK. For unknown rates we set hardware to auto detect 0xfe 0x30 */

	/*mod   fec       mask  val */
	{ SYS_DVBS, QPSK, FEC_NONE, 0xfe, 0x30 },
	{ SYS_DVBS, QPSK, FEC_1_2,  0x02, 0x2e }, /* 00000010 00101110 */
	{ SYS_DVBS, QPSK, FEC_2_3,  0x04, 0x2f }, /* 00000100 00101111 */
	{ SYS_DVBS, QPSK, FEC_3_4,  0x08, 0x30 }, /* 00001000 00110000 */
	{ SYS_DVBS, QPSK, FEC_4_5,  0xfe, 0x30 }, /* 000?0000 ?        */
	{ SYS_DVBS, QPSK, FEC_5_6,  0x20, 0x31 }, /* 00100000 00110001 */
	{ SYS_DVBS, QPSK, FEC_6_7,  0xfe, 0x30 }, /* 0?000000 ?        */
	{ SYS_DVBS, QPSK, FEC_7_8,  0x80, 0x32 }, /* 10000000 00110010 */
	{ SYS_DVBS, QPSK, FEC_8_9,  0xfe, 0x30 }, /* 0000000? ?        */
	{ SYS_DVBS, QPSK, FEC_AUTO, 0xfe, 0x30 },
	/* NBC-QPSK */
	{ SYS_DVBS2, QPSK, FEC_NONE, 0x00, 0x00 },
	{ SYS_DVBS2, QPSK, FEC_1_2,  0x00, 0x04 },
	{ SYS_DVBS2, QPSK, FEC_3_5,  0x00, 0x05 },
	{ SYS_DVBS2, QPSK, FEC_2_3,  0x00, 0x06 },
	{ SYS_DVBS2, QPSK, FEC_3_4,  0x00, 0x07 },
	{ SYS_DVBS2, QPSK, FEC_4_5,  0x00, 0x08 },
	{ SYS_DVBS2, QPSK, FEC_5_6,  0x00, 0x09 },
	{ SYS_DVBS2, QPSK, FEC_8_9,  0x00, 0x0a },
	{ SYS_DVBS2, QPSK, FEC_9_10, 0x00, 0x0b },
	{ SYS_DVBS2, QPSK, FEC_AUTO, 0x00, 0x00 },
	/* 8PSK */
	{ SYS_DVBS2, PSK_8, FEC_NONE, 0x00, 0x00 },
	{ SYS_DVBS2, PSK_8, FEC_3_5,  0x00, 0x0c },
	{ SYS_DVBS2, PSK_8, FEC_2_3,  0x00, 0x0d },
	{ SYS_DVBS2, PSK_8, FEC_3_4,  0x00, 0x0e },
	{ SYS_DVBS2, PSK_8, FEC_5_6,  0x00, 0x0f },
	{ SYS_DVBS2, PSK_8, FEC_8_9,  0x00, 0x10 },
	{ SYS_DVBS2, PSK_8, FEC_9_10, 0x00, 0x11 },

Annotation

Implementation Notes