power: pm8921-charger: fix host mode charging state

While the phone is in usb host mode (supplying power to a usb peripheral)
a charging state is reported. The phone cannot be charging from usb while
supplying power to a usb peripheral.

The fix is to make the usb vbus power code disable charging from usb before
enabling the otg regulators. In addition, the power supply class should not
show a usb charger source present or online when charging is disabled.

CRs-Fixed: 322516
Change-Id: I2eb91f1ea70665b7753924537982b183eb3e8894
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 f2279be..56559bf 100644
--- a/drivers/usb/otg/msm_otg.c
+++ b/drivers/usb/otg/msm_otg.c
@@ -970,6 +970,11 @@
 		return;
 	}
 
+	/*
+	 * if entering host mode tell the charger to not draw any current
+	 * from usb - if exiting host mode let the charger draw current
+	 */
+	pm8921_disable_source_current(on);
 	if (on) {
 		ret = regulator_enable(vbus_otg);
 		if (ret) {