drivers/media/i2c/imx355.c

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

File Facts

System
Linux kernel
Corpus path
drivers/media/i2c/imx355.c
Extension
.c
Size
42528 bytes
Lines
1899
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 imx355_reg {
	u16 address;
	u8 val;
};

struct imx355_reg_list {
	u32 num_of_regs;
	const struct imx355_reg *regs;
};

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

	/* V-timing */
	u32 fll_def;
	u32 fll_min;

	/* H-timing */
	u32 llp;

	/* index of link frequency */
	u32 link_freq_index;

	/* Default register values */
	struct imx355_reg_list reg_list;
};

struct imx355_hwcfg {
	unsigned long link_freq_bitmap;
};

struct imx355 {
	struct device *dev;
	struct clk *clk;

	struct v4l2_subdev sd;
	struct media_pad pad;

	struct v4l2_ctrl_handler ctrl_handler;
	/* V4L2 Controls */
	struct v4l2_ctrl *link_freq;
	struct v4l2_ctrl *pixel_rate;
	struct v4l2_ctrl *vblank;
	struct v4l2_ctrl *hblank;
	struct v4l2_ctrl *exposure;
	struct v4l2_ctrl *vflip;
	struct v4l2_ctrl *hflip;

	/* Current mode */
	const struct imx355_mode *cur_mode;

	struct imx355_hwcfg *hwcfg;

	/*
	 * Mutex for serialized access:
	 * Protect sensor set pad format and start/stop streaming safely.
	 * Protect access to sensor v4l2 controls.
	 */
	struct mutex mutex;

	struct gpio_desc *reset_gpio;
	struct regulator_bulk_data *supplies;
};

static const struct regulator_bulk_data imx355_supplies[] = {
	{ .supply = "avdd" },
	{ .supply = "dvdd" },
	{ .supply = "dovdd" },
};

static const struct imx355_reg imx355_global_regs[] = {
	{ 0x0136, 0x13 },
	{ 0x0137, 0x33 },
	{ 0x304e, 0x03 },
	{ 0x4348, 0x16 },
	{ 0x4350, 0x19 },
	{ 0x4408, 0x0a },
	{ 0x440c, 0x0b },
	{ 0x4411, 0x5f },
	{ 0x4412, 0x2c },
	{ 0x4623, 0x00 },
	{ 0x462c, 0x0f },
	{ 0x462d, 0x00 },
	{ 0x462e, 0x00 },
	{ 0x4684, 0x54 },
	{ 0x480a, 0x07 },

Annotation

Implementation Notes