drivers/media/i2c/ov7740.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/ov7740.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/ov7740.c- Extension
.c- Size
- 27361 bytes
- Lines
- 1182
- 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/gpio/consumer.hlinux/i2c.hlinux/module.hlinux/pm_runtime.hlinux/regmap.hmedia/v4l2-ctrls.hmedia/v4l2-event.hmedia/v4l2-image-sizes.hmedia/v4l2-subdev.h
Detected Declarations
struct ov7740struct ov7740_pixfmtstruct ov7740_framesizefunction ov7740_get_registerfunction ov7740_set_registerfunction ov7740_set_powerfunction ov7740_set_white_balancefunction ov7740_set_saturationfunction ov7740_set_gainfunction ov7740_set_autogainfunction ov7740_set_brightnessfunction ov7740_set_contrastfunction ov7740_get_gainfunction ov7740_get_expfunction ov7740_set_expfunction ov7740_set_autoexpfunction ov7740_get_volatile_ctrlfunction ov7740_set_ctrlfunction ov7740_start_streamingfunction ov7740_set_streamfunction ov7740_enum_mbus_codefunction ov7740_enum_frame_intervalfunction ov7740_enum_frame_sizefunction ov7740_try_fmt_internalfunction ov7740_set_fmtfunction ov7740_get_fmtfunction ov7740_get_frame_intervalfunction ov7740_get_default_formatfunction ov7740_openfunction ov7740_probe_dtfunction ov7740_detectfunction ov7740_init_controlsfunction ov7740_free_controlsfunction ov7740_probefunction ov7740_removefunction ov7740_runtime_suspendfunction ov7740_runtime_resume
Annotated Snippet
struct ov7740 {
struct v4l2_subdev subdev;
struct media_pad pad;
struct v4l2_mbus_framefmt format;
const struct ov7740_pixfmt *fmt; /* Current format */
const struct ov7740_framesize *frmsize;
struct regmap *regmap;
struct clk *xvclk;
struct v4l2_ctrl_handler ctrl_handler;
struct {
/* gain cluster */
struct v4l2_ctrl *auto_gain;
struct v4l2_ctrl *gain;
};
struct {
struct v4l2_ctrl *auto_wb;
struct v4l2_ctrl *blue_balance;
struct v4l2_ctrl *red_balance;
};
struct {
struct v4l2_ctrl *hflip;
struct v4l2_ctrl *vflip;
};
struct {
/* exposure cluster */
struct v4l2_ctrl *auto_exposure;
struct v4l2_ctrl *exposure;
};
struct {
/* saturation/hue cluster */
struct v4l2_ctrl *saturation;
struct v4l2_ctrl *hue;
};
struct v4l2_ctrl *brightness;
struct v4l2_ctrl *contrast;
struct mutex mutex; /* To serialize asynchronous callbacks */
struct gpio_desc *resetb_gpio;
struct gpio_desc *pwdn_gpio;
};
struct ov7740_pixfmt {
u32 mbus_code;
enum v4l2_colorspace colorspace;
const struct reg_sequence *regs;
u32 reg_num;
};
struct ov7740_framesize {
u16 width;
u16 height;
const struct reg_sequence *regs;
u32 reg_num;
};
static const struct reg_sequence ov7740_vga[] = {
{0x55, 0x40},
{0x11, 0x02},
{0xd5, 0x10},
{0x0c, 0x12},
{0x0d, 0x34},
{0x17, 0x25},
{0x18, 0xa0},
{0x19, 0x03},
{0x1a, 0xf0},
{0x1b, 0x89},
{0x22, 0x03},
{0x29, 0x18},
{0x2b, 0xf8},
{0x2c, 0x01},
{REG_HOUTSIZE, 0xa0},
{REG_VOUTSIZE, 0xf0},
{0x33, 0xc4},
{REG_OUTSIZE_LSB, 0x0},
{0x35, 0x05},
{0x04, 0x60},
{0x27, 0x80},
{0x3d, 0x0f},
{0x3e, 0x80},
{0x3f, 0x40},
{0x40, 0x7f},
{0x41, 0x6a},
{0x42, 0x29},
{0x44, 0x22},
{0x45, 0x41},
{0x47, 0x02},
{0x49, 0x64},
{0x4a, 0xa1},
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/module.h`, `linux/pm_runtime.h`, `linux/regmap.h`, `media/v4l2-ctrls.h`.
- Detected declarations: `struct ov7740`, `struct ov7740_pixfmt`, `struct ov7740_framesize`, `function ov7740_get_register`, `function ov7740_set_register`, `function ov7740_set_power`, `function ov7740_set_white_balance`, `function ov7740_set_saturation`, `function ov7740_set_gain`, `function ov7740_set_autogain`.
- 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.