drivers/media/i2c/ov9650.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/ov9650.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/ov9650.c- Extension
.c- Size
- 42728 bytes
- Lines
- 1600
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/clk.hlinux/delay.hlinux/gpio/consumer.hlinux/i2c.hlinux/kernel.hlinux/media.hlinux/module.hlinux/ratelimit.hlinux/regmap.hlinux/slab.hlinux/string.hlinux/videodev2.hmedia/media-entity.hmedia/v4l2-async.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-event.hmedia/v4l2-image-sizes.hmedia/v4l2-subdev.hmedia/v4l2-mediabus.h
Detected Declarations
struct ov965x_ctrlsstruct ov965x_framesizestruct ov965x_intervalstruct ov965xstruct i2c_rvstruct ov965x_pixfmtenum gpio_idfunction ov965x_readfunction ov965x_writefunction ov965x_write_arrayfunction ov965x_set_default_gamma_curvefunction ov965x_set_color_matrixfunction __ov965x_set_powerfunction ov965x_s_powerfunction ov965x_update_exposure_ctrlfunction ov965x_set_banding_filterfunction ov965x_set_white_balancefunction ov965x_set_brightnessfunction ov965x_set_gainfunction ov965x_set_sharpnessfunction ov965x_set_exposurefunction ov965x_set_flipfunction ov965x_set_saturationfunction ov965x_set_test_patternfunction __g_volatile_ctrlfunction ov965x_g_volatile_ctrlfunction ov965x_s_ctrlfunction ov965x_initialize_controlsfunction ov965x_get_default_formatfunction ov965x_enum_mbus_codefunction ov965x_enum_frame_sizesfunction ov965x_get_frame_intervalfunction __ov965x_set_frame_intervalfunction ov965x_set_frame_intervalfunction ov965x_get_fmtfunction __ov965x_try_frame_sizefunction ov965x_set_fmtfunction ov965x_set_frame_sizefunction __ov965x_set_paramsfunction ov965x_s_streamfunction ov965x_openfunction ov965x_configure_gpiosfunction ov965x_detect_sensorfunction ov965x_probefunction ov965x_remove
Annotated Snippet
struct ov965x_ctrls {
struct v4l2_ctrl_handler handler;
struct {
struct v4l2_ctrl *auto_exp;
struct v4l2_ctrl *exposure;
};
struct {
struct v4l2_ctrl *auto_wb;
struct v4l2_ctrl *blue_balance;
struct v4l2_ctrl *red_balance;
};
struct {
struct v4l2_ctrl *hflip;
struct v4l2_ctrl *vflip;
};
struct {
struct v4l2_ctrl *auto_gain;
struct v4l2_ctrl *gain;
};
struct v4l2_ctrl *brightness;
struct v4l2_ctrl *saturation;
struct v4l2_ctrl *sharpness;
struct v4l2_ctrl *light_freq;
u8 update;
};
struct ov965x_framesize {
u16 width;
u16 height;
u16 max_exp_lines;
const u8 *regs;
};
struct ov965x_interval {
struct v4l2_fract interval;
/* Maximum resolution for this interval */
struct v4l2_frmsize_discrete size;
u8 clkrc_div;
};
enum gpio_id {
GPIO_PWDN,
GPIO_RST,
NUM_GPIOS,
};
struct ov965x {
struct v4l2_subdev sd;
struct media_pad pad;
enum v4l2_mbus_type bus_type;
struct gpio_desc *gpios[NUM_GPIOS];
/* External master clock frequency */
unsigned long mclk_frequency;
struct clk *clk;
/* Protects the struct fields below */
struct mutex lock;
struct regmap *regmap;
/* Exposure row interval in us */
unsigned int exp_row_interval;
unsigned short id;
const struct ov965x_framesize *frame_size;
/* YUYV sequence (pixel format) control register */
u8 tslb_reg;
struct v4l2_mbus_framefmt format;
struct ov965x_ctrls ctrls;
/* Pointer to frame rate control data structure */
const struct ov965x_interval *fiv;
int streaming;
int power;
u8 apply_frame_fmt;
};
struct i2c_rv {
u8 addr;
u8 value;
};
static const struct i2c_rv ov965x_init_regs[] = {
{ REG_COM2, 0x10 }, /* Set soft sleep mode */
{ REG_COM5, 0x00 }, /* System clock options */
{ REG_COM2, 0x01 }, /* Output drive, soft sleep mode */
{ REG_COM10, 0x00 }, /* Slave mode, HREF vs HSYNC, signals negate */
{ REG_EDGE, 0xa6 }, /* Edge enhancement threshold and factor */
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/kernel.h`, `linux/media.h`, `linux/module.h`, `linux/ratelimit.h`.
- Detected declarations: `struct ov965x_ctrls`, `struct ov965x_framesize`, `struct ov965x_interval`, `struct ov965x`, `struct i2c_rv`, `struct ov965x_pixfmt`, `enum gpio_id`, `function ov965x_read`, `function ov965x_write`, `function ov965x_write_array`.
- Atlas domain: Driver Families / drivers/media.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.