summaryrefslogtreecommitdiff
path: root/drivers/media/platform/ti-vpe
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ideasonboard.com>2021-06-14 13:23:34 +0200
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>2021-07-12 14:21:55 +0200
commit7f9f8123212d090a89a0e3db794a684bbf3a6b1d (patch)
tree7434c45e5582a6a13de05529a49b061fc3f4346e /drivers/media/platform/ti-vpe
parentd3409a65735e617c425dcbcb7ba312d894547152 (diff)
downloadlwn-7f9f8123212d090a89a0e3db794a684bbf3a6b1d.tar.gz
lwn-7f9f8123212d090a89a0e3db794a684bbf3a6b1d.zip
media: ti-vpe: cal: add mbus_code support to cal_mc_enum_fmt_vid_cap
Commit e5b6b07a1b45 ("media: v4l2: Extend VIDIOC_ENUM_FMT to support MC-centric devices") added support to enumerate formats based on mbus-code. Add this feature to cal driver. Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
Diffstat (limited to 'drivers/media/platform/ti-vpe')
-rw-r--r--drivers/media/platform/ti-vpe/cal-video.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/drivers/media/platform/ti-vpe/cal-video.c b/drivers/media/platform/ti-vpe/cal-video.c
index cdbfdca8570f..1099ef4ae968 100644
--- a/drivers/media/platform/ti-vpe/cal-video.c
+++ b/drivers/media/platform/ti-vpe/cal-video.c
@@ -437,13 +437,28 @@ static const struct v4l2_ioctl_ops cal_ioctl_video_ops = {
static int cal_mc_enum_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_fmtdesc *f)
{
+ unsigned int i;
+ unsigned int idx;
+
if (f->index >= cal_num_formats)
return -EINVAL;
- f->pixelformat = cal_formats[f->index].fourcc;
- f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ idx = 0;
- return 0;
+ for (i = 0; i < cal_num_formats; ++i) {
+ if (f->mbus_code && cal_formats[i].code != f->mbus_code)
+ continue;
+
+ if (idx == f->index) {
+ f->pixelformat = cal_formats[i].fourcc;
+ f->type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
+ return 0;
+ }
+
+ idx++;
+ }
+
+ return -EINVAL;
}
static void cal_mc_try_fmt(struct cal_ctx *ctx, struct v4l2_format *f,