aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/keyboard
diff options
context:
space:
mode:
authorMagnus Damm <damm@igel.co.jp>2009-03-10 02:24:21 -0400
committerPaul Mundt <lethal@linux-sh.org>2009-03-10 02:28:07 -0400
commita29b99eccecefe5026713b226f66f117c8837ad5 (patch)
treea71b873f75e87516c54d8f848f1d66bbd2061485 /drivers/input/keyboard
parent508407149a7f927c4b65a20e0a08a2a94dc769c6 (diff)
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/keyboard')
-rw-r--r--drivers/input/keyboard/sh_keysc.c29
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)
219 pdata->scan_timing, priv->iomem_base + KYCR1_OFFS); 219 pdata->scan_timing, priv->iomem_base + KYCR1_OFFS);
220 iowrite16(0, priv->iomem_base + KYOUTDR_OFFS); 220 iowrite16(0, priv->iomem_base + KYOUTDR_OFFS);
221 iowrite16(KYCR2_IRQ_LEVEL, priv->iomem_base + KYCR2_OFFS); 221 iowrite16(KYCR2_IRQ_LEVEL, priv->iomem_base + KYCR2_OFFS);
222
223 device_init_wakeup(&pdev->dev, 1);
222 return 0; 224 return 0;
223 err5: 225 err5:
224 free_irq(irq, pdev); 226 free_irq(irq, pdev);
@@ -253,17 +255,36 @@ static int __devexit sh_keysc_remove(struct platform_device *pdev)
253 return 0; 255 return 0;
254} 256}
255 257
258static int sh_keysc_suspend(struct device *dev)
259{
260 struct platform_device *pdev;
261 struct sh_keysc_priv *priv;
262 unsigned short value;
263
264 pdev = container_of(dev, struct platform_device, dev);
265 priv = platform_get_drvdata(pdev);
266
267 value = ioread16(priv->iomem_base + KYCR1_OFFS);
256 268
257#define sh_keysc_suspend NULL 269 if (device_may_wakeup(dev))
258#define sh_keysc_resume NULL 270 value |= 0x80;
271 else
272 value &= ~0x80;
273
274 iowrite16(value, priv->iomem_base + KYCR1_OFFS);
275 return 0;
276}
277
278static struct dev_pm_ops sh_keysc_dev_pm_ops = {
279 .suspend = sh_keysc_suspend,
280};
259 281
260struct platform_driver sh_keysc_device_driver = { 282struct platform_driver sh_keysc_device_driver = {
261 .probe = sh_keysc_probe, 283 .probe = sh_keysc_probe,
262 .remove = __devexit_p(sh_keysc_remove), 284 .remove = __devexit_p(sh_keysc_remove),
263 .suspend = sh_keysc_suspend,
264 .resume = sh_keysc_resume,
265 .driver = { 285 .driver = {
266 .name = "sh_keysc", 286 .name = "sh_keysc",
287 .pm = &sh_keysc_dev_pm_ops,
267 } 288 }
268}; 289};
269 290