video: rockchip: dp: fix dp bugs when dp probing and connecting.
authorwenping.zhang <wenping.zhang@rock-chips.com>
Fri, 2 Sep 2016 11:10:46 +0000 (19:10 +0800)
committerHuang, Tao <huangtao@rock-chips.com>
Fri, 2 Sep 2016 12:31:54 +0000 (20:31 +0800)
set port->cap_lanes to 0 when dp connected error last time, and allow
dp go on probing if there is only one fusb302.

Change-Id: I90169f77ac02a94f42da96f20aacfd51b898de09
Signed-off-by: wenping.zhang <wenping.zhang@rock-chips.com>
drivers/video/rockchip/dp/rockchip_dp_core.c

index 02658f71755d3b34eb5775653236548af0536428..7da46859fcc3282e466d2be28742dd8a7a8c1729 100644 (file)
@@ -425,6 +425,7 @@ static void cdn_dp_pd_event_wq(struct work_struct *work)
        if (!new_cap_lanes) {
                ret = phy_power_off(port->phy);
                if (ret) {
+                       port->cap_lanes = 0;
                        dev_err(dp->dev, "phy power off failed: %d", ret);
                        return;
                }
@@ -446,6 +447,7 @@ static void cdn_dp_pd_event_wq(struct work_struct *work)
                if (dp->port[i]->phy_status) {
                        dev_warn(dp->dev, "busy, phy[%d] is running",
                                 dp->port[i]->id);
+                       port->cap_lanes = 0;
                        return;
                }
        }
@@ -463,8 +465,10 @@ static void cdn_dp_pd_event_wq(struct work_struct *work)
                        dev_warn(dp->dev, "retry to request firmware in %dS\n",
                                 dp->fw_wait);
                        dp->fw_wait *= 2;
+                       port->cap_lanes = 0;
                        return;
                } else if (ret) {
+                       port->cap_lanes = 0;
                        dev_err(dp->dev, "failed to request firmware: %d\n",
                                ret);
                        return;
@@ -479,6 +483,7 @@ static void cdn_dp_pd_event_wq(struct work_struct *work)
                if (!dp->fw_loaded)
                        release_firmware(dp->fw);
                dev_err(dp->dev, "phy power on failed: %d\n", ret);
+               port->cap_lanes = 0;
                return;
        }
        port->phy_status = true;
@@ -537,6 +542,7 @@ static void cdn_dp_pd_event_wq(struct work_struct *work)
        dev_err(dp->dev, "get dpcd failed: %d", ret);
 
 err_firmware:
+       port->cap_lanes = 0;
        ret = phy_power_off(port->phy);
        if (ret)
                dev_err(dp->dev, "phy power off failed: %d", ret);
@@ -603,14 +609,19 @@ static int cdn_dp_probe(struct platform_device *pdev)
                phy = devm_of_phy_get_by_index(dev, dev->of_node, i);
 
                if (PTR_ERR(extcon) == -EPROBE_DEFER ||
-                   PTR_ERR(phy) == -EPROBE_DEFER)
+                   PTR_ERR(phy) == -EPROBE_DEFER){
+                       /* don't exit if there already has one port */
+                       if(dp->ports)
+                               continue;
                        return -EPROBE_DEFER;
 
+               }
+
                if (IS_ERR(extcon) || IS_ERR(phy))
                        continue;
 
                port = devm_kzalloc(dev, sizeof(*port), GFP_KERNEL);
-               if (!dp)
+               if (!port)
                        return -ENOMEM;
 
                port->extcon = extcon;