drivers/media/i2c/imx290.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/imx290.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/imx290.c- Extension
.c- Size
- 47186 bytes
- Lines
- 1729
- 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/module.hlinux/of.hlinux/pm_runtime.hlinux/regmap.hlinux/regulator/consumer.hlinux/unaligned.hmedia/media-entity.hmedia/v4l2-cci.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-fwnode.hmedia/v4l2-subdev.h
Detected Declarations
struct imx290_model_infostruct imx290_clk_cfgstruct imx290_modestruct imx290_csi_cfgstruct imx290struct imx290_format_infoenum imx290_colour_variantenum imx290_modelenum imx290_clk_freqfunction imx290_probefunction imx290_link_freqs_numfunction imx290_modes_numfunction imx290_format_infofunction imx290_set_register_arrayfunction imx290_set_clockfunction imx290_set_data_lanesfunction imx290_set_black_levelfunction imx290_set_csi_configfunction imx290_setup_formatfunction imx290_exposure_updatefunction imx290_set_ctrlfunction imx290_ctrl_updatefunction imx290_ctrl_initfunction imx290_start_streamingfunction imx290_stop_streamingfunction imx290_set_streamfunction imx290_enum_mbus_codefunction imx290_enum_frame_sizefunction imx290_set_fmtfunction imx290_get_selectionfunction imx290_entity_init_statefunction imx290_subdev_initfunction imx290_subdev_cleanupfunction imx290_power_onfunction imx290_power_offfunction imx290_runtime_resumefunction imx290_runtime_suspendfunction imx290_get_regulatorsfunction imx290_init_clkfunction imx290_check_link_freqsfunction imx290_parse_dtfunction imx290_probefunction imx290_remove
Annotated Snippet
struct imx290_model_info {
enum imx290_colour_variant colour_variant;
const struct cci_reg_sequence *init_regs;
size_t init_regs_num;
unsigned int max_analog_gain;
const char *name;
};
enum imx290_clk_freq {
IMX290_CLK_37_125,
IMX290_CLK_74_25,
IMX290_NUM_CLK
};
/*
* Clock configuration for registers INCKSEL1 to INCKSEL6.
*/
struct imx290_clk_cfg {
u8 incksel1;
u8 incksel2;
u8 incksel3;
u8 incksel4;
u8 incksel5;
u8 incksel6;
};
struct imx290_mode {
u32 width;
u32 height;
u32 hmax_min;
u32 vmax_min;
u8 link_freq_index;
u8 ctrl_07;
const struct cci_reg_sequence *data;
u32 data_size;
const struct imx290_clk_cfg *clk_cfg;
};
struct imx290_csi_cfg {
u16 repetition;
u16 tclkpost;
u16 thszero;
u16 thsprepare;
u16 tclktrail;
u16 thstrail;
u16 tclkzero;
u16 tclkprepare;
u16 tlpx;
};
struct imx290 {
struct device *dev;
struct clk *xclk;
struct regmap *regmap;
enum imx290_clk_freq xclk_idx;
u8 nlanes;
const struct imx290_model_info *model;
struct v4l2_subdev sd;
struct media_pad pad;
const struct imx290_mode *current_mode;
struct regulator_bulk_data supplies[IMX290_NUM_SUPPLIES];
struct gpio_desc *rst_gpio;
struct v4l2_ctrl_handler ctrls;
struct v4l2_ctrl *link_freq;
struct v4l2_ctrl *hblank;
struct v4l2_ctrl *vblank;
struct v4l2_ctrl *exposure;
struct {
struct v4l2_ctrl *hflip;
struct v4l2_ctrl *vflip;
};
};
static inline struct imx290 *to_imx290(struct v4l2_subdev *_sd)
{
return container_of(_sd, struct imx290, sd);
}
/* -----------------------------------------------------------------------------
* Modes and formats
*/
static const struct cci_reg_sequence imx290_global_init_settings[] = {
{ IMX290_WINWV_OB, 12 },
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/module.h`, `linux/of.h`, `linux/pm_runtime.h`, `linux/regmap.h`.
- Detected declarations: `struct imx290_model_info`, `struct imx290_clk_cfg`, `struct imx290_mode`, `struct imx290_csi_cfg`, `struct imx290`, `struct imx290_format_info`, `enum imx290_colour_variant`, `enum imx290_model`, `enum imx290_clk_freq`, `function imx290_probe`.
- 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.