mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Viresh Kumar <viresh.kumar@linaro.org>
To: dmitry.torokhov@gmail.com
Cc: linux-input@vger.kernel.org, linux-kernel@vger.kernel.org,
	spear-devel@list.st.com, Deepak Sikri <deepak.sikri@st.com>,
	Viresh Kumar <viresh.kumar@linaro.org>
Subject: [PATCH 3/3] input: spear-keyboard: Fix for balancing the enable_irq_wake
Date: Thu,  8 Nov 2012 19:10:49 +0530	[thread overview]
Message-ID: <367241d1362f7b642e223bb7e7b108bc72df0851.1352381962.git.viresh.kumar@linaro.org> (raw)
In-Reply-To: <9f07bb7dbf29978970d901bbe89add0a333cc925.1352381962.git.viresh.kumar@linaro.org>
In-Reply-To: <9f07bb7dbf29978970d901bbe89add0a333cc925.1352381962.git.viresh.kumar@linaro.org>

From: Deepak Sikri <deepak.sikri@st.com>

This patch handles the fix for unbalanced irq for the cases when
enable_irq_wake fails, and a warning related to same is displayed
on the console. The workaround is handled at the driver level.

Signed-off-by: Deepak Sikri <deepak.sikri@st.com>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/input/keyboard/spear-keyboard.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/drivers/input/keyboard/spear-keyboard.c b/drivers/input/keyboard/spear-keyboard.c
index 9792924..b8784df 100644
--- a/drivers/input/keyboard/spear-keyboard.c
+++ b/drivers/input/keyboard/spear-keyboard.c
@@ -60,6 +60,7 @@ struct spear_kbd {
 	struct clk *clk;
 	unsigned int irq;
 	unsigned int mode;
+	unsigned int irq_wake;
 	unsigned short last_key;
 	unsigned short keycodes[NUM_ROWS * NUM_COLS];
 	bool rep;
@@ -327,7 +328,8 @@ static int spear_kbd_suspend(struct device *dev)
 	mode_ctl_reg = readl_relaxed(kbd->io_base + MODE_CTL_REG);
 
 	if (device_may_wakeup(&pdev->dev)) {
-		enable_irq_wake(kbd->irq);
+		if (!enable_irq_wake(kbd->irq))
+			kbd->irq_wake = 1;
 
 		/*
 		 * reprogram the keyboard operating frequency as on some
@@ -373,7 +375,10 @@ static int spear_kbd_resume(struct device *dev)
 	mutex_lock(&input_dev->mutex);
 
 	if (device_may_wakeup(&pdev->dev)) {
-		disable_irq_wake(kbd->irq);
+		if (kbd->irq_wake) {
+			kbd->irq_wake = 0;
+			disable_irq_wake(kbd->irq);
+		}
 	} else {
 		if (input_dev->users)
 			clk_enable(kbd->clk);
-- 
1.7.12.rc2.18.g61b472e


  parent reply	other threads:[~2012-11-08 13:42 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-08 13:40 [PATCH 1/3] input: spear-keyboard: Use devm_*() routines Viresh Kumar
2012-11-08 13:40 ` [PATCH 2/3] Input: spear-keyboard: Add clk_{un}prepare() support Viresh Kumar
2012-11-12  5:57   ` Viresh Kumar
2012-11-20  7:56     ` Viresh Kumar
2012-11-20  8:47       ` Dmitry Torokhov
2012-11-20  8:54         ` Viresh Kumar
2012-11-26 16:27         ` Viresh Kumar
2012-11-26 16:56           ` Dmitry Torokhov
2012-11-08 13:40 ` Viresh Kumar [this message]
2012-11-08 16:38 ` [PATCH 1/3] input: spear-keyboard: Use devm_*() routines Dmitry Torokhov
2012-11-09  2:36   ` Viresh Kumar
2012-11-09  3:03     ` Viresh Kumar
2012-11-09  5:33     ` Dmitry Torokhov
2012-11-09 17:05       ` Viresh Kumar

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=367241d1362f7b642e223bb7e7b108bc72df0851.1352381962.git.viresh.kumar@linaro.org \
    --to=viresh.kumar@linaro.org \
    --cc=deepak.sikri@st.com \
    --cc=dmitry.torokhov@gmail.com \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=spear-devel@list.st.com \
    /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

all inboxes | Powered by JetHome®