aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/platform
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>2016-09-02 12:44:58 -0400
committerMauro Carvalho Chehab <mchehab@s-opensource.com>2016-09-19 15:31:55 -0400
commit52a1b4e93518c7625fa9756637e54400637ad7ec (patch)
tree6c5238458509c180b9692d422b7fb4594bb6bcf8 /drivers/media/platform
parent7e13a8a45e3ec1c712f1f3995f7f3daf7fa07ecc (diff)
[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: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Signed-off-by: Hans Verkuil <hans.verkuil@cisco.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@s-opensource.com>
Diffstat (limited to 'drivers/media/platform')
-rw-r--r--drivers/media/platform/rcar-vin/rcar-v4l2.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index 62ca7e35517e..88bfee33b478 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -102,6 +102,7 @@ static int __rvin_try_format_source(struct rvin_dev *vin,
102 struct v4l2_subdev_format format = { 102 struct v4l2_subdev_format format = {
103 .which = which, 103 .which = which,
104 }; 104 };
105 enum v4l2_field field;
105 int ret; 106 int ret;
106 107
107 sd = vin_to_source(vin); 108 sd = vin_to_source(vin);
@@ -114,12 +115,16 @@ static int __rvin_try_format_source(struct rvin_dev *vin,
114 115
115 format.pad = vin->src_pad_idx; 116 format.pad = vin->src_pad_idx;
116 117
118 field = pix->field;
119
117 ret = v4l2_subdev_call(sd, pad, set_fmt, pad_cfg, &format); 120 ret = v4l2_subdev_call(sd, pad, set_fmt, pad_cfg, &format);
118 if (ret < 0 && ret != -ENOIOCTLCMD) 121 if (ret < 0 && ret != -ENOIOCTLCMD)
119 goto done; 122 goto done;
120 123
121 v4l2_fill_pix_format(pix, &format.format); 124 v4l2_fill_pix_format(pix, &format.format);
122 125
126 pix->field = field;
127
123 source->width = pix->width; 128 source->width = pix->width;
124 source->height = pix->height; 129 source->height = pix->height;
125 130
@@ -143,6 +148,10 @@ static int __rvin_try_format(struct rvin_dev *vin,
143 rwidth = pix->width; 148 rwidth = pix->width;
144 rheight = pix->height; 149 rheight = pix->height;
145 150
151 /* Keep current field if no specific one is asked for */
152 if (pix->field == V4L2_FIELD_ANY)
153 pix->field = vin->format.field;
154
146 /* 155 /*
147 * Retrieve format information and select the current format if the 156 * Retrieve format information and select the current format if the
148 * requested format isn't supported. 157 * requested format isn't supported.