drivers/media/i2c/ov2740.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/ov2740.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/ov2740.c- Extension
.c- Size
- 34962 bytes
- Lines
- 1487
- 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/acpi.hlinux/clk.hlinux/delay.hlinux/gpio/consumer.hlinux/i2c.hlinux/module.hlinux/nvmem-provider.hlinux/pm_runtime.hlinux/regmap.hlinux/regulator/consumer.hlinux/unaligned.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-fwnode.h
Detected Declarations
struct nvm_datastruct ov2740_regstruct ov2740_reg_liststruct ov2740_link_freq_configstruct ov2740_modestruct ov2740function to_pixel_ratefunction ov2740_read_regfunction ov2740_write_regfunction ov2740_write_reg_listfunction ov2740_identify_modulefunction ov2740_update_digital_gainfunction ov2740_test_patternfunction ov2740_set_ctrlfunction ov2740_init_controlsfunction ov2740_update_pad_formatfunction ov2740_load_otp_datafunction ov2740_start_streamingfunction ov2740_stop_streamingfunction ov2740_set_streamfunction ov2740_set_formatfunction ov2740_enum_mbus_codefunction ov2740_enum_frame_sizefunction ov2740_init_statefunction ov2740_check_hwcfgfunction ov2740_removefunction ov2740_nvmem_readfunction ov2740_register_nvmemfunction ov2740_suspendfunction ov2740_resumefunction ov2740_probe
Annotated Snippet
struct nvm_data {
struct nvmem_device *nvmem;
struct regmap *regmap;
char *nvm_buffer;
};
enum {
OV2740_LINK_FREQ_360MHZ_INDEX,
OV2740_LINK_FREQ_180MHZ_INDEX,
};
struct ov2740_reg {
u16 address;
u8 val;
};
struct ov2740_reg_list {
u32 num_of_regs;
const struct ov2740_reg *regs;
};
struct ov2740_link_freq_config {
const struct ov2740_reg_list reg_list;
};
struct ov2740_mode {
/* Frame width in pixels */
u32 width;
/* Frame height in pixels */
u32 height;
/* Horizontal timining size */
u32 hts;
/* Default vertical timining size */
u32 vts_def;
/* Min vertical timining size */
u32 vts_min;
/* Max vertical timining size */
u32 vts_max;
/* Link frequency needed for this resolution */
u32 link_freq_index;
/* Sensor register settings for this resolution */
const struct ov2740_reg_list reg_list;
};
static const struct ov2740_reg mipi_data_rate_720mbps[] = {
{0x0302, 0x4b},
{0x030d, 0x4b},
{0x030e, 0x02},
{0x030a, 0x01},
{0x0312, 0x11},
};
static const struct ov2740_reg mipi_data_rate_360mbps[] = {
{0x0302, 0x4b},
{0x0303, 0x01},
{0x030d, 0x4b},
{0x030e, 0x02},
{0x030a, 0x01},
{0x0312, 0x11},
{0x4837, 0x2c},
};
static const struct ov2740_reg mode_1932x1092_regs_360mhz[] = {
{0x3000, 0x00},
{0x3018, 0x32},
{0x3031, 0x0a},
{0x3080, 0x08},
{0x3083, 0xB4},
{0x3103, 0x00},
{0x3104, 0x01},
{0x3106, 0x01},
{0x3500, 0x00},
{0x3501, 0x44},
{0x3502, 0x40},
{0x3503, 0x88},
{0x3507, 0x00},
{0x3508, 0x00},
{0x3509, 0x80},
{0x350c, 0x00},
{0x350d, 0x80},
{0x3510, 0x00},
{0x3511, 0x00},
{0x3512, 0x20},
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/clk.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/module.h`, `linux/nvmem-provider.h`, `linux/pm_runtime.h`.
- Detected declarations: `struct nvm_data`, `struct ov2740_reg`, `struct ov2740_reg_list`, `struct ov2740_link_freq_config`, `struct ov2740_mode`, `struct ov2740`, `function to_pixel_rate`, `function ov2740_read_reg`, `function ov2740_write_reg`, `function ov2740_write_reg_list`.
- 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.