summaryrefslogtreecommitdiffstats
path: root/drivers/media/platform/rcar-vin/rcar-v4l2.c
diff options
context:
space:
mode:
authorNiklas Söderlund <niklas.soderlund+renesas@ragnatech.se>2019-09-04 18:54:08 -0300
committerMauro Carvalho Chehab <mchehab+samsung@kernel.org>2019-10-01 17:09:20 -0300
commit083693214f28b979b50cfcd689010725ca579eb8 (patch)
tree37f27882158be32543a42893b823d8f5468f0251 /drivers/media/platform/rcar-vin/rcar-v4l2.c
parent104464f573d5e1c58e2901fce209fc4682b6f8e3 (diff)
downloadlinux-083693214f28b979b50cfcd689010725ca579eb8.tar.bz2
media: rcar-vin: Add support for V4L2_FIELD_ALTERNATE
The hardware is capable to passing V4L2_FIELD_ALTERNATE to user-space. Allow users to request this field format but still default to using the hardware interlacer if alternating is not explicitly requested. Before this change a sensor providing data using alternate would be always combined to an interlaced frame. After this change the user can request to receive frames as alternate if the sensor provides it. Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@ragnatech.se> Reviewed-by: Kieran Bingham <kieran.bingham+renesas@ideasonboard.com> Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
Diffstat (limited to 'drivers/media/platform/rcar-vin/rcar-v4l2.c')
-rw-r--r--drivers/media/platform/rcar-vin/rcar-v4l2.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index 3f175e2e0a9a..a7ee44dd248e 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -117,15 +117,7 @@ static void rvin_format_align(struct rvin_dev *vin, struct v4l2_pix_format *pix)
case V4L2_FIELD_INTERLACED_TB:
case V4L2_FIELD_INTERLACED_BT:
case V4L2_FIELD_INTERLACED:
- break;
case V4L2_FIELD_ALTERNATE:
- /*
- * Driver does not (yet) support outputting ALTERNATE to a
- * userspace. It does support outputting INTERLACED so use
- * the VIN hardware to combine the two fields.
- */
- pix->field = V4L2_FIELD_INTERLACED;
- pix->height *= 2;
break;
default:
pix->field = RVIN_DEFAULT_FIELD;
@@ -164,15 +156,25 @@ static int rvin_reset_format(struct rvin_dev *vin)
v4l2_fill_pix_format(&vin->format, &fmt.format);
- rvin_format_align(vin, &vin->format);
-
vin->src_rect.top = 0;
vin->src_rect.left = 0;
vin->src_rect.width = vin->format.width;
vin->src_rect.height = vin->format.height;
+ /* Make use of the hardware interlacer by default. */
+ if (vin->format.field == V4L2_FIELD_ALTERNATE) {
+ vin->format.field = V4L2_FIELD_INTERLACED;
+ vin->format.height *= 2;
+ }
+
+ rvin_format_align(vin, &vin->format);
+
vin->crop = vin->src_rect;
- vin->compose = vin->src_rect;
+
+ vin->compose.top = 0;
+ vin->compose.left = 0;
+ vin->compose.width = vin->format.width;
+ vin->compose.height = vin->format.height;
return 0;
}
@@ -217,13 +219,6 @@ static int rvin_try_format(struct rvin_dev *vin, u32 which,
crop->left = 0;
crop->width = pix->width;
crop->height = pix->height;
-
- /*
- * If source is ALTERNATE the driver will use the VIN hardware
- * to INTERLACE it. The crop height then needs to be doubled.
- */
- if (pix->field == V4L2_FIELD_ALTERNATE)
- crop->height *= 2;
}
if (field != V4L2_FIELD_ANY)