From 94f34486d678f01378f539dee843a74eb476320e Mon Sep 17 00:00:00 2001
From: Sandor Yu <Sandor.yu@nxp.com>
Date: Fri, 29 Nov 2019 15:00:59 +0800
Subject: [PATCH] drm: hdmi: imx8: fix wrong hdmi type with non-SCDC HDMI sinks

hdmi type is uninitialized with non-SCDC HDMI sinks.
And hdmi ctrl will work in DVI mode that is not ecpected.
Set hdmi type to HDMI1.4 before SCDC support check to fix it.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
---
 drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c | 11 +++++------
 1 file changed, 5 insertions(+), 6 deletions(-)

--- a/drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c
+++ b/drivers/gpu/drm/bridge/cadence/cdns-hdmi-core.c
@@ -29,7 +29,10 @@
 static void hdmi_sink_config(struct cdns_mhdp_device *mhdp)
 {
 	struct drm_scdc *scdc = &mhdp->connector.base.display_info.hdmi.scdc;
-	u8 buff;
+	u8 buff = 0;
+
+	/* Default work in HDMI1.4 */
+	mhdp->hdmi.hdmi_type = MODE_HDMI_1_4;
 
 	/* check sink support SCDC or not */
 	if (scdc->supported != true) {
@@ -51,11 +54,7 @@ static void hdmi_sink_config(struct cdns
 		 */
 		buff = SCDC_SCRAMBLING_ENABLE;
 		mhdp->hdmi.hdmi_type = MODE_HDMI_2_0;
-	} else {
-		/* Default work in HDMI1.4 */
-		buff = 0;
-		mhdp->hdmi.hdmi_type = MODE_HDMI_1_4;
-	 }
+	}
 
 	/* TMDS config */
 	cdns_hdmi_scdc_write(mhdp, 0x20, buff);
