drivers/media/i2c/ov9282.c

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

File Facts

System
Linux kernel
Corpus path
drivers/media/i2c/ov9282.c
Extension
.c
Size
38009 bytes
Lines
1418
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 ov9282_reg_list {
	u32 num_of_regs;
	const struct cci_reg_sequence *regs;
};

/**
 * struct ov9282_mode - ov9282 sensor mode structure
 * @width: Frame width
 * @height: Frame height
 * @hblank_min: Minimum horizontal blanking in lines for non-continuous[0] and
 *		continuous[1] clock modes
 * @vblank: Vertical blanking in lines
 * @vblank_min: Minimum vertical blanking in lines
 * @vblank_max: Maximum vertical blanking in lines
 * @link_freq_idx: Link frequency index
 * @crop: on-sensor cropping for this mode
 * @reg_list: Register list for sensor mode
 */
struct ov9282_mode {
	u32 width;
	u32 height;
	u32 hblank_min[2];
	u32 vblank;
	u32 vblank_min;
	u32 vblank_max;
	u32 link_freq_idx;
	struct v4l2_rect crop;
	struct ov9282_reg_list reg_list;
};

/**
 * struct ov9282 - ov9282 sensor device structure
 * @dev: Pointer to generic device
 * @sd: V4L2 sub-device
 * @regmap: Regmap for sensor register access
 * @pad: Media pad. Only one pad supported
 * @reset_gpio: Sensor reset gpio
 * @inclk: Sensor input clock
 * @supplies: Regulator supplies for the sensor
 * @ctrl_handler: V4L2 control handler
 * @link_freq_ctrl: Pointer to link frequency control
 * @hblank_ctrl: Pointer to horizontal blanking control
 * @vblank_ctrl: Pointer to vertical blanking control
 * @exp_ctrl: Pointer to exposure control
 * @again_ctrl: Pointer to analog gain control
 * @pixel_rate: Pointer to pixel rate control
 * @flash_duration: Pointer to flash duration control
 * @vblank: Vertical blanking in lines
 * @noncontinuous_clock: Selection of CSI2 noncontinuous clock mode
 * @cur_mode: Pointer to current selected sensor mode
 * @code: Mbus code currently selected
 * @mutex: Mutex for serializing sensor controls
 */
struct ov9282 {
	struct device *dev;
	struct v4l2_subdev sd;
	struct regmap *regmap;
	struct media_pad pad;
	struct gpio_desc *reset_gpio;
	struct clk *inclk;
	struct regulator_bulk_data supplies[OV9282_NUM_SUPPLIES];
	struct v4l2_ctrl_handler ctrl_handler;
	struct v4l2_ctrl *link_freq_ctrl;
	struct v4l2_ctrl *hblank_ctrl;
	struct v4l2_ctrl *vblank_ctrl;
	struct {
		struct v4l2_ctrl *exp_ctrl;
		struct v4l2_ctrl *again_ctrl;
	};
	struct v4l2_ctrl *pixel_rate;
	struct v4l2_ctrl *flash_duration;
	u32 vblank;
	bool noncontinuous_clock;
	const struct ov9282_mode *cur_mode;
	u32 code;
};

static const s64 link_freq[] = {
	OV9282_LINK_FREQ,
};

/*
 * Common registers
 *
 * Note: Do NOT include a software reset (0x0103, 0x01) in any of these
 * register arrays as some settings are written as part of ov9282_power_on,
 * and the reset will clear them.
 */
static const struct cci_reg_sequence common_regs[] = {
	{CCI_REG8(0x0302), 0x32},

Annotation

Implementation Notes