drivers/media/i2c/ov2685.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/ov2685.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/ov2685.c- Extension
.c- Size
- 21138 bytes
- Lines
- 891
- 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-fwnode.hmedia/v4l2-subdev.h
Detected Declarations
struct regvalstruct ov2685_modestruct ov2685function ov2685_write_regfunction ov2685_write_arrayfunction ov2685_read_regfunction ov2685_fill_fmtfunction ov2685_set_fmtfunction ov2685_get_fmtfunction ov2685_enum_mbus_codefunction ov2685_enum_frame_sizesfunction __ov2685_get_pad_cropfunction ov2685_get_selectionfunction ov2685_cal_delayfunction __ov2685_power_onfunction __ov2685_power_offfunction ov2685_s_streamfunction ov2685_openfunction ov2685_runtime_resumefunction ov2685_runtime_suspendfunction ov2685_set_ctrlfunction ov2685_initialize_controlsfunction ov2685_check_sensor_idfunction ov2685_configure_regulatorsfunction ov2685_probefunction ov2685_remove
Annotated Snippet
struct regval {
u16 addr;
u8 val;
};
struct ov2685_mode {
u32 width;
u32 height;
u32 exp_def;
u32 hts_def;
u32 vts_def;
const struct v4l2_rect *analog_crop;
const struct regval *reg_list;
};
struct ov2685 {
struct i2c_client *client;
struct clk *xvclk;
struct gpio_desc *reset_gpio;
struct regulator_bulk_data supplies[OV2685_NUM_SUPPLIES];
struct mutex mutex;
struct v4l2_subdev subdev;
struct media_pad pad;
struct v4l2_ctrl *anal_gain;
struct v4l2_ctrl *exposure;
struct v4l2_ctrl *hblank;
struct v4l2_ctrl *vblank;
struct v4l2_ctrl *test_pattern;
struct v4l2_ctrl_handler ctrl_handler;
const struct ov2685_mode *cur_mode;
};
#define to_ov2685(sd) container_of(sd, struct ov2685, subdev)
/* PLL settings bases on 24M xvclk */
static struct regval ov2685_1600x1200_regs[] = {
{0x0103, 0x01},
{0x0100, 0x00},
{0x3002, 0x00},
{0x3016, 0x1c},
{0x3018, 0x44},
{0x301d, 0xf0},
{0x3020, 0x00},
{0x3082, 0x37},
{0x3083, 0x03},
{0x3084, 0x09},
{0x3085, 0x04},
{0x3086, 0x00},
{0x3087, 0x00},
{0x3501, 0x4e},
{0x3502, 0xe0},
{0x3503, 0x27},
{0x350b, 0x36},
{0x3600, 0xb4},
{0x3603, 0x35},
{0x3604, 0x24},
{0x3605, 0x00},
{0x3620, 0x24},
{0x3621, 0x34},
{0x3622, 0x03},
{0x3628, 0x10},
{0x3705, 0x3c},
{0x370a, 0x21},
{0x370c, 0x50},
{0x370d, 0xc0},
{0x3717, 0x58},
{0x3718, 0x80},
{0x3720, 0x00},
{0x3721, 0x09},
{0x3722, 0x06},
{0x3723, 0x59},
{0x3738, 0x99},
{0x3781, 0x80},
{0x3784, 0x0c},
{0x3789, 0x60},
{0x3800, 0x00},
{0x3801, 0x00},
{0x3802, 0x00},
{0x3803, 0x00},
{0x3804, 0x06},
{0x3805, 0x4f},
{0x3806, 0x04},
{0x3807, 0xbf},
{0x3808, 0x06},
{0x3809, 0x40},
{0x380a, 0x04},
{0x380b, 0xb0},
{0x380c, 0x06},
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 ov2685_mode`, `struct ov2685`, `function ov2685_write_reg`, `function ov2685_write_array`, `function ov2685_read_reg`, `function ov2685_fill_fmt`, `function ov2685_set_fmt`, `function ov2685_get_fmt`, `function ov2685_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.