drivers/media/pci/hws/hws.h

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

File Facts

System
Linux kernel
Corpus path
drivers/media/pci/hws/hws.h
Extension
.h
Size
3711 bytes
Lines
174
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 hwsmem_param {
	u32 index;
	u32 type;
	u32 status;
};

struct hws_pix_state {
	u32 width;
	u32 height;
	u32 fourcc;		/* V4L2_PIX_FMT_* (YUYV only here) */
	u32 bytesperline;	/* stride */
	u32 sizeimage;		/* full frame */
	enum v4l2_field field;	/* V4L2_FIELD_NONE or INTERLACED */
	enum v4l2_colorspace colorspace;	/* e.g., REC709 */
	enum v4l2_ycbcr_encoding ycbcr_enc;	/* V4L2_YCBCR_ENC_DEFAULT */
	enum v4l2_quantization quantization;	/* V4L2_QUANTIZATION_LIM_RANGE */
	enum v4l2_xfer_func xfer_func;	/* V4L2_XFER_FUNC_DEFAULT */
	bool interlaced;	/* cached hardware state */
	u32 half_size;		/* hardware half-frame size */
};

#define	UNSET	(-1U)

struct hws_pcie_dev;
struct hws_adapter;
struct hws_video;

struct hwsvideo_buffer {
	struct vb2_v4l2_buffer vb;
	struct list_head list;
	int slot;
};

struct hws_video {
	/* Linkage */
	struct hws_pcie_dev *parent;
	struct video_device *video_device;

	struct vb2_queue buffer_queue;
	struct list_head capture_queue;
	struct hwsvideo_buffer *active;
	struct hwsvideo_buffer *next_prepared;

	/* Locking */
	struct mutex state_lock;
	spinlock_t irq_lock;	/* Protects capture_queue and active buffers. */

	/* Indices */
	int channel_index;

	/* Color controls */
	int current_brightness;
	int current_contrast;
	int current_saturation;
	int current_hue;

	/* V4L2 controls */
	struct v4l2_ctrl_handler control_handler;
	struct v4l2_ctrl *ctrl_brightness;
	struct v4l2_ctrl *ctrl_contrast;
	struct v4l2_ctrl *ctrl_saturation;
	struct v4l2_ctrl *ctrl_hue;

	/* Capture queue status */
	struct hws_pix_state pix;
	struct v4l2_dv_timings cur_dv_timings; /* last configured/notified DV timings */
	u32 current_fps; /* Hz, updated by mode changes, not by read-only queries */

	/* Per-channel capture state */
	bool cap_active;
	bool stop_requested;
	u8 last_buf_half_toggle;
	bool half_seen;
	atomic_t sequence_number;
	u32 queued_count;

	/* Timeout and error handling */
	u32 timeout_count;
	u32 error_count;

	bool window_valid;
	u32 last_dma_hi;
	u32 last_dma_page;
	u32 last_pci_addr;
	u32 last_half16;

	/* Misc counters */
	int signal_loss_cnt;
};

Annotation

Implementation Notes