From 9c7c33cc41ef5f844fde1c2b26763a9d20f34026 Mon Sep 17 00:00:00 2001 From: "wenping.zhang" Date: Fri, 2 Sep 2016 19:10:46 +0800 Subject: [PATCH] video: rockchip: dp: fix dp bugs when dp probing and connecting. 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 --- drivers/video/rockchip/dp/rockchip_dp_core.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/video/rockchip/dp/rockchip_dp_core.c b/drivers/video/rockchip/dp/rockchip_dp_core.c index 02658f71755d..7da46859fcc3 100644 --- a/drivers/video/rockchip/dp/rockchip_dp_core.c +++ b/drivers/video/rockchip/dp/rockchip_dp_core.c @@ -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; -- 2.34.1