MLK-17107-03: hdp: return unknow status if cable detect failed
authorSandor Yu <Sandor.yu@nxp.com>
Mon, 11 Dec 2017 09:10:48 +0000 (17:10 +0800)
committerNitin Garg <nitin.garg@nxp.com>
Tue, 20 Mar 2018 19:51:37 +0000 (14:51 -0500)
Return unknow status to connector if hdp cable detect function
failed to get cable status.

Signed-off-by: Sandor Yu <Sandor.yu@nxp.com>
(cherry picked from commit d16c633b1be1326b3583632c5279ea6b34ed3ec2)

drivers/gpu/drm/imx/hdp/imx-hdp.c

index fd81e4b..414cc1a 100644 (file)
@@ -648,7 +648,7 @@ imx_hdp_connector_detect(struct drm_connector *connector, bool force)
        struct imx_hdp *hdp = container_of(connector,
                                                struct imx_hdp, connector);
        int ret;
-       u8 hpd;
+       u8 hpd = 0xf;
 
        ret = imx_hdp_call(hdp, get_hpd_state, &hdp->state, &hpd);
        if (ret > 0)
@@ -657,9 +657,14 @@ imx_hdp_connector_detect(struct drm_connector *connector, bool force)
        if (hpd == 1)
                /* Cable Connected */
                return connector_status_connected;
-       else
-               /* Cable Disconnedted  */
+       else if (hpd == 0)
+               /* Cable Disconnedted */
                return connector_status_disconnected;
+       else {
+               /* Cable status unknown */
+               DRM_INFO("Unknow cable status, hdp=%u\n", hpd);
+               return connector_status_unknown;
+       }
 }
 
 static int imx_hdp_connector_get_modes(struct drm_connector *connector)
@@ -985,7 +990,7 @@ static void hotplug_work_func(struct work_struct *work)
                /* Cable Connected */
                DRM_INFO("HDMI/DP Cable Plug In\n");
                enable_irq(hdp->irq[HPD_IRQ_OUT]);
-       } else {
+       } else if (connector->status == connector_status_disconnected) {
                /* Cable Disconnedted  */
                DRM_INFO("HDMI/DP Cable Plug Out\n");
                enable_irq(hdp->irq[HPD_IRQ_IN]);