drivers/media/i2c/ov4689.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/ov4689.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/ov4689.c- Extension
.c- Size
- 27653 bytes
- Lines
- 1046
- 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/clk.hlinux/delay.hlinux/gpio/consumer.hlinux/i2c.hlinux/module.hlinux/pm_runtime.hlinux/regulator/consumer.hmedia/media-entity.hmedia/v4l2-async.hmedia/v4l2-cci.hmedia/v4l2-ctrls.hmedia/v4l2-subdev.hmedia/v4l2-fwnode.h
Detected Declarations
struct ov4689_modestruct ov4689struct ov4689_gain_rangeenum ov4689_mode_idfunction ov4689_fill_fmtfunction ov4689_set_fmtfunction ov4689_enum_mbus_codefunction ov4689_enum_frame_sizesfunction ov4689_enable_test_patternfunction ov4689_get_selectionfunction ov4689_setup_timingsfunction ov4689_setup_blc_anchorsfunction ov4689_s_streamfunction ov4689_cal_delayfunction ov4689_power_onfunction ov4689_power_offfunction ov4689_init_statefunction userspacefunction ov4689_set_ctrlfunction ov4689_initialize_controlsfunction ov4689_check_sensor_idfunction ov4689_configure_regulatorsfunction ov4689_check_link_frequencyfunction ov4689_check_hwcfgfunction ov4689_probefunction ov4689_remove
Annotated Snippet
struct ov4689_mode {
enum ov4689_mode_id id;
u32 width;
u32 height;
u32 hts_def;
u32 hts_min;
u32 vts_def;
u32 exp_def;
u32 pixel_rate;
const struct cci_reg_sequence *reg_list;
unsigned int num_regs;
};
struct ov4689 {
struct device *dev;
struct regmap *regmap;
struct clk *xvclk;
struct gpio_desc *reset_gpio;
struct gpio_desc *pwdn_gpio;
struct regulator_bulk_data supplies[ARRAY_SIZE(ov4689_supply_names)];
struct v4l2_subdev subdev;
struct media_pad pad;
u32 clock_rate;
struct v4l2_ctrl_handler ctrl_handler;
struct v4l2_ctrl *exposure;
const struct ov4689_mode *cur_mode;
};
#define to_ov4689(sd) container_of(sd, struct ov4689, subdev)
struct ov4689_gain_range {
u32 logical_min;
u32 logical_max;
u32 offset;
u32 divider;
u32 physical_min;
u32 physical_max;
};
/*
* Xclk 24Mhz
* max_framerate 90fps
* mipi_datarate per lane 1008Mbps
*/
static const struct cci_reg_sequence ov4689_2688x1520_regs[] = {
/* System control*/
{ CCI_REG8(0x0103), 0x01 }, /* SC_CTRL0103 software_reset = 1 */
{ CCI_REG8(0x3000), 0x20 }, /* SC_CMMN_PAD_OEN0 FSIN_output_enable = 1 */
{ CCI_REG8(0x3021), 0x03 }, /*
* SC_CMMN_MISC_CTRL fst_stby_ctr = 0,
* sleep_no_latch_enable = 0
*/
/* AEC PK */
{ CCI_REG8(0x3503), 0x04 }, /* AEC_MANUAL gain_input_as_sensor_gain_format = 1 */
/* ADC and analog control*/
{ CCI_REG8(0x3603), 0x40 },
{ CCI_REG8(0x3604), 0x02 },
{ CCI_REG8(0x3609), 0x12 },
{ CCI_REG8(0x360c), 0x08 },
{ CCI_REG8(0x360f), 0xe5 },
{ CCI_REG8(0x3608), 0x8f },
{ CCI_REG8(0x3611), 0x00 },
{ CCI_REG8(0x3613), 0xf7 },
{ CCI_REG8(0x3616), 0x58 },
{ CCI_REG8(0x3619), 0x99 },
{ CCI_REG8(0x361b), 0x60 },
{ CCI_REG8(0x361e), 0x79 },
{ CCI_REG8(0x3634), 0x10 },
{ CCI_REG8(0x3635), 0x10 },
{ CCI_REG8(0x3636), 0x15 },
{ CCI_REG8(0x3646), 0x86 },
{ CCI_REG8(0x364a), 0x0b },
/* Sensor control */
{ CCI_REG8(0x3700), 0x17 },
{ CCI_REG8(0x3701), 0x22 },
{ CCI_REG8(0x3703), 0x10 },
{ CCI_REG8(0x370a), 0x37 },
{ CCI_REG8(0x3706), 0x63 },
{ CCI_REG8(0x3709), 0x3c },
{ CCI_REG8(0x370c), 0x30 },
{ CCI_REG8(0x3710), 0x24 },
{ CCI_REG8(0x3720), 0x28 },
{ CCI_REG8(0x3729), 0x7b },
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/module.h`, `linux/pm_runtime.h`, `linux/regulator/consumer.h`, `media/media-entity.h`.
- Detected declarations: `struct ov4689_mode`, `struct ov4689`, `struct ov4689_gain_range`, `enum ov4689_mode_id`, `function ov4689_fill_fmt`, `function ov4689_set_fmt`, `function ov4689_enum_mbus_code`, `function ov4689_enum_frame_sizes`, `function ov4689_enable_test_pattern`, `function ov4689_get_selection`.
- 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.