drivers/staging/media/atomisp/i2c/gc2235.h

Source file repositories/reference/linux-study-clean/drivers/staging/media/atomisp/i2c/gc2235.h

File Facts

System
Linux kernel
Corpus path
drivers/staging/media/atomisp/i2c/gc2235.h
Extension
.h
Size
17008 bytes
Lines
634
Domain
Driver Families
Bucket
drivers/staging
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 regval_list {
	u16 reg_num;
	u8 value;
};

struct gc2235_resolution {
	u8 *desc;
	const struct gc2235_reg *regs;
	int res;
	int width;
	int height;
	int fps;
	int pix_clk_freq;
	u32 skip_frames;
	u16 pixels_per_line;
	u16 lines_per_frame;
	bool used;
};

struct gc2235_format {
	u8 *desc;
	u32 pixelformat;
	struct gc2235_reg *regs;
};

/*
 * gc2235 device structure.
 */
struct gc2235_device {
	struct v4l2_subdev sd;
	struct media_pad pad;
	struct v4l2_mbus_framefmt format;
	struct mutex input_lock;
	struct v4l2_ctrl_handler ctrl_handler;
	struct gc2235_resolution *res;

	struct camera_sensor_platform_data *platform_data;
	u8 type;
};

enum gc2235_tok_type {
	GC2235_8BIT  = 0x0001,
	GC2235_16BIT = 0x0002,
	GC2235_32BIT = 0x0004,
	GC2235_TOK_TERM   = 0xf000,	/* terminating token for reg list */
	GC2235_TOK_DELAY  = 0xfe00,	/* delay token for reg list */
	GC2235_TOK_MASK = 0xfff0
};

/*
 * struct gc2235_reg - MI sensor  register format
 * @type: type of the register
 * @reg: 8-bit offset to register
 * @val: 8/16/32-bit register value
 *
 * Define a structure for sensor register initialization values
 */
struct gc2235_reg {
	enum gc2235_tok_type type;
	u8 reg;
	u32 val;	/* @set value for read/mod/write, @mask */
};

#define to_gc2235_sensor(x) container_of(x, struct gc2235_device, sd)

#define GC2235_MAX_WRITE_BUF_SIZE	30

struct gc2235_write_buffer {
	u8 addr;
	u8 data[GC2235_MAX_WRITE_BUF_SIZE];
};

struct gc2235_write_ctrl {
	int index;
	struct gc2235_write_buffer buffer;
};

static const struct gc2235_reg gc2235_stream_on[] = {
	{ GC2235_8BIT, 0xfe, 0x03}, /* switch to P3 */
	{ GC2235_8BIT, 0x10, 0x91}, /* start mipi */
	{ GC2235_8BIT, 0xfe, 0x00}, /* switch to P0 */
	{ GC2235_TOK_TERM, 0, 0 }
};

static const struct gc2235_reg gc2235_stream_off[] = {
	{ GC2235_8BIT, 0xfe, 0x03}, /* switch to P3 */
	{ GC2235_8BIT, 0x10, 0x01}, /* stop mipi */
	{ GC2235_8BIT, 0xfe, 0x00}, /* switch to P0 */
	{ GC2235_TOK_TERM, 0, 0 }
};

Annotation

Implementation Notes