Skip to content

Commit

Permalink
usb: chipidea: introduce CI_HDRC_CONTROLLER_VBUS_EVENT glue layer use
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Peter Chen committed May 6, 2020
1 parent 4ee2fc8 commit d755cdb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/usb/chipidea/udc.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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)
Expand Down
1 change: 1 addition & 0 deletions include/linux/usb/chipidea.h
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ struct ci_hdrc_platform_data {
#define CI_HDRC_CONTROLLER_STOPPED_EVENT 1
#define CI_HDRC_IMX_HSIC_ACTIVE_EVENT 2
#define CI_HDRC_IMX_HSIC_SUSPEND_EVENT 3
#define CI_HDRC_CONTROLLER_VBUS_EVENT 4
int (*notify_event) (struct ci_hdrc *ci, unsigned event);
struct regulator *reg_vbus;
struct usb_otg_caps ci_otg_caps;
Expand Down

0 comments on commit d755cdb

Please sign in to comment.