Commit 8f490061 authored by Niklas Söderlund's avatar Niklas Söderlund Committed by Mauro Carvalho Chehab

media: rcar-vin: Do not enumerate unsupported pixel formats

If a pixel format is not supported by the hardware NULL is returned by
rvin_format_from_pixel() for that fourcc. Verify that the pixel format
is supported using this or skip it when enumerating.
Signed-off-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Reviewed-by: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 1091eb83
...@@ -296,12 +296,22 @@ static int rvin_g_fmt_vid_cap(struct file *file, void *priv, ...@@ -296,12 +296,22 @@ static int rvin_g_fmt_vid_cap(struct file *file, void *priv,
static int rvin_enum_fmt_vid_cap(struct file *file, void *priv, static int rvin_enum_fmt_vid_cap(struct file *file, void *priv,
struct v4l2_fmtdesc *f) struct v4l2_fmtdesc *f)
{ {
if (f->index >= ARRAY_SIZE(rvin_formats)) struct rvin_dev *vin = video_drvdata(file);
return -EINVAL; unsigned int i;
int matched;
f->pixelformat = rvin_formats[f->index].fourcc; matched = -1;
for (i = 0; i < ARRAY_SIZE(rvin_formats); i++) {
if (rvin_format_from_pixel(vin, rvin_formats[i].fourcc))
matched++;
if (matched == f->index) {
f->pixelformat = rvin_formats[i].fourcc;
return 0; return 0;
}
}
return -EINVAL;
} }
static int rvin_g_selection(struct file *file, void *fh, static int rvin_g_selection(struct file *file, void *fh,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment