drivers/media/i2c/ov5645.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/ov5645.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/ov5645.c- Extension
.c- Size
- 29353 bytes
- Lines
- 1253
- 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/bitops.hlinux/clk.hlinux/delay.hlinux/device.hlinux/gpio/consumer.hlinux/i2c.hlinux/init.hlinux/module.hlinux/of.hlinux/of_graph.hlinux/pm_runtime.hlinux/regulator/consumer.hlinux/slab.hlinux/types.hmedia/v4l2-ctrls.hmedia/v4l2-fwnode.hmedia/v4l2-subdev.h
Detected Declarations
struct reg_valuestruct ov5645_mode_infostruct ov5645function ov5645_write_regfunction ov5645_read_regfunction ov5645_set_aec_modefunction ov5645_set_agc_modefunction ov5645_set_register_arrayfunction __ov5645_set_power_offfunction ov5645_set_power_offfunction ov5645_set_power_onfunction ov5645_set_saturationfunction ov5645_set_hflipfunction ov5645_set_vflipfunction ov5645_set_test_patternfunction ov5645_set_awbfunction ov5645_s_ctrlfunction ov5645_enum_mbus_codefunction ov5645_enum_frame_sizefunction ov5645_set_formatfunction ov5645_init_statefunction ov5645_get_selectionfunction ov5645_enable_streamsfunction ov5645_disable_streamsfunction ov5645_probefunction ov5645_remove
Annotated Snippet
struct reg_value {
u16 reg;
u8 val;
};
struct ov5645_mode_info {
u32 width;
u32 height;
const struct reg_value *data;
u32 data_size;
u32 pixel_clock;
u32 link_freq;
};
struct ov5645 {
struct i2c_client *i2c_client;
struct device *dev;
struct v4l2_subdev sd;
struct media_pad pad;
struct v4l2_fwnode_endpoint ep;
struct v4l2_rect crop;
struct clk *xclk;
struct regulator_bulk_data supplies[OV5645_NUM_SUPPLIES];
const struct ov5645_mode_info *current_mode;
struct v4l2_ctrl_handler ctrls;
struct v4l2_ctrl *pixel_clock;
struct v4l2_ctrl *link_freq;
/* Cached register values */
u8 aec_pk_manual;
u8 timing_tc_reg20;
u8 timing_tc_reg21;
struct gpio_desc *enable_gpio;
struct gpio_desc *rst_gpio;
};
static inline struct ov5645 *to_ov5645(struct v4l2_subdev *sd)
{
return container_of(sd, struct ov5645, sd);
}
static const struct reg_value ov5645_global_init_setting[] = {
{ 0x3103, 0x11 },
{ 0x3008, 0x42 },
{ 0x3103, 0x03 },
{ 0x3503, 0x07 },
{ 0x3002, 0x1c },
{ 0x3006, 0xc3 },
{ 0x3017, 0x00 },
{ 0x3018, 0x00 },
{ 0x302e, 0x0b },
{ 0x3037, 0x13 },
{ 0x3108, 0x01 },
{ 0x3611, 0x06 },
{ 0x3500, 0x00 },
{ 0x3501, 0x01 },
{ 0x3502, 0x00 },
{ 0x350a, 0x00 },
{ 0x350b, 0x3f },
{ 0x3620, 0x33 },
{ 0x3621, 0xe0 },
{ 0x3622, 0x01 },
{ 0x3630, 0x2e },
{ 0x3631, 0x00 },
{ 0x3632, 0x32 },
{ 0x3633, 0x52 },
{ 0x3634, 0x70 },
{ 0x3635, 0x13 },
{ 0x3636, 0x03 },
{ 0x3703, 0x5a },
{ 0x3704, 0xa0 },
{ 0x3705, 0x1a },
{ 0x3709, 0x12 },
{ 0x370b, 0x61 },
{ 0x370f, 0x10 },
{ 0x3715, 0x78 },
{ 0x3717, 0x01 },
{ 0x371b, 0x20 },
{ 0x3731, 0x12 },
{ 0x3901, 0x0a },
{ 0x3905, 0x02 },
{ 0x3906, 0x10 },
{ 0x3719, 0x86 },
{ 0x3810, 0x00 },
{ 0x3811, 0x10 },
{ 0x3812, 0x00 },
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/clk.h`, `linux/delay.h`, `linux/device.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/init.h`, `linux/module.h`.
- Detected declarations: `struct reg_value`, `struct ov5645_mode_info`, `struct ov5645`, `function ov5645_write_reg`, `function ov5645_read_reg`, `function ov5645_set_aec_mode`, `function ov5645_set_agc_mode`, `function ov5645_set_register_array`, `function __ov5645_set_power_off`, `function ov5645_set_power_off`.
- 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.