drivers/media/i2c/ov5695.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/ov5695.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/ov5695.c- Extension
.c- Size
- 29843 bytes
- Lines
- 1374
- 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/device.hlinux/delay.hlinux/gpio/consumer.hlinux/i2c.hlinux/module.hlinux/pm_runtime.hlinux/regulator/consumer.hlinux/sysfs.hmedia/media-entity.hmedia/v4l2-async.hmedia/v4l2-ctrls.hmedia/v4l2-subdev.h
Detected Declarations
struct regvalstruct ov5695_modestruct ov5695function ov5695_write_regfunction ov5695_write_arrayfunction ov5695_read_regfunction ov5695_get_reso_distfunction ov5695_find_best_fitfunction ov5695_set_fmtfunction ov5695_get_fmtfunction ov5695_enum_mbus_codefunction ov5695_enum_frame_sizesfunction ov5695_enable_test_patternfunction __ov5695_start_streamfunction __ov5695_stop_streamfunction ov5695_s_streamfunction __ov5695_power_onfunction __ov5695_power_offfunction ov5695_runtime_resumefunction ov5695_runtime_suspendfunction ov5695_openfunction ov5695_set_ctrlfunction ov5695_initialize_controlsfunction ov5695_check_sensor_idfunction ov5695_configure_regulatorsfunction ov5695_probefunction ov5695_remove
Annotated Snippet
struct regval {
u16 addr;
u8 val;
};
struct ov5695_mode {
u32 width;
u32 height;
u32 max_fps;
u32 hts_def;
u32 vts_def;
u32 exp_def;
const struct regval *reg_list;
};
struct ov5695 {
struct i2c_client *client;
struct clk *xvclk;
struct gpio_desc *reset_gpio;
struct regulator_bulk_data supplies[OV5695_NUM_SUPPLIES];
struct v4l2_subdev subdev;
struct media_pad pad;
struct v4l2_ctrl_handler ctrl_handler;
struct v4l2_ctrl *exposure;
struct v4l2_ctrl *anal_gain;
struct v4l2_ctrl *digi_gain;
struct v4l2_ctrl *hblank;
struct v4l2_ctrl *vblank;
struct v4l2_ctrl *test_pattern;
struct mutex mutex;
const struct ov5695_mode *cur_mode;
};
#define to_ov5695(sd) container_of(sd, struct ov5695, subdev)
/*
* Xclk 24Mhz
* Pclk 45Mhz
* linelength 672(0x2a0)
* framelength 2232(0x8b8)
* grabwindow_width 1296
* grabwindow_height 972
* max_framerate 30fps
* mipi_datarate per lane 840Mbps
*/
static const struct regval ov5695_global_regs[] = {
{0x0103, 0x01},
{0x0100, 0x00},
{0x0300, 0x04},
{0x0301, 0x00},
{0x0302, 0x69},
{0x0303, 0x00},
{0x0304, 0x00},
{0x0305, 0x01},
{0x0307, 0x00},
{0x030b, 0x00},
{0x030c, 0x00},
{0x030d, 0x1e},
{0x030e, 0x04},
{0x030f, 0x03},
{0x0312, 0x01},
{0x3000, 0x00},
{0x3002, 0xa1},
{0x3008, 0x00},
{0x3010, 0x00},
{0x3022, 0x51},
{0x3106, 0x15},
{0x3107, 0x01},
{0x3108, 0x05},
{0x3500, 0x00},
{0x3501, 0x45},
{0x3502, 0x00},
{0x3503, 0x08},
{0x3504, 0x03},
{0x3505, 0x8c},
{0x3507, 0x03},
{0x3508, 0x00},
{0x3509, 0x10},
{0x350c, 0x00},
{0x350d, 0x80},
{0x3510, 0x00},
{0x3511, 0x02},
{0x3512, 0x00},
{0x3601, 0x55},
{0x3602, 0x58},
{0x3614, 0x30},
{0x3615, 0x77},
{0x3621, 0x08},
{0x3624, 0x40},
Annotation
- Immediate include surface: `linux/clk.h`, `linux/device.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/module.h`, `linux/pm_runtime.h`, `linux/regulator/consumer.h`.
- Detected declarations: `struct regval`, `struct ov5695_mode`, `struct ov5695`, `function ov5695_write_reg`, `function ov5695_write_array`, `function ov5695_read_reg`, `function ov5695_get_reso_dist`, `function ov5695_find_best_fit`, `function ov5695_set_fmt`, `function ov5695_get_fmt`.
- 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.