drivers/staging/media/tegra-video/vi.h

Source file repositories/reference/linux-study-clean/drivers/staging/media/tegra-video/vi.h

File Facts

System
Linux kernel
Corpus path
drivers/staging/media/tegra-video/vi.h
Extension
.h
Size
10400 bytes
Lines
311
Domain
Driver Families
Bucket
drivers/staging
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 tegra_vi_ops {
	int (*vi_enable)(struct tegra_vi *vi, bool on);
	int (*channel_host1x_syncpt_init)(struct tegra_vi_channel *chan);
	void (*channel_host1x_syncpt_free)(struct tegra_vi_channel *chan);
	void (*vi_fmt_align)(struct v4l2_pix_format *pix, unsigned int bpp);
	void (*channel_queue_setup)(struct tegra_vi_channel *chan);
	int (*vi_start_streaming)(struct vb2_queue *vq, u32 count);
	void (*vi_stop_streaming)(struct vb2_queue *vq);
};

/**
 * struct tegra_vi_soc - NVIDIA Tegra Video Input SoC structure
 *
 * @video_formats: supported video formats
 * @nformats: total video formats
 * @default_video_format: default video format (pointer to a @video_formats item)
 * @ops: vi operations
 * @hw_revision: VI hw_revision
 * @vi_max_channels: supported max streaming channels
 * @vi_max_clk_hz: VI clock max frequency
 * @has_h_v_flip: the chip can do H and V flip, and the driver implements it
 */
struct tegra_vi_soc {
	const struct tegra_video_format *video_formats;
	const unsigned int nformats;
	const struct tegra_video_format *default_video_format;
	const struct tegra_vi_ops *ops;
	u32 hw_revision;
	unsigned int vi_max_channels;
	unsigned int vi_max_clk_hz;
	bool has_h_v_flip:1;
};

/**
 * struct tegra_vi - NVIDIA Tegra Video Input device structure
 *
 * @dev: device struct
 * @client: host1x_client struct
 * @iomem: register base
 * @clk: main clock for VI block
 * @soc: pointer to SoC data structure
 * @ops: vi operations
 * @vi_chans: list head for VI channels
 */
struct tegra_vi {
	struct device *dev;
	struct host1x_client client;
	void __iomem *iomem;
	struct clk *clk;
	const struct tegra_vi_soc *soc;
	const struct tegra_vi_ops *ops;
	struct list_head vi_chans;
};

/**
 * struct tegra_vi_channel - Tegra video channel
 *
 * @list: list head for this entry
 * @video: V4L2 video device associated with the video channel
 * @video_lock: protects the @format and @queue fields
 * @pad: media pad for the video device entity
 *
 * @vi: Tegra video input device structure
 * @frame_start_sp: host1x syncpoint pointer to synchronize programmed capture
 *		start condition with hardware frame start events through host1x
 *		syncpoint counters. (Tegra210)
 * @mw_ack_sp: host1x syncpoint pointer to synchronize programmed memory write
 *		ack trigger condition with hardware memory write done at end of
 *		frame through host1x syncpoint counters (On Tegra20 used for the
 *              OUT_1 syncpt)
 * @sp_incr_lock: protects cpu syncpoint increment.
 *
 * @kthread_start_capture: kthread to start capture of single frame when
 *		vb buffer is available. This thread programs VI CSI hardware
 *		for single frame capture and waits for frame start event from
 *		the hardware. On receiving frame start event, it wakes up
 *		kthread_finish_capture thread to wait for finishing frame data
 *		write to the memory. In case of missing frame start event, this
 *		thread returns buffer back to vb with VB2_BUF_STATE_ERROR.
 * @start_wait: waitqueue for starting frame capture when buffer is available.
 * @kthread_finish_capture: kthread to finish the buffer capture and return to.
 *		This thread is woken up by kthread_start_capture on receiving
 *		frame start event from the hardware and this thread waits for
 *		MW_ACK_DONE event which indicates completion of writing frame
 *		data to the memory. On receiving MW_ACK_DONE event, buffer is
 *		returned back to vb with VB2_BUF_STATE_DONE and in case of
 *		missing MW_ACK_DONE event, buffer is returned back to vb with
 *		VB2_BUF_STATE_ERROR.
 * @done_wait: waitqueue for finishing capture data writes to memory.
 *

Annotation

Implementation Notes