drivers/media/i2c/imx208.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/imx208.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/imx208.c- Extension
.c- Size
- 26368 bytes
- Lines
- 1070
- 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/acpi.hlinux/clk.hlinux/delay.hlinux/i2c.hlinux/module.hlinux/pm_runtime.hlinux/unaligned.hmedia/v4l2-ctrls.hmedia/v4l2-device.h
Detected Declarations
struct imx208_regstruct imx208_reg_liststruct imx208_link_freq_configstruct imx208_modestruct imx208function link_freq_to_pixel_ratefunction imx208_get_format_codefunction imx208_read_regfunction imx208_write_regfunction imx208_write_regsfunction imx208_openfunction imx208_update_digital_gainfunction imx208_set_ctrlfunction imx208_enum_mbus_codefunction imx208_enum_frame_sizefunction imx208_mode_to_pad_formatfunction __imx208_get_pad_formatfunction imx208_get_pad_formatfunction imx208_set_pad_formatfunction imx208_identify_modulefunction imx208_start_streamingfunction imx208_stop_streamingfunction imx208_set_streamfunction imx208_read_otpfunction otp_readfunction imx208_init_controlsfunction imx208_free_controlsfunction imx208_probefunction imx208_remove
Annotated Snippet
struct imx208_reg {
u16 address;
u8 val;
};
struct imx208_reg_list {
u32 num_of_regs;
const struct imx208_reg *regs;
};
/* Link frequency config */
struct imx208_link_freq_config {
u32 pixels_per_line;
/* PLL registers for this link frequency */
struct imx208_reg_list reg_list;
};
/* Mode : resolution and related config&values */
struct imx208_mode {
/* Frame width */
u32 width;
/* Frame height */
u32 height;
/* V-timing */
u32 vts_def;
u32 vts_min;
/* Index of Link frequency config to be used */
u32 link_freq_index;
/* Default register values */
struct imx208_reg_list reg_list;
};
static const struct imx208_reg pll_ctrl_reg[] = {
{0x0305, 0x02},
{0x0307, 0x50},
{0x303C, 0x3C},
};
static const struct imx208_reg mode_1936x1096_60fps_regs[] = {
{0x0340, 0x04},
{0x0341, 0x72},
{0x0342, 0x04},
{0x0343, 0x64},
{0x034C, 0x07},
{0x034D, 0x90},
{0x034E, 0x04},
{0x034F, 0x48},
{0x0381, 0x01},
{0x0383, 0x01},
{0x0385, 0x01},
{0x0387, 0x01},
{0x3048, 0x00},
{0x3050, 0x01},
{0x30D5, 0x00},
{0x3301, 0x00},
{0x3318, 0x62},
{0x0202, 0x01},
{0x0203, 0x90},
{0x0205, 0x00},
};
static const struct imx208_reg mode_968_548_60fps_regs[] = {
{0x0340, 0x02},
{0x0341, 0x39},
{0x0342, 0x08},
{0x0343, 0xC8},
{0x034C, 0x03},
{0x034D, 0xC8},
{0x034E, 0x02},
{0x034F, 0x24},
{0x0381, 0x01},
{0x0383, 0x03},
{0x0385, 0x01},
{0x0387, 0x03},
{0x3048, 0x01},
{0x3050, 0x02},
{0x30D5, 0x03},
{0x3301, 0x10},
{0x3318, 0x75},
{0x0202, 0x01},
{0x0203, 0x90},
{0x0205, 0x00},
};
static const s64 imx208_discrete_digital_gain[] = {
1, 2, 4, 8, 16,
};
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/clk.h`, `linux/delay.h`, `linux/i2c.h`, `linux/module.h`, `linux/pm_runtime.h`, `linux/unaligned.h`, `media/v4l2-ctrls.h`.
- Detected declarations: `struct imx208_reg`, `struct imx208_reg_list`, `struct imx208_link_freq_config`, `struct imx208_mode`, `struct imx208`, `function link_freq_to_pixel_rate`, `function imx208_get_format_code`, `function imx208_read_reg`, `function imx208_write_reg`, `function imx208_write_regs`.
- 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.