drivers/media/i2c/gc2145.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/gc2145.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/gc2145.c- Extension
.c- Size
- 49704 bytes
- Lines
- 1485
- 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/pm_runtime.hlinux/regulator/consumer.hlinux/units.hmedia/mipi-csi2.hmedia/v4l2-cci.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-fwnode.hmedia/v4l2-mediabus.h
Detected Declarations
struct gc2145_modestruct gc2145_formatstruct gc2145_ctrlsstruct gc2145function gc2145_get_format_codefunction gc2145_update_pad_formatfunction gc2145_init_statefunction gc2145_get_selectionfunction gc2145_enum_mbus_codefunction gc2145_enum_frame_sizefunction gc2145_set_pad_formatfunction gc2145_config_mipi_modefunction gc2145_enable_streamsfunction gc2145_disable_streamsfunction gc2145_power_onfunction gc2145_power_offfunction gc2145_get_regulatorsfunction gc2145_identify_modulefunction gc2145_set_ctrl_test_patternfunction gc2145_s_ctrlfunction gc2145_init_controlsfunction gc2145_check_hwcfgfunction gc2145_probefunction gc2145_remove
Annotated Snippet
struct gc2145_mode {
unsigned int width;
unsigned int height;
const struct cci_reg_sequence *reg_seq;
size_t reg_seq_size;
unsigned long pixel_rate;
struct v4l2_rect crop;
unsigned int hblank;
unsigned int vblank;
unsigned int link_freq_index;
};
#define GC2145_DEFAULT_EXPOSURE 0x04e2
#define GC2145_DEFAULT_GLOBAL_GAIN 0x55
static const struct cci_reg_sequence gc2145_common_regs[] = {
{GC2145_REG_PAGE_SELECT, 0x00},
/* SH Delay */
{CCI_REG8(0x12), 0x2e},
/* Flip */
{GC2145_REG_ANALOG_MODE1, 0x14},
/* Analog Conf */
{CCI_REG8(0x18), 0x22}, {CCI_REG8(0x19), 0x0e}, {CCI_REG8(0x1a), 0x01},
{CCI_REG8(0x1b), 0x4b}, {CCI_REG8(0x1c), 0x07}, {CCI_REG8(0x1d), 0x10},
{CCI_REG8(0x1e), 0x88}, {CCI_REG8(0x1f), 0x78}, {CCI_REG8(0x20), 0x03},
{CCI_REG8(0x21), 0x40}, {CCI_REG8(0x22), 0xa0}, {CCI_REG8(0x24), 0x16},
{CCI_REG8(0x25), 0x01}, {CCI_REG8(0x26), 0x10}, {CCI_REG8(0x2d), 0x60},
{CCI_REG8(0x30), 0x01}, {CCI_REG8(0x31), 0x90}, {CCI_REG8(0x33), 0x06},
{CCI_REG8(0x34), 0x01},
/* ISP related */
{CCI_REG8(0x80), 0x7f}, {CCI_REG8(0x81), 0x26}, {CCI_REG8(0x82), 0xfa},
{CCI_REG8(0x83), 0x00}, {CCI_REG8(0x84), 0x02}, {CCI_REG8(0x86), 0x02},
{CCI_REG8(0x88), 0x03},
{GC2145_REG_BYPASS_MODE, 0x03},
{CCI_REG8(0x85), 0x08}, {CCI_REG8(0x8a), 0x00}, {CCI_REG8(0x8b), 0x00},
{GC2145_REG_GLOBAL_GAIN, GC2145_DEFAULT_GLOBAL_GAIN},
{CCI_REG8(0xc3), 0x00}, {CCI_REG8(0xc4), 0x80}, {CCI_REG8(0xc5), 0x90},
{CCI_REG8(0xc6), 0x3b}, {CCI_REG8(0xc7), 0x46},
/* BLK */
{GC2145_REG_PAGE_SELECT, 0x00},
{CCI_REG8(0x40), 0x42}, {CCI_REG8(0x41), 0x00}, {CCI_REG8(0x43), 0x5b},
{CCI_REG8(0x5e), 0x00}, {CCI_REG8(0x5f), 0x00}, {CCI_REG8(0x60), 0x00},
{CCI_REG8(0x61), 0x00}, {CCI_REG8(0x62), 0x00}, {CCI_REG8(0x63), 0x00},
{CCI_REG8(0x64), 0x00}, {CCI_REG8(0x65), 0x00}, {CCI_REG8(0x66), 0x20},
{CCI_REG8(0x67), 0x20}, {CCI_REG8(0x68), 0x20}, {CCI_REG8(0x69), 0x20},
{CCI_REG8(0x76), 0x00}, {CCI_REG8(0x6a), 0x08}, {CCI_REG8(0x6b), 0x08},
{CCI_REG8(0x6c), 0x08}, {CCI_REG8(0x6d), 0x08}, {CCI_REG8(0x6e), 0x08},
{CCI_REG8(0x6f), 0x08}, {CCI_REG8(0x70), 0x08}, {CCI_REG8(0x71), 0x08},
{CCI_REG8(0x76), 0x00}, {CCI_REG8(0x72), 0xf0}, {CCI_REG8(0x7e), 0x3c},
{CCI_REG8(0x7f), 0x00},
{GC2145_REG_PAGE_SELECT, 0x02},
{CCI_REG8(0x48), 0x15}, {CCI_REG8(0x49), 0x00}, {CCI_REG8(0x4b), 0x0b},
/* AEC */
{GC2145_REG_PAGE_SELECT, 0x00},
{GC2145_REG_EXPOSURE, GC2145_DEFAULT_EXPOSURE},
{GC2145_REG_PAGE_SELECT, 0x01},
{CCI_REG8(0x01), 0x04}, {CCI_REG8(0x02), 0xc0}, {CCI_REG8(0x03), 0x04},
{CCI_REG8(0x04), 0x90}, {CCI_REG8(0x05), 0x30}, {CCI_REG8(0x06), 0x90},
{CCI_REG8(0x07), 0x30}, {CCI_REG8(0x08), 0x80}, {CCI_REG8(0x09), 0x00},
{CCI_REG8(0x0a), 0x82}, {CCI_REG8(0x0b), 0x11}, {CCI_REG8(0x0c), 0x10},
{CCI_REG8(0x11), 0x10}, {CCI_REG8(0x13), 0x7b}, {CCI_REG8(0x17), 0x00},
{CCI_REG8(0x1c), 0x11}, {CCI_REG8(0x1e), 0x61}, {CCI_REG8(0x1f), 0x35},
{CCI_REG8(0x20), 0x40}, {CCI_REG8(0x22), 0x40}, {CCI_REG8(0x23), 0x20},
{GC2145_REG_PAGE_SELECT, 0x02},
{CCI_REG8(0x0f), 0x04},
{GC2145_REG_PAGE_SELECT, 0x01},
{CCI_REG8(0x12), 0x35}, {CCI_REG8(0x15), 0xb0}, {CCI_REG8(0x10), 0x31},
{CCI_REG8(0x3e), 0x28}, {CCI_REG8(0x3f), 0xb0}, {CCI_REG8(0x40), 0x90},
{CCI_REG8(0x41), 0x0f},
/* INTPEE */
{GC2145_REG_PAGE_SELECT, 0x02},
{CCI_REG8(0x90), 0x6c}, {CCI_REG8(0x91), 0x03}, {CCI_REG8(0x92), 0xcb},
{CCI_REG8(0x94), 0x33}, {CCI_REG8(0x95), 0x84}, {CCI_REG8(0x97), 0x65},
{CCI_REG8(0xa2), 0x11},
/* DNDD */
{GC2145_REG_PAGE_SELECT, 0x02},
{CCI_REG8(0x80), 0xc1}, {CCI_REG8(0x81), 0x08}, {CCI_REG8(0x82), 0x05},
{CCI_REG8(0x83), 0x08}, {CCI_REG8(0x84), 0x0a}, {CCI_REG8(0x86), 0xf0},
{CCI_REG8(0x87), 0x50}, {CCI_REG8(0x88), 0x15}, {CCI_REG8(0x89), 0xb0},
{CCI_REG8(0x8a), 0x30}, {CCI_REG8(0x8b), 0x10},
/* ASDE */
{GC2145_REG_PAGE_SELECT, 0x01},
{CCI_REG8(0x21), 0x04},
{GC2145_REG_PAGE_SELECT, 0x02},
{CCI_REG8(0xa3), 0x50}, {CCI_REG8(0xa4), 0x20}, {CCI_REG8(0xa5), 0x40},
{CCI_REG8(0xa6), 0x80}, {CCI_REG8(0xab), 0x40}, {CCI_REG8(0xae), 0x0c},
{CCI_REG8(0xb3), 0x46}, {CCI_REG8(0xb4), 0x64}, {CCI_REG8(0xb6), 0x38},
{CCI_REG8(0xb7), 0x01}, {CCI_REG8(0xb9), 0x2b}, {CCI_REG8(0x3c), 0x04},
{CCI_REG8(0x3d), 0x15}, {CCI_REG8(0x4b), 0x06}, {CCI_REG8(0x4c), 0x20},
/* Gamma */
{GC2145_REG_PAGE_SELECT, 0x02},
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/module.h`, `linux/pm_runtime.h`, `linux/regulator/consumer.h`, `linux/units.h`.
- Detected declarations: `struct gc2145_mode`, `struct gc2145_format`, `struct gc2145_ctrls`, `struct gc2145`, `function gc2145_get_format_code`, `function gc2145_update_pad_format`, `function gc2145_init_state`, `function gc2145_get_selection`, `function gc2145_enum_mbus_code`, `function gc2145_enum_frame_size`.
- 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.