drivers/media/i2c/imx319.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/imx319.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/imx319.c- Extension
.c- Size
- 53581 bytes
- Lines
- 2506
- 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/acpi.hlinux/clk.hlinux/i2c.hlinux/module.hlinux/pm_runtime.hlinux/unaligned.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-event.hmedia/v4l2-fwnode.h
Detected Declarations
struct imx319_regstruct imx319_reg_liststruct imx319_modestruct imx319_hwcfgstruct imx319function imx319_get_format_codefunction imx319_read_regfunction imx319_write_regfunction imx319_write_regsfunction imx319_openfunction imx319_set_ctrlfunction imx319_enum_mbus_codefunction imx319_enum_frame_sizefunction imx319_update_pad_formatfunction imx319_do_get_pad_formatfunction imx319_get_pad_formatfunction imx319_set_pad_formatfunction imx319_identify_modulefunction imx319_start_streamingfunction imx319_stop_streamingfunction imx319_set_streamfunction imx319_init_controlsfunction imx319_probefunction imx319_remove
Annotated Snippet
struct imx319_reg {
u16 address;
u8 val;
};
struct imx319_reg_list {
u32 num_of_regs;
const struct imx319_reg *regs;
};
/* Mode : resolution and related config&values */
struct imx319_mode {
/* Frame width */
u32 width;
/* Frame height */
u32 height;
/* V-timing */
u32 fll_def;
u32 fll_min;
/* H-timing */
u32 llp;
/* index of link frequency */
u32 link_freq_index;
/* Default register values */
struct imx319_reg_list reg_list;
};
struct imx319_hwcfg {
unsigned long link_freq_bitmap;
};
struct imx319 {
struct device *dev;
struct v4l2_subdev sd;
struct media_pad pad;
struct v4l2_ctrl_handler ctrl_handler;
/* V4L2 Controls */
struct v4l2_ctrl *link_freq;
struct v4l2_ctrl *pixel_rate;
struct v4l2_ctrl *vblank;
struct v4l2_ctrl *hblank;
struct v4l2_ctrl *exposure;
struct v4l2_ctrl *vflip;
struct v4l2_ctrl *hflip;
/* Current mode */
const struct imx319_mode *cur_mode;
struct imx319_hwcfg *hwcfg;
/*
* Mutex for serialized access:
* Protect sensor set pad format and start/stop streaming safely.
* Protect access to sensor v4l2 controls.
*/
struct mutex mutex;
/* True if the device has been identified */
bool identified;
};
static const struct imx319_reg imx319_global_regs[] = {
{ 0x0136, 0x13 },
{ 0x0137, 0x33 },
{ 0x3c7e, 0x05 },
{ 0x3c7f, 0x07 },
{ 0x4d39, 0x0b },
{ 0x4d41, 0x33 },
{ 0x4d43, 0x0c },
{ 0x4d49, 0x89 },
{ 0x4e05, 0x0b },
{ 0x4e0d, 0x33 },
{ 0x4e0f, 0x0c },
{ 0x4e15, 0x89 },
{ 0x4e49, 0x2a },
{ 0x4e51, 0x33 },
{ 0x4e53, 0x0c },
{ 0x4e59, 0x89 },
{ 0x5601, 0x4f },
{ 0x560b, 0x45 },
{ 0x562f, 0x0a },
{ 0x5643, 0x0a },
{ 0x5645, 0x0c },
{ 0x56ef, 0x51 },
Annotation
- Immediate include surface: `linux/acpi.h`, `linux/clk.h`, `linux/i2c.h`, `linux/module.h`, `linux/pm_runtime.h`, `linux/unaligned.h`, `media/v4l2-ctrls.h`, `media/v4l2-device.h`.
- Detected declarations: `struct imx319_reg`, `struct imx319_reg_list`, `struct imx319_mode`, `struct imx319_hwcfg`, `struct imx319`, `function imx319_get_format_code`, `function imx319_read_reg`, `function imx319_write_reg`, `function imx319_write_regs`, `function imx319_open`.
- 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.