drivers/media/pci/tw686x/tw686x.h

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

File Facts

System
Linux kernel
Corpus path
drivers/media/pci/tw686x/tw686x.h
Extension
.h
Size
4434 bytes
Lines
180
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 tw686x_format {
	char *name;
	unsigned int fourcc;
	unsigned int depth;
	unsigned int mode;
};

struct tw686x_dma_desc {
	dma_addr_t phys;
	void *virt;
	unsigned int size;
};

struct tw686x_sg_desc {
	/* 3 MSBits for flags, 13 LSBits for length */
	__le32 flags_length;
	__le32 phys;
};

struct tw686x_audio_buf {
	dma_addr_t dma;
	void *virt;
	struct list_head list;
};

struct tw686x_v4l2_buf {
	struct vb2_v4l2_buffer vb;
	struct list_head list;
};

struct tw686x_audio_channel {
	struct tw686x_dev *dev;
	struct snd_pcm_substream *ss;
	unsigned int ch;
	struct tw686x_audio_buf *curr_bufs[2];
	struct tw686x_dma_desc dma_descs[2];
	dma_addr_t ptr;

	struct tw686x_audio_buf buf[TW686X_AUDIO_PAGE_MAX];
	struct list_head buf_list;
	spinlock_t lock;
};

struct tw686x_video_channel {
	struct tw686x_dev *dev;

	struct vb2_queue vidq;
	struct list_head vidq_queued;
	struct video_device *device;
	struct tw686x_v4l2_buf *curr_bufs[2];
	struct tw686x_dma_desc dma_descs[2];
	struct tw686x_sg_desc *sg_descs[2];

	struct v4l2_ctrl_handler ctrl_handler;
	const struct tw686x_format *format;
	struct mutex vb_mutex;
	spinlock_t qlock;
	v4l2_std_id video_standard;
	unsigned int width, height;
	unsigned int h_halve, v_halve;
	unsigned int ch;
	unsigned int num;
	unsigned int fps;
	unsigned int input;
	unsigned int sequence;
	unsigned int pb;
	bool no_signal;
};

struct tw686x_dma_ops {
	int (*setup)(struct tw686x_dev *dev);
	int (*alloc)(struct tw686x_video_channel *vc, unsigned int pb);
	void (*free)(struct tw686x_video_channel *vc, unsigned int pb);
	void (*buf_refill)(struct tw686x_video_channel *vc, unsigned int pb);
	const struct vb2_mem_ops *mem_ops;
	enum v4l2_field field;
	u32 hw_dma_mode;
};

/* struct tw686x_dev - global device status */
struct tw686x_dev {
	/*
	 * spinlock controlling access to the shared device registers
	 * (DMA enable/disable)
	 */
	spinlock_t lock;

	struct v4l2_device v4l2_dev;
	struct snd_card *snd_card;

Annotation

Implementation Notes