Merge tag 'drm-next-2019-07-16' of git://anongit.freedesktop.org/drm/drm
[linux-2.6-microblaze.git] / drivers / staging / media / imx / imx-media-csi.c
index 0eeb0db..367e39f 100644 (file)
@@ -1373,9 +1373,15 @@ static void csi_try_field(struct csi_priv *priv,
        struct v4l2_mbus_framefmt *infmt =
                __csi_get_fmt(priv, cfg, CSI_SINK_PAD, sdformat->which);
 
-       /* no restrictions on sink pad field type */
-       if (sdformat->pad == CSI_SINK_PAD)
+       /*
+        * no restrictions on sink pad field type except must
+        * be initialized.
+        */
+       if (sdformat->pad == CSI_SINK_PAD) {
+               if (sdformat->format.field == V4L2_FIELD_ANY)
+                       sdformat->format.field = V4L2_FIELD_NONE;
                return;
+       }
 
        switch (infmt->field) {
        case V4L2_FIELD_SEQ_TB:
@@ -1453,8 +1459,6 @@ static void csi_try_fmt(struct csi_priv *priv,
                /* propagate colorimetry from sink */
                sdformat->format.colorspace = infmt->colorspace;
                sdformat->format.xfer_func = infmt->xfer_func;
-               sdformat->format.quantization = infmt->quantization;
-               sdformat->format.ycbcr_enc = infmt->ycbcr_enc;
 
                break;
        case CSI_SINK_PAD:
@@ -1474,10 +1478,6 @@ static void csi_try_fmt(struct csi_priv *priv,
 
                csi_try_field(priv, cfg, sdformat);
 
-               imx_media_fill_default_mbus_fields(
-                       &sdformat->format, infmt,
-                       priv->active_output_pad == CSI_SRC_PAD_DIRECT);
-
                /* Reset crop and compose rectangles */
                crop->left = 0;
                crop->top = 0;
@@ -1493,6 +1493,9 @@ static void csi_try_fmt(struct csi_priv *priv,
 
                break;
        }
+
+       imx_media_try_colorimetry(&sdformat->format,
+                       priv->active_output_pad == CSI_SRC_PAD_DIRECT);
 }
 
 static int csi_set_fmt(struct v4l2_subdev *sd,