Phy power on/off cycle can happen several times during device life.
We then need to balance the extcon notifier registration accordingly.
Fixes: f0b5c2c96370 ("phy: qcom-usb-hs: Replace the extcon API")
Signed-off-by: Loic Poulain <[email protected]>
---
drivers/phy/qualcomm/phy-qcom-usb-hs.c | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/drivers/phy/qualcomm/phy-qcom-usb-hs.c
b/drivers/phy/qualcomm/phy-qcom-usb-hs.c
index 2d0c70b..92e9d94 100644
--- a/drivers/phy/qualcomm/phy-qcom-usb-hs.c
+++ b/drivers/phy/qualcomm/phy-qcom-usb-hs.c
@@ -181,6 +181,12 @@ static int qcom_usb_hs_phy_power_off(struct phy *phy)
{
struct qcom_usb_hs_phy *uphy = phy_get_drvdata(phy);
+ if (uphy->vbus_edev) {
+ devm_extcon_unregister_notifier(&uphy->ulpi->dev,
+ uphy->vbus_edev, EXTCON_USB,
+ &uphy->vbus_notify);
+ }
+
regulator_disable(uphy->v3p3);
regulator_disable(uphy->v1p8);
clk_disable_unprepare(uphy->sleep_clk);
--
2.7.4