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: Niklas Söderlund <niklas.soderlund+rene...@ragnatech.se>
---
 drivers/media/platform/rcar-vin/rcar-v4l2.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c 
b/drivers/media/platform/rcar-vin/rcar-v4l2.c
index 6403650aff22a2ed..f69ae76b3fda50c7 100644
--- a/drivers/media/platform/rcar-vin/rcar-v4l2.c
+++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c
@@ -23,6 +23,7 @@
 #include "rcar-vin.h"
 
 #define RVIN_DEFAULT_FORMAT    V4L2_PIX_FMT_YUYV
+#define RVIN_DEFAULT_FIELD     V4L2_FIELD_NONE
 #define RVIN_DEFAULT_COLORSPACE        V4L2_COLORSPACE_SRGB
 
 /* 
-----------------------------------------------------------------------------
@@ -171,7 +172,7 @@ static int rvin_get_source_format(struct rvin_dev *vin,
                fmt.format.height *= 2;
                break;
        default:
-               vin->format.field = V4L2_FIELD_NONE;
+               vin->format.field = RVIN_DEFAULT_FIELD;
                break;
        }
 
@@ -267,9 +268,8 @@ static int __rvin_try_format(struct rvin_dev *vin,
 {
        int ret;
 
-       /* Keep current field if no specific one is asked for */
        if (pix->field == V4L2_FIELD_ANY)
-               pix->field = vin->format.field;
+               pix->field = RVIN_DEFAULT_FIELD;
 
        /* Limit to source capabilities */
        ret = __rvin_try_format_source(vin, which, pix);
-- 
2.16.1

Reply via email to