drivers/media/i2c/ov5640.c

Source file repositories/reference/linux-study-clean/drivers/media/i2c/ov5640.c

File Facts

System
Linux kernel
Corpus path
drivers/media/i2c/ov5640.c
Extension
.c
Size
104705 bytes
Lines
4028
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 ov5640_pixfmt {
	u32 code;
	u32 colorspace;
	u8 bpp;
	u8 ctrl00;
	enum ov5640_format_mux mux;
};

static const struct ov5640_pixfmt ov5640_dvp_formats[] = {
	{
		/* YUV422, YUYV */
		.code		= MEDIA_BUS_FMT_JPEG_1X8,
		.colorspace	= V4L2_COLORSPACE_JPEG,
		.bpp		= 16,
		.ctrl00		= 0x30,
		.mux		= OV5640_FMT_MUX_YUV422,
	}, {
		/* YUV422, UYVY */
		.code		= MEDIA_BUS_FMT_UYVY8_2X8,
		.colorspace	= V4L2_COLORSPACE_SRGB,
		.bpp		= 16,
		.ctrl00		= 0x3f,
		.mux		= OV5640_FMT_MUX_YUV422,
	}, {
		/* YUV422, YUYV */
		.code		= MEDIA_BUS_FMT_YUYV8_2X8,
		.colorspace	= V4L2_COLORSPACE_SRGB,
		.bpp		= 16,
		.ctrl00		= 0x30,
		.mux		= OV5640_FMT_MUX_YUV422,
	}, {
		/* RGB565 {g[2:0],b[4:0]},{r[4:0],g[5:3]} */
		.code		= MEDIA_BUS_FMT_RGB565_2X8_LE,
		.colorspace	= V4L2_COLORSPACE_SRGB,
		.bpp		= 16,
		.ctrl00		= 0x6f,
		.mux		= OV5640_FMT_MUX_RGB,
	}, {
		/* RGB565 {r[4:0],g[5:3]},{g[2:0],b[4:0]} */
		.code		= MEDIA_BUS_FMT_RGB565_2X8_BE,
		.colorspace	= V4L2_COLORSPACE_SRGB,
		.bpp		= 16,
		.ctrl00		= 0x61,
		.mux		= OV5640_FMT_MUX_RGB,
	}, {
		/* Raw, BGBG... / GRGR... */
		.code		= MEDIA_BUS_FMT_SBGGR8_1X8,
		.colorspace	= V4L2_COLORSPACE_SRGB,
		.bpp		= 8,
		.ctrl00		= 0x00,
		.mux		= OV5640_FMT_MUX_RAW_DPC,
	}, {
		/* Raw bayer, GBGB... / RGRG... */
		.code		= MEDIA_BUS_FMT_SGBRG8_1X8,
		.colorspace	= V4L2_COLORSPACE_SRGB,
		.bpp		= 8,
		.ctrl00		= 0x01,
		.mux		= OV5640_FMT_MUX_RAW_DPC,
	}, {
		/* Raw bayer, GRGR... / BGBG... */
		.code		= MEDIA_BUS_FMT_SGRBG8_1X8,
		.colorspace	= V4L2_COLORSPACE_SRGB,
		.bpp		= 8,
		.ctrl00		= 0x02,
		.mux		= OV5640_FMT_MUX_RAW_DPC,
	}, {
		/* Raw bayer, RGRG... / GBGB... */
		.code		= MEDIA_BUS_FMT_SRGGB8_1X8,
		.colorspace	= V4L2_COLORSPACE_SRGB,
		.bpp		= 8,
		.ctrl00		= 0x03,
		.mux		= OV5640_FMT_MUX_RAW_DPC,
	},
	{ /* sentinel */ }
};

static const struct ov5640_pixfmt ov5640_csi2_formats[] = {
	{
		/* YUV422, YUYV */
		.code		= MEDIA_BUS_FMT_JPEG_1X8,
		.colorspace	= V4L2_COLORSPACE_JPEG,
		.bpp		= 16,
		.ctrl00		= 0x30,
		.mux		= OV5640_FMT_MUX_YUV422,
	}, {
		/* YUV422, UYVY */
		.code		= MEDIA_BUS_FMT_UYVY8_1X16,
		.colorspace	= V4L2_COLORSPACE_SRGB,
		.bpp		= 16,
		.ctrl00		= 0x3f,

Annotation

Implementation Notes