Commit 2db44b3d authored by Niklas Söderlund's avatar Niklas Söderlund Committed by Mauro Carvalho Chehab

media: rcar-vin: set a default field to fallback on

If the field is not supported by the driver it should not try to keep
the current field. Instead it should set it to a default fallback. Since
trying a format should always result in the same state regardless of the
current state of the device.
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 <hans.verkuil@cisco.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@s-opensource.com>
parent d1dc6bac
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "rcar-vin.h" #include "rcar-vin.h"
#define RVIN_DEFAULT_FORMAT V4L2_PIX_FMT_YUYV #define RVIN_DEFAULT_FORMAT V4L2_PIX_FMT_YUYV
#define RVIN_DEFAULT_FIELD V4L2_FIELD_NONE
/* ----------------------------------------------------------------------------- /* -----------------------------------------------------------------------------
* Format Conversions * Format Conversions
...@@ -143,7 +144,7 @@ static int rvin_reset_format(struct rvin_dev *vin) ...@@ -143,7 +144,7 @@ static int rvin_reset_format(struct rvin_dev *vin)
case V4L2_FIELD_INTERLACED: case V4L2_FIELD_INTERLACED:
break; break;
default: default:
vin->format.field = V4L2_FIELD_NONE; vin->format.field = RVIN_DEFAULT_FIELD;
break; break;
} }
...@@ -193,7 +194,9 @@ static int __rvin_try_format_source(struct rvin_dev *vin, ...@@ -193,7 +194,9 @@ static int __rvin_try_format_source(struct rvin_dev *vin,
source->width = pix->width; source->width = pix->width;
source->height = pix->height; source->height = pix->height;
if (field != V4L2_FIELD_ANY)
pix->field = field; pix->field = field;
pix->width = width; pix->width = width;
pix->height = height; pix->height = height;
...@@ -213,10 +216,6 @@ static int __rvin_try_format(struct rvin_dev *vin, ...@@ -213,10 +216,6 @@ static int __rvin_try_format(struct rvin_dev *vin,
u32 walign; u32 walign;
int ret; int ret;
/* Keep current field if no specific one is asked for */
if (pix->field == V4L2_FIELD_ANY)
pix->field = vin->format.field;
/* If requested format is not supported fallback to the default */ /* If requested format is not supported fallback to the default */
if (!rvin_format_from_pixel(pix->pixelformat)) { if (!rvin_format_from_pixel(pix->pixelformat)) {
vin_dbg(vin, "Format 0x%x not found, using default 0x%x\n", vin_dbg(vin, "Format 0x%x not found, using default 0x%x\n",
...@@ -246,7 +245,7 @@ static int __rvin_try_format(struct rvin_dev *vin, ...@@ -246,7 +245,7 @@ static int __rvin_try_format(struct rvin_dev *vin,
case V4L2_FIELD_INTERLACED: case V4L2_FIELD_INTERLACED:
break; break;
default: default:
pix->field = V4L2_FIELD_NONE; pix->field = RVIN_DEFAULT_FIELD;
break; break;
} }
......
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