drivers/media/i2c/ov2659.c

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

File Facts

System
Linux kernel
Corpus path
drivers/media/i2c/ov2659.c
Extension
.c
Size
38331 bytes
Lines
1585
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 sensor_register {
	u16 addr;
	u8 value;
};

struct ov2659_framesize {
	u16 width;
	u16 height;
	u16 max_exp_lines;
	const struct sensor_register *regs;
};

struct ov2659_pll_ctrl {
	u8 ctrl1;
	u8 ctrl2;
	u8 ctrl3;
};

struct ov2659_pixfmt {
	u32 code;
	/* Output format Register Value (REG_FORMAT_CTRL00) */
	struct sensor_register *format_ctrl_regs;
};

struct pll_ctrl_reg {
	unsigned int div;
	unsigned char reg;
};

struct ov2659 {
	struct v4l2_subdev sd;
	struct media_pad pad;
	struct v4l2_mbus_framefmt format;
	unsigned int xvclk_frequency;
	const struct ov2659_platform_data *pdata;
	struct mutex lock;
	struct i2c_client *client;
	struct v4l2_ctrl_handler ctrls;
	struct v4l2_ctrl *link_frequency;
	struct clk *clk;
	const struct ov2659_framesize *frame_size;
	struct sensor_register *format_ctrl_regs;
	struct ov2659_pll_ctrl pll;
	int streaming;
	/* used to control the sensor PWDN pin */
	struct gpio_desc *pwdn_gpio;
	/* used to control the sensor RESETB pin */
	struct gpio_desc *resetb_gpio;
};

static const struct sensor_register ov2659_init_regs[] = {
	{ REG_IO_CTRL00, 0x03 },
	{ REG_IO_CTRL01, 0xff },
	{ REG_IO_CTRL02, 0xe0 },
	{ 0x3633, 0x3d },
	{ 0x3620, 0x02 },
	{ 0x3631, 0x11 },
	{ 0x3612, 0x04 },
	{ 0x3630, 0x20 },
	{ 0x4702, 0x02 },
	{ 0x370c, 0x34 },
	{ REG_TIMING_HS_H, 0x00 },
	{ REG_TIMING_HS_L, 0x00 },
	{ REG_TIMING_VS_H, 0x00 },
	{ REG_TIMING_VS_L, 0x00 },
	{ REG_TIMING_HW_H, 0x06 },
	{ REG_TIMING_HW_L, 0x5f },
	{ REG_TIMING_VH_H, 0x04 },
	{ REG_TIMING_VH_L, 0xb7 },
	{ REG_TIMING_DVPHO_H, 0x03 },
	{ REG_TIMING_DVPHO_L, 0x20 },
	{ REG_TIMING_DVPVO_H, 0x02 },
	{ REG_TIMING_DVPVO_L, 0x58 },
	{ REG_TIMING_HTS_H, 0x05 },
	{ REG_TIMING_HTS_L, 0x14 },
	{ REG_TIMING_VTS_H, 0x02 },
	{ REG_TIMING_VTS_L, 0x68 },
	{ REG_TIMING_HOFFS_L, 0x08 },
	{ REG_TIMING_VOFFS_L, 0x02 },
	{ REG_TIMING_XINC, 0x31 },
	{ REG_TIMING_YINC, 0x31 },
	{ 0x3a02, 0x02 },
	{ 0x3a03, 0x68 },
	{ 0x3a08, 0x00 },
	{ 0x3a09, 0x5c },
	{ 0x3a0a, 0x00 },
	{ 0x3a0b, 0x4d },
	{ 0x3a0d, 0x08 },
	{ 0x3a0e, 0x06 },
	{ 0x3a14, 0x02 },

Annotation

Implementation Notes