otg: msm_otg: fix otg boost ordering

While turning on the OTG, the charger should be configured to not draw
any current from the usb before turning on the 5V boost. While turning
off the OTG, the boost should be turned off before configuring the
charger to draw current from usb.

Fix this ordering.

Change-Id: Iebd9bf166334e34d92b2ada623dec71a5f0326eb
CRs-Fixed: 338648
Signed-off-by: Abhijeet Dharmapurikar <adharmap@codeaurora.org>
diff --git a/drivers/usb/otg/msm_otg.c b/drivers/usb/otg/msm_otg.c
index deb4064..0ff0a48 100644
--- a/drivers/usb/otg/msm_otg.c
+++ b/drivers/usb/otg/msm_otg.c
@@ -1192,10 +1192,12 @@
 
 	/*
 	 * if entering host mode tell the charger to not draw any current
-	 * from usb - if exiting host mode let the charger draw current
+	 * from usb before turning on the boost.
+	 * if exiting host mode disable the boost before enabling to draw
+	 * current from the source.
 	 */
-	pm8921_disable_source_current(on);
 	if (on) {
+		pm8921_disable_source_current(on);
 		ret = regulator_enable(vbus_otg);
 		if (ret) {
 			pr_err("unable to enable vbus_otg\n");
@@ -1208,6 +1210,7 @@
 			pr_err("unable to disable vbus_otg\n");
 			return;
 		}
+		pm8921_disable_source_current(on);
 		vbus_is_on = false;
 	}
 }