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.

Dependency Surface

Detected Declarations

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

Implementation Notes