diff options
| author | Jack Pham <jackp@codeaurora.org> | 2016-08-09 11:07:22 -0700 |
|---|---|---|
| committer | Jack Pham <jackp@codeaurora.org> | 2016-08-10 09:48:09 -0700 |
| commit | cf9e05be9aba20837be2a7cf1bf0e72e86699318 (patch) | |
| tree | 081ead3a74aa912fc7333542680b34747c495ec4 | |
| parent | 3acfc4ffecb1bbf3e38e90ba3f45fec04fa7143c (diff) | |
usb: dwc3-msm: Remove call to set POWER_SUPPLY_PROP_ONLINE
The charger drivers now handle setting of this property without
input from USB gadget other than the negotiated current draw
amount (set via POWER_SUPPLY_PROP_CURRENT_MAX). Remove setting
of POWER_SUPPLY_PROP_ONLINE which helps simplify the
dwc3_msm_gadget_vbus_draw() function a bit.
Change-Id: I2c5ec90cc8c45019ad75056b6feb7e6319f85514
Signed-off-by: Jack Pham <jackp@codeaurora.org>
| -rw-r--r-- | drivers/usb/dwc3/dwc3-msm.c | 41 |
1 files changed, 8 insertions, 33 deletions
diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c index c40c61b184b9..ac3372619537 100644 --- a/drivers/usb/dwc3/dwc3-msm.c +++ b/drivers/usb/dwc3/dwc3-msm.c @@ -3176,7 +3176,8 @@ static int dwc3_otg_start_peripheral(struct dwc3_msm *mdwc, int on) static int dwc3_msm_gadget_vbus_draw(struct dwc3_msm *mdwc, unsigned mA) { - union power_supply_propval pval = {0,}; + union power_supply_propval pval = {1000 * mA}; + int ret; if (mdwc->charging_disabled) return 0; @@ -3194,42 +3195,16 @@ static int dwc3_msm_gadget_vbus_draw(struct dwc3_msm *mdwc, unsigned mA) dev_info(mdwc->dev, "Avail curr from USB = %u\n", mA); - if (mdwc->max_power <= 2 && mA > 2) { - /* Enable Charging */ - pval.intval = true; - if (power_supply_set_property(mdwc->usb_psy, - POWER_SUPPLY_PROP_ONLINE, &pval)) - goto psy_error; - pval.intval = 1000 * mA; - if (power_supply_set_property(mdwc->usb_psy, - POWER_SUPPLY_PROP_CURRENT_MAX, &pval)) - goto psy_error; - } else if (mdwc->max_power > 0 && (mA == 0 || mA == 2)) { - /* Disable charging */ - pval.intval = false; - if (power_supply_set_property(mdwc->usb_psy, - POWER_SUPPLY_PROP_ONLINE, &pval)) - goto psy_error; - } else { - /* Enable charging */ - pval.intval = true; - if (power_supply_set_property(mdwc->usb_psy, - POWER_SUPPLY_PROP_ONLINE, &pval)) - goto psy_error; - } - /* Set max current limit in uA */ - pval.intval = 1000 * mA; - if (power_supply_set_property(mdwc->usb_psy, - POWER_SUPPLY_PROP_CURRENT_MAX, &pval)) - goto psy_error; + ret = power_supply_set_property(mdwc->usb_psy, + POWER_SUPPLY_PROP_CURRENT_MAX, &pval); + if (ret) { + dev_dbg(mdwc->dev, "power supply error when setting property\n"); + return ret; + } mdwc->max_power = mA; return 0; - -psy_error: - dev_dbg(mdwc->dev, "power supply error when setting property\n"); - return -ENXIO; } |
