diff options
author | Peter Chen <peter.chen@nxp.com> | 2020-01-23 09:00:26 +0300 |
---|---|---|
committer | Peter Chen <peter.chen@nxp.com> | 2020-05-06 04:41:55 +0300 |
commit | d755cdb1b9d7e1b645e176b97eb137194bbe8cf9 (patch) | |
tree | 056bf0e141883ca890210918d1f3d842787567ee /drivers/usb/chipidea | |
parent | 4ee2fc81a631a3a2a45f3f6939323e8a5fea1e29 (diff) | |
download | linux-d755cdb1b9d7e1b645e176b97eb137194bbe8cf9.tar.xz |
usb: chipidea: introduce CI_HDRC_CONTROLLER_VBUS_EVENT glue layer use
Some vendors glue layer need to handle some events for vbus, eg,
some i.mx platforms (imx7d, imx8mm, imx8mn, etc) needs vbus event
to handle charger detection, its charger detection is finished at
glue layer code, but not at USB PHY driver.
Signed-off-by: Peter Chen <peter.chen@nxp.com>
Diffstat (limited to 'drivers/usb/chipidea')
-rw-r--r-- | drivers/usb/chipidea/udc.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c index 921bcf14dc06..da70fbe7ca4c 100644 --- a/drivers/usb/chipidea/udc.c +++ b/drivers/usb/chipidea/udc.c @@ -1561,6 +1561,7 @@ static int ci_udc_vbus_session(struct usb_gadget *_gadget, int is_active) { struct ci_hdrc *ci = container_of(_gadget, struct ci_hdrc, gadget); unsigned long flags; + int ret = 0; spin_lock_irqsave(&ci->lock, flags); ci->vbus_active = is_active; @@ -1570,10 +1571,14 @@ static int ci_udc_vbus_session(struct usb_gadget *_gadget, int is_active) usb_phy_set_charger_state(ci->usb_phy, is_active ? USB_CHARGER_PRESENT : USB_CHARGER_ABSENT); + if (ci->platdata->notify_event) + ret = ci->platdata->notify_event(ci, + CI_HDRC_CONTROLLER_VBUS_EVENT); + if (ci->driver) ci_hdrc_gadget_connect(_gadget, is_active); - return 0; + return ret; } static int ci_udc_wakeup(struct usb_gadget *_gadget) |