drivers/media/i2c/ov02a10.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/ov02a10.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/ov02a10.c- Extension
.c- Size
- 23932 bytes
- Lines
- 1004
- 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/device.hlinux/gpio/consumer.hlinux/i2c.hlinux/module.hlinux/pm_runtime.hlinux/regulator/consumer.hlinux/units.hmedia/media-entity.hmedia/v4l2-async.hmedia/v4l2-ctrls.hmedia/v4l2-fwnode.hmedia/v4l2-subdev.h
Detected Declarations
struct ov02a10_regstruct ov02a10_reg_liststruct ov02a10_modestruct ov02a10function to_pixel_ratefunction ov02a10_write_arrayfunction ov02a10_fill_fmtfunction ov02a10_set_fmtfunction ov02a10_get_fmtfunction ov02a10_enum_mbus_codefunction ov02a10_enum_frame_sizesfunction ov02a10_check_sensor_idfunction ov02a10_power_onfunction ov02a10_power_offfunction __ov02a10_start_streamfunction __ov02a10_stop_streamfunction ov02a10_init_statefunction ov02a10_s_streamfunction ov02a10_set_exposurefunction ov02a10_set_gainfunction ov02a10_set_vblankfunction ov02a10_set_test_patternfunction ov02a10_set_ctrlfunction ov02a10_initialize_controlsfunction ov02a10_check_hwcfgfunction ov02a10_probefunction ov02a10_remove
Annotated Snippet
struct ov02a10_reg {
u8 addr;
u8 val;
};
struct ov02a10_reg_list {
u32 num_of_regs;
const struct ov02a10_reg *regs;
};
struct ov02a10_mode {
u32 width;
u32 height;
u32 exp_def;
u32 hts_def;
u32 vts_def;
const struct ov02a10_reg_list reg_list;
};
struct ov02a10 {
struct device *dev;
/* Indication of MIPI transmission speed select */
u32 mipi_clock_voltage;
struct clk *eclk;
struct gpio_desc *pd_gpio;
struct gpio_desc *rst_gpio;
struct regulator_bulk_data supplies[ARRAY_SIZE(ov02a10_supply_names)];
bool streaming;
bool upside_down;
/*
* Serialize control access, get/set format, get selection
* and start streaming.
*/
struct mutex mutex;
struct v4l2_subdev subdev;
struct media_pad pad;
struct v4l2_mbus_framefmt fmt;
struct v4l2_ctrl_handler ctrl_handler;
struct v4l2_ctrl *exposure;
const struct ov02a10_mode *cur_mode;
};
static inline struct ov02a10 *to_ov02a10(struct v4l2_subdev *sd)
{
return container_of(sd, struct ov02a10, subdev);
}
/*
* eclk 24Mhz
* pclk 39Mhz
* linelength 934(0x3a6)
* framelength 1390(0x56E)
* grabwindow_width 1600
* grabwindow_height 1200
* max_framerate 30fps
* mipi_datarate per lane 780Mbps
*/
static const struct ov02a10_reg ov02a10_1600x1200_regs[] = {
{0xfd, 0x01},
{0xac, 0x00},
{0xfd, 0x00},
{0x2f, 0x29},
{0x34, 0x00},
{0x35, 0x21},
{0x30, 0x15},
{0x33, 0x01},
{0xfd, 0x01},
{0x44, 0x00},
{0x2a, 0x4c},
{0x2b, 0x1e},
{0x2c, 0x60},
{0x25, 0x11},
{0x03, 0x01},
{0x04, 0xae},
{0x09, 0x00},
{0x0a, 0x02},
{0x06, 0xa6},
{0x31, 0x00},
{0x24, 0x40},
{0x01, 0x01},
{0xfb, 0x73},
{0xfd, 0x01},
{0x16, 0x04},
{0x1c, 0x09},
{0x21, 0x42},
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/device.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/module.h`, `linux/pm_runtime.h`, `linux/regulator/consumer.h`.
- Detected declarations: `struct ov02a10_reg`, `struct ov02a10_reg_list`, `struct ov02a10_mode`, `struct ov02a10`, `function to_pixel_rate`, `function ov02a10_write_array`, `function ov02a10_fill_fmt`, `function ov02a10_set_fmt`, `function ov02a10_get_fmt`, `function ov02a10_enum_mbus_code`.
- 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.