drivers/media/dvb-frontends/dib9000.c

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

File Facts

System
Linux kernel
Corpus path
drivers/media/dvb-frontends/dib9000.c
Extension
.c
Size
72062 bytes
Lines
2585
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 i2c_device {
	struct i2c_adapter *i2c_adap;
	u8 i2c_addr;
	u8 *i2c_read_buffer;
	u8 *i2c_write_buffer;
};

struct dib9000_pid_ctrl {
#define DIB9000_PID_FILTER_CTRL 0
#define DIB9000_PID_FILTER      1
	u8 cmd;
	u8 id;
	u16 pid;
	u8 onoff;
};

struct dib9000_state {
	struct i2c_device i2c;

	struct dibx000_i2c_master i2c_master;
	struct i2c_adapter tuner_adap;
	struct i2c_adapter component_bus;

	u16 revision;
	u8 reg_offs;

	enum frontend_tune_state tune_state;
	u32 status;
	struct dvb_frontend_parametersContext channel_status;

	u8 fe_id;

#define DIB9000_GPIO_DEFAULT_DIRECTIONS 0xffff
	u16 gpio_dir;
#define DIB9000_GPIO_DEFAULT_VALUES     0x0000
	u16 gpio_val;
#define DIB9000_GPIO_DEFAULT_PWM_POS    0xffff
	u16 gpio_pwm_pos;

	union {			/* common for all chips */
		struct {
			u8 mobile_mode:1;
		} host;

		struct {
			struct dib9000_fe_memory_map {
				u16 addr;
				u16 size;
			} fe_mm[18];
			u8 memcmd;

			struct mutex mbx_if_lock;	/* to protect read/write operations */
			struct mutex mbx_lock;	/* to protect the whole mailbox handling */

			struct mutex mem_lock;	/* to protect the memory accesses */
			struct mutex mem_mbx_lock;	/* to protect the memory-based mailbox */

#define MBX_MAX_WORDS (256 - 200 - 2)
#define DIB9000_MSG_CACHE_SIZE 2
			u16 message_cache[DIB9000_MSG_CACHE_SIZE][MBX_MAX_WORDS];
			u8 fw_is_running;
		} risc;
	} platform;

	union {			/* common for all platforms */
		struct {
			struct dib9000_config cfg;
		} d9;
	} chip;

	struct dvb_frontend *fe[MAX_NUMBER_OF_FRONTENDS];
	u16 component_bus_speed;

	/* for the I2C transfer */
	struct i2c_msg msg[2];
	u8 i2c_write_buffer[255];
	u8 i2c_read_buffer[255];
	struct mutex demod_lock;
	u8 get_frontend_internal;
	struct dib9000_pid_ctrl pid_ctrl[10];
	s8 pid_ctrl_index; /* -1: empty list; -2: do not use the list */
};

static const u32 fe_info[44] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
	0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
	0, 0, 0, 0, 0, 0, 0, 0
};

enum dib9000_power_mode {
	DIB9000_POWER_ALL = 0,

Annotation

Implementation Notes