drivers/media/platform/microchip/microchip-csi2dc.c

Source file repositories/reference/linux-study-clean/drivers/media/platform/microchip/microchip-csi2dc.c

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/microchip/microchip-csi2dc.c
Extension
.c
Size
21255 bytes
Lines
798
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 csi2dc_format {
	u32				mbus_code;
	u32				dt;
};

static const struct csi2dc_format csi2dc_formats[] = {
	{
		.mbus_code =		MEDIA_BUS_FMT_SRGGB8_1X8,
		.dt =			CSI2DC_DT_RAW8,
	}, {
		.mbus_code =		MEDIA_BUS_FMT_SBGGR8_1X8,
		.dt =			CSI2DC_DT_RAW8,
	}, {
		.mbus_code =		MEDIA_BUS_FMT_SGRBG8_1X8,
		.dt =			CSI2DC_DT_RAW8,
	}, {
		.mbus_code =		MEDIA_BUS_FMT_SGBRG8_1X8,
		.dt =			CSI2DC_DT_RAW8,
	}, {
		.mbus_code =		MEDIA_BUS_FMT_SRGGB10_1X10,
		.dt =			CSI2DC_DT_RAW10,
	}, {
		.mbus_code =		MEDIA_BUS_FMT_SBGGR10_1X10,
		.dt =			CSI2DC_DT_RAW10,
	}, {
		.mbus_code =		MEDIA_BUS_FMT_SGRBG10_1X10,
		.dt =			CSI2DC_DT_RAW10,
	}, {
		.mbus_code =		MEDIA_BUS_FMT_SGBRG10_1X10,
		.dt =			CSI2DC_DT_RAW10,
	}, {
		.mbus_code =		MEDIA_BUS_FMT_YUYV8_2X8,
		.dt =			CSI2DC_DT_YUV422_8B,
	},
};

enum mipi_csi_pads {
	CSI2DC_PAD_SINK			= 0,
	CSI2DC_PAD_SOURCE		= 1,
	CSI2DC_PADS_NUM			= 2,
};

/*
 * struct csi2dc_device - CSI2DC device driver data/config struct
 * @base:		Register map base address
 * @csi2dc_sd:		v4l2 subdevice for the csi2dc device
 *			This is the subdevice that the csi2dc device itself
 *			registers in v4l2 subsystem
 * @dev:		struct device for this csi2dc device
 * @pclk:		Peripheral clock reference
 *			Input clock that clocks the hardware block internal
 *			logic
 * @scck:		Sensor Controller clock reference
 *			Input clock that is used to generate the pixel clock
 * @format:		Current saved format used in g/s fmt
 * @cur_fmt:		Current state format
 * @try_fmt:		Try format that is being tried
 * @pads:		Media entity pads for the csi2dc subdevice
 * @clk_gated:		Whether the clock is gated or free running
 * @video_pipe:		Whether video pipeline is configured
 * @parallel_mode:	The underlying subdevice is connected on a parallel bus
 * @vc:			Current set virtual channel
 * @notifier:		Async notifier that is used to bound the underlying
 *			subdevice to the csi2dc subdevice
 * @input_sd:		Reference to the underlying subdevice bound to the
 *			csi2dc subdevice
 * @remote_pad:		Pad number of the underlying subdevice that is linked
 *			to the csi2dc subdevice sink pad.
 */
struct csi2dc_device {
	void __iomem			*base;
	struct v4l2_subdev		csi2dc_sd;
	struct device			*dev;
	struct clk			*pclk;
	struct clk			*scck;

	struct v4l2_mbus_framefmt	 format;

	const struct csi2dc_format	*cur_fmt;
	const struct csi2dc_format	*try_fmt;

	struct media_pad		pads[CSI2DC_PADS_NUM];

	bool				clk_gated;
	bool				video_pipe;
	bool				parallel_mode;
	u32				vc;

	struct v4l2_async_notifier	notifier;

Annotation

Implementation Notes