From 4ba50df685e85b9d912a290d9614ffbeb4d9f060 Mon Sep 17 00:00:00 2001 From: Magnus Damm Date: Wed, 1 Apr 2009 14:39:20 +0000 Subject: input: sh_keysc: use enable/disable_irq_wake() 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 Signed-off-by: Paul Mundt --- drivers/input/keyboard/sh_keysc.c | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) (limited to 'drivers/input') diff --git a/drivers/input/keyboard/sh_keysc.c b/drivers/input/keyboard/sh_keysc.c index e1480fb11de..cea70e6a103 100644 --- a/drivers/input/keyboard/sh_keysc.c +++ b/drivers/input/keyboard/sh_keysc.c @@ -259,12 +259,15 @@ 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; @@ -272,8 +275,20 @@ static int sh_keysc_suspend(struct device *dev) 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 = { -- cgit v1.2.3 From 0935ade0bf6baf9c5f23024102737bdaf7075abc Mon Sep 17 00:00:00 2001 From: Magnus Damm Date: Wed, 1 Apr 2009 14:49:41 +0000 Subject: input: migor_ts: add wakeup support Add wakeup support to the migor_ts driver. If user space has enabled wakeup, use set_irq_wake() during suspend and resume. With this patch the migor_ts driver can be used to wake the system from suspend. Signed-off-by: Magnus Damm Signed-off-by: Paul Mundt --- drivers/input/touchscreen/migor_ts.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) (limited to 'drivers/input') diff --git a/drivers/input/touchscreen/migor_ts.c b/drivers/input/touchscreen/migor_ts.c index 504ca11749a..141dd584330 100644 --- a/drivers/input/touchscreen/migor_ts.c +++ b/drivers/input/touchscreen/migor_ts.c @@ -198,6 +198,7 @@ static int migor_ts_probe(struct i2c_client *client, goto err2; } + device_init_wakeup(&client->dev, 1); return 0; err2: @@ -224,6 +225,26 @@ static int migor_ts_remove(struct i2c_client *client) return 0; } +static int migor_ts_suspend(struct i2c_client *client, pm_message_t mesg) +{ + struct migor_ts_priv *priv = dev_get_drvdata(&client->dev); + + if (device_may_wakeup(&client->dev)) + enable_irq_wake(priv->irq); + + return 0; +} + +static int migor_ts_resume(struct i2c_client *client) +{ + struct migor_ts_priv *priv = dev_get_drvdata(&client->dev); + + if (device_may_wakeup(&client->dev)) + disable_irq_wake(priv->irq); + + return 0; +} + static const struct i2c_device_id migor_ts_id[] = { { "migor_ts", 0 }, { } @@ -236,6 +257,8 @@ static struct i2c_driver migor_ts_driver = { }, .probe = migor_ts_probe, .remove = migor_ts_remove, + .suspend = migor_ts_suspend, + .resume = migor_ts_resume, .id_table = migor_ts_id, }; -- cgit v1.2.3