drivers/media/i2c/imx111.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/imx111.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/imx111.c- Extension
.c- Size
- 50377 bytes
- Lines
- 1611
- 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/kernel.hlinux/media.hlinux/module.hlinux/pm_runtime.hlinux/regmap.hlinux/regulator/consumer.hlinux/types.hlinux/videodev2.hlinux/units.hmedia/media-entity.hmedia/v4l2-async.hmedia/v4l2-cci.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-fwnode.hmedia/v4l2-subdev.hmedia/v4l2-mediabus.h
Detected Declarations
struct imx111_modestruct imx111_pllstruct imx111function to_settle_delayfunction imx111_get_format_codefunction imx111_get_format_bppfunction imx111_update_digital_gainfunction imx111_set_ctrlfunction imx111_init_controlsfunction imx111_enable_streamsfunction imx111_disable_streamsfunction imx111_initializefunction imx111_enum_mbus_codefunction imx111_enum_frame_sizefunction imx111_set_formatfunction imx111_init_statefunction imx111_init_subdevfunction imx111_power_onfunction imx111_power_offfunction imx111_pm_runtime_resumefunction imx111_pm_runtime_suspendfunction imx111_identify_modulefunction imx111_clk_initfunction imx111_parse_dtfunction imx111_probefunction imx111_remove
Annotated Snippet
struct imx111_mode {
u32 width;
u32 height;
/* Default vertical and horizontal total length */
u32 vtl_def;
u32 htl_def;
struct {
const struct cci_reg_sequence *regs;
u32 num_of_regs;
} reg_list;
};
struct imx111_pll {
u64 extclk_rate;
u8 pre_div;
u8 mult;
};
struct imx111 {
struct regmap *regmap;
struct clk *extclk;
struct gpio_desc *reset;
struct regulator_bulk_data *supplies;
struct v4l2_fwnode_endpoint bus_cfg;
struct v4l2_subdev sd;
struct media_pad pad;
/* V4L2 Controls */
struct v4l2_ctrl_handler hdl;
struct v4l2_ctrl *pixel_rate;
struct v4l2_ctrl *link_freq;
struct v4l2_ctrl *exposure;
struct v4l2_ctrl *vblank;
struct v4l2_ctrl *hblank;
struct v4l2_ctrl *hflip;
struct v4l2_ctrl *vflip;
/* Current mode */
const struct imx111_mode *cur_mode;
const struct imx111_pll *pll;
u32 data_depth;
u64 pixel_clk_raw;
s64 default_link_freq;
};
static const struct imx111_pll imx111_pll[] = {
{ .extclk_rate = 6000000, .pre_div = 1, .mult = 113, },
{ .extclk_rate = 12000000, .pre_div = 2, .mult = 113, },
{ .extclk_rate = 13500000, .pre_div = 1, .mult = 50, },
{ .extclk_rate = 18000000, .pre_div = 2, .mult = 75, },
{ .extclk_rate = 24000000, .pre_div = 4, .mult = 113, },
{ .extclk_rate = 27000000, .pre_div = 2, .mult = 50, },
{ .extclk_rate = 36000000, .pre_div = 4, .mult = 75, },
{ .extclk_rate = 54000000, .pre_div = 4, .mult = 50, },
};
/*
* This table MUST contain 4 entries per format, to cover the various flip
* combinations in the order
* - no flip
* - h flip
* - v flip
* - h&v flips
*/
static const u32 imx111_mbus_formats[] = {
MEDIA_BUS_FMT_SGBRG10_1X10,
MEDIA_BUS_FMT_SBGGR10_1X10,
MEDIA_BUS_FMT_SRGGB10_1X10,
MEDIA_BUS_FMT_SGRBG10_1X10,
MEDIA_BUS_FMT_SGBRG8_1X8,
MEDIA_BUS_FMT_SBGGR8_1X8,
MEDIA_BUS_FMT_SRGGB8_1X8,
MEDIA_BUS_FMT_SGRBG8_1X8,
};
static const struct cci_reg_sequence imx111_global_init[] = {
{ CCI_REG8(0x3080), 0x50 },
{ CCI_REG8(0x3087), 0x53 },
{ CCI_REG8(0x309d), 0x94 },
{ CCI_REG8(0x30b1), 0x03 },
{ CCI_REG8(0x30c6), 0x00 },
{ CCI_REG8(0x30c7), 0x00 },
{ CCI_REG8(0x3115), 0x0b },
{ CCI_REG8(0x3118), 0x30 },
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/kernel.h`, `linux/media.h`, `linux/module.h`, `linux/pm_runtime.h`.
- Detected declarations: `struct imx111_mode`, `struct imx111_pll`, `struct imx111`, `function to_settle_delay`, `function imx111_get_format_code`, `function imx111_get_format_bpp`, `function imx111_update_digital_gain`, `function imx111_set_ctrl`, `function imx111_init_controls`, `function imx111_enable_streams`.
- 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.