drivers/media/platform/ti/am437x/am437x-vpfe.c

Source file repositories/reference/linux-study-clean/drivers/media/platform/ti/am437x/am437x-vpfe.c

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/ti/am437x/am437x-vpfe.c
Extension
.c
Size
69802 bytes
Lines
2632
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 vpfe_standard {
	v4l2_std_id std_id;
	unsigned int width;
	unsigned int height;
	struct v4l2_fract pixelaspect;
	int frame_format;
};

static const struct vpfe_standard vpfe_standards[] = {
	{V4L2_STD_525_60, 720, 480, {11, 10}, 1},
	{V4L2_STD_625_50, 720, 576, {54, 59}, 1},
};

static struct vpfe_fmt formats[VPFE_NUM_FORMATS] = {
	{
		.fourcc		= V4L2_PIX_FMT_YUYV,
		.code		= MEDIA_BUS_FMT_YUYV8_2X8,
		.bitsperpixel	= 16,
	}, {
		.fourcc		= V4L2_PIX_FMT_UYVY,
		.code		= MEDIA_BUS_FMT_UYVY8_2X8,
		.bitsperpixel	= 16,
	}, {
		.fourcc		= V4L2_PIX_FMT_YVYU,
		.code		= MEDIA_BUS_FMT_YVYU8_2X8,
		.bitsperpixel	= 16,
	}, {
		.fourcc		= V4L2_PIX_FMT_VYUY,
		.code		= MEDIA_BUS_FMT_VYUY8_2X8,
		.bitsperpixel	= 16,
	}, {
		.fourcc		= V4L2_PIX_FMT_SBGGR8,
		.code		= MEDIA_BUS_FMT_SBGGR8_1X8,
		.bitsperpixel	= 8,
	}, {
		.fourcc		= V4L2_PIX_FMT_SGBRG8,
		.code		= MEDIA_BUS_FMT_SGBRG8_1X8,
		.bitsperpixel	= 8,
	}, {
		.fourcc		= V4L2_PIX_FMT_SGRBG8,
		.code		= MEDIA_BUS_FMT_SGRBG8_1X8,
		.bitsperpixel	= 8,
	}, {
		.fourcc		= V4L2_PIX_FMT_SRGGB8,
		.code		= MEDIA_BUS_FMT_SRGGB8_1X8,
		.bitsperpixel	= 8,
	}, {
		.fourcc		= V4L2_PIX_FMT_RGB565,
		.code		= MEDIA_BUS_FMT_RGB565_2X8_LE,
		.bitsperpixel	= 16,
	}, {
		.fourcc		= V4L2_PIX_FMT_RGB565X,
		.code		= MEDIA_BUS_FMT_RGB565_2X8_BE,
		.bitsperpixel	= 16,
	},
};

static int __subdev_get_format(struct vpfe_device *vpfe,
			       struct v4l2_mbus_framefmt *fmt);
static int vpfe_calc_format_size(struct vpfe_device *vpfe,
				 const struct vpfe_fmt *fmt,
				 struct v4l2_format *f);

static struct vpfe_fmt *find_format_by_code(struct vpfe_device *vpfe,
					    unsigned int code)
{
	struct vpfe_fmt *fmt;
	unsigned int k;

	for (k = 0; k < vpfe->num_active_fmt; k++) {
		fmt = vpfe->active_fmt[k];
		if (fmt->code == code)
			return fmt;
	}

	return NULL;
}

static struct vpfe_fmt *find_format_by_pix(struct vpfe_device *vpfe,
					   unsigned int pixelformat)
{
	struct vpfe_fmt *fmt;
	unsigned int k;

	for (k = 0; k < vpfe->num_active_fmt; k++) {
		fmt = vpfe->active_fmt[k];
		if (fmt->fourcc == pixelformat)
			return fmt;
	}

Annotation

Implementation Notes