drivers/media/platform/renesas/renesas-ceu.c

Source file repositories/reference/linux-study-clean/drivers/media/platform/renesas/renesas-ceu.c

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/renesas/renesas-ceu.c
Extension
.c
Size
44302 bytes
Lines
1730
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 ceu_mbus_fmt {
	u32	mbus_code;
	u32	fmt_order;
	u32	fmt_order_swap;
	bool	swapped;
	u8	bps;
	u8	bpp;
};

/*
 * ceu_buffer - Link vb2 buffer to the list of available buffers.
 */
struct ceu_buffer {
	struct vb2_v4l2_buffer vb;
	struct list_head queue;
};

static inline struct ceu_buffer *vb2_to_ceu(struct vb2_v4l2_buffer *vbuf)
{
	return container_of(vbuf, struct ceu_buffer, vb);
}

/*
 * ceu_subdev - Wraps v4l2 sub-device and provides async subdevice.
 */
struct ceu_subdev {
	struct v4l2_async_connection asd;
	struct v4l2_subdev *v4l2_sd;

	/* per-subdevice mbus configuration options */
	unsigned int mbus_flags;
	struct ceu_mbus_fmt mbus_fmt;
};

static struct ceu_subdev *to_ceu_subdev(struct v4l2_async_connection *asd)
{
	return container_of(asd, struct ceu_subdev, asd);
}

/*
 * ceu_device - CEU device instance
 */
struct ceu_device {
	struct device		*dev;
	struct video_device	vdev;
	struct v4l2_device	v4l2_dev;

	/* subdevices descriptors */
	struct ceu_subdev	**subdevs;
	/* the subdevice currently in use */
	struct ceu_subdev	*sd;
	unsigned int		sd_index;
	unsigned int		num_sd;

	/* platform specific mask with all IRQ sources flagged */
	u32			irq_mask;

	/* currently configured field and pixel format */
	enum v4l2_field	field;
	struct v4l2_pix_format_mplane v4l2_pix;

	/* async subdev notification helpers */
	struct v4l2_async_notifier notifier;

	/* vb2 queue, capture buffer list and active buffer pointer */
	struct vb2_queue	vb2_vq;
	struct list_head	capture;
	struct vb2_v4l2_buffer	*active;
	unsigned int		sequence;

	/* mlock - lock access to interface reset and vb2 queue */
	struct mutex	mlock;

	/* lock - lock access to capture buffer queue and active buffer */
	spinlock_t	lock;

	/* base - CEU memory base address */
	void __iomem	*base;
};

static inline struct ceu_device *v4l2_to_ceu(struct v4l2_device *v4l2_dev)
{
	return container_of(v4l2_dev, struct ceu_device, v4l2_dev);
}

/* --- CEU memory output formats --- */

/*
 * ceu_fmt - describe a memory output format supported by CEU interface.
 *

Annotation

Implementation Notes