drivers/media/i2c/ov5647.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/ov5647.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/ov5647.c- Extension
.c- Size
- 33125 bytes
- Lines
- 1310
- 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/clk.hlinux/delay.hlinux/gpio/consumer.hlinux/i2c.hlinux/init.hlinux/io.hlinux/module.hlinux/of_graph.hlinux/pm_runtime.hlinux/regmap.hlinux/regulator/consumer.hlinux/slab.hlinux/videodev2.hmedia/v4l2-cci.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-event.hmedia/v4l2-fwnode.hmedia/v4l2-image-sizes.hmedia/v4l2-mediabus.h
Detected Declarations
struct ov5647_modestruct ov5647function ov5647_set_virtual_channelfunction ov5647_set_modefunction ov5647_stream_stopfunction ov5647_enable_streamsfunction ov5647_disable_streamsfunction ov5647_power_onfunction ov5647_power_offfunction ov5647_sensor_get_registerfunction ov5647_sensor_set_registerfunction __ov5647_get_pad_cropfunction ov5647_get_mbus_codefunction ov5647_enum_mbus_codefunction ov5647_enum_frame_sizefunction ov5647_get_pad_fmtfunction ov5647_set_pad_fmtfunction ov5647_get_selectionfunction ov5647_detectfunction ov5647_openfunction ov5647_s_ctrlfunction ov5647_configure_regulatorsfunction ov5647_init_controlsfunction ov5647_parse_dtfunction ov5647_probefunction ov5647_remove
Annotated Snippet
struct ov5647_mode {
struct v4l2_mbus_framefmt format;
struct v4l2_rect crop;
u64 pixel_rate;
unsigned int link_freq_index;
int hts;
int vts;
const struct reg_sequence *reg_list;
unsigned int num_regs;
};
struct ov5647 {
struct v4l2_subdev sd;
struct regmap *regmap;
struct media_pad pad;
struct clk *xclk;
struct gpio_desc *pwdn;
struct regulator_bulk_data supplies[OV5647_NUM_SUPPLIES];
bool clock_ncont;
struct v4l2_ctrl_handler ctrls;
const struct ov5647_mode *mode;
struct v4l2_ctrl *pixel_rate;
struct v4l2_ctrl *hblank;
struct v4l2_ctrl *vblank;
struct v4l2_ctrl *exposure;
struct v4l2_ctrl *hflip;
struct v4l2_ctrl *vflip;
struct v4l2_ctrl *link_freq;
};
static inline struct ov5647 *to_sensor(struct v4l2_subdev *sd)
{
return container_of(sd, struct ov5647, sd);
}
static const char * const ov5647_test_pattern_menu[] = {
"Disabled",
"Color Bars",
"Color Squares",
"Random Data",
};
static const u8 ov5647_test_pattern_val[] = {
0x00, /* Disabled */
0x80, /* Color Bars */
0x82, /* Color Squares */
0x81, /* Random Data */
};
static const struct reg_sequence sensor_oe_disable_regs[] = {
{0x3000, 0x00},
{0x3001, 0x00},
{0x3002, 0x00},
};
static const struct reg_sequence sensor_oe_enable_regs[] = {
{0x3000, 0x0f},
{0x3001, 0xff},
{0x3002, 0xe4},
};
static const struct reg_sequence ov5647_common_regs[] = {
{0x0100, 0x00},
{0x0103, 0x01},
{0x3034, 0x1a},
{0x3035, 0x21},
{0x303c, 0x11},
{0x3106, 0xf5},
{0x3827, 0xec},
{0x370c, 0x03},
{0x5000, 0x06},
{0x5003, 0x08},
{0x5a00, 0x08},
{0x3000, 0x00},
{0x3001, 0x00},
{0x3002, 0x00},
{0x3016, 0x08},
{0x3017, 0xe0},
{0x3018, 0x44},
{0x301c, 0xf8},
{0x301d, 0xf0},
{0x3a18, 0x00},
{0x3a19, 0xf8},
{0x3c01, 0x80},
{0x3b07, 0x0c},
{0x3630, 0x2e},
{0x3632, 0xe2},
{0x3633, 0x23},
{0x3634, 0x44},
{0x3636, 0x06},
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/init.h`, `linux/io.h`, `linux/module.h`, `linux/of_graph.h`.
- Detected declarations: `struct ov5647_mode`, `struct ov5647`, `function ov5647_set_virtual_channel`, `function ov5647_set_mode`, `function ov5647_stream_stop`, `function ov5647_enable_streams`, `function ov5647_disable_streams`, `function ov5647_power_on`, `function ov5647_power_off`, `function ov5647_sensor_get_register`.
- 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.