drivers/media/i2c/ov2659.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/ov2659.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/ov2659.c- Extension
.c- Size
- 38331 bytes
- Lines
- 1585
- 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/module.hlinux/of_graph.hlinux/pm_runtime.hmedia/i2c/ov2659.hmedia/v4l2-ctrls.hmedia/v4l2-event.hmedia/v4l2-fwnode.hmedia/v4l2-image-sizes.hmedia/v4l2-subdev.h
Detected Declarations
struct sensor_registerstruct ov2659_framesizestruct ov2659_pll_ctrlstruct ov2659_pixfmtstruct pll_ctrl_regstruct ov2659function ov2659_writefunction ov2659_readfunction ov2659_write_arrayfunction ov2659_pll_calc_paramsfunction ov2659_set_pixel_clockfunction ov2659_get_default_formatfunction ov2659_set_streamingfunction ov2659_initfunction ov2659_enum_mbus_codefunction ov2659_enum_frame_sizesfunction ov2659_get_fmtfunction __ov2659_try_frame_sizefunction ov2659_set_fmtfunction ov2659_set_frame_sizefunction ov2659_set_formatfunction ov2659_s_streamfunction ov2659_set_test_patternfunction ov2659_s_ctrlfunction ov2659_power_offfunction ov2659_power_onfunction ov2659_openfunction ov2659_detectfunction ov2659_get_pdatafunction ov2659_probefunction ov2659_remove
Annotated Snippet
struct sensor_register {
u16 addr;
u8 value;
};
struct ov2659_framesize {
u16 width;
u16 height;
u16 max_exp_lines;
const struct sensor_register *regs;
};
struct ov2659_pll_ctrl {
u8 ctrl1;
u8 ctrl2;
u8 ctrl3;
};
struct ov2659_pixfmt {
u32 code;
/* Output format Register Value (REG_FORMAT_CTRL00) */
struct sensor_register *format_ctrl_regs;
};
struct pll_ctrl_reg {
unsigned int div;
unsigned char reg;
};
struct ov2659 {
struct v4l2_subdev sd;
struct media_pad pad;
struct v4l2_mbus_framefmt format;
unsigned int xvclk_frequency;
const struct ov2659_platform_data *pdata;
struct mutex lock;
struct i2c_client *client;
struct v4l2_ctrl_handler ctrls;
struct v4l2_ctrl *link_frequency;
struct clk *clk;
const struct ov2659_framesize *frame_size;
struct sensor_register *format_ctrl_regs;
struct ov2659_pll_ctrl pll;
int streaming;
/* used to control the sensor PWDN pin */
struct gpio_desc *pwdn_gpio;
/* used to control the sensor RESETB pin */
struct gpio_desc *resetb_gpio;
};
static const struct sensor_register ov2659_init_regs[] = {
{ REG_IO_CTRL00, 0x03 },
{ REG_IO_CTRL01, 0xff },
{ REG_IO_CTRL02, 0xe0 },
{ 0x3633, 0x3d },
{ 0x3620, 0x02 },
{ 0x3631, 0x11 },
{ 0x3612, 0x04 },
{ 0x3630, 0x20 },
{ 0x4702, 0x02 },
{ 0x370c, 0x34 },
{ REG_TIMING_HS_H, 0x00 },
{ REG_TIMING_HS_L, 0x00 },
{ REG_TIMING_VS_H, 0x00 },
{ REG_TIMING_VS_L, 0x00 },
{ REG_TIMING_HW_H, 0x06 },
{ REG_TIMING_HW_L, 0x5f },
{ REG_TIMING_VH_H, 0x04 },
{ REG_TIMING_VH_L, 0xb7 },
{ REG_TIMING_DVPHO_H, 0x03 },
{ REG_TIMING_DVPHO_L, 0x20 },
{ REG_TIMING_DVPVO_H, 0x02 },
{ REG_TIMING_DVPVO_L, 0x58 },
{ REG_TIMING_HTS_H, 0x05 },
{ REG_TIMING_HTS_L, 0x14 },
{ REG_TIMING_VTS_H, 0x02 },
{ REG_TIMING_VTS_L, 0x68 },
{ REG_TIMING_HOFFS_L, 0x08 },
{ REG_TIMING_VOFFS_L, 0x02 },
{ REG_TIMING_XINC, 0x31 },
{ REG_TIMING_YINC, 0x31 },
{ 0x3a02, 0x02 },
{ 0x3a03, 0x68 },
{ 0x3a08, 0x00 },
{ 0x3a09, 0x5c },
{ 0x3a0a, 0x00 },
{ 0x3a0b, 0x4d },
{ 0x3a0d, 0x08 },
{ 0x3a0e, 0x06 },
{ 0x3a14, 0x02 },
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/module.h`, `linux/of_graph.h`, `linux/pm_runtime.h`, `media/i2c/ov2659.h`.
- Detected declarations: `struct sensor_register`, `struct ov2659_framesize`, `struct ov2659_pll_ctrl`, `struct ov2659_pixfmt`, `struct pll_ctrl_reg`, `struct ov2659`, `function ov2659_write`, `function ov2659_read`, `function ov2659_write_array`, `function ov2659_pll_calc_params`.
- 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.