aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Lauss <manuel.lauss@googlemail.com>2009-07-29 13:13:13 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2009-09-23 09:46:29 -0400
commit807fcb5e19877d339a4cc56f2c6ddaf3a147457a (patch)
tree561c5309e691a40dfbceef34138d6766759ed59d
parent64aebe73152ab3a9f5f426baaf65db632bd72c13 (diff)
USB: au1xxx: add dev_pm_ops
move both ohci-au1xxx and ehci-au1xxx over to dev_pm_ops. Tested on Au1200. Signed-off-by: Manuel Lauss <manuel.lauss@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
-rw-r--r--drivers/usb/host/ehci-au1xxx.c29
-rw-r--r--drivers/usb/host/ohci-au1xxx.c27
2 files changed, 27 insertions, 29 deletions
diff --git a/drivers/usb/host/ehci-au1xxx.c b/drivers/usb/host/ehci-au1xxx.c
index 59d208d94d4e..ed77be76d6bb 100644
--- a/drivers/usb/host/ehci-au1xxx.c
+++ b/drivers/usb/host/ehci-au1xxx.c
@@ -199,10 +199,9 @@ static int ehci_hcd_au1xxx_drv_remove(struct platform_device *pdev)
199} 199}
200 200
201#ifdef CONFIG_PM 201#ifdef CONFIG_PM
202static int ehci_hcd_au1xxx_drv_suspend(struct platform_device *pdev, 202static int ehci_hcd_au1xxx_drv_suspend(struct device *dev)
203 pm_message_t message)
204{ 203{
205 struct usb_hcd *hcd = platform_get_drvdata(pdev); 204 struct usb_hcd *hcd = dev_get_drvdata(dev);
206 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 205 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
207 unsigned long flags; 206 unsigned long flags;
208 int rc; 207 int rc;
@@ -229,12 +228,6 @@ static int ehci_hcd_au1xxx_drv_suspend(struct platform_device *pdev,
229 ehci_writel(ehci, 0, &ehci->regs->intr_enable); 228 ehci_writel(ehci, 0, &ehci->regs->intr_enable);
230 (void)ehci_readl(ehci, &ehci->regs->intr_enable); 229 (void)ehci_readl(ehci, &ehci->regs->intr_enable);
231 230
232 /* make sure snapshot being resumed re-enumerates everything */
233 if (message.event == PM_EVENT_PRETHAW) {
234 ehci_halt(ehci);
235 ehci_reset(ehci);
236 }
237
238 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); 231 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
239 232
240 au1xxx_stop_ehc(); 233 au1xxx_stop_ehc();
@@ -248,10 +241,9 @@ bail:
248 return rc; 241 return rc;
249} 242}
250 243
251 244static int ehci_hcd_au1xxx_drv_resume(struct device *dev)
252static int ehci_hcd_au1xxx_drv_resume(struct platform_device *pdev)
253{ 245{
254 struct usb_hcd *hcd = platform_get_drvdata(pdev); 246 struct usb_hcd *hcd = dev_get_drvdata(dev);
255 struct ehci_hcd *ehci = hcd_to_ehci(hcd); 247 struct ehci_hcd *ehci = hcd_to_ehci(hcd);
256 248
257 au1xxx_start_ehc(); 249 au1xxx_start_ehc();
@@ -305,20 +297,25 @@ static int ehci_hcd_au1xxx_drv_resume(struct platform_device *pdev)
305 return 0; 297 return 0;
306} 298}
307 299
300static struct dev_pm_ops au1xxx_ehci_pmops = {
301 .suspend = ehci_hcd_au1xxx_drv_suspend,
302 .resume = ehci_hcd_au1xxx_drv_resume,
303};
304
305#define AU1XXX_EHCI_PMOPS &au1xxx_ehci_pmops
306
308#else 307#else
309#define ehci_hcd_au1xxx_drv_suspend NULL 308#define AU1XXX_EHCI_PMOPS NULL
310#define ehci_hcd_au1xxx_drv_resume NULL
311#endif 309#endif
312 310
313static struct platform_driver ehci_hcd_au1xxx_driver = { 311static struct platform_driver ehci_hcd_au1xxx_driver = {
314 .probe = ehci_hcd_au1xxx_drv_probe, 312 .probe = ehci_hcd_au1xxx_drv_probe,
315 .remove = ehci_hcd_au1xxx_drv_remove, 313 .remove = ehci_hcd_au1xxx_drv_remove,
316 .shutdown = usb_hcd_platform_shutdown, 314 .shutdown = usb_hcd_platform_shutdown,
317 .suspend = ehci_hcd_au1xxx_drv_suspend,
318 .resume = ehci_hcd_au1xxx_drv_resume,
319 .driver = { 315 .driver = {
320 .name = "au1xxx-ehci", 316 .name = "au1xxx-ehci",
321 .owner = THIS_MODULE, 317 .owner = THIS_MODULE,
318 .pm = AU1XXX_EHCI_PMOPS,
322 } 319 }
323}; 320};
324 321
diff --git a/drivers/usb/host/ohci-au1xxx.c b/drivers/usb/host/ohci-au1xxx.c
index 2ac4e022a13f..e4380082ebb1 100644
--- a/drivers/usb/host/ohci-au1xxx.c
+++ b/drivers/usb/host/ohci-au1xxx.c
@@ -248,10 +248,9 @@ static int ohci_hcd_au1xxx_drv_remove(struct platform_device *pdev)
248} 248}
249 249
250#ifdef CONFIG_PM 250#ifdef CONFIG_PM
251static int ohci_hcd_au1xxx_drv_suspend(struct platform_device *pdev, 251static int ohci_hcd_au1xxx_drv_suspend(struct device *dev)
252 pm_message_t message)
253{ 252{
254 struct usb_hcd *hcd = platform_get_drvdata(pdev); 253 struct usb_hcd *hcd = dev_get_drvdata(dev);
255 struct ohci_hcd *ohci = hcd_to_ohci(hcd); 254 struct ohci_hcd *ohci = hcd_to_ohci(hcd);
256 unsigned long flags; 255 unsigned long flags;
257 int rc; 256 int rc;
@@ -274,10 +273,6 @@ static int ohci_hcd_au1xxx_drv_suspend(struct platform_device *pdev,
274 ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable); 273 ohci_writel(ohci, OHCI_INTR_MIE, &ohci->regs->intrdisable);
275 (void)ohci_readl(ohci, &ohci->regs->intrdisable); 274 (void)ohci_readl(ohci, &ohci->regs->intrdisable);
276 275
277 /* make sure snapshot being resumed re-enumerates everything */
278 if (message.event == PM_EVENT_PRETHAW)
279 ohci_usb_reset(ohci);
280
281 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); 276 clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags);
282 277
283 au1xxx_stop_ohc(); 278 au1xxx_stop_ohc();
@@ -287,9 +282,9 @@ bail:
287 return rc; 282 return rc;
288} 283}
289 284
290static int ohci_hcd_au1xxx_drv_resume(struct platform_device *pdev) 285static int ohci_hcd_au1xxx_drv_resume(struct device *dev)
291{ 286{
292 struct usb_hcd *hcd = platform_get_drvdata(pdev); 287 struct usb_hcd *hcd = dev_get_drvdata(dev);
293 288
294 au1xxx_start_ohc(); 289 au1xxx_start_ohc();
295 290
@@ -298,20 +293,26 @@ static int ohci_hcd_au1xxx_drv_resume(struct platform_device *pdev)
298 293
299 return 0; 294 return 0;
300} 295}
296
297static struct dev_pm_ops au1xxx_ohci_pmops = {
298 .suspend = ohci_hcd_au1xxx_drv_suspend,
299 .resume = ohci_hcd_au1xxx_drv_resume,
300};
301
302#define AU1XXX_OHCI_PMOPS &au1xxx_ohci_pmops
303
301#else 304#else
302#define ohci_hcd_au1xxx_drv_suspend NULL 305#define AU1XXX_OHCI_PMOPS NULL
303#define ohci_hcd_au1xxx_drv_resume NULL
304#endif 306#endif
305 307
306static struct platform_driver ohci_hcd_au1xxx_driver = { 308static struct platform_driver ohci_hcd_au1xxx_driver = {
307 .probe = ohci_hcd_au1xxx_drv_probe, 309 .probe = ohci_hcd_au1xxx_drv_probe,
308 .remove = ohci_hcd_au1xxx_drv_remove, 310 .remove = ohci_hcd_au1xxx_drv_remove,
309 .shutdown = usb_hcd_platform_shutdown, 311 .shutdown = usb_hcd_platform_shutdown,
310 .suspend = ohci_hcd_au1xxx_drv_suspend,
311 .resume = ohci_hcd_au1xxx_drv_resume,
312 .driver = { 312 .driver = {
313 .name = "au1xxx-ohci", 313 .name = "au1xxx-ohci",
314 .owner = THIS_MODULE, 314 .owner = THIS_MODULE,
315 .pm = AU1XXX_OHCI_PMOPS,
315 }, 316 },
316}; 317};
317 318