drivers/media/i2c/hi846.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/hi846.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/hi846.c- Extension
.c- Size
- 53762 bytes
- Lines
- 2177
- 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/unaligned.hlinux/clk.hlinux/delay.hlinux/gpio/consumer.hlinux/i2c.hlinux/module.hlinux/pm_runtime.hlinux/pm.hlinux/property.hlinux/regulator/consumer.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-fwnode.h
Detected Declarations
struct hi846_regstruct hi846_reg_liststruct hi846_modestruct hi846_datafmtstruct hi846function hi846_get_link_freq_indexfunction hi846_get_link_freqfunction hi846_calc_pixel_ratefunction hi846_read_regfunction hi846_write_regfunction hi846_write_reg_16function hi846_write_reg_listfunction hi846_update_digital_gainfunction hi846_test_patternfunction hi846_set_ctrlfunction hi846_init_controlsfunction hi846_set_video_modefunction hi846_start_streamingfunction hi846_stop_streamingfunction hi846_set_streamfunction hi846_power_onfunction hi846_power_offfunction hi846_suspendfunction hi846_resumefunction hi846_set_formatfunction hi846_get_formatfunction hi846_enum_mbus_codefunction hi846_enum_frame_sizefunction hi846_get_selectionfunction hi846_init_statefunction hi846_identify_modulefunction hi846_check_link_freqsfunction hi846_parse_dtfunction hi846_probefunction hi846_remove
Annotated Snippet
struct hi846_reg {
u16 address;
u16 val;
};
struct hi846_reg_list {
u32 num_of_regs;
const struct hi846_reg *regs;
};
struct hi846_mode {
/* Frame width in pixels */
u32 width;
/* Frame height in pixels */
u32 height;
/* Horizontal timing size */
u32 llp;
/* Link frequency needed for this resolution */
u8 link_freq_index;
u16 fps;
/* Vertical timining size */
u16 frame_len;
const struct hi846_reg_list reg_list_config;
const struct hi846_reg_list reg_list_2lane;
const struct hi846_reg_list reg_list_4lane;
/* Position inside of the 3264x2448 pixel array */
struct v4l2_rect crop;
};
static const struct hi846_reg hi846_init_2lane[] = {
{HI846_REG_MODE_SELECT, 0x0000},
/* regs below are unknown */
{0x2000, 0x100a},
{0x2002, 0x00ff},
{0x2004, 0x0007},
{0x2006, 0x3fff},
{0x2008, 0x3fff},
{0x200a, 0xc216},
{0x200c, 0x1292},
{0x200e, 0xc01a},
{0x2010, 0x403d},
{0x2012, 0x000e},
{0x2014, 0x403e},
{0x2016, 0x0b80},
{0x2018, 0x403f},
{0x201a, 0x82ae},
{0x201c, 0x1292},
{0x201e, 0xc00c},
{0x2020, 0x4130},
{0x2022, 0x43e2},
{0x2024, 0x0180},
{0x2026, 0x4130},
{0x2028, 0x7400},
{0x202a, 0x5000},
{0x202c, 0x0253},
{0x202e, 0x0ad1},
{0x2030, 0x2360},
{0x2032, 0x0009},
{0x2034, 0x5020},
{0x2036, 0x000b},
{0x2038, 0x0002},
{0x203a, 0x0044},
{0x203c, 0x0016},
{0x203e, 0x1792},
{0x2040, 0x7002},
{0x2042, 0x154f},
{0x2044, 0x00d5},
{0x2046, 0x000b},
{0x2048, 0x0019},
{0x204a, 0x1698},
{0x204c, 0x000e},
{0x204e, 0x099a},
{0x2050, 0x0058},
{0x2052, 0x7000},
{0x2054, 0x1799},
{0x2056, 0x0310},
{0x2058, 0x03c3},
{0x205a, 0x004c},
{0x205c, 0x064a},
{0x205e, 0x0001},
{0x2060, 0x0007},
{0x2062, 0x0bc7},
{0x2064, 0x0055},
Annotation
- Immediate include surface: `linux/unaligned.h`, `linux/clk.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/module.h`, `linux/pm_runtime.h`, `linux/pm.h`.
- Detected declarations: `struct hi846_reg`, `struct hi846_reg_list`, `struct hi846_mode`, `struct hi846_datafmt`, `struct hi846`, `function hi846_get_link_freq_index`, `function hi846_get_link_freq`, `function hi846_calc_pixel_rate`, `function hi846_read_reg`, `function hi846_write_reg`.
- 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.