Skip to content

Commit

Permalink
input: sh_keysc: use enable/disable_irq_wake()
Browse files Browse the repository at this point in the history
Modify the sh_keysc driver to use enable/disable_irq_wake()
during suspend and resume. These functions are used to enable
the sh_keysc interrupt in the interrupt controller so the
keypad can be used to wakeup the system from suspend.

Signed-off-by: Magnus Damm <damm@igel.co.jp>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
  • Loading branch information
Magnus Damm authored and Paul Mundt committed Apr 2, 2009
1 parent 2dcec7a commit 4ba50df
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion drivers/input/keyboard/sh_keysc.c
Original file line number Diff line number Diff line change
Expand Up @@ -259,21 +259,36 @@ static int sh_keysc_suspend(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
struct sh_keysc_priv *priv = platform_get_drvdata(pdev);
int irq = platform_get_irq(pdev, 0);
unsigned short value;

value = ioread16(priv->iomem_base + KYCR1_OFFS);

if (device_may_wakeup(dev))
if (device_may_wakeup(dev)) {
value |= 0x80;
enable_irq_wake(irq);
}
else
value &= ~0x80;

iowrite16(value, priv->iomem_base + KYCR1_OFFS);
return 0;
}

static int sh_keysc_resume(struct device *dev)
{
struct platform_device *pdev = to_platform_device(dev);
int irq = platform_get_irq(pdev, 0);

if (device_may_wakeup(dev))
disable_irq_wake(irq);

return 0;
}

static struct dev_pm_ops sh_keysc_dev_pm_ops = {
.suspend = sh_keysc_suspend,
.resume = sh_keysc_resume,
};

struct platform_driver sh_keysc_device_driver = {
Expand Down

0 comments on commit 4ba50df

Please sign in to comment.