usb: otg: use power supply framework to set supply type
Remove dependency on PM8921 charger driver by introducing
a new power supply framework API which allows the USB
driver to set the power supply type.
Change-Id: I990cbf72c0b49041283b12c52ac80ace0bcbd133
Signed-off-by: David Keitel <dkeitel@codeaurora.org>
diff --git a/drivers/usb/otg/msm_otg.c b/drivers/usb/otg/msm_otg.c
index 65ddd4c..3c39cc8 100644
--- a/drivers/usb/otg/msm_otg.c
+++ b/drivers/usb/otg/msm_otg.c
@@ -1039,6 +1039,7 @@
static int msm_otg_notify_chg_type(struct msm_otg *motg)
{
static int charger_type;
+
/*
* TODO
* Unify OTG driver charger types and power supply charger types
@@ -1061,7 +1062,14 @@
else
charger_type = POWER_SUPPLY_TYPE_BATTERY;
- return pm8921_set_usb_power_supply_type(charger_type);
+ if (!psy) {
+ pr_err("No USB power supply registered!\n");
+ return -EINVAL;
+ }
+
+ pr_debug("setting usb power supply type %d\n", charger_type);
+ power_supply_set_supply_type(psy, charger_type);
+ return 0;
}
static int msm_otg_notify_power_supply(struct msm_otg *motg, unsigned mA)