drivers/media/i2c/imx283.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/imx283.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/imx283.c- Extension
.c- Size
- 43301 bytes
- Lines
- 1638
- 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/array_size.hlinux/bitops.hlinux/container_of.hlinux/clk.hlinux/delay.hlinux/err.hlinux/gpio/consumer.hlinux/i2c.hlinux/minmax.hlinux/module.hlinux/mutex.hlinux/pm_runtime.hlinux/property.hlinux/regulator/consumer.hlinux/types.hlinux/units.hmedia/v4l2-cci.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-fwnode.hmedia/v4l2-mediabus.h
Detected Declarations
struct imx283_reg_liststruct imx283_modestruct imx283_input_frequencystruct imx283_readout_modestruct imx283enum imx283_modesfunction get_mode_tablefunction imx283_pixel_ratefunction imx283_internal_clockfunction imx283_iclk_to_pixfunction imx283_exposurefunction imx283_exposure_limitsfunction imx283_shrfunction imx283_update_test_patternfunction imx283_set_ctrlfunction BITfunction imx283_enum_mbus_codefunction imx283_enum_frame_sizefunction imx283_update_image_pad_formatfunction imx283_init_statefunction imx283_set_framing_limitsfunction imx283_set_pad_formatfunction imx283_standby_cancelfunction imx283_start_streamingfunction imx283_enable_streamsfunction imx283_disable_streamsfunction imx283_power_onfunction imx283_power_offfunction imx283_get_regulatorsfunction imx283_identify_modulefunction imx283_get_selectionfunction imx283_init_controlsfunction imx283_parse_endpointfunction imx283_probefunction imx283_remove
Annotated Snippet
struct imx283_reg_list {
unsigned int num_of_regs;
const struct cci_reg_sequence *regs;
};
/* Mode : resolution and related config values */
struct imx283_mode {
unsigned int mode;
/* Bits per pixel */
unsigned int bpp;
/* Frame width */
unsigned int width;
/* Frame height */
unsigned int height;
/*
* Minimum horizontal timing in pixel-units
*
* Note that HMAX is written in 72MHz units, and the datasheet assumes a
* 720MHz link frequency. Convert datasheet values with the following:
*
* For 12 bpp modes (480Mbps) convert with:
* hmax = [hmax in 72MHz units] * 480 / 72
*
* For 10 bpp modes (576Mbps) convert with:
* hmax = [hmax in 72MHz units] * 576 / 72
*/
u32 min_hmax;
/* minimum V-timing in lines */
u32 min_vmax;
/* default H-timing */
u32 default_hmax;
/* default V-timing */
u32 default_vmax;
/* minimum SHR */
u32 min_shr;
/*
* Per-mode vertical crop constants used to calculate values
* of IMX283REG_WIDCUT and IMX283_REG_VWINPOS.
*/
u32 veff;
u32 vst;
u32 vct;
/* Horizontal and vertical binning ratio */
u8 hbin_ratio;
u8 vbin_ratio;
/* Optical Blanking */
u32 horizontal_ob;
u32 vertical_ob;
/* Analog crop rectangle. */
struct v4l2_rect crop;
};
struct imx283_input_frequency {
unsigned int mhz;
unsigned int reg_count;
struct cci_reg_sequence regs[4];
};
static const struct imx283_input_frequency imx283_frequencies[] = {
{
.mhz = 6 * HZ_PER_MHZ,
.reg_count = 4,
.regs = {
{ IMX283_REG_PLRD1, 0x00 },
{ IMX283_REG_PLRD2, 0x00f0 },
{ IMX283_REG_PLRD3, 0x00 },
{ IMX283_REG_PLRD4, 0xc0 },
},
},
{
.mhz = 12 * HZ_PER_MHZ,
.reg_count = 4,
.regs = {
{ IMX283_REG_PLRD1, 0x01 },
{ IMX283_REG_PLRD2, 0x00f0 },
{ IMX283_REG_PLRD3, 0x01 },
{ IMX283_REG_PLRD4, 0xc0 },
},
Annotation
- Immediate include surface: `linux/array_size.h`, `linux/bitops.h`, `linux/container_of.h`, `linux/clk.h`, `linux/delay.h`, `linux/err.h`, `linux/gpio/consumer.h`, `linux/i2c.h`.
- Detected declarations: `struct imx283_reg_list`, `struct imx283_mode`, `struct imx283_input_frequency`, `struct imx283_readout_mode`, `struct imx283`, `enum imx283_modes`, `function get_mode_table`, `function imx283_pixel_rate`, `function imx283_internal_clock`, `function imx283_iclk_to_pix`.
- 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.