Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 280890
b: refs/heads/master
c: 5076ae5
h: refs/heads/master
v: v3
  • Loading branch information
Neil Zhang authored and Felipe Balbi committed Dec 12, 2011
1 parent 6560d44 commit 5d986c8
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 85ff7bfb6e260d7cc6d675941f5569c9b7ad6b44
refs/heads/master: 5076ae5588e53da32fef697f604fec33fe5fada0
47 changes: 36 additions & 11 deletions trunk/drivers/usb/gadget/mv_udc_core.c
Original file line number Diff line number Diff line change
Expand Up @@ -2447,7 +2447,30 @@ static int mv_udc_suspend(struct device *_dev)
{
struct mv_udc *udc = the_controller;

udc_stop(udc);
/* if OTG is enabled, the following will be done in OTG driver*/
if (udc->transceiver)
return 0;

if (udc->pdata->vbus && udc->pdata->vbus->poll)
if (udc->pdata->vbus->poll() == VBUS_HIGH) {
dev_info(&udc->dev->dev, "USB cable is connected!\n");
return -EAGAIN;
}

/*
* only cable is unplugged, udc can suspend.
* So do not care about clock_gating == 1.
*/
if (!udc->clock_gating) {
udc_stop(udc);

spin_lock_irq(&udc->lock);
/* stop all usb activities */
stop_activity(udc, udc->driver);
spin_unlock_irq(&udc->lock);

mv_udc_disable_internal(udc);
}

return 0;
}
Expand All @@ -2457,20 +2480,22 @@ static int mv_udc_resume(struct device *_dev)
struct mv_udc *udc = the_controller;
int retval;

if (udc->pdata->phy_init) {
retval = udc->pdata->phy_init(udc->phy_regs);
if (retval) {
dev_err(&udc->dev->dev,
"init phy error %d when resume back\n",
retval);
/* if OTG is enabled, the following will be done in OTG driver*/
if (udc->transceiver)
return 0;

if (!udc->clock_gating) {
retval = mv_udc_enable_internal(udc);
if (retval)
return retval;

if (udc->driver && udc->softconnect) {
udc_reset(udc);
ep0_reset(udc);
udc_start(udc);
}
}

udc_reset(udc);
ep0_reset(udc);
udc_start(udc);

return 0;
}

Expand Down

0 comments on commit 5d986c8

Please sign in to comment.