ac5df97dffc11131923c3c724c8a2b3b089621e0
[openembedded.git] /
1 From df0801d2cd6a7081700c79f437d1185cbe1960a7 Mon Sep 17 00:00:00 2001
2 From: Dmitry Baryshkov <dbaryshkov@gmail.com>
3 Date: Wed, 9 Jan 2008 02:08:18 +0300
4 Subject: [PATCH 28/64] Add suspend/resume/wakeup support for pda_power.
5  Now with device_init_wakeup.
6
7 Signed-off-by: Dmitry Baryshkov <dbaryshkov@gmail.com>
8 ---
9  drivers/power/pda_power.c |   34 ++++++++++++++++++++++++++++++++++
10  1 files changed, 34 insertions(+), 0 deletions(-)
11
12 diff --git a/drivers/power/pda_power.c b/drivers/power/pda_power.c
13 index d98622f..28360e8 100644
14 --- a/drivers/power/pda_power.c
15 +++ b/drivers/power/pda_power.c
16 @@ -207,6 +207,8 @@ static int pda_power_probe(struct platform_device *pdev)
17                 }
18         }
19  
20 +       device_init_wakeup(&pdev->dev, 1);
21 +
22         return 0;
23  
24  usb_irq_failed:
25 @@ -239,12 +241,44 @@ static int pda_power_remove(struct platform_device *pdev)
26         return 0;
27  }
28  
29 +#ifdef CONFIG_PM
30 +static int pda_power_suspend(struct platform_device *pdev, pm_message_t state)
31 +{
32 +       if (device_may_wakeup(&pdev->dev)) {
33 +               if (ac_irq)
34 +                       enable_irq_wake(ac_irq->start);
35 +               if (usb_irq)
36 +                       enable_irq_wake(usb_irq->start);
37 +       }
38 +
39 +       return 0;
40 +}
41 +
42 +static int pda_power_resume(struct platform_device *pdev)
43 +{
44 +       if (device_may_wakeup(&pdev->dev)) {
45 +               if (usb_irq)
46 +                       disable_irq_wake(usb_irq->start);
47 +               if (ac_irq)
48 +                       disable_irq_wake(ac_irq->start);
49 +       }
50 +
51 +       return 0;
52 +}
53 +#else
54 +#define pda_power_suspend      NULL
55 +#define pda_power_resume       NULL
56 +#endif
57 +
58 +
59  static struct platform_driver pda_power_pdrv = {
60         .driver = {
61                 .name = "pda-power",
62         },
63         .probe = pda_power_probe,
64         .remove = pda_power_remove,
65 +       .suspend = pda_power_suspend,
66 +       .resume = pda_power_resume,
67  };
68  
69  static int __init pda_power_init(void)
70 -- 
71 1.5.3.8
72