diff --git a/drivers/usb/phy/phy-msm-usb.c b/drivers/usb/phy/phy-msm-usb.c
index e1c92c4e1fdcaa470291b9d2652d16380e8ec4ea..9c6ab0c541b2e18bbd2c307c7b380560dffcc025 100644
--- a/drivers/usb/phy/phy-msm-usb.c
+++ b/drivers/usb/phy/phy-msm-usb.c
@@ -2803,7 +2803,12 @@ static void msm_otg_sm_work(struct work_struct *w)
 			 */
 			pm_runtime_mark_last_busy(otg->phy->dev);
 			pm_runtime_autosuspend(otg->phy->dev);
-			motg->pm_done = 1;
+			/*
+			 * Set pm_done to true as part of USB disconnect
+			 * only when USB is in low power mode.
+			 */
+			if (atomic_read(&motg->in_lpm))
+				motg->pm_done = 1;
 		}
 		break;
 	case OTG_STATE_B_SRP_INIT:
diff --git a/include/linux/usb/msm_hsusb.h b/include/linux/usb/msm_hsusb.h
index 17f28aeea795229403aebe3fb87d499dbd71596f..78a2ed4c05e96dcdd29f28e4c74559123049cc08 100644
--- a/include/linux/usb/msm_hsusb.h
+++ b/include/linux/usb/msm_hsusb.h
@@ -369,7 +369,10 @@ struct msm_otg_platform_data {
  * @chg_check_timer: The timer used to implement the workaround to detect
  *               very slow plug in of wall charger.
  * @ui_enabled: USB Intterupt is enabled or disabled.
- * @pm_done: Indicates whether USB is PM resumed
+ * @pm_done: It is used to increment the pm counter using pm_runtime_get_sync.
+	     This handles the race case when PM resume thread returns before
+	     the charger detection starts. When USB is disconnected and in lpm
+	     pm_done is set to true.
  */
 struct msm_otg {
 	struct usb_phy phy;