Merge branch 'core/xen' into x86/xen
[safe/jmp/linux-2.6] / drivers / input / keyboard / bf54x-keys.c
index d87ac33..e348cfc 100644 (file)
@@ -29,7 +29,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/version.h>
 
 #include <linux/init.h>
 #include <linux/fs.h>
@@ -44,7 +43,7 @@
 #include <linux/input.h>
 
 #include <asm/portmux.h>
-#include <asm/mach/bf54x_keys.h>
+#include <mach/bf54x_keys.h>
 
 #define DRV_NAME       "bf54x-keys"
 #define TIME_SCALE     100     /* 100 ns */
@@ -312,6 +311,8 @@ static int __devinit bfin_kpad_probe(struct platform_device *pdev)
 
        bfin_write_KPAD_CTL(bfin_read_KPAD_CTL() | KPAD_EN);
 
+       device_init_wakeup(&pdev->dev, 1);
+
        printk(KERN_ERR DRV_NAME
                ": Blackfin BF54x Keypad registered IRQ %d\n", bf54x_kpad->irq);
 
@@ -354,13 +355,40 @@ static int __devexit bfin_kpad_remove(struct platform_device *pdev)
        return 0;
 }
 
+#ifdef CONFIG_PM
+static int bfin_kpad_suspend(struct platform_device *pdev, pm_message_t state)
+{
+       struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev);
+
+       if (device_may_wakeup(&pdev->dev))
+               enable_irq_wake(bf54x_kpad->irq);
+
+       return 0;
+}
+
+static int bfin_kpad_resume(struct platform_device *pdev)
+{
+       struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev);
+
+       if (device_may_wakeup(&pdev->dev))
+               disable_irq_wake(bf54x_kpad->irq);
+
+       return 0;
+}
+#else
+# define bfin_kpad_suspend NULL
+# define bfin_kpad_resume  NULL
+#endif
+
 struct platform_driver bfin_kpad_device_driver = {
-       .probe          = bfin_kpad_probe,
-       .remove         = __devexit_p(bfin_kpad_remove),
        .driver         = {
                .name   = DRV_NAME,
                .owner  = THIS_MODULE,
-       }
+       },
+       .probe          = bfin_kpad_probe,
+       .remove         = __devexit_p(bfin_kpad_remove),
+       .suspend        = bfin_kpad_suspend,
+       .resume         = bfin_kpad_resume,
 };
 
 static int __init bfin_kpad_init(void)