usb: dwc3-msm: Add support for proprietary charger detection
Proprietary chargers pull D+/- to specific voltages between 2.0-3.3V
(VLGC) for identification. The DM voltage may not exceed VLGC due
to pull-down resistor. Hence a proprietary charger is detected as
a Standard downstream port (SDP). Read line state to distinguish
between SDP and proprietary charger. The DP voltage would exceed
VLGC for proprietary chargers.
CRs-fixed: 383075
Change-Id: Ic9afbdd0996a4c1c7a2af76cd99182d8ae5f3b68
Signed-off-by: Manu Gautam <mgautam@codeaurora.org>
diff --git a/drivers/usb/dwc3/dwc3_otg.c b/drivers/usb/dwc3/dwc3_otg.c
index 8bdaa5d..01fad76 100644
--- a/drivers/usb/dwc3/dwc3_otg.c
+++ b/drivers/usb/dwc3/dwc3_otg.c
@@ -482,7 +482,8 @@
power_supply_type = POWER_SUPPLY_TYPE_USB;
else if (dotg->charger->chg_type == DWC3_CDP_CHARGER)
power_supply_type = POWER_SUPPLY_TYPE_USB_CDP;
- else if (dotg->charger->chg_type == DWC3_DCP_CHARGER)
+ else if (dotg->charger->chg_type == DWC3_DCP_CHARGER ||
+ dotg->charger->chg_type == DWC3_PROPRIETARY_CHARGER)
power_supply_type = POWER_SUPPLY_TYPE_USB_DCP;
else
power_supply_type = POWER_SUPPLY_TYPE_BATTERY;
@@ -685,6 +686,7 @@
/* Has charger been detected? If no detect it */
switch (charger->chg_type) {
case DWC3_DCP_CHARGER:
+ case DWC3_PROPRIETARY_CHARGER:
dev_dbg(phy->dev, "lpm, DCP charger\n");
dwc3_otg_set_power(phy,
DWC3_IDEV_CHG_MAX);