mirror of
git://projects.qi-hardware.com/openwrt-xburst.git
synced 2024-08-20 16:58:59 +03:00
[xburst] jz4740_udc: Implement suspend/resume
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@19978 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
parent
d34517dacf
commit
37f69cee3c
@ -160,11 +160,6 @@
|
|||||||
# define DEBUG_SETUP(fmt,args...) do {} while(0)
|
# define DEBUG_SETUP(fmt,args...) do {} while(0)
|
||||||
#endif
|
#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 */
|
static unsigned int use_dma = 0; /* 1: use DMA, 0: use PIO */
|
||||||
|
|
||||||
module_param(use_dma, int, 0);
|
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.
|
* there are no actions on the USB bus.
|
||||||
* UDC still works during this bit was set.
|
* UDC still works during this bit was set.
|
||||||
*/
|
*/
|
||||||
jz4740_clock_udc_enable_auto_suspend();
|
jz4740_clock_udc_enable_auto_suspend();
|
||||||
|
|
||||||
/* Enable the USB PHY */
|
/* Enable the USB PHY */
|
||||||
clk_enable(dev->clk);
|
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)
|
static int jz4740_udc_pullup(struct usb_gadget *_gadget, int on)
|
||||||
{
|
{
|
||||||
struct jz4740_udc *udc = gadget_to_udc(_gadget);
|
struct jz4740_udc *udc = gadget_to_udc(_gadget);
|
||||||
|
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
|
|
||||||
local_irq_save(flags);
|
local_irq_save(flags);
|
||||||
@ -2170,6 +2164,7 @@ static int jz4740_udc_pullup(struct usb_gadget *_gadget, int on)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const struct usb_gadget_ops jz4740_udc_ops = {
|
static const struct usb_gadget_ops jz4740_udc_ops = {
|
||||||
.get_frame = jz4740_udc_get_frame,
|
.get_frame = jz4740_udc_get_frame,
|
||||||
.wakeup = jz4740_udc_wakeup,
|
.wakeup = jz4740_udc_wakeup,
|
||||||
@ -2381,12 +2376,48 @@ static int jz4740_udc_remove(struct platform_device *pdev)
|
|||||||
return 0;
|
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 = {
|
static struct platform_driver udc_driver = {
|
||||||
.probe = jz4740_udc_probe,
|
.probe = jz4740_udc_probe,
|
||||||
.remove = jz4740_udc_remove,
|
.remove = jz4740_udc_remove,
|
||||||
.driver = {
|
.driver = {
|
||||||
.name = "jz-udc",
|
.name = "jz-udc",
|
||||||
.owner = THIS_MODULE,
|
.owner = THIS_MODULE,
|
||||||
|
.pm = JZ4740_UDC_PM_OPS,
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -2396,13 +2427,12 @@ static int __init udc_init (void)
|
|||||||
{
|
{
|
||||||
return platform_driver_register(&udc_driver);
|
return platform_driver_register(&udc_driver);
|
||||||
}
|
}
|
||||||
|
module_init(udc_init);
|
||||||
|
|
||||||
static void __exit udc_exit (void)
|
static void __exit udc_exit (void)
|
||||||
{
|
{
|
||||||
platform_driver_unregister(&udc_driver);
|
platform_driver_unregister(&udc_driver);
|
||||||
}
|
}
|
||||||
|
|
||||||
module_init(udc_init);
|
|
||||||
module_exit(udc_exit);
|
module_exit(udc_exit);
|
||||||
|
|
||||||
MODULE_DESCRIPTION("JZ4740 USB Device Controller");
|
MODULE_DESCRIPTION("JZ4740 USB Device Controller");
|
||||||
|
Loading…
Reference in New Issue
Block a user