From fa7621adf1f85a64b227b513fe1a4fa3dfb3bb2a Mon Sep 17 00:00:00 2001
From: Liu Ying <victor.liu@nxp.com>
Date: Thu, 10 Aug 2017 15:26:09 +0800
Subject: [PATCH] MLK-16183 drm/bridge: it6263: Workaround cable detection
 failure at boot time

There is cable detection failure issue on i.MX8qxp arm2 platform
at boot time when we avoid imx-drm deferral probe entirely(i2c
bus driver probe needs to be before the it6263 driver probe).
The workaround is to read the cable detection status multiple
times.  Based on experiments, it looks reading for 40 times works.

Signed-off-by: Liu Ying <victor.liu@nxp.com>
(cherry picked from commit fb719c95e4b7e157c48022eb0295ef517166d944)
---
 drivers/gpu/drm/bridge/it6263.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/gpu/drm/bridge/it6263.c b/drivers/gpu/drm/bridge/it6263.c
index 4f1c388395b275..4d1e3dce6712fa 100644
--- a/drivers/gpu/drm/bridge/it6263.c
+++ b/drivers/gpu/drm/bridge/it6263.c
@@ -345,8 +345,15 @@ it6263_connector_detect(struct drm_connector *connector, bool force)
 {
 	struct it6263 *it6263 = connector_to_it6263(connector);
 	unsigned int status;
-
-	regmap_read(it6263->hdmi_regmap, HDMI_REG_SYS_STATUS, &status);
+	int i;
+
+	/*
+	 * FIXME: We read status tens of times to workaround
+	 * cable detection failure issue at boot time on some
+	 * platforms.
+	 */
+	for (i = 0; i < 40; i++)
+		regmap_read(it6263->hdmi_regmap, HDMI_REG_SYS_STATUS, &status);
 
 	return (status & HPDETECT) ? connector_status_connected :
 					connector_status_disconnected;
-- 
GitLab