Commit 52a1b4e9 authored by Niklas Söderlund's avatar Niklas Söderlund Committed by Mauro Carvalho Chehab

[media] media: rcar-vin: allow field to be changed

The driver forced whatever field was set by the source subdevice to be
used. This patch allows the user to change from the default field.
Signed-off-by: default avatarNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>
Signed-off-by: default avatarHans Verkuil <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent 7e13a8a4
...@@ -102,6 +102,7 @@ static int __rvin_try_format_source(struct rvin_dev *vin, ...@@ -102,6 +102,7 @@ static int __rvin_try_format_source(struct rvin_dev *vin,
struct v4l2_subdev_format format = { struct v4l2_subdev_format format = {
.which = which, .which = which,
}; };
enum v4l2_field field;
int ret; int ret;
sd = vin_to_source(vin); sd = vin_to_source(vin);
...@@ -114,12 +115,16 @@ static int __rvin_try_format_source(struct rvin_dev *vin, ...@@ -114,12 +115,16 @@ static int __rvin_try_format_source(struct rvin_dev *vin,
format.pad = vin->src_pad_idx; format.pad = vin->src_pad_idx;
field = pix->field;
ret = v4l2_subdev_call(sd, pad, set_fmt, pad_cfg, &format); ret = v4l2_subdev_call(sd, pad, set_fmt, pad_cfg, &format);
if (ret < 0 && ret != -ENOIOCTLCMD) if (ret < 0 && ret != -ENOIOCTLCMD)
goto done; goto done;
v4l2_fill_pix_format(pix, &format.format); v4l2_fill_pix_format(pix, &format.format);
pix->field = field;
source->width = pix->width; source->width = pix->width;
source->height = pix->height; source->height = pix->height;
...@@ -143,6 +148,10 @@ static int __rvin_try_format(struct rvin_dev *vin, ...@@ -143,6 +148,10 @@ static int __rvin_try_format(struct rvin_dev *vin,
rwidth = pix->width; rwidth = pix->width;
rheight = pix->height; rheight = pix->height;
/* Keep current field if no specific one is asked for */
if (pix->field == V4L2_FIELD_ANY)
pix->field = vin->format.field;
/* /*
* Retrieve format information and select the current format if the * Retrieve format information and select the current format if the
* requested format isn't supported. * requested format isn't supported.
......
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