phy: rockchip-inno-usb2: release mutex lock if otg in host mode

We add a mutex lock in rockchip_usb2phy_init(), but foget to
release it if otg port work in host only mode.

Change-Id: I45abf173097be4463b668b51eece99a72047fb18
Signed-off-by: Wu Liang feng <wulf@rock-chips.com>
This commit is contained in:
Wu Liang feng
2016-09-19 18:43:54 +08:00
committed by Huang, Tao
parent a8efa2f611
commit 787f11f0cf

View File

@@ -410,43 +410,45 @@ static int rockchip_usb2phy_init(struct phy *phy)
{
struct rockchip_usb2phy_port *rport = phy_get_drvdata(phy);
struct rockchip_usb2phy *rphy = dev_get_drvdata(phy->dev.parent);
int ret;
int ret = 0;
mutex_lock(&rport->mutex);
if (rport->port_id == USB2PHY_PORT_OTG &&
rport->mode != USB_DR_MODE_HOST) {
/* clear bvalid status and enable bvalid detect irq */
ret = property_enable(rphy,
&rport->port_cfg->bvalid_det_clr, true);
if (ret)
goto err;
if (rport->port_id == USB2PHY_PORT_OTG) {
if (rport->mode != USB_DR_MODE_HOST) {
/* clear bvalid status and enable bvalid detect irq */
ret = property_enable(rphy,
&rport->port_cfg->bvalid_det_clr,
true);
if (ret)
goto out;
ret = property_enable(rphy,
&rport->port_cfg->bvalid_det_en, true);
if (ret)
goto err;
mutex_unlock(&rport->mutex);
schedule_delayed_work(&rport->otg_sm_work, OTG_SCHEDULE_DELAY);
ret = property_enable(rphy,
&rport->port_cfg->bvalid_det_en,
true);
if (ret)
goto out;
schedule_delayed_work(&rport->otg_sm_work,
OTG_SCHEDULE_DELAY);
} else {
/* If OTG works in host only mode, do nothing. */
dev_dbg(&rport->phy->dev, "mode %d\n", rport->mode);
}
} else if (rport->port_id == USB2PHY_PORT_HOST) {
/* clear linestate and enable linestate detect irq */
ret = property_enable(rphy, &rport->port_cfg->ls_det_clr, true);
if (ret)
goto err;
goto out;
ret = property_enable(rphy, &rport->port_cfg->ls_det_en, true);
if (ret)
goto err;
goto out;
mutex_unlock(&rport->mutex);
schedule_delayed_work(&rport->sm_work, SCHEDULE_DELAY);
}
return 0;
err:
out:
mutex_unlock(&rport->mutex);
return ret;
}