diff options
author | Magnus Damm <damm@igel.co.jp> | 2009-03-10 06:24:21 +0000 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2009-03-10 15:28:07 +0900 |
commit | a29b99eccecefe5026713b226f66f117c8837ad5 (patch) | |
tree | a71b873f75e87516c54d8f848f1d66bbd2061485 /drivers/input | |
parent | 508407149a7f927c4b65a20e0a08a2a94dc769c6 (diff) | |
download | blackbird-obmc-linux-a29b99eccecefe5026713b226f66f117c8837ad5.tar.gz blackbird-obmc-linux-a29b99eccecefe5026713b226f66f117c8837ad5.zip |
input: add suspend wakeup support to sh_keysc
This patch adds wakeup support to the sh_keysc driver.
With this feature the ".../power/wakeup" file can be
used to enable and disable if the device takes the
system out of suspend. Default is enabled.
Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers/input')
-rw-r--r-- | drivers/input/keyboard/sh_keysc.c | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/drivers/input/keyboard/sh_keysc.c b/drivers/input/keyboard/sh_keysc.c index 5c8a1bcf7ca7..bf92178644ab 100644 --- a/drivers/input/keyboard/sh_keysc.c +++ b/drivers/input/keyboard/sh_keysc.c @@ -219,6 +219,8 @@ static int __devinit sh_keysc_probe(struct platform_device *pdev) pdata->scan_timing, priv->iomem_base + KYCR1_OFFS); iowrite16(0, priv->iomem_base + KYOUTDR_OFFS); iowrite16(KYCR2_IRQ_LEVEL, priv->iomem_base + KYCR2_OFFS); + + device_init_wakeup(&pdev->dev, 1); return 0; err5: free_irq(irq, pdev); @@ -253,17 +255,36 @@ static int __devexit sh_keysc_remove(struct platform_device *pdev) return 0; } +static int sh_keysc_suspend(struct device *dev) +{ + struct platform_device *pdev; + struct sh_keysc_priv *priv; + unsigned short value; + + pdev = container_of(dev, struct platform_device, dev); + priv = platform_get_drvdata(pdev); + + value = ioread16(priv->iomem_base + KYCR1_OFFS); -#define sh_keysc_suspend NULL -#define sh_keysc_resume NULL + if (device_may_wakeup(dev)) + value |= 0x80; + else + value &= ~0x80; + + iowrite16(value, priv->iomem_base + KYCR1_OFFS); + return 0; +} + +static struct dev_pm_ops sh_keysc_dev_pm_ops = { + .suspend = sh_keysc_suspend, +}; struct platform_driver sh_keysc_device_driver = { .probe = sh_keysc_probe, .remove = __devexit_p(sh_keysc_remove), - .suspend = sh_keysc_suspend, - .resume = sh_keysc_resume, .driver = { .name = "sh_keysc", + .pm = &sh_keysc_dev_pm_ops, } }; |