summaryrefslogtreecommitdiffstats
path: root/target/linux
diff options
context:
space:
mode:
authorlars <lars@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-03-04 20:20:54 +0000
committerlars <lars@3c298f89-4303-0410-b956-a3cf2f4a3e73>2010-03-04 20:20:54 +0000
commit37f69cee3c49eef1e3390348c7bb03eaeb1a7ca1 (patch)
treefeeefbd4d5a32db9aa4983cde94381ead6adbcbc /target/linux
parentd34517dacf5175d12bf2349f5bea5b192f6064fb (diff)
[xburst] jz4740_udc: Implement suspend/resume
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19978 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/xburst/files-2.6.32/drivers/usb/gadget/jz4740_udc.c48
1 files changed, 39 insertions, 9 deletions
diff --git a/target/linux/xburst/files-2.6.32/drivers/usb/gadget/jz4740_udc.c b/target/linux/xburst/files-2.6.32/drivers/usb/gadget/jz4740_udc.c
index 881bca786..8c58494b9 100644
--- a/target/linux/xburst/files-2.6.32/drivers/usb/gadget/jz4740_udc.c
+++ b/target/linux/xburst/files-2.6.32/drivers/usb/gadget/jz4740_udc.c
@@ -160,11 +160,6 @@
# define DEBUG_SETUP(fmt,args...) do {} while(0)
#endif
-static unsigned int udc_debug = 0; /* 0: normal mode, 1: test udc cable type mode */
-
-module_param(udc_debug, int, 0);
-MODULE_PARM_DESC(udc_debug, "test udc cable or power type");
-
static unsigned int use_dma = 0; /* 1: use DMA, 0: use PIO */
module_param(use_dma, int, 0);
@@ -407,7 +402,7 @@ static void udc_enable(struct jz4740_udc *dev)
* there are no actions on the USB bus.
* UDC still works during this bit was set.
*/
- jz4740_clock_udc_enable_auto_suspend();
+ jz4740_clock_udc_enable_auto_suspend();
/* Enable the USB PHY */
clk_enable(dev->clk);
@@ -2152,7 +2147,6 @@ static int jz4740_udc_wakeup(struct usb_gadget *_gadget)
static int jz4740_udc_pullup(struct usb_gadget *_gadget, int on)
{
struct jz4740_udc *udc = gadget_to_udc(_gadget);
-
unsigned long flags;
local_irq_save(flags);
@@ -2170,6 +2164,7 @@ static int jz4740_udc_pullup(struct usb_gadget *_gadget, int on)
return 0;
}
+
static const struct usb_gadget_ops jz4740_udc_ops = {
.get_frame = jz4740_udc_get_frame,
.wakeup = jz4740_udc_wakeup,
@@ -2381,12 +2376,48 @@ static int jz4740_udc_remove(struct platform_device *pdev)
return 0;
}
+#ifdef CONFIG_PM
+
+static int jz4740_udc_suspend(struct device *dev)
+{
+ struct jz4740_udc *udc = dev_get_drvdata(dev);
+
+ if (udc->state == UDC_STATE_ENABLE)
+ udc_disable(udc);
+
+ return 0;
+}
+
+static int jz4740_udc_resume(struct device *dev)
+{
+ struct jz4740_udc *udc = dev_get_drvdata(dev);
+
+ if (udc->state == UDC_STATE_ENABLE)
+ udc_enable(udc);
+
+ return 0;
+}
+
+static struct dev_pm_ops jz4740_udc_pm_ops = {
+ .suspend = jz4740_udc_suspend,
+ .resume = jz4740_udc_resume,
+};
+
+#define JZ4740_UDC_PM_OPS (&jz4740_udc_pm_ops)
+
+#else
+
+#define JZ4740_UDC_PM_OPS NULL
+
+#endif
+
static struct platform_driver udc_driver = {
.probe = jz4740_udc_probe,
.remove = jz4740_udc_remove,
.driver = {
.name = "jz-udc",
.owner = THIS_MODULE,
+ .pm = JZ4740_UDC_PM_OPS,
},
};
@@ -2396,13 +2427,12 @@ static int __init udc_init (void)
{
return platform_driver_register(&udc_driver);
}
+module_init(udc_init);
static void __exit udc_exit (void)
{
platform_driver_unregister(&udc_driver);
}
-
-module_init(udc_init);
module_exit(udc_exit);
MODULE_DESCRIPTION("JZ4740 USB Device Controller");