drivers/media/platform/ti/omap3isp/ispvideo.c

Source file repositories/reference/linux-study-clean/drivers/media/platform/ti/omap3isp/ispvideo.c

File Facts

System
Linux kernel
Corpus path
drivers/media/platform/ti/omap3isp/ispvideo.c
Extension
.c
Size
44379 bytes
Lines
1584
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

if (j == f->index) {
			f->pixelformat = formats[i].pixelformat;
			return 0;
		}
		j++;
	}

	return -EINVAL;
}

static int
isp_video_get_format(struct file *file, void *fh, struct v4l2_format *format)
{
	struct isp_video_fh *vfh = file_to_isp_video_fh(file);
	struct isp_video *video = video_drvdata(file);

	if (format->type != video->type)
		return -EINVAL;

	mutex_lock(&video->mutex);
	*format = vfh->format;
	mutex_unlock(&video->mutex);

	return 0;
}

static int
isp_video_try_format(struct file *file, void *fh, struct v4l2_format *format)
{
	struct isp_video *video = video_drvdata(file);
	struct v4l2_subdev_format fmt = {
		.which = V4L2_SUBDEV_FORMAT_ACTIVE,
	};
	struct v4l2_subdev *subdev;
	u32 pad;
	int ret;

	if (format->type != video->type)
		return -EINVAL;

	/* Replace unsupported field orders with sane defaults. */
	switch (format->fmt.pix.field) {
	case V4L2_FIELD_NONE:
		/* Progressive is supported everywhere. */
		break;
	case V4L2_FIELD_ALTERNATE:
		/* ALTERNATE is not supported on output nodes. */
		if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT)
			format->fmt.pix.field = V4L2_FIELD_NONE;
		break;
	case V4L2_FIELD_INTERLACED:
		/* The ISP has no concept of video standard, select the
		 * top-bottom order when the unqualified interlaced order is
		 * requested.
		 */
		format->fmt.pix.field = V4L2_FIELD_INTERLACED_TB;
		fallthrough;
	case V4L2_FIELD_INTERLACED_TB:
	case V4L2_FIELD_INTERLACED_BT:
		/* Interlaced orders are only supported at the CCDC output. */
		if (video != &video->isp->isp_ccdc.video_out)
			format->fmt.pix.field = V4L2_FIELD_NONE;
		break;
	case V4L2_FIELD_TOP:
	case V4L2_FIELD_BOTTOM:
	case V4L2_FIELD_SEQ_TB:
	case V4L2_FIELD_SEQ_BT:
	default:
		/* All other field orders are currently unsupported, default to
		 * progressive.
		 */
		format->fmt.pix.field = V4L2_FIELD_NONE;
		break;
	}

	if (video->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) {
		isp_video_pix_to_mbus(&format->fmt.pix, &fmt.format);
		isp_video_mbus_to_pix(video, &fmt.format, &format->fmt.pix);
		return 0;
	}

	subdev = isp_video_remote_subdev(video, &pad);
	if (subdev == NULL)
		return -EINVAL;

	isp_video_pix_to_mbus(&format->fmt.pix, &fmt.format);

	fmt.pad = pad;
	ret = v4l2_subdev_call(subdev, pad, get_fmt, NULL, &fmt);
	if (ret)

Annotation

Implementation Notes