drivers/media/i2c/vd56g3.c
Source file repositories/reference/linux-study-clean/drivers/media/i2c/vd56g3.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/media/i2c/vd56g3.c- Extension
.c- Size
- 44462 bytes
- Lines
- 1583
- 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/iopoll.hlinux/module.hlinux/pm_runtime.hlinux/regmap.hlinux/regulator/consumer.hlinux/unaligned.hlinux/units.hmedia/mipi-csi2.hmedia/v4l2-async.hmedia/v4l2-cci.hmedia/v4l2-ctrls.hmedia/v4l2-device.hmedia/v4l2-fwnode.hmedia/v4l2-subdev.h
Detected Declarations
struct vd56g3_modestruct vd56g3enum vd56g3_modelsfunction vd56g3_poll_regfunction vd56g3_wait_statefunction vd56g3_get_bppfunction vd56g3_get_datatypefunction vd56g3_read_expo_clusterfunction vd56g3_update_patgenfunction vd56g3_update_expo_clusterfunction vd56g3_lock_exposurefunction vd56g3_write_gpioxfunction for_each_set_bitfunction vd56g3_g_volatile_ctrlfunction vd56g3_s_ctrlfunction vd56g3_update_controlsfunction vd56g3_init_controlsfunction vd56g3_get_mbus_codefunction vd56g3_enum_mbus_codefunction vd56g3_enum_frame_sizefunction vd56g3_update_img_pad_formatfunction vd56g3_set_pad_fmtfunction vd56g3_get_selectionfunction vd56g3_get_frame_descfunction vd56g3_enable_streamsfunction vd56g3_disable_streamsfunction vd56g3_init_statefunction vd56g3_power_onfunction vd56g3_power_offfunction vd56g3_check_csi_conffunction vd56g3_parse_dt_gpios_arrayfunction vd56g3_parse_dt_gpiosfunction vd56g3_parse_dtfunction vd56g3_get_regulatorsfunction vd56g3_prepare_clock_treefunction vd56g3_detectfunction vd56g3_subdev_initfunction vd56g3_subdev_cleanupfunction vd56g3_probefunction vd56g3_remove
Annotated Snippet
struct vd56g3_mode {
u32 width;
u32 height;
};
static const struct vd56g3_mode vd56g3_supported_modes[] = {
{
.width = VD56G3_NATIVE_WIDTH,
.height = VD56G3_NATIVE_HEIGHT,
},
{
.width = 1120,
.height = 1360,
},
{
.width = 1024,
.height = 1280,
},
{
.width = 1024,
.height = 768,
},
{
.width = 768,
.height = 1024,
},
{
.width = 720,
.height = 1280,
},
{
.width = 640,
.height = 480,
},
{
.width = 480,
.height = 640,
},
{
.width = 320,
.height = 240,
},
};
/*
* Sensor support 8bits and 10bits output in both variants
* - Monochrome
* - RGB (with all H/V flip variations)
*/
static const unsigned int vd56g3_mbus_codes[2][5] = {
{
MEDIA_BUS_FMT_Y8_1X8,
MEDIA_BUS_FMT_SGRBG8_1X8,
MEDIA_BUS_FMT_SRGGB8_1X8,
MEDIA_BUS_FMT_SBGGR8_1X8,
MEDIA_BUS_FMT_SGBRG8_1X8,
},
{
MEDIA_BUS_FMT_Y10_1X10,
MEDIA_BUS_FMT_SGRBG10_1X10,
MEDIA_BUS_FMT_SRGGB10_1X10,
MEDIA_BUS_FMT_SBGGR10_1X10,
MEDIA_BUS_FMT_SGBRG10_1X10,
},
};
struct vd56g3 {
struct device *dev;
struct v4l2_subdev sd;
struct media_pad pad;
struct regulator_bulk_data supplies[ARRAY_SIZE(vd56g3_supply_names)];
struct gpio_desc *reset_gpio;
struct clk *xclk;
struct regmap *regmap;
u32 xclk_freq;
u32 pll_prediv;
u32 pll_mult;
u32 pixel_clock;
u16 oif_ctrl;
u8 nb_of_lane;
u32 gpios[VD56G3_NB_GPIOS];
unsigned long ext_leds_mask;
bool is_mono;
struct v4l2_ctrl_handler ctrl_handler;
struct v4l2_ctrl *hblank_ctrl;
struct v4l2_ctrl *vblank_ctrl;
struct {
struct v4l2_ctrl *hflip_ctrl;
struct v4l2_ctrl *vflip_ctrl;
};
Annotation
- Immediate include surface: `linux/clk.h`, `linux/delay.h`, `linux/gpio/consumer.h`, `linux/i2c.h`, `linux/iopoll.h`, `linux/module.h`, `linux/pm_runtime.h`, `linux/regmap.h`.
- Detected declarations: `struct vd56g3_mode`, `struct vd56g3`, `enum vd56g3_models`, `function vd56g3_poll_reg`, `function vd56g3_wait_state`, `function vd56g3_get_bpp`, `function vd56g3_get_datatype`, `function vd56g3_read_expo_cluster`, `function vd56g3_update_patgen`, `function vd56g3_update_expo_cluster`.
- 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.