From 8636345683a6269fb315421b68f54c3b6185128d Mon Sep 17 00:00:00 2001 From: Leonard Crestez Date: Mon, 14 May 2018 11:24:30 +0800 Subject: [PATCH] MLK-18297 drm/bridge: it6263: Sleep between status reads in connector detect There are some issues with the HDMI connection on it6263 being slow to come up. There is a hack there which reads the register multiple times but it doesn't seem to be sufficient. This is particularly a problem when inside a xen guest. Improve this workaround by reading the status multiple times every few 5-10ms and returning connector_status_connected if any of those reads sees HPDETECT. Signed-off-by: Leonard Crestez Signed-off-by: Peng Fan (cherry picked from commit 699ccad27c5476746e0b2c5da25c5a98e6ffab3f) --- drivers/gpu/drm/bridge/it6263.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/bridge/it6263.c b/drivers/gpu/drm/bridge/it6263.c index 8a998387a425..bb200c0f50d7 100644 --- a/drivers/gpu/drm/bridge/it6263.c +++ b/drivers/gpu/drm/bridge/it6263.c @@ -1,5 +1,5 @@ /* - * Copyright 2017 NXP + * Copyright 2017-2018 NXP * * This program is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License as published by the @@ -391,12 +391,16 @@ it6263_connector_detect(struct drm_connector *connector, bool force) * FIXME: We read status tens of times to workaround * cable detection failure issue at boot time on some * platforms. + * Spin on this for up to one second. */ - for (i = 0; i < 90; i++) + for (i = 0; i < 100; i++) { regmap_read(it6263->hdmi_regmap, HDMI_REG_SYS_STATUS, &status); + if (status & HPDETECT) + return connector_status_connected; + usleep_range(5000, 10000); + } - return (status & HPDETECT) ? connector_status_connected : - connector_status_disconnected; + return connector_status_disconnected; } static const struct drm_connector_funcs it6263_connector_funcs = { -- 2.17.1