drivers/media/i2c/gc0310.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/gc0310.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/gc0310.c- Extension
.c- Size
- 21064 bytes
- Lines
- 784
- 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/delay.hlinux/errno.hlinux/gpio/consumer.hlinux/i2c.hlinux/kernel.hlinux/module.hlinux/pm_runtime.hlinux/regmap.hlinux/string.hlinux/types.hmedia/v4l2-cci.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-fwnode.h
Detected Declarations
struct gc0310_devicestruct gc0310_ctrlsstruct gc0310_regfunction gc0310_gain_setfunction gc0310_exposure_update_rangefunction gc0310_s_ctrlfunction gc0310_fill_formatfunction gc0310_get_selectionfunction gc0310_power_offfunction gc0310_power_onfunction gc0310_detectfunction gc0310_enable_streamsfunction gc0310_disable_streamsfunction gc0310_enum_mbus_codefunction gc0310_enum_frame_sizefunction gc0310_init_statefunction gc0310_init_controlsfunction gc0310_removefunction gc0310_check_hwcfgfunction gc0310_probe
Annotated Snippet
struct gc0310_device {
struct v4l2_subdev sd;
struct media_pad pad;
struct regmap *regmap;
struct gpio_desc *reset;
struct gpio_desc *powerdown;
struct gc0310_ctrls {
struct v4l2_ctrl_handler handler;
struct v4l2_ctrl *exposure;
struct v4l2_ctrl *gain;
struct v4l2_ctrl *link_freq;
struct v4l2_ctrl *pixel_rate;
struct v4l2_ctrl *vblank;
struct v4l2_ctrl *hblank;
} ctrls;
};
struct gc0310_reg {
u8 reg;
u8 val;
};
static const struct reg_sequence gc0310_reset_register[] = {
/* System registers */
{ 0xfe, 0xf0 },
{ 0xfe, 0xf0 },
{ 0xfe, 0x00 },
{ 0xfc, 0x0e }, /* 4e */
{ 0xfc, 0x0e }, /* 16//4e // [0]apwd [6]regf_clk_gate */
{ 0xf2, 0x80 }, /* sync output */
{ 0xf3, 0x00 }, /* 1f//01 data output */
{ 0xf7, 0x33 }, /* f9 */
{ 0xf8, 0x05 }, /* 00 */
{ 0xf9, 0x0e }, /* 0x8e //0f */
{ 0xfa, 0x11 },
/* MIPI */
{ 0xfe, 0x03 },
{ 0x01, 0x03 }, /* mipi 1lane */
{ 0x02, 0x22 }, /* 0x33 */
{ 0x03, 0x94 },
{ 0x04, 0x01 }, /* fifo_prog */
{ 0x05, 0x00 }, /* fifo_prog */
{ 0x06, 0x80 }, /* b0 //YUV ISP data */
{ 0x11, 0x2a }, /* 1e //LDI set YUV422 */
{ 0x12, 0x90 }, /* 00 //04 //00 //04//00 //LWC[7:0] */
{ 0x13, 0x02 }, /* 05 //05 //LWC[15:8] */
{ 0x15, 0x12 }, /* 0x10 //DPHYY_MODE read_ready */
{ 0x17, 0x01 },
{ 0x40, 0x08 },
{ 0x41, 0x00 },
{ 0x42, 0x00 },
{ 0x43, 0x00 },
{ 0x21, 0x02 }, /* 0x01 */
{ 0x22, 0x02 }, /* 0x01 */
{ 0x23, 0x01 }, /* 0x05 //Nor:0x05 DOU:0x06 */
{ 0x29, 0x00 },
{ 0x2A, 0x25 }, /* 0x05 //data zero 0x7a de */
{ 0x2B, 0x02 },
{ 0xfe, 0x00 },
/* CISCTL */
{ 0x00, 0x2f }, /* 2f//0f//02//01 */
{ 0x01, 0x0f }, /* 06 */
{ 0x02, 0x04 },
{ 0x4f, 0x00 }, /* AEC 0FF */
{ 0x03, 0x01 }, /* 0x03 //04 */
{ 0x04, 0xc0 }, /* 0xe8 //58 */
{ 0x05, 0x00 },
{ 0x06, 0xb2 }, /* 0x0a //HB */
/* Vblank (reg 0x07 + 0x08) gets set by the vblank ctrl */
{ 0x09, 0x00 }, /* row start */
{ 0x0a, 0x00 },
{ 0x0b, 0x00 }, /* col start */
{ 0x0c, 0x00 },
{ 0x0d, 0x01 }, /* height */
{ 0x0e, 0xf2 }, /* 0xf7 //height */
{ 0x0f, 0x02 }, /* width */
{ 0x10, 0x94 }, /* 0xa0 //height */
{ 0x17, 0x14 },
{ 0x18, 0x1a }, /* 0a//[4]double reset */
{ 0x19, 0x14 }, /* AD pipeline */
{ 0x1b, 0x48 },
{ 0x1e, 0x6b }, /* 3b//col bias */
{ 0x1f, 0x28 }, /* 20//00//08//txlow */
{ 0x20, 0x89 }, /* 88//0c//[3:2]DA15 */
Annotation
- Immediate include surface: `linux/delay.h`, `linux/errno.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/kernel.h`, `linux/module.h`, `linux/pm_runtime.h`, `linux/regmap.h`.
- Detected declarations: `struct gc0310_device`, `struct gc0310_ctrls`, `struct gc0310_reg`, `function gc0310_gain_set`, `function gc0310_exposure_update_range`, `function gc0310_s_ctrl`, `function gc0310_fill_format`, `function gc0310_get_selection`, `function gc0310_power_off`, `function gc0310_power_on`.
- 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.