public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Dominic Curran <dcurran@ti.com>
To: linux-omap@vger.kernel.org
Cc: stanley.miao@windriver.com
Subject: [PATCH 3/3] [OMAPZOOM] Fix persistent TWL4030 keypress in LDP board file.
Date: Wed, 12 Nov 2008 13:07:45 -0600	[thread overview]
Message-ID: <200811121307.45678.dcurran@ti.com> (raw)

Removes ZOOM specific code from TWL4030 keypad driver.
Adds generic code to deal with persistent TWL4030 keypress.
Code originally submitted by Stanley Miao to linux-omap tree.

Signed-off-by: Dominic Curran <dcurran@ti.com>
cc: Stanley.Miao <stanley.miao@windriver.com>
---
 arch/arm/mach-omap2/board-ldp.c             |    1 +
 arch/arm/plat-omap/include/mach/keypad.h    |    5 +++++
 drivers/input/keyboard/omap-twl4030keypad.c |   21 ++++++---------------
 3 files changed, 12 insertions(+), 15 deletions(-)

diff --git a/arch/arm/mach-omap2/board-ldp.c b/arch/arm/mach-omap2/board-ldp.c
index b2e8c9c..6cdccf3 100755
--- a/arch/arm/mach-omap2/board-ldp.c
+++ b/arch/arm/mach-omap2/board-ldp.c
@@ -263,6 +263,7 @@ static int ldp_twl4030_keymap[] = {
 	KEY(0, 3, KEY_F7),
 	KEY(1, 3, KEY_0),
 	KEY(2, 3, KEY_F8),
+	PERSISTENT_KEY(4, 5),
 	KEY(5, 4, KEY_MUTE),
 	KEY(4, 4, KEY_VOLUMEUP),
 	KEY(5, 5, KEY_VOLUMEDOWN),
diff --git a/arch/arm/plat-omap/include/mach/keypad.h b/arch/arm/plat-omap/include/mach/keypad.h
index ba1c95c..b7f270a 100644
--- a/arch/arm/plat-omap/include/mach/keypad.h
+++ b/arch/arm/plat-omap/include/mach/keypad.h
@@ -34,7 +34,12 @@ struct omap_kp_platform_data {
 #define GROUP_3		(3 << 16)
 #define GROUP_MASK	GROUP_3
 
+#define ROWCOL_MASK		0xFF000000
+#define KEY_PERSISTENT		0x00800000
+#define KEYNUM_MASK		0x00EFFFFF
 #define KEY(col, row, val) (((col) << 28) | ((row) << 24) | (val))
+#define PERSISTENT_KEY(col, row) (((col) << 28) | ((row) << 24) | \
+						KEY_PERSISTENT)
 
 #endif
 
diff --git a/drivers/input/keyboard/omap-twl4030keypad.c 
b/drivers/input/keyboard/omap-twl4030keypad.c
index e8fd21c..40ee869 100644
--- a/drivers/input/keyboard/omap-twl4030keypad.c
+++ b/drivers/input/keyboard/omap-twl4030keypad.c
@@ -40,14 +40,12 @@
 #include <linux/irq.h>
 #include <mach/gpio.h>
 #include <mach/keypad.h>
+
 #include "twl4030-keypad.h"
 
 #define PTV_PRESCALER		4
 
 #define MAX_ROWS		8 /* TWL4030 hardlimit */
-#define ROWCOL_MASK		0xFF000000
-#define KEYNUM_MASK		0x00FFFFFF
-#define KEY(col, row, val) (((col) << 28) | ((row) << 24) | (val))
 
 /* Global variables */
 
@@ -103,7 +101,7 @@ static int omap_kp_find_key(struct omap_keypad *kp, int col, int row)
 	rc = KEY(col, row, 0);
 	for (i = 0; i < kp->keymapsize; i++)
 		if ((kp->keymap[i] & ROWCOL_MASK) == rc)
-			return kp->keymap[i] & KEYNUM_MASK;
+			return kp->keymap[i] & (KEYNUM_MASK | KEY_PERSISTENT);
 
 	return -EINVAL;
 }
@@ -187,20 +185,13 @@ static void twl4030_kp_scan(struct omap_keypad *kp, int release_all)
 				"press" : "release");
 
 			key = omap_kp_find_key(kp, col, row);
-			if (key < 0) {
-#if defined(CONFIG_MACH_OMAP_LDP) || defined(CONFIG_MACH_OMAP_ZOOM2)
-				/* OMAP LDP has a TWL4030 GPIO
-				 * (KBR5/KBC4) that is set to a persistent
-				 * state and should be ignored.
-				 */
-				if (row == 5 && col == 4)
-					continue;
-#endif
-
+			if (key < 0)
 				dev_warn(kp->dbg_dev,
 					"Spurious key event %d-%d\n",
 					 col, row);
-			} else
+			else if (key & KEY_PERSISTENT)
+				continue;
+			else
 				input_report_key(kp->omap_twl4030kp, key,
 						 new_state[row] & (1 << col));
 		}
-- 
1.5.4.1


                 reply	other threads:[~2008-11-12 19:07 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=200811121307.45678.dcurran@ti.com \
    --to=dcurran@ti.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=stanley.miao@windriver.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