drivers/media/pci/pt3/pt3.h

Source file repositories/reference/linux-study-clean/drivers/media/pci/pt3/pt3.h

File Facts

System
Linux kernel
Corpus path
drivers/media/pci/pt3/pt3.h
Extension
.h
Size
4347 bytes
Lines
178
Domain
Driver Families
Bucket
drivers/media
Inferred role
Driver Families: implementation source
Status
source 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 pt3_i2cbuf {
	u8  data[PT3_I2C_MAX];
	u8  tmp;
	u32 num_cmds;
};

/*
 * DMA things
 */
#define TS_PACKET_SZ  188
/* DMA transfers must not cross 4GiB, so use one page / transfer */
#define DATA_XFER_SZ   4096
#define DATA_BUF_XFERS 47
/* (num_bufs * DATA_BUF_SZ) % TS_PACKET_SZ must be 0 */
#define DATA_BUF_SZ    (DATA_BUF_XFERS * DATA_XFER_SZ)
#define MAX_DATA_BUFS  16
#define MIN_DATA_BUFS   2

#define DESCS_IN_PAGE (PAGE_SIZE / sizeof(struct xfer_desc))
#define MAX_NUM_XFERS (MAX_DATA_BUFS * DATA_BUF_XFERS)
#define MAX_DESC_BUFS DIV_ROUND_UP(MAX_NUM_XFERS, DESCS_IN_PAGE)

/* DMA transfer description.
 * device is passed a pointer to this struct, dma-reads it,
 * and gets the DMA buffer ring for storing TS data.
 */
struct xfer_desc {
	u32 addr_l; /* bus address of target data buffer */
	u32 addr_h;
	u32 size;
	u32 next_l; /* bus address of the next xfer_desc */
	u32 next_h;
};

/* A DMA mapping of a page containing xfer_desc's */
struct xfer_desc_buffer {
	dma_addr_t b_addr;
	struct xfer_desc *descs; /* PAGE_SIZE (xfer_desc[DESCS_IN_PAGE]) */
};

/* A DMA mapping of a data buffer */
struct dma_data_buffer {
	dma_addr_t b_addr;
	u8 *data; /* size: u8[PAGE_SIZE] */
};

/*
 * device things
 */
struct pt3_adap_config {
	struct i2c_board_info demod_info;
	struct tc90522_config demod_cfg;

	struct i2c_board_info tuner_info;
	union tuner_config {
		struct qm1d1c0042_config qm1d1c0042;
		struct mxl301rf_config   mxl301rf;
	} tuner_cfg;
	u32 init_freq;
};

struct pt3_adapter {
	struct dvb_adapter  dvb_adap;  /* dvb_adap.priv => struct pt3_board */
	int adap_idx;

	struct dvb_demux    demux;
	struct dmxdev       dmxdev;
	struct dvb_frontend *fe;
	struct i2c_client   *i2c_demod;
	struct i2c_client   *i2c_tuner;

	/* data fetch thread */
	struct task_struct *thread;
	int num_feeds;

	bool cur_lna;
	bool cur_lnb; /* current LNB power status (on/off) */

	/* items below are for DMA */
	struct dma_data_buffer buffer[MAX_DATA_BUFS];
	int buf_idx;
	int buf_ofs;
	int num_bufs;  /* == pt3_board->num_bufs */
	int num_discard; /* how many access units to discard initially */

	struct xfer_desc_buffer desc_buf[MAX_DESC_BUFS];
	int num_desc_bufs;  /* == num_bufs * DATA_BUF_XFERS / DESCS_IN_PAGE */
};

Annotation

Implementation Notes