drivers/media/i2c/imx274.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/imx274.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/imx274.c- Extension
.c- Size
- 53085 bytes
- Lines
- 2136
- 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/clk.hlinux/delay.hlinux/gpio/consumer.hlinux/i2c.hlinux/init.hlinux/kernel.hlinux/module.hlinux/pm_runtime.hlinux/regmap.hlinux/regulator/consumer.hlinux/slab.hlinux/v4l2-mediabus.hlinux/videodev2.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-fwnode.hmedia/v4l2-subdev.h
Detected Declarations
struct reg_8struct imx274_modestruct imx274_ctrlsstruct stimx274function msleep_rangefunction imx274_write_tablefunction imx274_write_regfunction imx274_read_mbregfunction imx274_write_mbregfunction imx274_mode_regsfunction imx274_start_streamfunction incorrectfunction imx274_power_onfunction imx274_power_offfunction imx274_regulators_getfunction imx274_s_ctrlfunction imx274_binning_goodnessfunction set_selectionfunction imx274_get_fmtfunction imx274_set_fmtfunction imx274_get_selectionfunction imx274_set_selection_cropfunction imx274_set_selectionfunction imx274_apply_trimmingfunction imx274_get_frame_intervalfunction imx274_set_frame_intervalfunction imx274_load_defaultfunction imx274_s_streamfunction imx274_get_frame_lengthfunction imx274_clamp_coarse_timefunction imx274_set_digital_gainfunction imx274_set_gainfunction imx274_set_coarse_timefunction imx274_set_exposurefunction imx274_set_vflipfunction imx274_set_test_patternfunction imx274_set_frame_lengthfunction __imx274_set_frame_intervalfunction imx274_enum_mbus_codefunction imx274_fwnode_parsefunction imx274_probefunction imx274_remove
Annotated Snippet
struct reg_8 {
u16 addr;
u8 val;
};
static const struct regmap_config imx274_regmap_config = {
.reg_bits = 16,
.val_bits = 8,
.cache_type = REGCACHE_MAPLE,
};
/*
* Parameters for each imx274 readout mode.
*
* These are the values to configure the sensor in one of the
* implemented modes.
*
* @init_regs: registers to initialize the mode
* @wbin_ratio: width downscale factor (e.g. 3 for 1280; 3 = 3840/1280)
* @hbin_ratio: height downscale factor (e.g. 3 for 720; 3 = 2160/720)
* @min_frame_len: Minimum frame length for each mode (see "Frame Rate
* Adjustment (CSI-2)" in the datasheet)
* @min_SHR: Minimum SHR register value (see "Shutter Setting (CSI-2)" in the
* datasheet)
* @max_fps: Maximum frames per second
* @nocpiop: Number of clocks per internal offset period (see "Integration Time
* in Each Readout Drive Mode (CSI-2)" in the datasheet)
*/
struct imx274_mode {
const struct reg_8 *init_regs;
u8 wbin_ratio;
u8 hbin_ratio;
int min_frame_len;
int min_SHR;
int max_fps;
int nocpiop;
};
/*
* imx274 test pattern related enum
*/
enum {
TEST_PATTERN_DISABLED = 0,
TEST_PATTERN_ALL_000H,
TEST_PATTERN_ALL_FFFH,
TEST_PATTERN_ALL_555H,
TEST_PATTERN_ALL_AAAH,
TEST_PATTERN_VSP_5AH, /* VERTICAL STRIPE PATTERN 555H/AAAH */
TEST_PATTERN_VSP_A5H, /* VERTICAL STRIPE PATTERN AAAH/555H */
TEST_PATTERN_VSP_05H, /* VERTICAL STRIPE PATTERN 000H/555H */
TEST_PATTERN_VSP_50H, /* VERTICAL STRIPE PATTERN 555H/000H */
TEST_PATTERN_VSP_0FH, /* VERTICAL STRIPE PATTERN 000H/FFFH */
TEST_PATTERN_VSP_F0H, /* VERTICAL STRIPE PATTERN FFFH/000H */
TEST_PATTERN_H_COLOR_BARS,
TEST_PATTERN_V_COLOR_BARS,
};
static const char * const tp_qmenu[] = {
"Disabled",
"All 000h Pattern",
"All FFFh Pattern",
"All 555h Pattern",
"All AAAh Pattern",
"Vertical Stripe (555h / AAAh)",
"Vertical Stripe (AAAh / 555h)",
"Vertical Stripe (000h / 555h)",
"Vertical Stripe (555h / 000h)",
"Vertical Stripe (000h / FFFh)",
"Vertical Stripe (FFFh / 000h)",
"Vertical Color Bars",
"Horizontal Color Bars",
};
/*
* All-pixel scan mode (10-bit)
* imx274 mode1(refer to datasheet) register configuration with
* 3840x2160 resolution, raw10 data and mipi four lane output
*/
static const struct reg_8 imx274_mode1_3840x2160_raw10[] = {
{0x3004, 0x01},
{0x3005, 0x01},
{0x3006, 0x00},
{0x3007, 0xa2},
{0x3018, 0xA2}, /* output XVS, HVS */
{0x306B, 0x05},
{0x30E2, 0x01},
{0x30EE, 0x01},
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/init.h`, `linux/kernel.h`, `linux/module.h`, `linux/pm_runtime.h`.
- Detected declarations: `struct reg_8`, `struct imx274_mode`, `struct imx274_ctrls`, `struct stimx274`, `function msleep_range`, `function imx274_write_table`, `function imx274_write_reg`, `function imx274_read_mbreg`, `function imx274_write_mbreg`, `function imx274_mode_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.