Loading drivers/usb/phy/phy-msm-qusb.c +34 −37 Original line number Diff line number Diff line Loading @@ -187,15 +187,14 @@ static int qusb_phy_config_vdd(struct qusb_phy *qphy, int high) return ret; } static int qusb_phy_enable_power(struct qusb_phy *qphy, bool on, bool toggle_vdd) static int qusb_phy_enable_power(struct qusb_phy *qphy, bool on) { int ret = 0; dev_dbg(qphy->phy.dev, "%s turn %s regulators. power_enabled:%d\n", __func__, on ? "on" : "off", qphy->power_enabled); if (toggle_vdd && qphy->power_enabled == on) { if (qphy->power_enabled == on) { dev_dbg(qphy->phy.dev, "PHYs' regulators are already ON.\n"); return 0; } Loading @@ -203,7 +202,6 @@ static int qusb_phy_enable_power(struct qusb_phy *qphy, bool on, if (!on) goto disable_vdda33; if (toggle_vdd) { ret = qusb_phy_config_vdd(qphy, true); if (ret) { dev_err(qphy->phy.dev, "Unable to config VDD:%d\n", Loading @@ -216,7 +214,6 @@ static int qusb_phy_enable_power(struct qusb_phy *qphy, bool on, dev_err(qphy->phy.dev, "Unable to enable VDD\n"); goto unconfig_vdd; } } ret = regulator_set_load(qphy->vdda18, QUSB2PHY_1P8_HPM_LOAD); if (ret < 0) { Loading Loading @@ -258,7 +255,6 @@ static int qusb_phy_enable_power(struct qusb_phy *qphy, bool on, goto unset_vdd33; } if (toggle_vdd) qphy->power_enabled = true; pr_debug("%s(): QUSB PHY's regulators are turned ON.\n", __func__); Loading Loading @@ -297,7 +293,6 @@ static int qusb_phy_enable_power(struct qusb_phy *qphy, bool on, dev_err(qphy->phy.dev, "Unable to set LPM of vdda18\n"); disable_vdd: if (toggle_vdd) { ret = regulator_disable(qphy->vdd); if (ret) dev_err(qphy->phy.dev, "Unable to disable vdd:%d\n", Loading @@ -308,9 +303,7 @@ static int qusb_phy_enable_power(struct qusb_phy *qphy, bool on, if (ret) dev_err(qphy->phy.dev, "Unable unconfig VDD:%d\n", ret); } err_vdd: if (toggle_vdd) qphy->power_enabled = false; dev_dbg(qphy->phy.dev, "QUSB PHY's regulators are turned OFF.\n"); return ret; Loading Loading @@ -375,7 +368,7 @@ static int qusb_phy_init(struct usb_phy *phy) dev_dbg(phy->dev, "%s\n", __func__); ret = qusb_phy_enable_power(qphy, true, true); ret = qusb_phy_enable_power(qphy, true); if (ret) return ret; Loading Loading @@ -623,7 +616,7 @@ static int qusb_phy_set_suspend(struct usb_phy *phy, int suspend) qusb_phy_enable_clocks(qphy, false); qusb_phy_enable_power(qphy, false, true); qusb_phy_enable_power(qphy, false); } qphy->suspended = true; } else { Loading @@ -635,7 +628,7 @@ static int qusb_phy_set_suspend(struct usb_phy *phy, int suspend) writel_relaxed(0x00, qphy->base + QUSB2PHY_PORT_INTR_CTRL); } else { qusb_phy_enable_power(qphy, true, true); qusb_phy_enable_power(qphy, true); qusb_phy_enable_clocks(qphy, true); } qphy->suspended = false; Loading Loading @@ -677,7 +670,7 @@ static int qusb_phy_dpdm_regulator_enable(struct regulator_dev *rdev) __func__, qphy->dpdm_enable); if (!qphy->dpdm_enable) { ret = qusb_phy_enable_power(qphy, true, false); ret = qusb_phy_enable_power(qphy, true); if (ret < 0) { dev_dbg(qphy->phy.dev, "dpdm regulator enable failed:%d\n", ret); Loading @@ -698,12 +691,16 @@ static int qusb_phy_dpdm_regulator_disable(struct regulator_dev *rdev) __func__, qphy->dpdm_enable); if (qphy->dpdm_enable) { ret = qusb_phy_enable_power(qphy, false, false); if (!qphy->cable_connected) { dev_dbg(qphy->phy.dev, "turn off for HVDCP case\n"); ret = qusb_phy_enable_power(qphy, false); if (ret < 0) { dev_dbg(qphy->phy.dev, "dpdm regulator disable failed:%d\n", ret); "dpdm regulator disable failed:%d\n", ret); return ret; } } qphy->dpdm_enable = false; } Loading Loading @@ -1029,7 +1026,7 @@ static int qusb_phy_remove(struct platform_device *pdev) qphy->clocks_enabled = false; } qusb_phy_enable_power(qphy, false, true); qusb_phy_enable_power(qphy, false); return 0; } Loading Loading
drivers/usb/phy/phy-msm-qusb.c +34 −37 Original line number Diff line number Diff line Loading @@ -187,15 +187,14 @@ static int qusb_phy_config_vdd(struct qusb_phy *qphy, int high) return ret; } static int qusb_phy_enable_power(struct qusb_phy *qphy, bool on, bool toggle_vdd) static int qusb_phy_enable_power(struct qusb_phy *qphy, bool on) { int ret = 0; dev_dbg(qphy->phy.dev, "%s turn %s regulators. power_enabled:%d\n", __func__, on ? "on" : "off", qphy->power_enabled); if (toggle_vdd && qphy->power_enabled == on) { if (qphy->power_enabled == on) { dev_dbg(qphy->phy.dev, "PHYs' regulators are already ON.\n"); return 0; } Loading @@ -203,7 +202,6 @@ static int qusb_phy_enable_power(struct qusb_phy *qphy, bool on, if (!on) goto disable_vdda33; if (toggle_vdd) { ret = qusb_phy_config_vdd(qphy, true); if (ret) { dev_err(qphy->phy.dev, "Unable to config VDD:%d\n", Loading @@ -216,7 +214,6 @@ static int qusb_phy_enable_power(struct qusb_phy *qphy, bool on, dev_err(qphy->phy.dev, "Unable to enable VDD\n"); goto unconfig_vdd; } } ret = regulator_set_load(qphy->vdda18, QUSB2PHY_1P8_HPM_LOAD); if (ret < 0) { Loading Loading @@ -258,7 +255,6 @@ static int qusb_phy_enable_power(struct qusb_phy *qphy, bool on, goto unset_vdd33; } if (toggle_vdd) qphy->power_enabled = true; pr_debug("%s(): QUSB PHY's regulators are turned ON.\n", __func__); Loading Loading @@ -297,7 +293,6 @@ static int qusb_phy_enable_power(struct qusb_phy *qphy, bool on, dev_err(qphy->phy.dev, "Unable to set LPM of vdda18\n"); disable_vdd: if (toggle_vdd) { ret = regulator_disable(qphy->vdd); if (ret) dev_err(qphy->phy.dev, "Unable to disable vdd:%d\n", Loading @@ -308,9 +303,7 @@ static int qusb_phy_enable_power(struct qusb_phy *qphy, bool on, if (ret) dev_err(qphy->phy.dev, "Unable unconfig VDD:%d\n", ret); } err_vdd: if (toggle_vdd) qphy->power_enabled = false; dev_dbg(qphy->phy.dev, "QUSB PHY's regulators are turned OFF.\n"); return ret; Loading Loading @@ -375,7 +368,7 @@ static int qusb_phy_init(struct usb_phy *phy) dev_dbg(phy->dev, "%s\n", __func__); ret = qusb_phy_enable_power(qphy, true, true); ret = qusb_phy_enable_power(qphy, true); if (ret) return ret; Loading Loading @@ -623,7 +616,7 @@ static int qusb_phy_set_suspend(struct usb_phy *phy, int suspend) qusb_phy_enable_clocks(qphy, false); qusb_phy_enable_power(qphy, false, true); qusb_phy_enable_power(qphy, false); } qphy->suspended = true; } else { Loading @@ -635,7 +628,7 @@ static int qusb_phy_set_suspend(struct usb_phy *phy, int suspend) writel_relaxed(0x00, qphy->base + QUSB2PHY_PORT_INTR_CTRL); } else { qusb_phy_enable_power(qphy, true, true); qusb_phy_enable_power(qphy, true); qusb_phy_enable_clocks(qphy, true); } qphy->suspended = false; Loading Loading @@ -677,7 +670,7 @@ static int qusb_phy_dpdm_regulator_enable(struct regulator_dev *rdev) __func__, qphy->dpdm_enable); if (!qphy->dpdm_enable) { ret = qusb_phy_enable_power(qphy, true, false); ret = qusb_phy_enable_power(qphy, true); if (ret < 0) { dev_dbg(qphy->phy.dev, "dpdm regulator enable failed:%d\n", ret); Loading @@ -698,12 +691,16 @@ static int qusb_phy_dpdm_regulator_disable(struct regulator_dev *rdev) __func__, qphy->dpdm_enable); if (qphy->dpdm_enable) { ret = qusb_phy_enable_power(qphy, false, false); if (!qphy->cable_connected) { dev_dbg(qphy->phy.dev, "turn off for HVDCP case\n"); ret = qusb_phy_enable_power(qphy, false); if (ret < 0) { dev_dbg(qphy->phy.dev, "dpdm regulator disable failed:%d\n", ret); "dpdm regulator disable failed:%d\n", ret); return ret; } } qphy->dpdm_enable = false; } Loading Loading @@ -1029,7 +1026,7 @@ static int qusb_phy_remove(struct platform_device *pdev) qphy->clocks_enabled = false; } qusb_phy_enable_power(qphy, false, true); qusb_phy_enable_power(qphy, false); return 0; } Loading