diff options
| -rw-r--r-- | drivers/usb/gadget/s3c-hsotg.c | 53 |
1 files changed, 49 insertions, 4 deletions
diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c index 99c8e3ca6a3c..2a9cb674926a 100644 --- a/drivers/usb/gadget/s3c-hsotg.c +++ b/drivers/usb/gadget/s3c-hsotg.c | |||
| @@ -3774,10 +3774,55 @@ static int s3c_hsotg_remove(struct platform_device *pdev) | |||
| 3774 | return 0; | 3774 | return 0; |
| 3775 | } | 3775 | } |
| 3776 | 3776 | ||
| 3777 | #if 1 | 3777 | static int s3c_hsotg_suspend(struct platform_device *pdev, pm_message_t state) |
| 3778 | #define s3c_hsotg_suspend NULL | 3778 | { |
| 3779 | #define s3c_hsotg_resume NULL | 3779 | struct s3c_hsotg *hsotg = platform_get_drvdata(pdev); |
| 3780 | #endif | 3780 | unsigned long flags; |
| 3781 | int ret = 0; | ||
| 3782 | |||
| 3783 | if (hsotg->driver) | ||
| 3784 | dev_info(hsotg->dev, "suspending usb gadget %s\n", | ||
| 3785 | hsotg->driver->driver.name); | ||
| 3786 | |||
| 3787 | spin_lock_irqsave(&hsotg->lock, flags); | ||
| 3788 | s3c_hsotg_disconnect(hsotg); | ||
| 3789 | s3c_hsotg_phy_disable(hsotg); | ||
| 3790 | hsotg->gadget.speed = USB_SPEED_UNKNOWN; | ||
| 3791 | spin_unlock_irqrestore(&hsotg->lock, flags); | ||
| 3792 | |||
| 3793 | if (hsotg->driver) { | ||
| 3794 | int ep; | ||
| 3795 | for (ep = 0; ep < hsotg->num_of_eps; ep++) | ||
| 3796 | s3c_hsotg_ep_disable(&hsotg->eps[ep].ep); | ||
| 3797 | |||
| 3798 | ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), | ||
| 3799 | hsotg->supplies); | ||
| 3800 | } | ||
| 3801 | |||
| 3802 | return ret; | ||
| 3803 | } | ||
| 3804 | |||
| 3805 | static int s3c_hsotg_resume(struct platform_device *pdev) | ||
| 3806 | { | ||
| 3807 | struct s3c_hsotg *hsotg = platform_get_drvdata(pdev); | ||
| 3808 | unsigned long flags; | ||
| 3809 | int ret = 0; | ||
| 3810 | |||
| 3811 | if (hsotg->driver) { | ||
| 3812 | dev_info(hsotg->dev, "resuming usb gadget %s\n", | ||
| 3813 | hsotg->driver->driver.name); | ||
| 3814 | ret = regulator_bulk_enable(ARRAY_SIZE(hsotg->supplies), | ||
| 3815 | hsotg->supplies); | ||
| 3816 | } | ||
| 3817 | |||
| 3818 | spin_lock_irqsave(&hsotg->lock, flags); | ||
| 3819 | hsotg->last_rst = jiffies; | ||
| 3820 | s3c_hsotg_phy_enable(hsotg); | ||
| 3821 | s3c_hsotg_core_init(hsotg); | ||
| 3822 | spin_unlock_irqrestore(&hsotg->lock, flags); | ||
| 3823 | |||
| 3824 | return ret; | ||
| 3825 | } | ||
| 3781 | 3826 | ||
| 3782 | #ifdef CONFIG_OF | 3827 | #ifdef CONFIG_OF |
| 3783 | static const struct of_device_id s3c_hsotg_of_ids[] = { | 3828 | static const struct of_device_id s3c_hsotg_of_ids[] = { |
