drivers/media/usb/stk1160/stk1160.h

Source file repositories/reference/linux-study-clean/drivers/media/usb/stk1160/stk1160.h

File Facts

System
Linux kernel
Corpus path
drivers/media/usb/stk1160/stk1160.h
Extension
.h
Size
4688 bytes
Lines
196
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 stk1160_buffer {
	/* common v4l buffer stuff -- must be first */
	struct vb2_v4l2_buffer vb;
	struct list_head list;

	void *mem;
	unsigned int length;		/* buffer length */
	unsigned int bytesused;		/* bytes written */
	int odd;			/* current oddity */

	/*
	 * Since we interlace two fields per frame,
	 * this is different from bytesused.
	 */
	unsigned int pos;		/* current pos inside buffer */
};

struct stk1160_urb {
	struct urb *urb;
	char *transfer_buffer;
	struct sg_table *sgt;
	struct stk1160 *dev;
	dma_addr_t dma;
};

struct stk1160_isoc_ctl {
	/* max packet size of isoc transaction */
	int max_pkt_size;

	/* number of allocated urbs */
	int num_bufs;

	struct stk1160_urb urb_ctl[STK1160_NUM_BUFS];

	/* current buffer */
	struct stk1160_buffer *buf;
};

struct stk1160_fmt {
	u32   fourcc;          /* v4l2 format id */
	int   depth;
};

struct stk1160 {
	struct v4l2_device v4l2_dev;
	struct video_device vdev;
	struct v4l2_ctrl_handler ctrl_handler;

	struct device *dev;
	struct usb_device *udev;

	/* saa7115 subdev */
	struct v4l2_subdev *sd_saa7115;

	/* isoc control struct */
	struct list_head avail_bufs;

	/* video capture */
	struct vb2_queue vb_vidq;

	/* max packet size of isoc transaction */
	int max_pkt_size;
	/* array of wMaxPacketSize */
	unsigned int *alt_max_pkt_size;
	/* alternate */
	int alt;
	/* Number of alternative settings */
	int num_alt;

	struct stk1160_isoc_ctl isoc_ctl;

	/* frame properties */
	int width;		  /* current frame width */
	int height;		  /* current frame height */
	unsigned int ctl_input;	  /* selected input */
	v4l2_std_id norm;	  /* current norm */
	struct stk1160_fmt *fmt;  /* selected format */

	unsigned int sequence;

	/* i2c i/o */
	struct i2c_adapter i2c_adap;
	struct i2c_client i2c_client;

	struct mutex v4l_lock;
	struct mutex vb_queue_lock;
	spinlock_t buf_lock;

	struct file *fh_owner;	/* filehandle ownership */

Annotation

Implementation Notes