drivers/media/i2c/ov8856.c

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

File Facts

System
Linux kernel
Corpus path
drivers/media/i2c/ov8856.c
Extension
.c
Size
54138 bytes
Lines
2497
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 ov8856_reg {
	u16 address;
	u8 val;
};

struct ov8856_reg_list {
	u32 num_of_regs;
	const struct ov8856_reg *regs;
};

struct ov8856_link_freq_config {
	const struct ov8856_reg_list reg_list;
};

struct ov8856_mode {
	/* Frame width in pixels */
	u32 width;

	/* Frame height in pixels */
	u32 height;

	/* Horizontal timining size */
	u32 hts;

	/* Default vertical timining size */
	u32 vts_def;

	/* Min vertical timining size */
	u32 vts_min;

	/* Link frequency needed for this resolution */
	u32 link_freq_index;

	/* Sensor register settings for this resolution */
	const struct ov8856_reg_list reg_list;

	/* Number of data lanes */
	u8 data_lanes;

	/* Default MEDIA_BUS_FMT for this mode */
	u32 default_mbus_index;
};

struct ov8856_mipi_data_rates {
	const struct ov8856_reg regs_0[NUM_REGS];
	const struct ov8856_reg regs_1[NUM_REGS];
};

static const struct ov8856_mipi_data_rates mipi_data_rate_lane_2 = {
	//mipi_data_rate_1440mbps
	{
		{0x0103, 0x01},
		{0x0100, 0x00},
		{0x0302, 0x43},
		{0x0303, 0x00},
		{0x030b, 0x02},
		{0x030d, 0x4b},
		{0x031e, 0x0c}
	},
	//mipi_data_rate_720mbps
	{
		{0x0103, 0x01},
		{0x0100, 0x00},
		{0x0302, 0x4b},
		{0x0303, 0x01},
		{0x030b, 0x02},
		{0x030d, 0x4b},
		{0x031e, 0x0c}
	}
};

static const struct ov8856_mipi_data_rates mipi_data_rate_lane_4 = {
	//mipi_data_rate_720mbps
	{
		{0x0103, 0x01},
		{0x0100, 0x00},
		{0x0302, 0x4b},
		{0x0303, 0x01},
		{0x030b, 0x02},
		{0x030d, 0x4b},
		{0x031e, 0x0c}
	},
	//mipi_data_rate_360mbps
	{
		{0x0103, 0x01},
		{0x0100, 0x00},
		{0x0302, 0x4b},
		{0x0303, 0x03},
		{0x030b, 0x02},
		{0x030d, 0x4b},

Annotation

Implementation Notes