drivers/media/i2c/s5kjn1.c

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

File Facts

System
Linux kernel
Corpus path
drivers/media/i2c/s5kjn1.c
Extension
.c
Size
42033 bytes
Lines
1488
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 s5kjn1_reg_list {
	const struct cci_reg_sequence *regs;
	unsigned int num_regs;
};

struct s5kjn1_mode {
	u32 width;			/* Frame width in pixels */
	u32 height;			/* Frame height in pixels */
	u32 hts;			/* Horizontal timing size */
	u32 vts;			/* Default vertical timing size */
	u32 exposure;			/* Default exposure value */
	u32 exposure_margin;		/* Exposure margin */

	const struct s5kjn1_reg_list reg_list;	/* Sensor register setting */
};

static const char * const s5kjn1_test_pattern_menu[] = {
	"Disabled",
	"Solid color",
	"Color bars",
	"Fade to grey color bars",
	"PN9",
};

struct s5kjn1 {
	struct device *dev;
	struct regmap *regmap;
	struct clk *mclk;
	struct gpio_desc *reset_gpio;
	struct regulator *afvdd;	/* Autofocus actuator power */
	struct regulator *vdda;		/* Analog power */
	struct regulator *vddd;		/* Digital core power */
	struct regulator *vddio;	/* Digital I/O power */

	struct v4l2_subdev sd;
	struct media_pad pad;

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

	const struct s5kjn1_mode *mode;
};

static const struct cci_reg_sequence init_array_setting[] = {
	{ CCI_REG16(0x6028), 0x2400 },
	{ CCI_REG16(0x602a), 0x1354 },
	{ CCI_REG16(0x6f12), 0x0100 },
	{ CCI_REG16(0x6f12), 0x7017 },
	{ CCI_REG16(0x602a), 0x13b2 },
	{ CCI_REG16(0x6f12), 0x0000 },
	{ CCI_REG16(0x602a), 0x1236 },
	{ CCI_REG16(0x6f12), 0x0000 },
	{ CCI_REG16(0x602a), 0x1a0a },
	{ CCI_REG16(0x6f12), 0x4c0a },
	{ CCI_REG16(0x602a), 0x2210 },
	{ CCI_REG16(0x6f12), 0x3401 },
	{ CCI_REG16(0x602a), 0x2176 },
	{ CCI_REG16(0x6f12), 0x6400 },
	{ CCI_REG16(0x602a), 0x222e },
	{ CCI_REG16(0x6f12), 0x0001 },
	{ CCI_REG16(0x602a), 0x06b6 },
	{ CCI_REG16(0x6f12), 0x0a00 },
	{ CCI_REG16(0x602a), 0x06bc },
	{ CCI_REG16(0x6f12), 0x1001 },
	{ CCI_REG16(0x602a), 0x2140 },
	{ CCI_REG16(0x6f12), 0x0101 },
	{ CCI_REG16(0x602a), 0x1a0e },
	{ CCI_REG16(0x6f12), 0x9600 },
	{ CCI_REG16(0x6028), 0x4000 },
	{ CCI_REG16(0xf44e), 0x0011 },
	{ CCI_REG16(0xf44c), 0x0b0b },
	{ CCI_REG16(0xf44a), 0x0006 },
	{ CCI_REG16(0x0118), 0x0002 },
	{ CCI_REG16(0x011a), 0x0001 },
};

static const struct cci_reg_sequence s5kjn1_4080x3072_30fps_mode[] = {
	{ CCI_REG16(0x6028), 0x2400 },
	{ CCI_REG16(0x602a), 0x1a28 },
	{ CCI_REG16(0x6f12), 0x4c00 },
	{ CCI_REG16(0x602a), 0x065a },
	{ CCI_REG16(0x6f12), 0x0000 },
	{ CCI_REG16(0x602a), 0x139e },
	{ CCI_REG16(0x6f12), 0x0100 },

Annotation

Implementation Notes