drivers/media/i2c/thp7312.c

Source file repositories/reference/linux-study-clean/drivers/media/i2c/thp7312.c

File Facts

System
Linux kernel
Corpus path
drivers/media/i2c/thp7312.c
Extension
.c
Size
60164 bytes
Lines
2250
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 thp7312_frame_rate {
	u32 fps;
	u32 link_freq;
	u8 reg_frame_rate_mode;
};

struct thp7312_mode_info {
	u32 width;
	u32 height;
	u8 reg_image_size;
	const struct thp7312_frame_rate *rates;
};

static const u32 thp7312_colour_fmts[] = {
	MEDIA_BUS_FMT_YUYV8_1X16,
};

/* regulator supplies */
static const char * const thp7312_supply_name[] = {
	"vddcore",
	"vhtermrx",
	"vddtx",
	"vddhost",
	"vddcmos",
	"vddgpio-0",
	"vddgpio-1",
};

static const struct thp7312_mode_info thp7312_mode_info_data[] = {
	{
		.width = 1920,
		.height = 1080,
		.reg_image_size = THP7312_VIDEO_IMAGE_SIZE_1920x1080,
		.rates = (const struct thp7312_frame_rate[]) {
			{ 30, 300000000, 0x81 },
			{ 60, 387500000, 0x82 },
			{ 0 }
		},
	}, {
		.width = 2048,
		.height = 1536,
		.reg_image_size = THP7312_VIDEO_IMAGE_SIZE_2048x1536,
		.rates = (const struct thp7312_frame_rate[]) {
			{ 30, 300000000, 0x81 },
			{ 0 }
		}
	}, {
		.width = 3840,
		.height = 2160,
		.reg_image_size = THP7312_VIDEO_IMAGE_SIZE_3840x2160,
		.rates = (const struct thp7312_frame_rate[]) {
			{ 30, 600000000, 0x81 },
			{ 0 }
		},
	}, {
		.width = 4160,
		.height = 3120,
		.reg_image_size = THP7312_VIDEO_IMAGE_SIZE_4160x3120,
		.rates = (const struct thp7312_frame_rate[]) {
			{ 20, 600000000, 0x81 },
			{ 0 }
		},
	},
};

struct thp7312_device;

struct thp7312_sensor_info {
	const char *model;
};

struct thp7312_sensor {
	const struct thp7312_sensor_info *info;
	u8 lane_remap;
};

struct thp7312_device {
	struct device *dev;
	struct regmap *regmap;

	struct v4l2_subdev sd;
	struct media_pad pad;

	struct gpio_desc *reset_gpio;
	struct regulator_bulk_data supplies[ARRAY_SIZE(thp7312_supply_name)];
	struct clk *iclk;

	u8 lane_remap;

	struct thp7312_sensor sensors[1];

Annotation

Implementation Notes