diff options
author | Vijayavardhan Vennapusa <vvreddy@codeaurora.org> | 2018-08-28 11:06:16 +0530 |
---|---|---|
committer | Vijayavardhan Vennapusa <vvreddy@codeaurora.org> | 2018-09-05 14:46:32 +0530 |
commit | 6494e9ee09caf8402f38aa94d95c0bba0882846a (patch) | |
tree | c6964da5181617c46f2380017b34745ec840c25e /drivers/usb/dwc3/dwc3-msm.c | |
parent | 51740526b9b90ef772ba2c3c6b288f0d1688bb10 (diff) |
USB: pd: Notify selfpowered state based on type C current
It is required to notify device as selfpowered and bmaxpower as zero
even for non PD capable devices based on Type C current. Hence notify
as selfpowerer in bMattributes of configuation descriptor in case of
medium or high Type C current.
Change-Id: Ie552560d93a8195f4c69fdaf6086ef3a52b31d39
Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
Diffstat (limited to 'drivers/usb/dwc3/dwc3-msm.c')
-rw-r--r-- | drivers/usb/dwc3/dwc3-msm.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/usb/dwc3/dwc3-msm.c b/drivers/usb/dwc3/dwc3-msm.c index 623f3ce211aa..2b4a6de99876 100644 --- a/drivers/usb/dwc3/dwc3-msm.c +++ b/drivers/usb/dwc3/dwc3-msm.c @@ -2629,6 +2629,7 @@ static int dwc3_msm_vbus_notifier(struct notifier_block *nb, struct extcon_dev *edev = ptr; int cc_state; int speed; + int self_powered; if (!edev) { dev_err(mdwc->dev, "%s: edev null\n", __func__); @@ -2654,6 +2655,13 @@ static int dwc3_msm_vbus_notifier(struct notifier_block *nb, if (dwc->maximum_speed > dwc->max_hw_supp_speed) dwc->maximum_speed = dwc->max_hw_supp_speed; + self_powered = extcon_get_cable_state_(edev, + EXTCON_USB_TYPEC_MED_HIGH_CURRENT); + if (self_powered < 0) + dwc->gadget.is_selfpowered = 0; + else + dwc->gadget.is_selfpowered = self_powered; + mdwc->vbus_active = event; if (dwc->is_drd && !mdwc->in_restart) { dbg_event(0xFF, "Q RW (vbus)", mdwc->vbus_active); |