drivers/media/i2c/imx208.c

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

File Facts

System
Linux kernel
Corpus path
drivers/media/i2c/imx208.c
Extension
.c
Size
26368 bytes
Lines
1070
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 imx208_reg {
	u16 address;
	u8 val;
};

struct imx208_reg_list {
	u32 num_of_regs;
	const struct imx208_reg *regs;
};

/* Link frequency config */
struct imx208_link_freq_config {
	u32 pixels_per_line;

	/* PLL registers for this link frequency */
	struct imx208_reg_list reg_list;
};

/* Mode : resolution and related config&values */
struct imx208_mode {
	/* Frame width */
	u32 width;
	/* Frame height */
	u32 height;

	/* V-timing */
	u32 vts_def;
	u32 vts_min;

	/* Index of Link frequency config to be used */
	u32 link_freq_index;
	/* Default register values */
	struct imx208_reg_list reg_list;
};

static const struct imx208_reg pll_ctrl_reg[] = {
	{0x0305, 0x02},
	{0x0307, 0x50},
	{0x303C, 0x3C},
};

static const struct imx208_reg mode_1936x1096_60fps_regs[] = {
	{0x0340, 0x04},
	{0x0341, 0x72},
	{0x0342, 0x04},
	{0x0343, 0x64},
	{0x034C, 0x07},
	{0x034D, 0x90},
	{0x034E, 0x04},
	{0x034F, 0x48},
	{0x0381, 0x01},
	{0x0383, 0x01},
	{0x0385, 0x01},
	{0x0387, 0x01},
	{0x3048, 0x00},
	{0x3050, 0x01},
	{0x30D5, 0x00},
	{0x3301, 0x00},
	{0x3318, 0x62},
	{0x0202, 0x01},
	{0x0203, 0x90},
	{0x0205, 0x00},
};

static const struct imx208_reg mode_968_548_60fps_regs[] = {
	{0x0340, 0x02},
	{0x0341, 0x39},
	{0x0342, 0x08},
	{0x0343, 0xC8},
	{0x034C, 0x03},
	{0x034D, 0xC8},
	{0x034E, 0x02},
	{0x034F, 0x24},
	{0x0381, 0x01},
	{0x0383, 0x03},
	{0x0385, 0x01},
	{0x0387, 0x03},
	{0x3048, 0x01},
	{0x3050, 0x02},
	{0x30D5, 0x03},
	{0x3301, 0x10},
	{0x3318, 0x75},
	{0x0202, 0x01},
	{0x0203, 0x90},
	{0x0205, 0x00},
};

static const s64 imx208_discrete_digital_gain[] = {
	1, 2, 4, 8, 16,
};

Annotation

Implementation Notes