diff options
author | Vijayavardhan Vennapusa <vvreddy@codeaurora.org> | 2017-10-03 14:44:52 +0530 |
---|---|---|
committer | Vijayavardhan Vennapusa <vvreddy@codeaurora.org> | 2017-10-05 12:09:37 +0530 |
commit | 83cf33d6a045ede53808097c2d7fa5767f382c5b (patch) | |
tree | d958fabbffc4dbad43c50cbc4ca02d233b3454a9 /drivers/usb/dwc3 | |
parent | 8aedd7084222d4cce3acdfe3c71820c674503bee (diff) |
dwc3: msm: Notify -ETIMEDOUT always in case of floating charger
Charger driver expects USB driver notify -ETIMEDOUT always on
POWER_SUPPLY_PROP_CURRENT_MAXCURRENT on enumeration failure in case
of floating charger. This is to set ICL to value based on Rp in case of
floating charger. But currently driver is not notifying this, when floating
charger is disconnected and connected back. Due to this, device is charging
only with 100mA instead of current based on Rp value. Fix this by having
proper check and allow to notify in case of floating charger type.
Change-Id: Iee0c4d8faa7e25c8445b83784a782751e7148421
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Diffstat (limited to 'drivers/usb/dwc3')
-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 5ad68df298cd..46a077b0a930 100644 --- a/drivers/usb/dwc3/dwc3-msm.c +++ b/drivers/usb/dwc3/dwc3-msm.c @@ -3692,20 +3692,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) { |