diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2010-03-04 20:20:54 +0000 |
---|---|---|
committer | Lars-Peter Clausen <lars@metafoo.de> | 2010-03-04 20:20:54 +0000 |
commit | 7c966b8a3271a9312292094671dfcb7c08ec61c7 (patch) | |
tree | 17540edd6ea28db5d4294cc5bc7e1d5b90014e2c /target | |
parent | 86494323fe2fa4cd6b2a76a7b4b31ef01b0c7d5f (diff) | |
download | mtk-20170518-7c966b8a3271a9312292094671dfcb7c08ec61c7.zip mtk-20170518-7c966b8a3271a9312292094671dfcb7c08ec61c7.tar.gz mtk-20170518-7c966b8a3271a9312292094671dfcb7c08ec61c7.tar.bz2 |
jz4740_udc: Implement suspend/resume
SVN-Revision: 19978
Diffstat (limited to 'target')
-rw-r--r-- | target/linux/xburst/files-2.6.32/drivers/usb/gadget/jz4740_udc.c | 48 |
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 881bca7..8c58494 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"); |