From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
To: linux-input@vger.kernel.org
Cc: Alexander Sverdlin <alexander.sverdlin@gmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH 3/4] Input: ep93xx_keypad - use dev_pm_set_wake_irq()
Date: Mon, 11 Oct 2021 18:37:34 -0700 [thread overview]
Message-ID: <20211012013735.3523140-3-dmitry.torokhov@gmail.com> (raw)
In-Reply-To: <20211012013735.3523140-1-dmitry.torokhov@gmail.com>
Instead of manually toggling interrupt as wakeup source in suspend/resume
methods, let's declare keypad interrupt and wakeup interrupt and leave the
rest to the PM core.
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
drivers/input/keyboard/ep93xx_keypad.c | 13 +++++++------
1 file changed, 7 insertions(+), 6 deletions(-)
diff --git a/drivers/input/keyboard/ep93xx_keypad.c b/drivers/input/keyboard/ep93xx_keypad.c
index 6be5474ba2f2..a66cfeaf5b21 100644
--- a/drivers/input/keyboard/ep93xx_keypad.c
+++ b/drivers/input/keyboard/ep93xx_keypad.c
@@ -27,6 +27,7 @@
#include <linux/slab.h>
#include <linux/soc/cirrus/ep93xx.h>
#include <linux/platform_data/keypad-ep93xx.h>
+#include <linux/pm_wakeirq.h>
/*
* Keypad Interface Register offsets
@@ -191,9 +192,6 @@ static int __maybe_unused ep93xx_keypad_suspend(struct device *dev)
mutex_unlock(&input_dev->mutex);
- if (device_may_wakeup(&pdev->dev))
- enable_irq_wake(keypad->irq);
-
return 0;
}
@@ -203,9 +201,6 @@ static int __maybe_unused ep93xx_keypad_resume(struct device *dev)
struct ep93xx_keypad *keypad = platform_get_drvdata(pdev);
struct input_dev *input_dev = keypad->input_dev;
- if (device_may_wakeup(&pdev->dev))
- disable_irq_wake(keypad->irq);
-
mutex_lock(&input_dev->mutex);
if (input_device_enabled(input_dev)) {
@@ -316,7 +311,11 @@ static int ep93xx_keypad_probe(struct platform_device *pdev)
goto failed_free_irq;
platform_set_drvdata(pdev, keypad);
+
device_init_wakeup(&pdev->dev, 1);
+ err = dev_pm_set_wake_irq(&pdev->dev, keypad->irq);
+ if (err)
+ dev_warn(&pdev->dev, "failed to set up wakeup irq: %d\n", err);
return 0;
@@ -342,6 +341,8 @@ static int ep93xx_keypad_remove(struct platform_device *pdev)
struct ep93xx_keypad *keypad = platform_get_drvdata(pdev);
struct resource *res;
+ dev_pm_clear_wake_irq(&pdev->dev);
+
free_irq(keypad->irq, keypad);
if (keypad->enabled)
--
2.33.0.882.g93a45727a2-goog
next prev parent reply other threads:[~2021-10-12 1:37 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-10-12 1:37 [PATCH 1/4] Input: ep93xx_keypad - annotate suspend/resume as __maybe_unused Dmitry Torokhov
2021-10-12 1:37 ` [PATCH 2/4] Input: ep93xx_keypad - use BIT() and GENMASK() macros Dmitry Torokhov
2021-10-12 6:58 ` Alexander Sverdlin
2021-10-12 1:37 ` Dmitry Torokhov [this message]
2021-10-12 7:30 ` [PATCH 3/4] Input: ep93xx_keypad - use dev_pm_set_wake_irq() Alexander Sverdlin
2021-10-12 1:37 ` [PATCH 4/4] Input: ep93xx_keypad - switch to using managed resources Dmitry Torokhov
2021-10-12 7:54 ` Alexander Sverdlin
2021-10-13 2:34 ` Dmitry Torokhov
2021-10-13 2:36 ` [PATCH v2 " Dmitry Torokhov
2021-10-13 5:42 ` Alexander Sverdlin
2021-10-12 6:31 ` [PATCH 1/4] Input: ep93xx_keypad - annotate suspend/resume as __maybe_unused Alexander Sverdlin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20211012013735.3523140-3-dmitry.torokhov@gmail.com \
--to=dmitry.torokhov@gmail.com \
--cc=alexander.sverdlin@gmail.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).