summaryrefslogtreecommitdiff
path: root/drivers/usb/chipidea
diff options
context:
space:
mode:
authorLi Jun <jun.li@nxp.com>2017-09-04 23:14:01 +0800
committerPeter Chen <peter.chen@nxp.com>2017-09-21 11:15:56 +0800
commitfc5b920c3b9bbe9bf05aeb1c497643608ecb656b (patch)
tree7bdc574763950363e77ad0353b9a1449c789505d /drivers/usb/chipidea
parent38502ef49f96f7fe25fcb3aaa904a570df955c2c (diff)
usb: chipidea: do charger detection in vbus session
In case the usb phy has the capability to detect usb charger type, do it when vbus is on. Signed-off-by: Li Jun <jun.li@nxp.com> Signed-off-by: Peter Chen <peter.chen@nxp.com>
Diffstat (limited to 'drivers/usb/chipidea')
-rw-r--r--drivers/usb/chipidea/udc.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
index fe8a90543ea3..daffa5ed396d 100644
--- a/drivers/usb/chipidea/udc.c
+++ b/drivers/usb/chipidea/udc.c
@@ -1526,6 +1526,10 @@ static int ci_udc_vbus_session(struct usb_gadget *_gadget, int is_active)
gadget_ready = 1;
spin_unlock_irqrestore(&ci->lock, flags);
+ if (ci->usb_phy)
+ usb_phy_set_charger_state(ci->usb_phy, is_active ?
+ USB_CHARGER_PRESENT : USB_CHARGER_ABSENT);
+
if (gadget_ready) {
if (is_active) {
pm_runtime_get_sync(&_gadget->dev);