drivers/media/platform/ti/cal/cal.h

Source file repositories/reference/linux-study-clean/drivers/media/platform/ti/cal/cal.h

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/ti/cal/cal.h
Extension
.h
Size
8825 bytes
Lines
342
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 cal_format_info {
	u32	fourcc;
	u32	code;
	/* Bits per pixel */
	u8	bpp;
	bool	meta;
};

/* buffer for one video frame */
struct cal_buffer {
	/* common v4l buffer stuff -- must be first */
	struct vb2_v4l2_buffer	vb;
	struct list_head	list;
};

/**
 * struct cal_dmaqueue - Queue of DMA buffers
 */
struct cal_dmaqueue {
	/**
	 * @lock: Protects all fields in the cal_dmaqueue.
	 */
	spinlock_t		lock;

	/**
	 * @queue: Buffers queued to the driver and waiting for DMA processing.
	 * Buffers are added to the list by the vb2 .buffer_queue() operation,
	 * and move to @pending when they are scheduled for the next frame.
	 */
	struct list_head	queue;
	/**
	 * @pending: Buffer provided to the hardware to DMA the next frame.
	 * Will move to @active at the end of the current frame.
	 */
	struct cal_buffer	*pending;
	/**
	 * @active: Buffer being DMA'ed to for the current frame. Will be
	 * retired and given back to vb2 at the end of the current frame if
	 * a @pending buffer has been scheduled to replace it.
	 */
	struct cal_buffer	*active;

	/** @state: State of the DMA engine. */
	enum cal_dma_state	state;
	/** @wait: Wait queue to signal a @state transition to CAL_DMA_STOPPED. */
	struct wait_queue_head	wait;
};

struct cal_camerarx_data {
	struct {
		unsigned int lsb;
		unsigned int msb;
	} fields[F_MAX_FIELDS];
	unsigned int num_lanes;
};

struct cal_data {
	const struct cal_camerarx_data *camerarx;
	unsigned int num_csi2_phy;
	unsigned int flags;
};

/*
 * The Camera Adaptation Layer (CAL) module is paired with one or more complex
 * I/O PHYs (CAMERARX). It contains multiple instances of CSI-2, processing and
 * DMA contexts.
 *
 * The cal_dev structure represents the whole subsystem, including the CAL and
 * the CAMERARX instances. Instances of struct cal_dev are named cal through the
 * driver.
 *
 * The cal_camerarx structure represents one CAMERARX instance. Instances of
 * cal_camerarx are named phy through the driver.
 *
 * The cal_ctx structure represents the combination of one CSI-2 context, one
 * processing context and one DMA context. Instance of struct cal_ctx are named
 * ctx through the driver.
 */

struct cal_camerarx {
	void __iomem		*base;
	struct resource		*res;
	struct regmap_field	*fields[F_MAX_FIELDS];

	struct cal_dev		*cal;
	unsigned int		instance;

	struct v4l2_fwnode_endpoint	endpoint;
	struct device_node	*source_ep_node;
	struct device_node	*source_node;

Annotation

Implementation Notes