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.
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/unaligned.hlinux/clk.hlinux/delay.hlinux/i2c.hlinux/math.hlinux/module.hlinux/pm_runtime.hlinux/regmap.hlinux/regulator/consumer.hmedia/v4l2-cci.hmedia/v4l2-ctrls.hmedia/v4l2-event.hmedia/v4l2-fwnode.hmedia/v4l2-subdev.h
Detected Declarations
struct ov9282_reg_liststruct ov9282_modestruct ov9282function to_ov9282function ov9282_update_controlsfunction ov9282_exposure_to_usfunction ov9282_update_exp_gainfunction ov9282_us_to_flash_durationfunction ov9282_flash_duration_to_usfunction ov9282_set_ctrlfunction ov9282_try_ctrlfunction ov9282_enum_mbus_codefunction ov9282_enum_frame_sizefunction ov9282_fill_pad_formatfunction ov9282_get_pad_formatfunction ov9282_set_pad_formatfunction ov9282_init_statefunction __ov9282_get_pad_cropfunction ov9282_get_selectionfunction ov9282_enable_streamsfunction ov9282_disable_streamsfunction ov9282_detectfunction ov9282_configure_regulatorsfunction ov9282_parse_hw_configfunction ov9282_power_onfunction ov9282_power_offfunction ov9282_init_controlsfunction ov9282_probefunction ov9282_remove
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
- Immediate include surface: `linux/unaligned.h`, `linux/clk.h`, `linux/delay.h`, `linux/i2c.h`, `linux/math.h`, `linux/module.h`, `linux/pm_runtime.h`, `linux/regmap.h`.
- Detected declarations: `struct ov9282_reg_list`, `struct ov9282_mode`, `struct ov9282`, `function to_ov9282`, `function ov9282_update_controls`, `function ov9282_exposure_to_us`, `function ov9282_update_exp_gain`, `function ov9282_us_to_flash_duration`, `function ov9282_flash_duration_to_us`, `function ov9282_set_ctrl`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.