summaryrefslogtreecommitdiff
path: root/patches.tizen/0882-drivers-s3c-hsotg-add-proper-suspend-resume-support.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches.tizen/0882-drivers-s3c-hsotg-add-proper-suspend-resume-support.patch')
-rw-r--r--patches.tizen/0882-drivers-s3c-hsotg-add-proper-suspend-resume-support.patch77
1 files changed, 77 insertions, 0 deletions
diff --git a/patches.tizen/0882-drivers-s3c-hsotg-add-proper-suspend-resume-support.patch b/patches.tizen/0882-drivers-s3c-hsotg-add-proper-suspend-resume-support.patch
new file mode 100644
index 00000000000..f93cafdfcb7
--- /dev/null
+++ b/patches.tizen/0882-drivers-s3c-hsotg-add-proper-suspend-resume-support.patch
@@ -0,0 +1,77 @@
+From 0731988585aff6355bad682f32bc3f4ecca08c84 Mon Sep 17 00:00:00 2001
+From: Marek Szyprowski <m.szyprowski@samsung.com>
+Date: Tue, 22 Oct 2013 14:42:14 +0200
+Subject: [PATCH 0882/1302] drivers: s3c-hsotg: add proper suspend/resume
+ support
+
+Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
+Signed-off-by: MyungJoo Ham <myungjoo.ham@samsung.com>
+---
+ drivers/usb/gadget/s3c-hsotg.c | 51 ++++++++++++++++++++++++++++++++++++++----
+ 1 file changed, 47 insertions(+), 4 deletions(-)
+
+diff --git a/drivers/usb/gadget/s3c-hsotg.c b/drivers/usb/gadget/s3c-hsotg.c
+index 25008c0..55c6f92 100644
+--- a/drivers/usb/gadget/s3c-hsotg.c
++++ b/drivers/usb/gadget/s3c-hsotg.c
+@@ -3677,10 +3677,53 @@ static int s3c_hsotg_remove(struct platform_device *pdev)
+ return 0;
+ }
+
+-#if 1
+-#define s3c_hsotg_suspend NULL
+-#define s3c_hsotg_resume NULL
+-#endif
++static int s3c_hsotg_suspend(struct platform_device *pdev, pm_message_t state)
++{
++ struct s3c_hsotg *hsotg = platform_get_drvdata(pdev);
++ unsigned long flags;
++ int ret = 0;
++
++ if (hsotg->driver)
++ dev_info(hsotg->dev, "suspending usb gadget %s\n", hsotg->driver->driver.name);
++
++ spin_lock_irqsave(&hsotg->lock, flags);
++ s3c_hsotg_disconnect(hsotg);
++ s3c_hsotg_phy_disable(hsotg);
++ hsotg->gadget.speed = USB_SPEED_UNKNOWN;
++ spin_unlock_irqrestore(&hsotg->lock, flags);
++
++ if (hsotg->driver) {
++ int ep;
++ for (ep = 0; ep < hsotg->num_of_eps; ep++)
++ s3c_hsotg_ep_disable(&hsotg->eps[ep].ep);
++
++ ret = regulator_bulk_disable(ARRAY_SIZE(hsotg->supplies), hsotg->supplies);
++ }
++
++ return ret;
++}
++
++static int s3c_hsotg_resume(struct platform_device *pdev)
++{
++ struct s3c_hsotg *hsotg = platform_get_drvdata(pdev);
++ unsigned long flags;
++ int ret = 0;
++
++ if (hsotg->driver)
++ dev_info(hsotg->dev, "resuming usb gadget %s\n", hsotg->driver->driver.name);
++
++ spin_lock_irqsave(&hsotg->lock, flags);
++ hsotg->last_rst = jiffies;
++ s3c_hsotg_phy_enable(hsotg);
++ s3c_hsotg_core_init(hsotg);
++ spin_unlock_irqrestore(&hsotg->lock, flags);
++
++ if (hsotg->driver)
++ ret = regulator_bulk_enable(ARRAY_SIZE(hsotg->supplies),
++ hsotg->supplies);
++
++ return ret;
++}
+
+ static const struct of_device_id s3c_hsotg_of_ids[] = {
+ { .compatible = "samsung,s3c-hsotg", },
+--
+1.8.3.2
+