diff options
author | Linux Build Service Account <lnxbuild@quicinc.com> | 2017-10-06 13:42:30 -0700 |
---|---|---|
committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2017-10-06 13:42:30 -0700 |
commit | 479d36e015acbb5cf98676e66babea3456ac2d6a (patch) | |
tree | 1b03f084bc0260e6e94c29e6c7bb2eb078cf7f3b /drivers/usb | |
parent | df42ac7d5cb45f05bab6c58c0e613deabe22512e (diff) | |
parent | 83cf33d6a045ede53808097c2d7fa5767f382c5b (diff) |
Merge "dwc3: msm: Notify -ETIMEDOUT always in case of floating charger"
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | drivers/usb/dwc3/dwc3-msm.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c index 96a16808b028..d92a33097461 100644 --- a/drivers/usb/dwc3/dwc3-msm.c +++ b/drivers/usb/dwc3/dwc3-msm.c @@ -3714,20 +3714,20 @@ static int dwc3_msm_gadget_vbus_draw(struct dwc3_msm *mdwc, unsigned mA) union power_supply_propval pval = {0}; int ret, psy_type; - if (mdwc->max_power == mA) - return 0; - psy_type = get_psy_type(mdwc); - if (psy_type == POWER_SUPPLY_TYPE_USB) { - dev_info(mdwc->dev, "Avail curr from USB = %u\n", mA); - /* Set max current limit in uA */ - pval.intval = 1000 * mA; - } else if (psy_type == POWER_SUPPLY_TYPE_USB_FLOAT) { + if (psy_type == POWER_SUPPLY_TYPE_USB_FLOAT) { pval.intval = -ETIMEDOUT; - } else { - return 0; + goto set_prop; } + if (mdwc->max_power == mA || psy_type != POWER_SUPPLY_TYPE_USB) + return 0; + + dev_info(mdwc->dev, "Avail curr from USB = %u\n", mA); + /* Set max current limit in uA */ + pval.intval = 1000 * mA; + +set_prop: ret = power_supply_set_property(mdwc->usb_psy, POWER_SUPPLY_PROP_SDP_CURRENT_MAX, &pval); if (ret) { |