drivers/media/i2c/imx219.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/imx219.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/imx219.c- Extension
.c- Size
- 38058 bytes
- Lines
- 1347
- 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/minmax.hlinux/module.hlinux/pm_runtime.hlinux/regulator/consumer.hmedia/v4l2-cci.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-fwnode.hmedia/v4l2-mediabus.h
Detected Declarations
struct imx219_modestruct imx219function imx219_get_format_codefunction imx219_get_format_bppfunction imx219_get_binningfunction imx219_get_rate_factorfunction imx219_set_ctrlfunction imx219_get_pixel_ratefunction imx219_init_controlsfunction imx219_free_controlsfunction imx219_set_framefmtfunction imx219_configure_lanesfunction imx219_enable_streamsfunction imx219_disable_streamsfunction imx219_enum_mbus_codefunction imx219_enum_frame_sizefunction imx219_set_pad_formatfunction imx219_get_selectionfunction imx219_init_statefunction imx219_power_onfunction imx219_power_offfunction imx219_get_regulatorsfunction imx219_identify_modulefunction imx219_check_hwcfgfunction imx219_probefunction imx219_remove
Annotated Snippet
struct imx219_mode {
/* Frame width */
unsigned int width;
/* Frame height */
unsigned int height;
/* V-timing */
unsigned int fll_def;
};
static const struct cci_reg_sequence imx219_common_regs[] = {
{ IMX219_REG_MODE_SELECT, 0x00 }, /* Mode Select */
/* To Access Addresses 3000-5fff, send the following commands */
{ CCI_REG8(0x30eb), 0x05 },
{ CCI_REG8(0x30eb), 0x0c },
{ CCI_REG8(0x300a), 0xff },
{ CCI_REG8(0x300b), 0xff },
{ CCI_REG8(0x30eb), 0x05 },
{ CCI_REG8(0x30eb), 0x09 },
/* Undocumented registers */
{ CCI_REG8(0x455e), 0x00 },
{ CCI_REG8(0x471e), 0x4b },
{ CCI_REG8(0x4767), 0x0f },
{ CCI_REG8(0x4750), 0x14 },
{ CCI_REG8(0x4540), 0x00 },
{ CCI_REG8(0x47b4), 0x14 },
{ CCI_REG8(0x4713), 0x30 },
{ CCI_REG8(0x478b), 0x10 },
{ CCI_REG8(0x478f), 0x10 },
{ CCI_REG8(0x4793), 0x10 },
{ CCI_REG8(0x4797), 0x0e },
{ CCI_REG8(0x479b), 0x0e },
/* Frame Bank Register Group "A" */
{ IMX219_REG_X_ODD_INC_A, 1 },
{ IMX219_REG_Y_ODD_INC_A, 1 },
/* Output setup registers */
{ IMX219_REG_DPHY_CTRL, IMX219_DPHY_CTRL_TIMING_AUTO },
{ IMX219_REG_EXCK_FREQ, IMX219_EXCK_FREQ(IMX219_XCLK_FREQ / 1000000) },
};
static const struct cci_reg_sequence imx219_2lane_regs[] = {
/* PLL Clock Table */
{ IMX219_REG_VTPXCK_DIV, 5 },
{ IMX219_REG_VTSYCK_DIV, 1 },
{ IMX219_REG_PREPLLCK_VT_DIV, 3 }, /* 0x03 = AUTO set */
{ IMX219_REG_PREPLLCK_OP_DIV, 3 }, /* 0x03 = AUTO set */
{ IMX219_REG_PLL_VT_MPY, 57 },
{ IMX219_REG_OPSYCK_DIV, 1 },
{ IMX219_REG_PLL_OP_MPY, 114 },
/* 2-Lane CSI Mode */
{ IMX219_REG_CSI_LANE_MODE, IMX219_CSI_2_LANE_MODE },
};
static const struct cci_reg_sequence imx219_4lane_regs[] = {
/* PLL Clock Table */
{ IMX219_REG_VTPXCK_DIV, 5 },
{ IMX219_REG_VTSYCK_DIV, 1 },
{ IMX219_REG_PREPLLCK_VT_DIV, 3 }, /* 0x03 = AUTO set */
{ IMX219_REG_PREPLLCK_OP_DIV, 3 }, /* 0x03 = AUTO set */
{ IMX219_REG_PLL_VT_MPY, 88 },
{ IMX219_REG_OPSYCK_DIV, 1 },
{ IMX219_REG_PLL_OP_MPY, 91 },
/* 4-Lane CSI Mode */
{ IMX219_REG_CSI_LANE_MODE, IMX219_CSI_4_LANE_MODE },
};
static const s64 imx219_link_freq_menu[] = {
IMX219_DEFAULT_LINK_FREQ,
};
static const s64 imx219_link_freq_4lane_menu[] = {
IMX219_DEFAULT_LINK_FREQ_4LANE,
/*
* This will never be advertised to userspace, but will be used for
* v4l2_link_freq_to_bitmap
*/
IMX219_DEFAULT_LINK_FREQ_4LANE_UNSUPPORTED,
};
static const char * const imx219_test_pattern_menu[] = {
"Disabled",
"Color Bars",
"Solid Color",
"Grey Color Bars",
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/minmax.h`, `linux/module.h`, `linux/pm_runtime.h`, `linux/regulator/consumer.h`.
- Detected declarations: `struct imx219_mode`, `struct imx219`, `function imx219_get_format_code`, `function imx219_get_format_bpp`, `function imx219_get_binning`, `function imx219_get_rate_factor`, `function imx219_set_ctrl`, `function imx219_get_pixel_rate`, `function imx219_init_controls`, `function imx219_free_controls`.
- 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.