drivers/media/i2c/imx319.c

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

File Facts

System
Linux kernel
Corpus path
drivers/media/i2c/imx319.c
Extension
.c
Size
53581 bytes
Lines
2506
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 imx319_reg {
	u16 address;
	u8 val;
};

struct imx319_reg_list {
	u32 num_of_regs;
	const struct imx319_reg *regs;
};

/* Mode : resolution and related config&values */
struct imx319_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 imx319_reg_list reg_list;
};

struct imx319_hwcfg {
	unsigned long link_freq_bitmap;
};

struct imx319 {
	struct device *dev;

	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 imx319_mode *cur_mode;

	struct imx319_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;

	/* True if the device has been identified */
	bool identified;
};

static const struct imx319_reg imx319_global_regs[] = {
	{ 0x0136, 0x13 },
	{ 0x0137, 0x33 },
	{ 0x3c7e, 0x05 },
	{ 0x3c7f, 0x07 },
	{ 0x4d39, 0x0b },
	{ 0x4d41, 0x33 },
	{ 0x4d43, 0x0c },
	{ 0x4d49, 0x89 },
	{ 0x4e05, 0x0b },
	{ 0x4e0d, 0x33 },
	{ 0x4e0f, 0x0c },
	{ 0x4e15, 0x89 },
	{ 0x4e49, 0x2a },
	{ 0x4e51, 0x33 },
	{ 0x4e53, 0x0c },
	{ 0x4e59, 0x89 },
	{ 0x5601, 0x4f },
	{ 0x560b, 0x45 },
	{ 0x562f, 0x0a },
	{ 0x5643, 0x0a },
	{ 0x5645, 0x0c },
	{ 0x56ef, 0x51 },

Annotation

Implementation Notes