drivers/media/i2c/imx283.c

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

File Facts

System
Linux kernel
Corpus path
drivers/media/i2c/imx283.c
Extension
.c
Size
43301 bytes
Lines
1638
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 imx283_reg_list {
	unsigned int num_of_regs;
	const struct cci_reg_sequence *regs;
};

/* Mode : resolution and related config values */
struct imx283_mode {
	unsigned int mode;

	/* Bits per pixel */
	unsigned int bpp;

	/* Frame width */
	unsigned int width;

	/* Frame height */
	unsigned int height;

	/*
	 * Minimum horizontal timing in pixel-units
	 *
	 * Note that HMAX is written in 72MHz units, and the datasheet assumes a
	 * 720MHz link frequency. Convert datasheet values with the following:
	 *
	 * For 12 bpp modes (480Mbps) convert with:
	 *   hmax = [hmax in 72MHz units] * 480 / 72
	 *
	 * For 10 bpp modes (576Mbps) convert with:
	 *   hmax = [hmax in 72MHz units] * 576 / 72
	 */
	u32 min_hmax;

	/* minimum V-timing in lines */
	u32 min_vmax;

	/* default H-timing */
	u32 default_hmax;

	/* default V-timing */
	u32 default_vmax;

	/* minimum SHR */
	u32 min_shr;

	/*
	 * Per-mode vertical crop constants used to calculate values
	 * of IMX283REG_WIDCUT and IMX283_REG_VWINPOS.
	 */
	u32 veff;
	u32 vst;
	u32 vct;

	/* Horizontal and vertical binning ratio */
	u8 hbin_ratio;
	u8 vbin_ratio;

	/* Optical Blanking */
	u32 horizontal_ob;
	u32 vertical_ob;

	/* Analog crop rectangle. */
	struct v4l2_rect crop;
};

struct imx283_input_frequency {
	unsigned int mhz;
	unsigned int reg_count;
	struct cci_reg_sequence regs[4];
};

static const struct imx283_input_frequency imx283_frequencies[] = {
	{
		.mhz = 6 * HZ_PER_MHZ,
		.reg_count = 4,
		.regs = {
			{ IMX283_REG_PLRD1, 0x00 },
			{ IMX283_REG_PLRD2, 0x00f0 },
			{ IMX283_REG_PLRD3, 0x00 },
			{ IMX283_REG_PLRD4, 0xc0 },
		},
	},
	{
		.mhz = 12 * HZ_PER_MHZ,
		.reg_count = 4,
		.regs = {
			{ IMX283_REG_PLRD1, 0x01 },
			{ IMX283_REG_PLRD2, 0x00f0 },
			{ IMX283_REG_PLRD3, 0x01 },
			{ IMX283_REG_PLRD4, 0xc0 },
		},

Annotation

Implementation Notes