diff options
author | Li Jun <jun.li@nxp.com> | 2017-09-04 11:14:01 -0400 |
---|---|---|
committer | Peter Chen <peter.chen@nxp.com> | 2017-09-20 23:15:56 -0400 |
commit | fc5b920c3b9bbe9bf05aeb1c497643608ecb656b (patch) | |
tree | 7bdc574763950363e77ad0353b9a1449c789505d /drivers/usb/chipidea/udc.c | |
parent | 38502ef49f96f7fe25fcb3aaa904a570df955c2c (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/udc.c')
-rw-r--r-- | drivers/usb/chipidea/udc.c | 4 |
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) | |||
1526 | gadget_ready = 1; | 1526 | gadget_ready = 1; |
1527 | spin_unlock_irqrestore(&ci->lock, flags); | 1527 | spin_unlock_irqrestore(&ci->lock, flags); |
1528 | 1528 | ||
1529 | if (ci->usb_phy) | ||
1530 | usb_phy_set_charger_state(ci->usb_phy, is_active ? | ||
1531 | USB_CHARGER_PRESENT : USB_CHARGER_ABSENT); | ||
1532 | |||
1529 | if (gadget_ready) { | 1533 | if (gadget_ready) { |
1530 | if (is_active) { | 1534 | if (is_active) { |
1531 | pm_runtime_get_sync(&_gadget->dev); | 1535 | pm_runtime_get_sync(&_gadget->dev); |