drivers/media/usb/usbtv/usbtv.h

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

File Facts

System
Linux kernel
Corpus path
drivers/media/usb/usbtv/usbtv.h
Extension
.h
Size
4216 bytes
Lines
139
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 usbtv_norm_params {
	v4l2_std_id norm;
	int cap_width, cap_height;
};

/* A single videobuf2 frame buffer. */
struct usbtv_buf {
	struct vb2_v4l2_buffer vb;
	struct list_head list;
};

/* Per-device structure. */
struct usbtv {
	struct device *dev;
	struct usb_device *udev;

	/* video */
	struct v4l2_device v4l2_dev;
	struct v4l2_ctrl_handler ctrl;
	struct video_device vdev;
	struct vb2_queue vb2q;
	struct mutex v4l2_lock;
	struct mutex vb2q_lock;

	/* List of videobuf2 buffers protected by a lock. */
	spinlock_t buflock;
	struct list_head bufs;

	/* Number of currently processed frame, useful find
	 * out when a new one begins. */
	u32 frame_id;
	int chunks_done;

	enum {
		USBTV_COMPOSITE_INPUT,
		USBTV_SVIDEO_INPUT,
	} input;
	v4l2_std_id norm;
	int width, height;
	int n_chunks;
	int iso_size;
	int last_odd;
	unsigned int sequence;
	struct urb *isoc_urbs[USBTV_ISOC_TRANSFERS];

	/* audio */
	struct snd_card *snd;
	struct snd_pcm_substream *snd_substream;
	atomic_t snd_stream;
	struct work_struct snd_trigger;
	struct urb *snd_bulk_urb;
	size_t snd_buffer_pos;
	size_t snd_period_pos;
};

int usbtv_set_regs(struct usbtv *usbtv, const u16 regs[][2], int size);

int usbtv_video_init(struct usbtv *usbtv);
void usbtv_video_free(struct usbtv *usbtv);

int usbtv_audio_init(struct usbtv *usbtv);
void usbtv_audio_free(struct usbtv *usbtv);
void usbtv_audio_suspend(struct usbtv *usbtv);
void usbtv_audio_resume(struct usbtv *usbtv);

Annotation

Implementation Notes