All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] Omap keypad cleanup and omap5 support
@ 2012-03-16 14:26 ` Sourav Poddar
  0 siblings, 0 replies; 19+ messages in thread
From: Sourav Poddar @ 2012-03-16 14:26 UTC (permalink / raw)
  To: dmitry.torokhov, sourav.poddar, linux-input, linux-arm-kernel,
	linux-omap
  Cc: balbi

The series consists of two patches.
Patch1 of the series makes omap4 keypad independent of the
architecture by moving platform_data to <linux/platform_data>

Patch2 add support for omap5 onchip keypad.

Tested on omap4430sdp using 3.3-rc6.
Tested on omap5 board using 3.1 custom kernel. 

Felipe Balbi (1):
  input: keypad: move platform_data to <linux/platform_data>

G, Manjunath Kondaiah (1):
  Input: omap-keypad: dynamically handle register offsets

 arch/arm/mach-omap2/board-4430sdp.c            |    1 +
 arch/arm/mach-omap2/devices.c                  |    1 +
 arch/arm/plat-omap/include/plat/omap4-keypad.h |    9 --
 drivers/input/keyboard/Kconfig                 |    7 +-
 drivers/input/keyboard/omap4-keypad.c          |  124 +++++++++++++++++++-----
 include/linux/platform_data/omap4-keypad.h     |   13 +++
 6 files changed, 118 insertions(+), 37 deletions(-)
 create mode 100644 include/linux/platform_data/omap4-keypad.h


^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 0/2] Omap keypad cleanup and omap5 support
@ 2012-03-16 14:26 ` Sourav Poddar
  0 siblings, 0 replies; 19+ messages in thread
From: Sourav Poddar @ 2012-03-16 14:26 UTC (permalink / raw)
  To: linux-arm-kernel

The series consists of two patches.
Patch1 of the series makes omap4 keypad independent of the
architecture by moving platform_data to <linux/platform_data>

Patch2 add support for omap5 onchip keypad.

Tested on omap4430sdp using 3.3-rc6.
Tested on omap5 board using 3.1 custom kernel. 

Felipe Balbi (1):
  input: keypad: move platform_data to <linux/platform_data>

G, Manjunath Kondaiah (1):
  Input: omap-keypad: dynamically handle register offsets

 arch/arm/mach-omap2/board-4430sdp.c            |    1 +
 arch/arm/mach-omap2/devices.c                  |    1 +
 arch/arm/plat-omap/include/plat/omap4-keypad.h |    9 --
 drivers/input/keyboard/Kconfig                 |    7 +-
 drivers/input/keyboard/omap4-keypad.c          |  124 +++++++++++++++++++-----
 include/linux/platform_data/omap4-keypad.h     |   13 +++
 6 files changed, 118 insertions(+), 37 deletions(-)
 create mode 100644 include/linux/platform_data/omap4-keypad.h

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 1/2] input: keypad: move platform_data to <linux/platform_data>
  2012-03-16 14:26 ` Sourav Poddar
@ 2012-03-16 14:26   ` Sourav Poddar
  -1 siblings, 0 replies; 19+ messages in thread
From: Sourav Poddar @ 2012-03-16 14:26 UTC (permalink / raw)
  To: dmitry.torokhov, sourav.poddar, linux-input, linux-arm-kernel,
	linux-omap
  Cc: balbi

From: Felipe Balbi <balbi@ti.com>

This patch allows us to drop the OMAP depencendy
from the OMAP4 keypad driver.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
---
 arch/arm/mach-omap2/board-4430sdp.c            |    1 +
 arch/arm/mach-omap2/devices.c                  |    1 +
 arch/arm/plat-omap/include/plat/omap4-keypad.h |    9 ---------
 drivers/input/keyboard/Kconfig                 |    1 -
 drivers/input/keyboard/omap4-keypad.c          |    2 +-
 include/linux/platform_data/omap4-keypad.h     |   13 +++++++++++++
 6 files changed, 16 insertions(+), 11 deletions(-)
 create mode 100644 include/linux/platform_data/omap4-keypad.h

diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 4e90715..d16902c 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -25,6 +25,7 @@
 #include <linux/regulator/fixed.h>
 #include <linux/leds.h>
 #include <linux/leds_pwm.h>
+#include <linux/platform_data/omap4-keypad.h>
 
 #include <mach/hardware.h>
 #include <asm/hardware/gic.h>
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 283d11e..58e1d20 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -17,6 +17,7 @@
 #include <linux/err.h>
 #include <linux/slab.h>
 #include <linux/of.h>
+#include <linux/platform_data/omap4-keypad.h>
 
 #include <mach/hardware.h>
 #include <mach/irqs.h>
diff --git a/arch/arm/plat-omap/include/plat/omap4-keypad.h b/arch/arm/plat-omap/include/plat/omap4-keypad.h
index 9fe6c87..8ad0a37 100644
--- a/arch/arm/plat-omap/include/plat/omap4-keypad.h
+++ b/arch/arm/plat-omap/include/plat/omap4-keypad.h
@@ -1,15 +1,6 @@
 #ifndef ARCH_ARM_PLAT_OMAP4_KEYPAD_H
 #define ARCH_ARM_PLAT_OMAP4_KEYPAD_H
 
-#include <linux/input/matrix_keypad.h>
-
-struct omap4_keypad_platform_data {
-	const struct matrix_keymap_data *keymap_data;
-
-	u8 rows;
-	u8 cols;
-};
-
 extern int omap4_keyboard_init(struct omap4_keypad_platform_data *,
 				struct omap_board_data *);
 #endif
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index cdc385b..1379daa 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -512,7 +512,6 @@ config KEYBOARD_OMAP
 
 config KEYBOARD_OMAP4
 	tristate "TI OMAP4 keypad support"
-	depends on ARCH_OMAP4
 	help
 	  Say Y here if you want to use the OMAP4 keypad.
 
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index d5c5d77..e809ac0 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -31,7 +31,7 @@
 #include <linux/slab.h>
 #include <linux/pm_runtime.h>
 
-#include <plat/omap4-keypad.h>
+#include <linux/platform_data/omap4-keypad.h>
 
 /* OMAP4 registers */
 #define OMAP4_KBD_REVISION		0x00
diff --git a/include/linux/platform_data/omap4-keypad.h b/include/linux/platform_data/omap4-keypad.h
new file mode 100644
index 0000000..4eef5fb
--- /dev/null
+++ b/include/linux/platform_data/omap4-keypad.h
@@ -0,0 +1,13 @@
+#ifndef __LINUX_INPUT_OMAP4_KEYPAD_H
+#define __LINUX_INPUT_OMAP4_KEYPAD_H
+
+#include <linux/input/matrix_keypad.h>
+
+struct omap4_keypad_platform_data {
+	const struct matrix_keymap_data *keymap_data;
+
+	u8 rows;
+	u8 cols;
+};
+
+#endif /* __LINUX_INPUT_OMAP4_KEYPAD_H */
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 1/2] input: keypad: move platform_data to <linux/platform_data>
@ 2012-03-16 14:26   ` Sourav Poddar
  0 siblings, 0 replies; 19+ messages in thread
From: Sourav Poddar @ 2012-03-16 14:26 UTC (permalink / raw)
  To: linux-arm-kernel

From: Felipe Balbi <balbi@ti.com>

This patch allows us to drop the OMAP depencendy
from the OMAP4 keypad driver.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
---
 arch/arm/mach-omap2/board-4430sdp.c            |    1 +
 arch/arm/mach-omap2/devices.c                  |    1 +
 arch/arm/plat-omap/include/plat/omap4-keypad.h |    9 ---------
 drivers/input/keyboard/Kconfig                 |    1 -
 drivers/input/keyboard/omap4-keypad.c          |    2 +-
 include/linux/platform_data/omap4-keypad.h     |   13 +++++++++++++
 6 files changed, 16 insertions(+), 11 deletions(-)
 create mode 100644 include/linux/platform_data/omap4-keypad.h

diff --git a/arch/arm/mach-omap2/board-4430sdp.c b/arch/arm/mach-omap2/board-4430sdp.c
index 4e90715..d16902c 100644
--- a/arch/arm/mach-omap2/board-4430sdp.c
+++ b/arch/arm/mach-omap2/board-4430sdp.c
@@ -25,6 +25,7 @@
 #include <linux/regulator/fixed.h>
 #include <linux/leds.h>
 #include <linux/leds_pwm.h>
+#include <linux/platform_data/omap4-keypad.h>
 
 #include <mach/hardware.h>
 #include <asm/hardware/gic.h>
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c
index 283d11e..58e1d20 100644
--- a/arch/arm/mach-omap2/devices.c
+++ b/arch/arm/mach-omap2/devices.c
@@ -17,6 +17,7 @@
 #include <linux/err.h>
 #include <linux/slab.h>
 #include <linux/of.h>
+#include <linux/platform_data/omap4-keypad.h>
 
 #include <mach/hardware.h>
 #include <mach/irqs.h>
diff --git a/arch/arm/plat-omap/include/plat/omap4-keypad.h b/arch/arm/plat-omap/include/plat/omap4-keypad.h
index 9fe6c87..8ad0a37 100644
--- a/arch/arm/plat-omap/include/plat/omap4-keypad.h
+++ b/arch/arm/plat-omap/include/plat/omap4-keypad.h
@@ -1,15 +1,6 @@
 #ifndef ARCH_ARM_PLAT_OMAP4_KEYPAD_H
 #define ARCH_ARM_PLAT_OMAP4_KEYPAD_H
 
-#include <linux/input/matrix_keypad.h>
-
-struct omap4_keypad_platform_data {
-	const struct matrix_keymap_data *keymap_data;
-
-	u8 rows;
-	u8 cols;
-};
-
 extern int omap4_keyboard_init(struct omap4_keypad_platform_data *,
 				struct omap_board_data *);
 #endif
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index cdc385b..1379daa 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -512,7 +512,6 @@ config KEYBOARD_OMAP
 
 config KEYBOARD_OMAP4
 	tristate "TI OMAP4 keypad support"
-	depends on ARCH_OMAP4
 	help
 	  Say Y here if you want to use the OMAP4 keypad.
 
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index d5c5d77..e809ac0 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -31,7 +31,7 @@
 #include <linux/slab.h>
 #include <linux/pm_runtime.h>
 
-#include <plat/omap4-keypad.h>
+#include <linux/platform_data/omap4-keypad.h>
 
 /* OMAP4 registers */
 #define OMAP4_KBD_REVISION		0x00
diff --git a/include/linux/platform_data/omap4-keypad.h b/include/linux/platform_data/omap4-keypad.h
new file mode 100644
index 0000000..4eef5fb
--- /dev/null
+++ b/include/linux/platform_data/omap4-keypad.h
@@ -0,0 +1,13 @@
+#ifndef __LINUX_INPUT_OMAP4_KEYPAD_H
+#define __LINUX_INPUT_OMAP4_KEYPAD_H
+
+#include <linux/input/matrix_keypad.h>
+
+struct omap4_keypad_platform_data {
+	const struct matrix_keymap_data *keymap_data;
+
+	u8 rows;
+	u8 cols;
+};
+
+#endif /* __LINUX_INPUT_OMAP4_KEYPAD_H */
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/2] Input: omap-keypad: dynamically handle register offsets
  2012-03-16 14:26 ` Sourav Poddar
@ 2012-03-16 14:26   ` Sourav Poddar
  -1 siblings, 0 replies; 19+ messages in thread
From: Sourav Poddar @ 2012-03-16 14:26 UTC (permalink / raw)
  To: dmitry.torokhov, sourav.poddar, linux-input, linux-arm-kernel,
	linux-omap
  Cc: balbi

From: G, Manjunath Kondaiah <manjugk@ti.com>

Keypad controller register offsets are different for omap4
and omap5. Handle these offsets through static mapping and
assign these mappings during run time.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: G, Manjunath Kondaiah <manjugk@ti.com>
Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
---
 drivers/input/keyboard/Kconfig        |    6 +-
 drivers/input/keyboard/omap4-keypad.c |  122 ++++++++++++++++++++++++++------
 2 files changed, 102 insertions(+), 26 deletions(-)

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 1379daa..09d7d0b 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -510,10 +510,10 @@ config KEYBOARD_OMAP
 	  To compile this driver as a module, choose M here: the
 	  module will be called omap-keypad.
 
-config KEYBOARD_OMAP4
-	tristate "TI OMAP4 keypad support"
+config KEYBOARD_OMAP4+
+	tristate "TI OMAP4+ keypad support"
 	help
-	  Say Y here if you want to use the OMAP4 keypad.
+	  Say Y here if you want to use the OMAP4+ keypad.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called omap4-keypad.
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index e809ac0..6872495 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -68,6 +68,11 @@
 
 #define OMAP4_MASK_IRQSTATUSDISABLE	0xFFFF
 
+enum {
+	KBD_REVISION_OMAP4 = 0,
+	KBD_REVISION_OMAP5,
+};
+
 struct omap4_keypad {
 	struct input_dev *input;
 
@@ -76,11 +81,79 @@ struct omap4_keypad {
 
 	unsigned int rows;
 	unsigned int cols;
+	unsigned int revision;
 	unsigned int row_shift;
 	unsigned char key_state[8];
 	unsigned short keymap[];
 };
 
+static int kbd_read_irqstatus(struct omap4_keypad *keypad_data, u32 offset)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		return __raw_readl(keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		return __raw_readl(keypad_data->base + offset + 0x0c);
+
+	return -ENODEV;
+}
+
+static int kbd_write_irqstatus(struct omap4_keypad *keypad_data,
+						u32 offset, u32 value)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		return __raw_writel(value, keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		return __raw_writel(value, keypad_data->base + offset + 0x0c);
+
+	return -ENODEV;
+}
+
+static int kbd_write_irqenable(struct omap4_keypad *keypad_data,
+						u32 offset, u32 value)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		return __raw_writel(value, keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		return __raw_writel(value, keypad_data->base + offset + 0x0c);
+
+	return -ENODEV;
+}
+
+static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		return __raw_readl(keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		return __raw_readl(keypad_data->base + offset + 0x10);
+
+	return -ENODEV;
+}
+
+static void kbd_writel(struct omap4_keypad *keypad_data, u32 offset, u32 value)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		__raw_writel(value, keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		__raw_writel(value, keypad_data->base + offset + 0x10);
+}
+
+static int kbd_read_revision(struct omap4_keypad *keypad_data, u32 offset)
+{
+	int reg;
+	reg = __raw_readl(keypad_data->base + offset);
+	reg &= 0x03 << 30;
+	reg >>= 30;
+
+	switch (reg) {
+	case 1:
+		return KBD_REVISION_OMAP5;
+	case 0:
+		return KBD_REVISION_OMAP4;
+	default:
+		return -ENODEV;
+	}
+}
+
 /* Interrupt handler */
 static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
 {
@@ -91,12 +164,11 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
 	u32 *new_state = (u32 *) key_state;
 
 	/* Disable interrupts */
-	__raw_writel(OMAP4_VAL_IRQDISABLE,
-		     keypad_data->base + OMAP4_KBD_IRQENABLE);
+	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
+						OMAP4_VAL_IRQDISABLE);
 
-	*new_state = __raw_readl(keypad_data->base + OMAP4_KBD_FULLCODE31_0);
-	*(new_state + 1) = __raw_readl(keypad_data->base
-						+ OMAP4_KBD_FULLCODE63_32);
+	*new_state = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE31_0);
+	*(new_state + 1) = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE63_32);
 
 	for (row = 0; row < keypad_data->rows; row++) {
 		changed = key_state[row] ^ keypad_data->key_state[row];
@@ -121,12 +193,13 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
 		sizeof(keypad_data->key_state));
 
 	/* clear pending interrupts */
-	__raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS),
-			keypad_data->base + OMAP4_KBD_IRQSTATUS);
+	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
+			kbd_read_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS));
 
 	/* enable interrupts */
-	__raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY,
-			keypad_data->base + OMAP4_KBD_IRQENABLE);
+	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
+			OMAP4_DEF_IRQENABLE_EVENTEN |
+				OMAP4_DEF_IRQENABLE_LONGKEY);
 
 	return IRQ_HANDLED;
 }
@@ -139,16 +212,19 @@ static int omap4_keypad_open(struct input_dev *input)
 
 	disable_irq(keypad_data->irq);
 
-	__raw_writel(OMAP4_VAL_FUNCTIONALCFG,
-			keypad_data->base + OMAP4_KBD_CTRL);
-	__raw_writel(OMAP4_VAL_DEBOUNCINGTIME,
-			keypad_data->base + OMAP4_KBD_DEBOUNCINGTIME);
-	__raw_writel(OMAP4_VAL_IRQDISABLE,
-			keypad_data->base + OMAP4_KBD_IRQSTATUS);
-	__raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY,
-			keypad_data->base + OMAP4_KBD_IRQENABLE);
-	__raw_writel(OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA,
-			keypad_data->base + OMAP4_KBD_WAKEUPENABLE);
+	keypad_data->revision = kbd_read_revision(keypad_data,
+			OMAP4_KBD_REVISION);
+	kbd_writel(keypad_data, OMAP4_KBD_CTRL,
+			OMAP4_VAL_FUNCTIONALCFG);
+	kbd_writel(keypad_data, OMAP4_KBD_DEBOUNCINGTIME,
+			OMAP4_VAL_DEBOUNCINGTIME);
+	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
+			OMAP4_VAL_IRQDISABLE);
+	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
+			OMAP4_DEF_IRQENABLE_EVENTEN |
+				OMAP4_DEF_IRQENABLE_LONGKEY);
+	kbd_writel(keypad_data, OMAP4_KBD_WAKEUPENABLE,
+			OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA);
 
 	enable_irq(keypad_data->irq);
 
@@ -162,12 +238,12 @@ static void omap4_keypad_close(struct input_dev *input)
 	disable_irq(keypad_data->irq);
 
 	/* Disable interrupts */
-	__raw_writel(OMAP4_VAL_IRQDISABLE,
-		     keypad_data->base + OMAP4_KBD_IRQENABLE);
+	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
+			OMAP4_VAL_IRQDISABLE);
 
 	/* clear pending interrupts */
-	__raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS),
-			keypad_data->base + OMAP4_KBD_IRQSTATUS);
+	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
+			kbd_read_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS));
 
 	enable_irq(keypad_data->irq);
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/2] Input: omap-keypad: dynamically handle register offsets
@ 2012-03-16 14:26   ` Sourav Poddar
  0 siblings, 0 replies; 19+ messages in thread
From: Sourav Poddar @ 2012-03-16 14:26 UTC (permalink / raw)
  To: linux-arm-kernel

From: G, Manjunath Kondaiah <manjugk@ti.com>

Keypad controller register offsets are different for omap4
and omap5. Handle these offsets through static mapping and
assign these mappings during run time.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: G, Manjunath Kondaiah <manjugk@ti.com>
Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
---
 drivers/input/keyboard/Kconfig        |    6 +-
 drivers/input/keyboard/omap4-keypad.c |  122 ++++++++++++++++++++++++++------
 2 files changed, 102 insertions(+), 26 deletions(-)

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 1379daa..09d7d0b 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -510,10 +510,10 @@ config KEYBOARD_OMAP
 	  To compile this driver as a module, choose M here: the
 	  module will be called omap-keypad.
 
-config KEYBOARD_OMAP4
-	tristate "TI OMAP4 keypad support"
+config KEYBOARD_OMAP4+
+	tristate "TI OMAP4+ keypad support"
 	help
-	  Say Y here if you want to use the OMAP4 keypad.
+	  Say Y here if you want to use the OMAP4+ keypad.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called omap4-keypad.
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index e809ac0..6872495 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -68,6 +68,11 @@
 
 #define OMAP4_MASK_IRQSTATUSDISABLE	0xFFFF
 
+enum {
+	KBD_REVISION_OMAP4 = 0,
+	KBD_REVISION_OMAP5,
+};
+
 struct omap4_keypad {
 	struct input_dev *input;
 
@@ -76,11 +81,79 @@ struct omap4_keypad {
 
 	unsigned int rows;
 	unsigned int cols;
+	unsigned int revision;
 	unsigned int row_shift;
 	unsigned char key_state[8];
 	unsigned short keymap[];
 };
 
+static int kbd_read_irqstatus(struct omap4_keypad *keypad_data, u32 offset)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		return __raw_readl(keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		return __raw_readl(keypad_data->base + offset + 0x0c);
+
+	return -ENODEV;
+}
+
+static int kbd_write_irqstatus(struct omap4_keypad *keypad_data,
+						u32 offset, u32 value)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		return __raw_writel(value, keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		return __raw_writel(value, keypad_data->base + offset + 0x0c);
+
+	return -ENODEV;
+}
+
+static int kbd_write_irqenable(struct omap4_keypad *keypad_data,
+						u32 offset, u32 value)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		return __raw_writel(value, keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		return __raw_writel(value, keypad_data->base + offset + 0x0c);
+
+	return -ENODEV;
+}
+
+static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		return __raw_readl(keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		return __raw_readl(keypad_data->base + offset + 0x10);
+
+	return -ENODEV;
+}
+
+static void kbd_writel(struct omap4_keypad *keypad_data, u32 offset, u32 value)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		__raw_writel(value, keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		__raw_writel(value, keypad_data->base + offset + 0x10);
+}
+
+static int kbd_read_revision(struct omap4_keypad *keypad_data, u32 offset)
+{
+	int reg;
+	reg = __raw_readl(keypad_data->base + offset);
+	reg &= 0x03 << 30;
+	reg >>= 30;
+
+	switch (reg) {
+	case 1:
+		return KBD_REVISION_OMAP5;
+	case 0:
+		return KBD_REVISION_OMAP4;
+	default:
+		return -ENODEV;
+	}
+}
+
 /* Interrupt handler */
 static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
 {
@@ -91,12 +164,11 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
 	u32 *new_state = (u32 *) key_state;
 
 	/* Disable interrupts */
-	__raw_writel(OMAP4_VAL_IRQDISABLE,
-		     keypad_data->base + OMAP4_KBD_IRQENABLE);
+	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
+						OMAP4_VAL_IRQDISABLE);
 
-	*new_state = __raw_readl(keypad_data->base + OMAP4_KBD_FULLCODE31_0);
-	*(new_state + 1) = __raw_readl(keypad_data->base
-						+ OMAP4_KBD_FULLCODE63_32);
+	*new_state = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE31_0);
+	*(new_state + 1) = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE63_32);
 
 	for (row = 0; row < keypad_data->rows; row++) {
 		changed = key_state[row] ^ keypad_data->key_state[row];
@@ -121,12 +193,13 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
 		sizeof(keypad_data->key_state));
 
 	/* clear pending interrupts */
-	__raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS),
-			keypad_data->base + OMAP4_KBD_IRQSTATUS);
+	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
+			kbd_read_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS));
 
 	/* enable interrupts */
-	__raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY,
-			keypad_data->base + OMAP4_KBD_IRQENABLE);
+	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
+			OMAP4_DEF_IRQENABLE_EVENTEN |
+				OMAP4_DEF_IRQENABLE_LONGKEY);
 
 	return IRQ_HANDLED;
 }
@@ -139,16 +212,19 @@ static int omap4_keypad_open(struct input_dev *input)
 
 	disable_irq(keypad_data->irq);
 
-	__raw_writel(OMAP4_VAL_FUNCTIONALCFG,
-			keypad_data->base + OMAP4_KBD_CTRL);
-	__raw_writel(OMAP4_VAL_DEBOUNCINGTIME,
-			keypad_data->base + OMAP4_KBD_DEBOUNCINGTIME);
-	__raw_writel(OMAP4_VAL_IRQDISABLE,
-			keypad_data->base + OMAP4_KBD_IRQSTATUS);
-	__raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY,
-			keypad_data->base + OMAP4_KBD_IRQENABLE);
-	__raw_writel(OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA,
-			keypad_data->base + OMAP4_KBD_WAKEUPENABLE);
+	keypad_data->revision = kbd_read_revision(keypad_data,
+			OMAP4_KBD_REVISION);
+	kbd_writel(keypad_data, OMAP4_KBD_CTRL,
+			OMAP4_VAL_FUNCTIONALCFG);
+	kbd_writel(keypad_data, OMAP4_KBD_DEBOUNCINGTIME,
+			OMAP4_VAL_DEBOUNCINGTIME);
+	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
+			OMAP4_VAL_IRQDISABLE);
+	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
+			OMAP4_DEF_IRQENABLE_EVENTEN |
+				OMAP4_DEF_IRQENABLE_LONGKEY);
+	kbd_writel(keypad_data, OMAP4_KBD_WAKEUPENABLE,
+			OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA);
 
 	enable_irq(keypad_data->irq);
 
@@ -162,12 +238,12 @@ static void omap4_keypad_close(struct input_dev *input)
 	disable_irq(keypad_data->irq);
 
 	/* Disable interrupts */
-	__raw_writel(OMAP4_VAL_IRQDISABLE,
-		     keypad_data->base + OMAP4_KBD_IRQENABLE);
+	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
+			OMAP4_VAL_IRQDISABLE);
 
 	/* clear pending interrupts */
-	__raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS),
-			keypad_data->base + OMAP4_KBD_IRQSTATUS);
+	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
+			kbd_read_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS));
 
 	enable_irq(keypad_data->irq);
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/2] input: keypad: move platform_data to <linux/platform_data>
  2012-03-16 14:26   ` Sourav Poddar
@ 2012-03-16 16:36     ` Dmitry Torokhov
  -1 siblings, 0 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2012-03-16 16:36 UTC (permalink / raw)
  To: Sourav Poddar; +Cc: linux-input, linux-arm-kernel, linux-omap, balbi

On Friday, March 16, 2012 07:56:28 PM Sourav Poddar wrote:
> From: Felipe Balbi <balbi@ti.com>
> 
> This patch allows us to drop the OMAP depencendy
> from the OMAP4 keypad driver.
> 
> Signed-off-by: Felipe Balbi <balbi@ti.com>
> Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
> ---
>  arch/arm/mach-omap2/board-4430sdp.c            |    1 +
>  arch/arm/mach-omap2/devices.c                  |    1 +
>  arch/arm/plat-omap/include/plat/omap4-keypad.h |    9 ---------
>  drivers/input/keyboard/Kconfig                 |    1 -
>  drivers/input/keyboard/omap4-keypad.c          |    2 +-
>  include/linux/platform_data/omap4-keypad.h     |   13 +++++++++++++

Instead of creating platform_data directory why not move to
include/linux/input/omap4-keypad.h?

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 1/2] input: keypad: move platform_data to <linux/platform_data>
@ 2012-03-16 16:36     ` Dmitry Torokhov
  0 siblings, 0 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2012-03-16 16:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Friday, March 16, 2012 07:56:28 PM Sourav Poddar wrote:
> From: Felipe Balbi <balbi@ti.com>
> 
> This patch allows us to drop the OMAP depencendy
> from the OMAP4 keypad driver.
> 
> Signed-off-by: Felipe Balbi <balbi@ti.com>
> Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
> ---
>  arch/arm/mach-omap2/board-4430sdp.c            |    1 +
>  arch/arm/mach-omap2/devices.c                  |    1 +
>  arch/arm/plat-omap/include/plat/omap4-keypad.h |    9 ---------
>  drivers/input/keyboard/Kconfig                 |    1 -
>  drivers/input/keyboard/omap4-keypad.c          |    2 +-
>  include/linux/platform_data/omap4-keypad.h     |   13 +++++++++++++

Instead of creating platform_data directory why not move to
include/linux/input/omap4-keypad.h?

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/2] input: keypad: move platform_data to <linux/platform_data>
  2012-03-16 16:36     ` Dmitry Torokhov
@ 2012-03-16 21:08       ` Felipe Balbi
  -1 siblings, 0 replies; 19+ messages in thread
From: Felipe Balbi @ 2012-03-16 21:08 UTC (permalink / raw)
  To: Dmitry Torokhov
  Cc: Sourav Poddar, linux-input, linux-arm-kernel, linux-omap, balbi

[-- Attachment #1: Type: text/plain, Size: 1024 bytes --]

Hi,

On Fri, Mar 16, 2012 at 09:36:19AM -0700, Dmitry Torokhov wrote:
> On Friday, March 16, 2012 07:56:28 PM Sourav Poddar wrote:
> > From: Felipe Balbi <balbi@ti.com>
> > 
> > This patch allows us to drop the OMAP depencendy
> > from the OMAP4 keypad driver.
> > 
> > Signed-off-by: Felipe Balbi <balbi@ti.com>
> > Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
> > ---
> >  arch/arm/mach-omap2/board-4430sdp.c            |    1 +
> >  arch/arm/mach-omap2/devices.c                  |    1 +
> >  arch/arm/plat-omap/include/plat/omap4-keypad.h |    9 ---------
> >  drivers/input/keyboard/Kconfig                 |    1 -
> >  drivers/input/keyboard/omap4-keypad.c          |    2 +-
> >  include/linux/platform_data/omap4-keypad.h     |   13 +++++++++++++
> 
> Instead of creating platform_data directory why not move to
> include/linux/input/omap4-keypad.h?

look closer, that directory already exists. But if you prefer placing
that header on <linux/input> that's doable too.

-- 
balbi

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 1/2] input: keypad: move platform_data to <linux/platform_data>
@ 2012-03-16 21:08       ` Felipe Balbi
  0 siblings, 0 replies; 19+ messages in thread
From: Felipe Balbi @ 2012-03-16 21:08 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Fri, Mar 16, 2012 at 09:36:19AM -0700, Dmitry Torokhov wrote:
> On Friday, March 16, 2012 07:56:28 PM Sourav Poddar wrote:
> > From: Felipe Balbi <balbi@ti.com>
> > 
> > This patch allows us to drop the OMAP depencendy
> > from the OMAP4 keypad driver.
> > 
> > Signed-off-by: Felipe Balbi <balbi@ti.com>
> > Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
> > ---
> >  arch/arm/mach-omap2/board-4430sdp.c            |    1 +
> >  arch/arm/mach-omap2/devices.c                  |    1 +
> >  arch/arm/plat-omap/include/plat/omap4-keypad.h |    9 ---------
> >  drivers/input/keyboard/Kconfig                 |    1 -
> >  drivers/input/keyboard/omap4-keypad.c          |    2 +-
> >  include/linux/platform_data/omap4-keypad.h     |   13 +++++++++++++
> 
> Instead of creating platform_data directory why not move to
> include/linux/input/omap4-keypad.h?

look closer, that directory already exists. But if you prefer placing
that header on <linux/input> that's doable too.

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120316/ffe20fa7/attachment-0001.sig>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 1/2] input: keypad: move platform_data to <linux/platform_data>
  2012-03-16 21:08       ` Felipe Balbi
@ 2012-03-17  5:36         ` Dmitry Torokhov
  -1 siblings, 0 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2012-03-17  5:36 UTC (permalink / raw)
  To: Felipe Balbi; +Cc: Sourav Poddar, linux-input, linux-arm-kernel, linux-omap

On Fri, Mar 16, 2012 at 11:08:43PM +0200, Felipe Balbi wrote:
> Hi,
> 
> On Fri, Mar 16, 2012 at 09:36:19AM -0700, Dmitry Torokhov wrote:
> > On Friday, March 16, 2012 07:56:28 PM Sourav Poddar wrote:
> > > From: Felipe Balbi <balbi@ti.com>
> > > 
> > > This patch allows us to drop the OMAP depencendy
> > > from the OMAP4 keypad driver.
> > > 
> > > Signed-off-by: Felipe Balbi <balbi@ti.com>
> > > Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
> > > ---
> > >  arch/arm/mach-omap2/board-4430sdp.c            |    1 +
> > >  arch/arm/mach-omap2/devices.c                  |    1 +
> > >  arch/arm/plat-omap/include/plat/omap4-keypad.h |    9 ---------
> > >  drivers/input/keyboard/Kconfig                 |    1 -
> > >  drivers/input/keyboard/omap4-keypad.c          |    2 +-
> > >  include/linux/platform_data/omap4-keypad.h     |   13 +++++++++++++
> > 
> > Instead of creating platform_data directory why not move to
> > include/linux/input/omap4-keypad.h?
> 
> look closer, that directory already exists. But if you prefer placing
> that header on <linux/input> that's doable too.

OK, fair enough, applied.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 1/2] input: keypad: move platform_data to <linux/platform_data>
@ 2012-03-17  5:36         ` Dmitry Torokhov
  0 siblings, 0 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2012-03-17  5:36 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Mar 16, 2012 at 11:08:43PM +0200, Felipe Balbi wrote:
> Hi,
> 
> On Fri, Mar 16, 2012 at 09:36:19AM -0700, Dmitry Torokhov wrote:
> > On Friday, March 16, 2012 07:56:28 PM Sourav Poddar wrote:
> > > From: Felipe Balbi <balbi@ti.com>
> > > 
> > > This patch allows us to drop the OMAP depencendy
> > > from the OMAP4 keypad driver.
> > > 
> > > Signed-off-by: Felipe Balbi <balbi@ti.com>
> > > Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
> > > ---
> > >  arch/arm/mach-omap2/board-4430sdp.c            |    1 +
> > >  arch/arm/mach-omap2/devices.c                  |    1 +
> > >  arch/arm/plat-omap/include/plat/omap4-keypad.h |    9 ---------
> > >  drivers/input/keyboard/Kconfig                 |    1 -
> > >  drivers/input/keyboard/omap4-keypad.c          |    2 +-
> > >  include/linux/platform_data/omap4-keypad.h     |   13 +++++++++++++
> > 
> > Instead of creating platform_data directory why not move to
> > include/linux/input/omap4-keypad.h?
> 
> look closer, that directory already exists. But if you prefer placing
> that header on <linux/input> that's doable too.

OK, fair enough, applied.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/2] Input: omap-keypad: dynamically handle register offsets
  2012-03-16 14:26   ` Sourav Poddar
@ 2012-03-17  5:47     ` Dmitry Torokhov
  -1 siblings, 0 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2012-03-17  5:47 UTC (permalink / raw)
  To: Sourav Poddar; +Cc: linux-input, linux-arm-kernel, linux-omap, balbi

Hi Sourav,

On Fri, Mar 16, 2012 at 07:56:29PM +0530, Sourav Poddar wrote:
> From: G, Manjunath Kondaiah <manjugk@ti.com>
> 
> Keypad controller register offsets are different for omap4
> and omap5. Handle these offsets through static mapping and
> assign these mappings during run time.
> 
> Signed-off-by: Felipe Balbi <balbi@ti.com>
> Signed-off-by: G, Manjunath Kondaiah <manjugk@ti.com>
> Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
> ---
>  drivers/input/keyboard/Kconfig        |    6 +-
>  drivers/input/keyboard/omap4-keypad.c |  122 ++++++++++++++++++++++++++------
>  2 files changed, 102 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> index 1379daa..09d7d0b 100644
> --- a/drivers/input/keyboard/Kconfig
> +++ b/drivers/input/keyboard/Kconfig
> @@ -510,10 +510,10 @@ config KEYBOARD_OMAP
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called omap-keypad.
>  
> -config KEYBOARD_OMAP4
> -	tristate "TI OMAP4 keypad support"
> +config KEYBOARD_OMAP4+
> +	tristate "TI OMAP4+ keypad support"
>  	help
> -	  Say Y here if you want to use the OMAP4 keypad.
> +	  Say Y here if you want to use the OMAP4+ keypad.
>  
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called omap4-keypad.
> diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
> index e809ac0..6872495 100644
> --- a/drivers/input/keyboard/omap4-keypad.c
> +++ b/drivers/input/keyboard/omap4-keypad.c
> @@ -68,6 +68,11 @@
>  
>  #define OMAP4_MASK_IRQSTATUSDISABLE	0xFFFF
>  
> +enum {
> +	KBD_REVISION_OMAP4 = 0,
> +	KBD_REVISION_OMAP5,
> +};
> +
>  struct omap4_keypad {
>  	struct input_dev *input;
>  
> @@ -76,11 +81,79 @@ struct omap4_keypad {
>  
>  	unsigned int rows;
>  	unsigned int cols;
> +	unsigned int revision;
>  	unsigned int row_shift;
>  	unsigned char key_state[8];
>  	unsigned short keymap[];
>  };
>  
> +static int kbd_read_irqstatus(struct omap4_keypad *keypad_data, u32 offset)
> +{
> +	if (keypad_data->revision == KBD_REVISION_OMAP4)
> +		return __raw_readl(keypad_data->base + offset);
> +	else if (keypad_data->revision == KBD_REVISION_OMAP5)
> +		return __raw_readl(keypad_data->base + offset + 0x0c);
> +

This is called from ISR and doing comparisons seems quite wasteful. Why
don't you stuff register numbers for IRQ manipulations into struct
omap4_keypad at probe time and your function would just do:

	return __raw_readl(keypad_data->base + keypad_data->irqstatus_reg);

And do the same for irqstatus. FOr the rest of the register store the
common offset (seems to be 0x10).

> +	return -ENODEV;
> +}
> +
> +static int kbd_write_irqstatus(struct omap4_keypad *keypad_data,
> +						u32 offset, u32 value)
> +{
> +	if (keypad_data->revision == KBD_REVISION_OMAP4)
> +		return __raw_writel(value, keypad_data->base + offset);
> +	else if (keypad_data->revision == KBD_REVISION_OMAP5)
> +		return __raw_writel(value, keypad_data->base + offset + 0x0c);
> +
> +	return -ENODEV;
> +}
> +
> +static int kbd_write_irqenable(struct omap4_keypad *keypad_data,
> +						u32 offset, u32 value)
> +{
> +	if (keypad_data->revision == KBD_REVISION_OMAP4)
> +		return __raw_writel(value, keypad_data->base + offset);
> +	else if (keypad_data->revision == KBD_REVISION_OMAP5)
> +		return __raw_writel(value, keypad_data->base + offset + 0x0c);
> +
> +	return -ENODEV;
> +}
> +
> +static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset)
> +{
> +	if (keypad_data->revision == KBD_REVISION_OMAP4)
> +		return __raw_readl(keypad_data->base + offset);
> +	else if (keypad_data->revision == KBD_REVISION_OMAP5)
> +		return __raw_readl(keypad_data->base + offset + 0x10);
> +
> +	return -ENODEV;
> +}
> +
> +static void kbd_writel(struct omap4_keypad *keypad_data, u32 offset, u32 value)
> +{
> +	if (keypad_data->revision == KBD_REVISION_OMAP4)
> +		__raw_writel(value, keypad_data->base + offset);
> +	else if (keypad_data->revision == KBD_REVISION_OMAP5)
> +		__raw_writel(value, keypad_data->base + offset + 0x10);
> +}
> +
> +static int kbd_read_revision(struct omap4_keypad *keypad_data, u32 offset)
> +{
> +	int reg;
> +	reg = __raw_readl(keypad_data->base + offset);
> +	reg &= 0x03 << 30;
> +	reg >>= 30;
> +
> +	switch (reg) {
> +	case 1:
> +		return KBD_REVISION_OMAP5;
> +	case 0:
> +		return KBD_REVISION_OMAP4;
> +	default:
> +		return -ENODEV;
> +	}
> +}
> +
>  /* Interrupt handler */
>  static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
>  {
> @@ -91,12 +164,11 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
>  	u32 *new_state = (u32 *) key_state;
>  
>  	/* Disable interrupts */
> -	__raw_writel(OMAP4_VAL_IRQDISABLE,
> -		     keypad_data->base + OMAP4_KBD_IRQENABLE);
> +	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
> +						OMAP4_VAL_IRQDISABLE);
>  
> -	*new_state = __raw_readl(keypad_data->base + OMAP4_KBD_FULLCODE31_0);
> -	*(new_state + 1) = __raw_readl(keypad_data->base
> -						+ OMAP4_KBD_FULLCODE63_32);
> +	*new_state = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE31_0);
> +	*(new_state + 1) = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE63_32);
>  
>  	for (row = 0; row < keypad_data->rows; row++) {
>  		changed = key_state[row] ^ keypad_data->key_state[row];
> @@ -121,12 +193,13 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
>  		sizeof(keypad_data->key_state));
>  
>  	/* clear pending interrupts */
> -	__raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS),
> -			keypad_data->base + OMAP4_KBD_IRQSTATUS);
> +	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
> +			kbd_read_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS));
>  
>  	/* enable interrupts */
> -	__raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY,
> -			keypad_data->base + OMAP4_KBD_IRQENABLE);
> +	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
> +			OMAP4_DEF_IRQENABLE_EVENTEN |
> +				OMAP4_DEF_IRQENABLE_LONGKEY);
>  
>  	return IRQ_HANDLED;
>  }
> @@ -139,16 +212,19 @@ static int omap4_keypad_open(struct input_dev *input)
>  
>  	disable_irq(keypad_data->irq);
>  
> -	__raw_writel(OMAP4_VAL_FUNCTIONALCFG,
> -			keypad_data->base + OMAP4_KBD_CTRL);
> -	__raw_writel(OMAP4_VAL_DEBOUNCINGTIME,
> -			keypad_data->base + OMAP4_KBD_DEBOUNCINGTIME);
> -	__raw_writel(OMAP4_VAL_IRQDISABLE,
> -			keypad_data->base + OMAP4_KBD_IRQSTATUS);
> -	__raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY,
> -			keypad_data->base + OMAP4_KBD_IRQENABLE);
> -	__raw_writel(OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA,
> -			keypad_data->base + OMAP4_KBD_WAKEUPENABLE);
> +	keypad_data->revision = kbd_read_revision(keypad_data,
> +			OMAP4_KBD_REVISION);

You want to bail out of kbd_read_revision() returns error here.

> +	kbd_writel(keypad_data, OMAP4_KBD_CTRL,
> +			OMAP4_VAL_FUNCTIONALCFG);
> +	kbd_writel(keypad_data, OMAP4_KBD_DEBOUNCINGTIME,
> +			OMAP4_VAL_DEBOUNCINGTIME);
> +	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
> +			OMAP4_VAL_IRQDISABLE);
> +	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
> +			OMAP4_DEF_IRQENABLE_EVENTEN |
> +				OMAP4_DEF_IRQENABLE_LONGKEY);
> +	kbd_writel(keypad_data, OMAP4_KBD_WAKEUPENABLE,
> +			OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA);
>  
>  	enable_irq(keypad_data->irq);
>  
> @@ -162,12 +238,12 @@ static void omap4_keypad_close(struct input_dev *input)
>  	disable_irq(keypad_data->irq);
>  
>  	/* Disable interrupts */
> -	__raw_writel(OMAP4_VAL_IRQDISABLE,
> -		     keypad_data->base + OMAP4_KBD_IRQENABLE);
> +	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
> +			OMAP4_VAL_IRQDISABLE);
>  
>  	/* clear pending interrupts */
> -	__raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS),
> -			keypad_data->base + OMAP4_KBD_IRQSTATUS);
> +	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
> +			kbd_read_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS));
>  
>  	enable_irq(keypad_data->irq);
>  
> -- 
> 1.7.1
> 

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 2/2] Input: omap-keypad: dynamically handle register offsets
@ 2012-03-17  5:47     ` Dmitry Torokhov
  0 siblings, 0 replies; 19+ messages in thread
From: Dmitry Torokhov @ 2012-03-17  5:47 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Sourav,

On Fri, Mar 16, 2012 at 07:56:29PM +0530, Sourav Poddar wrote:
> From: G, Manjunath Kondaiah <manjugk@ti.com>
> 
> Keypad controller register offsets are different for omap4
> and omap5. Handle these offsets through static mapping and
> assign these mappings during run time.
> 
> Signed-off-by: Felipe Balbi <balbi@ti.com>
> Signed-off-by: G, Manjunath Kondaiah <manjugk@ti.com>
> Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
> ---
>  drivers/input/keyboard/Kconfig        |    6 +-
>  drivers/input/keyboard/omap4-keypad.c |  122 ++++++++++++++++++++++++++------
>  2 files changed, 102 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
> index 1379daa..09d7d0b 100644
> --- a/drivers/input/keyboard/Kconfig
> +++ b/drivers/input/keyboard/Kconfig
> @@ -510,10 +510,10 @@ config KEYBOARD_OMAP
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called omap-keypad.
>  
> -config KEYBOARD_OMAP4
> -	tristate "TI OMAP4 keypad support"
> +config KEYBOARD_OMAP4+
> +	tristate "TI OMAP4+ keypad support"
>  	help
> -	  Say Y here if you want to use the OMAP4 keypad.
> +	  Say Y here if you want to use the OMAP4+ keypad.
>  
>  	  To compile this driver as a module, choose M here: the
>  	  module will be called omap4-keypad.
> diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
> index e809ac0..6872495 100644
> --- a/drivers/input/keyboard/omap4-keypad.c
> +++ b/drivers/input/keyboard/omap4-keypad.c
> @@ -68,6 +68,11 @@
>  
>  #define OMAP4_MASK_IRQSTATUSDISABLE	0xFFFF
>  
> +enum {
> +	KBD_REVISION_OMAP4 = 0,
> +	KBD_REVISION_OMAP5,
> +};
> +
>  struct omap4_keypad {
>  	struct input_dev *input;
>  
> @@ -76,11 +81,79 @@ struct omap4_keypad {
>  
>  	unsigned int rows;
>  	unsigned int cols;
> +	unsigned int revision;
>  	unsigned int row_shift;
>  	unsigned char key_state[8];
>  	unsigned short keymap[];
>  };
>  
> +static int kbd_read_irqstatus(struct omap4_keypad *keypad_data, u32 offset)
> +{
> +	if (keypad_data->revision == KBD_REVISION_OMAP4)
> +		return __raw_readl(keypad_data->base + offset);
> +	else if (keypad_data->revision == KBD_REVISION_OMAP5)
> +		return __raw_readl(keypad_data->base + offset + 0x0c);
> +

This is called from ISR and doing comparisons seems quite wasteful. Why
don't you stuff register numbers for IRQ manipulations into struct
omap4_keypad at probe time and your function would just do:

	return __raw_readl(keypad_data->base + keypad_data->irqstatus_reg);

And do the same for irqstatus. FOr the rest of the register store the
common offset (seems to be 0x10).

> +	return -ENODEV;
> +}
> +
> +static int kbd_write_irqstatus(struct omap4_keypad *keypad_data,
> +						u32 offset, u32 value)
> +{
> +	if (keypad_data->revision == KBD_REVISION_OMAP4)
> +		return __raw_writel(value, keypad_data->base + offset);
> +	else if (keypad_data->revision == KBD_REVISION_OMAP5)
> +		return __raw_writel(value, keypad_data->base + offset + 0x0c);
> +
> +	return -ENODEV;
> +}
> +
> +static int kbd_write_irqenable(struct omap4_keypad *keypad_data,
> +						u32 offset, u32 value)
> +{
> +	if (keypad_data->revision == KBD_REVISION_OMAP4)
> +		return __raw_writel(value, keypad_data->base + offset);
> +	else if (keypad_data->revision == KBD_REVISION_OMAP5)
> +		return __raw_writel(value, keypad_data->base + offset + 0x0c);
> +
> +	return -ENODEV;
> +}
> +
> +static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset)
> +{
> +	if (keypad_data->revision == KBD_REVISION_OMAP4)
> +		return __raw_readl(keypad_data->base + offset);
> +	else if (keypad_data->revision == KBD_REVISION_OMAP5)
> +		return __raw_readl(keypad_data->base + offset + 0x10);
> +
> +	return -ENODEV;
> +}
> +
> +static void kbd_writel(struct omap4_keypad *keypad_data, u32 offset, u32 value)
> +{
> +	if (keypad_data->revision == KBD_REVISION_OMAP4)
> +		__raw_writel(value, keypad_data->base + offset);
> +	else if (keypad_data->revision == KBD_REVISION_OMAP5)
> +		__raw_writel(value, keypad_data->base + offset + 0x10);
> +}
> +
> +static int kbd_read_revision(struct omap4_keypad *keypad_data, u32 offset)
> +{
> +	int reg;
> +	reg = __raw_readl(keypad_data->base + offset);
> +	reg &= 0x03 << 30;
> +	reg >>= 30;
> +
> +	switch (reg) {
> +	case 1:
> +		return KBD_REVISION_OMAP5;
> +	case 0:
> +		return KBD_REVISION_OMAP4;
> +	default:
> +		return -ENODEV;
> +	}
> +}
> +
>  /* Interrupt handler */
>  static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
>  {
> @@ -91,12 +164,11 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
>  	u32 *new_state = (u32 *) key_state;
>  
>  	/* Disable interrupts */
> -	__raw_writel(OMAP4_VAL_IRQDISABLE,
> -		     keypad_data->base + OMAP4_KBD_IRQENABLE);
> +	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
> +						OMAP4_VAL_IRQDISABLE);
>  
> -	*new_state = __raw_readl(keypad_data->base + OMAP4_KBD_FULLCODE31_0);
> -	*(new_state + 1) = __raw_readl(keypad_data->base
> -						+ OMAP4_KBD_FULLCODE63_32);
> +	*new_state = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE31_0);
> +	*(new_state + 1) = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE63_32);
>  
>  	for (row = 0; row < keypad_data->rows; row++) {
>  		changed = key_state[row] ^ keypad_data->key_state[row];
> @@ -121,12 +193,13 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
>  		sizeof(keypad_data->key_state));
>  
>  	/* clear pending interrupts */
> -	__raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS),
> -			keypad_data->base + OMAP4_KBD_IRQSTATUS);
> +	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
> +			kbd_read_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS));
>  
>  	/* enable interrupts */
> -	__raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY,
> -			keypad_data->base + OMAP4_KBD_IRQENABLE);
> +	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
> +			OMAP4_DEF_IRQENABLE_EVENTEN |
> +				OMAP4_DEF_IRQENABLE_LONGKEY);
>  
>  	return IRQ_HANDLED;
>  }
> @@ -139,16 +212,19 @@ static int omap4_keypad_open(struct input_dev *input)
>  
>  	disable_irq(keypad_data->irq);
>  
> -	__raw_writel(OMAP4_VAL_FUNCTIONALCFG,
> -			keypad_data->base + OMAP4_KBD_CTRL);
> -	__raw_writel(OMAP4_VAL_DEBOUNCINGTIME,
> -			keypad_data->base + OMAP4_KBD_DEBOUNCINGTIME);
> -	__raw_writel(OMAP4_VAL_IRQDISABLE,
> -			keypad_data->base + OMAP4_KBD_IRQSTATUS);
> -	__raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY,
> -			keypad_data->base + OMAP4_KBD_IRQENABLE);
> -	__raw_writel(OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA,
> -			keypad_data->base + OMAP4_KBD_WAKEUPENABLE);
> +	keypad_data->revision = kbd_read_revision(keypad_data,
> +			OMAP4_KBD_REVISION);

You want to bail out of kbd_read_revision() returns error here.

> +	kbd_writel(keypad_data, OMAP4_KBD_CTRL,
> +			OMAP4_VAL_FUNCTIONALCFG);
> +	kbd_writel(keypad_data, OMAP4_KBD_DEBOUNCINGTIME,
> +			OMAP4_VAL_DEBOUNCINGTIME);
> +	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
> +			OMAP4_VAL_IRQDISABLE);
> +	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
> +			OMAP4_DEF_IRQENABLE_EVENTEN |
> +				OMAP4_DEF_IRQENABLE_LONGKEY);
> +	kbd_writel(keypad_data, OMAP4_KBD_WAKEUPENABLE,
> +			OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA);
>  
>  	enable_irq(keypad_data->irq);
>  
> @@ -162,12 +238,12 @@ static void omap4_keypad_close(struct input_dev *input)
>  	disable_irq(keypad_data->irq);
>  
>  	/* Disable interrupts */
> -	__raw_writel(OMAP4_VAL_IRQDISABLE,
> -		     keypad_data->base + OMAP4_KBD_IRQENABLE);
> +	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
> +			OMAP4_VAL_IRQDISABLE);
>  
>  	/* clear pending interrupts */
> -	__raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS),
> -			keypad_data->base + OMAP4_KBD_IRQSTATUS);
> +	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
> +			kbd_read_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS));
>  
>  	enable_irq(keypad_data->irq);
>  
> -- 
> 1.7.1
> 

Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 19+ messages in thread

* Re: [PATCH 2/2] Input: omap-keypad: dynamically handle register offsets
       [not found]     ` <CAKdam54CudK-BoeAfOMrcHk51D9QsUbPhh5=Rqw5_ERCu2BpKA@mail.gmail.com>
@ 2012-03-19  8:33         ` Felipe Balbi
  0 siblings, 0 replies; 19+ messages in thread
From: Felipe Balbi @ 2012-03-19  8:33 UTC (permalink / raw)
  To: Poddar, Sourav
  Cc: linux-omap, Dmitry Torokhov, balbi, linux-arm-kernel, linux-input


[-- Attachment #1.1: Type: text/plain, Size: 9510 bytes --]

Hi,

On Mon, Mar 19, 2012 at 01:27:50PM +0530, Poddar, Sourav wrote:
> 
> 
> On Sat, Mar 17, 2012 at 11:17 AM, Dmitry Torokhov <dmitry.torokhov@gmail.com>
> wrote:
> 
>     Hi Sourav,
> 
>     On Fri, Mar 16, 2012 at 07:56:29PM +0530, Sourav Poddar wrote:
>     > From: G, Manjunath Kondaiah <manjugk@ti.com>
>     >
>     > Keypad controller register offsets are different for omap4
>     > and omap5. Handle these offsets through static mapping and
>     > assign these mappings during run time.
>     >
>     > Signed-off-by: Felipe Balbi <balbi@ti.com>
>     > Signed-off-by: G, Manjunath Kondaiah <manjugk@ti.com>
>     > Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
>     > ---
>     >  drivers/input/keyboard/Kconfig        |    6 +-
>     >  drivers/input/keyboard/omap4-keypad.c |  122
>     ++++++++++++++++++++++++++------
>     >  2 files changed, 102 insertions(+), 26 deletions(-)
>     >
>     > diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/
>     Kconfig
>     > index 1379daa..09d7d0b 100644
>     > --- a/drivers/input/keyboard/Kconfig
>     > +++ b/drivers/input/keyboard/Kconfig
>     > @@ -510,10 +510,10 @@ config KEYBOARD_OMAP
>     >         To compile this driver as a module, choose M here: the
>     >         module will be called omap-keypad.
>     >
>     > -config KEYBOARD_OMAP4
>     > -     tristate "TI OMAP4 keypad support"
>     > +config KEYBOARD_OMAP4+
>     > +     tristate "TI OMAP4+ keypad support"
>     >       help
>     > -       Say Y here if you want to use the OMAP4 keypad.
>     > +       Say Y here if you want to use the OMAP4+ keypad.
>     >
>     >         To compile this driver as a module, choose M here: the
>     >         module will be called omap4-keypad.
>     > diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/
>     keyboard/omap4-keypad.c
>     > index e809ac0..6872495 100644
>     > --- a/drivers/input/keyboard/omap4-keypad.c
>     > +++ b/drivers/input/keyboard/omap4-keypad.c
>     > @@ -68,6 +68,11 @@
>     >
>     >  #define OMAP4_MASK_IRQSTATUSDISABLE  0xFFFF
>     >
>     > +enum {
>     > +     KBD_REVISION_OMAP4 = 0,
>     > +     KBD_REVISION_OMAP5,
>     > +};
>     > +
>     >  struct omap4_keypad {
>     >       struct input_dev *input;
>     >
>     > @@ -76,11 +81,79 @@ struct omap4_keypad {
>     >
>     >       unsigned int rows;
>     >       unsigned int cols;
>     > +     unsigned int revision;
>     >       unsigned int row_shift;
>     >       unsigned char key_state[8];
>     >       unsigned short keymap[];
>     >  };
>     >
>     > +static int kbd_read_irqstatus(struct omap4_keypad *keypad_data, u32
>     offset)
>     > +{
>     > +     if (keypad_data->revision == KBD_REVISION_OMAP4)
>     > +             return __raw_readl(keypad_data->base + offset);
>     > +     else if (keypad_data->revision == KBD_REVISION_OMAP5)
>     > +             return __raw_readl(keypad_data->base + offset + 0x0c);
>     > +
> 
>     This is called from ISR and doing comparisons seems quite wasteful. Why
>     don't you stuff register numbers for IRQ manipulations into struct
>     omap4_keypad at probe time and your function would just do:
> 
>            return __raw_readl(keypad_data->base + keypad_data->irqstatus_reg);
> 
> 
> Yes, can do that way . Will make necessary changes and post it again.
> 
>     And do the same for irqstatus. FOr the rest of the register store the
> 
>      I think you mean "irqenable" here.
> 
>     common offset (seems to be 0x10).
> 
>     > +     return -ENODEV;
>     > +}
>     > +
>     > +static int kbd_write_irqstatus(struct omap4_keypad *keypad_data,
>     > +                                             u32 offset, u32 value)
>     > +{
>     > +     if (keypad_data->revision == KBD_REVISION_OMAP4)
>     > +             return __raw_writel(value, keypad_data->base + offset);
>     > +     else if (keypad_data->revision == KBD_REVISION_OMAP5)
>     > +             return __raw_writel(value, keypad_data->base + offset +
>     0x0c);
>     > +
>     > +     return -ENODEV;
>     > +}
>     > +
>     > +static int kbd_write_irqenable(struct omap4_keypad *keypad_data,
>     > +                                             u32 offset, u32 value)
>     > +{
>     > +     if (keypad_data->revision == KBD_REVISION_OMAP4)
>     > +             return __raw_writel(value, keypad_data->base + offset);
>     > +     else if (keypad_data->revision == KBD_REVISION_OMAP5)
>     > +             return __raw_writel(value, keypad_data->base + offset +
>     0x0c);
>     > +
>     > +     return -ENODEV;
>     > +}
>     > +
>     > +static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset)
>     > +{
>     > +     if (keypad_data->revision == KBD_REVISION_OMAP4)
>     > +             return __raw_readl(keypad_data->base + offset);
>     > +     else if (keypad_data->revision == KBD_REVISION_OMAP5)
>     > +             return __raw_readl(keypad_data->base + offset + 0x10);
>     > +
>     > +     return -ENODEV;
>     > +}
>     > +
>     > +static void kbd_writel(struct omap4_keypad *keypad_data, u32 offset, u32
>     value)
>     > +{
>     > +     if (keypad_data->revision == KBD_REVISION_OMAP4)
>     > +             __raw_writel(value, keypad_data->base + offset);
>     > +     else if (keypad_data->revision == KBD_REVISION_OMAP5)
>     > +             __raw_writel(value, keypad_data->base + offset + 0x10);
>     > +}
>     > +
>     > +static int kbd_read_revision(struct omap4_keypad *keypad_data, u32
>     offset)
>     > +{
>     > +     int reg;
>     > +     reg = __raw_readl(keypad_data->base + offset);
>     > +     reg &= 0x03 << 30;
>     > +     reg >>= 30;
>     > +
>     > +     switch (reg) {
>     > +     case 1:
>     > +             return KBD_REVISION_OMAP5;
>     > +     case 0:
>     > +             return KBD_REVISION_OMAP4;
>     > +     default:
>     > +             return -ENODEV;
>     > +     }
>     > +}
>     > +
>     >  /* Interrupt handler */
>     >  static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
>     >  {
>     > @@ -91,12 +164,11 @@ static irqreturn_t omap4_keypad_interrupt(int irq,
>     void *dev_id)
>     >       u32 *new_state = (u32 *) key_state;
>     >
>     >       /* Disable interrupts */
>     > -     __raw_writel(OMAP4_VAL_IRQDISABLE,
>     > -                  keypad_data->base + OMAP4_KBD_IRQENABLE);
>     > +     kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
>     > +                                             OMAP4_VAL_IRQDISABLE);
>     >
>     > -     *new_state = __raw_readl(keypad_data->base +
>     OMAP4_KBD_FULLCODE31_0);
>     > -     *(new_state + 1) = __raw_readl(keypad_data->base
>     > -                                             + OMAP4_KBD_FULLCODE63_32);
>     > +     *new_state = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE31_0);
>     > +     *(new_state + 1) = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE63_32);
>     >
>     >       for (row = 0; row < keypad_data->rows; row++) {
>     >               changed = key_state[row] ^ keypad_data->key_state[row];
>     > @@ -121,12 +193,13 @@ static irqreturn_t omap4_keypad_interrupt(int irq,
>     void *dev_id)
>     >               sizeof(keypad_data->key_state));
>     >
>     >       /* clear pending interrupts */
>     > -     __raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS),
>     > -                     keypad_data->base + OMAP4_KBD_IRQSTATUS);
>     > +     kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
>     > +                     kbd_read_irqstatus(keypad_data,
>     OMAP4_KBD_IRQSTATUS));
>     >
>     >       /* enable interrupts */
>     > -     __raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN |
>     OMAP4_DEF_IRQENABLE_LONGKEY,
>     > -                     keypad_data->base + OMAP4_KBD_IRQENABLE);
>     > +     kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
>     > +                     OMAP4_DEF_IRQENABLE_EVENTEN |
>     > +                             OMAP4_DEF_IRQENABLE_LONGKEY);
>     >
>     >       return IRQ_HANDLED;
>     >  }
>     > @@ -139,16 +212,19 @@ static int omap4_keypad_open(struct input_dev
>     *input)
>     >
>     >       disable_irq(keypad_data->irq);
>     >
>     > -     __raw_writel(OMAP4_VAL_FUNCTIONALCFG,
>     > -                     keypad_data->base + OMAP4_KBD_CTRL);
>     > -     __raw_writel(OMAP4_VAL_DEBOUNCINGTIME,
>     > -                     keypad_data->base + OMAP4_KBD_DEBOUNCINGTIME);
>     > -     __raw_writel(OMAP4_VAL_IRQDISABLE,
>     > -                     keypad_data->base + OMAP4_KBD_IRQSTATUS);
>     > -     __raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN |
>     OMAP4_DEF_IRQENABLE_LONGKEY,
>     > -                     keypad_data->base + OMAP4_KBD_IRQENABLE);
>     > -     __raw_writel(OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA,
>     > -                     keypad_data->base + OMAP4_KBD_WAKEUPENABLE);
>     > +     keypad_data->revision = kbd_read_revision(keypad_data,
>     > +                     OMAP4_KBD_REVISION);
> 
>     You want to bail out of kbd_read_revision() returns error here.
> 
> 
> Yes, will include a error check.

Please send text/plain emails. You're currently sending multipart:

Content-Type: multipart/alternative;

-- 
balbi

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 2/2] Input: omap-keypad: dynamically handle register offsets
@ 2012-03-19  8:33         ` Felipe Balbi
  0 siblings, 0 replies; 19+ messages in thread
From: Felipe Balbi @ 2012-03-19  8:33 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On Mon, Mar 19, 2012 at 01:27:50PM +0530, Poddar, Sourav wrote:
> 
> 
> On Sat, Mar 17, 2012 at 11:17 AM, Dmitry Torokhov <dmitry.torokhov@gmail.com>
> wrote:
> 
>     Hi Sourav,
> 
>     On Fri, Mar 16, 2012 at 07:56:29PM +0530, Sourav Poddar wrote:
>     > From: G, Manjunath Kondaiah <manjugk@ti.com>
>     >
>     > Keypad controller register offsets are different for omap4
>     > and omap5. Handle these offsets through static mapping and
>     > assign these mappings during run time.
>     >
>     > Signed-off-by: Felipe Balbi <balbi@ti.com>
>     > Signed-off-by: G, Manjunath Kondaiah <manjugk@ti.com>
>     > Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
>     > ---
>     >  drivers/input/keyboard/Kconfig        |    6 +-
>     >  drivers/input/keyboard/omap4-keypad.c |  122
>     ++++++++++++++++++++++++++------
>     >  2 files changed, 102 insertions(+), 26 deletions(-)
>     >
>     > diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/
>     Kconfig
>     > index 1379daa..09d7d0b 100644
>     > --- a/drivers/input/keyboard/Kconfig
>     > +++ b/drivers/input/keyboard/Kconfig
>     > @@ -510,10 +510,10 @@ config KEYBOARD_OMAP
>     >         To compile this driver as a module, choose M here: the
>     >         module will be called omap-keypad.
>     >
>     > -config KEYBOARD_OMAP4
>     > -     tristate "TI OMAP4 keypad support"
>     > +config KEYBOARD_OMAP4+
>     > +     tristate "TI OMAP4+ keypad support"
>     >       help
>     > -       Say Y here if you want to use the OMAP4 keypad.
>     > +       Say Y here if you want to use the OMAP4+ keypad.
>     >
>     >         To compile this driver as a module, choose M here: the
>     >         module will be called omap4-keypad.
>     > diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/
>     keyboard/omap4-keypad.c
>     > index e809ac0..6872495 100644
>     > --- a/drivers/input/keyboard/omap4-keypad.c
>     > +++ b/drivers/input/keyboard/omap4-keypad.c
>     > @@ -68,6 +68,11 @@
>     >
>     >  #define OMAP4_MASK_IRQSTATUSDISABLE  0xFFFF
>     >
>     > +enum {
>     > +     KBD_REVISION_OMAP4 = 0,
>     > +     KBD_REVISION_OMAP5,
>     > +};
>     > +
>     >  struct omap4_keypad {
>     >       struct input_dev *input;
>     >
>     > @@ -76,11 +81,79 @@ struct omap4_keypad {
>     >
>     >       unsigned int rows;
>     >       unsigned int cols;
>     > +     unsigned int revision;
>     >       unsigned int row_shift;
>     >       unsigned char key_state[8];
>     >       unsigned short keymap[];
>     >  };
>     >
>     > +static int kbd_read_irqstatus(struct omap4_keypad *keypad_data, u32
>     offset)
>     > +{
>     > +     if (keypad_data->revision == KBD_REVISION_OMAP4)
>     > +             return __raw_readl(keypad_data->base + offset);
>     > +     else if (keypad_data->revision == KBD_REVISION_OMAP5)
>     > +             return __raw_readl(keypad_data->base + offset + 0x0c);
>     > +
> 
>     This is called from ISR and doing comparisons seems quite wasteful. Why
>     don't you stuff register numbers for IRQ manipulations into struct
>     omap4_keypad at probe time and your function would just do:
> 
>            return __raw_readl(keypad_data->base + keypad_data->irqstatus_reg);
> 
> 
> Yes, can do that way . Will make necessary changes and post it again.
> 
>     And do the same for irqstatus. FOr the rest of the register store the
> 
>      I think you mean "irqenable" here.
> 
>     common offset (seems to be 0x10).
> 
>     > +     return -ENODEV;
>     > +}
>     > +
>     > +static int kbd_write_irqstatus(struct omap4_keypad *keypad_data,
>     > +                                             u32 offset, u32 value)
>     > +{
>     > +     if (keypad_data->revision == KBD_REVISION_OMAP4)
>     > +             return __raw_writel(value, keypad_data->base + offset);
>     > +     else if (keypad_data->revision == KBD_REVISION_OMAP5)
>     > +             return __raw_writel(value, keypad_data->base + offset +
>     0x0c);
>     > +
>     > +     return -ENODEV;
>     > +}
>     > +
>     > +static int kbd_write_irqenable(struct omap4_keypad *keypad_data,
>     > +                                             u32 offset, u32 value)
>     > +{
>     > +     if (keypad_data->revision == KBD_REVISION_OMAP4)
>     > +             return __raw_writel(value, keypad_data->base + offset);
>     > +     else if (keypad_data->revision == KBD_REVISION_OMAP5)
>     > +             return __raw_writel(value, keypad_data->base + offset +
>     0x0c);
>     > +
>     > +     return -ENODEV;
>     > +}
>     > +
>     > +static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset)
>     > +{
>     > +     if (keypad_data->revision == KBD_REVISION_OMAP4)
>     > +             return __raw_readl(keypad_data->base + offset);
>     > +     else if (keypad_data->revision == KBD_REVISION_OMAP5)
>     > +             return __raw_readl(keypad_data->base + offset + 0x10);
>     > +
>     > +     return -ENODEV;
>     > +}
>     > +
>     > +static void kbd_writel(struct omap4_keypad *keypad_data, u32 offset, u32
>     value)
>     > +{
>     > +     if (keypad_data->revision == KBD_REVISION_OMAP4)
>     > +             __raw_writel(value, keypad_data->base + offset);
>     > +     else if (keypad_data->revision == KBD_REVISION_OMAP5)
>     > +             __raw_writel(value, keypad_data->base + offset + 0x10);
>     > +}
>     > +
>     > +static int kbd_read_revision(struct omap4_keypad *keypad_data, u32
>     offset)
>     > +{
>     > +     int reg;
>     > +     reg = __raw_readl(keypad_data->base + offset);
>     > +     reg &= 0x03 << 30;
>     > +     reg >>= 30;
>     > +
>     > +     switch (reg) {
>     > +     case 1:
>     > +             return KBD_REVISION_OMAP5;
>     > +     case 0:
>     > +             return KBD_REVISION_OMAP4;
>     > +     default:
>     > +             return -ENODEV;
>     > +     }
>     > +}
>     > +
>     >  /* Interrupt handler */
>     >  static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
>     >  {
>     > @@ -91,12 +164,11 @@ static irqreturn_t omap4_keypad_interrupt(int irq,
>     void *dev_id)
>     >       u32 *new_state = (u32 *) key_state;
>     >
>     >       /* Disable interrupts */
>     > -     __raw_writel(OMAP4_VAL_IRQDISABLE,
>     > -                  keypad_data->base + OMAP4_KBD_IRQENABLE);
>     > +     kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
>     > +                                             OMAP4_VAL_IRQDISABLE);
>     >
>     > -     *new_state = __raw_readl(keypad_data->base +
>     OMAP4_KBD_FULLCODE31_0);
>     > -     *(new_state + 1) = __raw_readl(keypad_data->base
>     > -                                             + OMAP4_KBD_FULLCODE63_32);
>     > +     *new_state = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE31_0);
>     > +     *(new_state + 1) = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE63_32);
>     >
>     >       for (row = 0; row < keypad_data->rows; row++) {
>     >               changed = key_state[row] ^ keypad_data->key_state[row];
>     > @@ -121,12 +193,13 @@ static irqreturn_t omap4_keypad_interrupt(int irq,
>     void *dev_id)
>     >               sizeof(keypad_data->key_state));
>     >
>     >       /* clear pending interrupts */
>     > -     __raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS),
>     > -                     keypad_data->base + OMAP4_KBD_IRQSTATUS);
>     > +     kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
>     > +                     kbd_read_irqstatus(keypad_data,
>     OMAP4_KBD_IRQSTATUS));
>     >
>     >       /* enable interrupts */
>     > -     __raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN |
>     OMAP4_DEF_IRQENABLE_LONGKEY,
>     > -                     keypad_data->base + OMAP4_KBD_IRQENABLE);
>     > +     kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
>     > +                     OMAP4_DEF_IRQENABLE_EVENTEN |
>     > +                             OMAP4_DEF_IRQENABLE_LONGKEY);
>     >
>     >       return IRQ_HANDLED;
>     >  }
>     > @@ -139,16 +212,19 @@ static int omap4_keypad_open(struct input_dev
>     *input)
>     >
>     >       disable_irq(keypad_data->irq);
>     >
>     > -     __raw_writel(OMAP4_VAL_FUNCTIONALCFG,
>     > -                     keypad_data->base + OMAP4_KBD_CTRL);
>     > -     __raw_writel(OMAP4_VAL_DEBOUNCINGTIME,
>     > -                     keypad_data->base + OMAP4_KBD_DEBOUNCINGTIME);
>     > -     __raw_writel(OMAP4_VAL_IRQDISABLE,
>     > -                     keypad_data->base + OMAP4_KBD_IRQSTATUS);
>     > -     __raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN |
>     OMAP4_DEF_IRQENABLE_LONGKEY,
>     > -                     keypad_data->base + OMAP4_KBD_IRQENABLE);
>     > -     __raw_writel(OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA,
>     > -                     keypad_data->base + OMAP4_KBD_WAKEUPENABLE);
>     > +     keypad_data->revision = kbd_read_revision(keypad_data,
>     > +                     OMAP4_KBD_REVISION);
> 
>     You want to bail out of kbd_read_revision() returns error here.
> 
> 
> Yes, will include a error check.

Please send text/plain emails. You're currently sending multipart:

Content-Type: multipart/alternative;

-- 
balbi
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120319/8fe3b937/attachment-0001.sig>

^ permalink raw reply	[flat|nested] 19+ messages in thread

* [PATCH 2/2] Input: omap-keypad: dynamically handle register offsets
  2012-03-16 13:39 [PATCH 0/2] Omap keypad cleanup and omap5 support Sourav Poddar
  2012-03-16 13:39   ` Sourav Poddar
@ 2012-03-16 13:39   ` Sourav Poddar
  0 siblings, 0 replies; 19+ messages in thread
From: Sourav Poddar @ 2012-03-16 13:39 UTC (permalink / raw)
  To: dmitry.torokhov, linux-input, linux-arm-kernel, linux-kernel; +Cc: balbi

From: G, Manjunath Kondaiah <manjugk@ti.com>

Keypad controller register offsets are different for omap4
and omap5. Handle these offsets through static mapping and
assign these mappings during run time.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: G, Manjunath Kondaiah <manjugk@ti.com>
Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
---
 drivers/input/keyboard/Kconfig        |    6 +-
 drivers/input/keyboard/omap4-keypad.c |  122 ++++++++++++++++++++++++++------
 2 files changed, 102 insertions(+), 26 deletions(-)

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 1379daa..09d7d0b 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -510,10 +510,10 @@ config KEYBOARD_OMAP
 	  To compile this driver as a module, choose M here: the
 	  module will be called omap-keypad.
 
-config KEYBOARD_OMAP4
-	tristate "TI OMAP4 keypad support"
+config KEYBOARD_OMAP4+
+	tristate "TI OMAP4+ keypad support"
 	help
-	  Say Y here if you want to use the OMAP4 keypad.
+	  Say Y here if you want to use the OMAP4+ keypad.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called omap4-keypad.
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index e809ac0..6872495 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -68,6 +68,11 @@
 
 #define OMAP4_MASK_IRQSTATUSDISABLE	0xFFFF
 
+enum {
+	KBD_REVISION_OMAP4 = 0,
+	KBD_REVISION_OMAP5,
+};
+
 struct omap4_keypad {
 	struct input_dev *input;
 
@@ -76,11 +81,79 @@ struct omap4_keypad {
 
 	unsigned int rows;
 	unsigned int cols;
+	unsigned int revision;
 	unsigned int row_shift;
 	unsigned char key_state[8];
 	unsigned short keymap[];
 };
 
+static int kbd_read_irqstatus(struct omap4_keypad *keypad_data, u32 offset)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		return __raw_readl(keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		return __raw_readl(keypad_data->base + offset + 0x0c);
+
+	return -ENODEV;
+}
+
+static int kbd_write_irqstatus(struct omap4_keypad *keypad_data,
+						u32 offset, u32 value)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		return __raw_writel(value, keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		return __raw_writel(value, keypad_data->base + offset + 0x0c);
+
+	return -ENODEV;
+}
+
+static int kbd_write_irqenable(struct omap4_keypad *keypad_data,
+						u32 offset, u32 value)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		return __raw_writel(value, keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		return __raw_writel(value, keypad_data->base + offset + 0x0c);
+
+	return -ENODEV;
+}
+
+static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		return __raw_readl(keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		return __raw_readl(keypad_data->base + offset + 0x10);
+
+	return -ENODEV;
+}
+
+static void kbd_writel(struct omap4_keypad *keypad_data, u32 offset, u32 value)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		__raw_writel(value, keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		__raw_writel(value, keypad_data->base + offset + 0x10);
+}
+
+static int kbd_read_revision(struct omap4_keypad *keypad_data, u32 offset)
+{
+	int reg;
+	reg = __raw_readl(keypad_data->base + offset);
+	reg &= 0x03 << 30;
+	reg >>= 30;
+
+	switch (reg) {
+	case 1:
+		return KBD_REVISION_OMAP5;
+	case 0:
+		return KBD_REVISION_OMAP4;
+	default:
+		return -ENODEV;
+	}
+}
+
 /* Interrupt handler */
 static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
 {
@@ -91,12 +164,11 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
 	u32 *new_state = (u32 *) key_state;
 
 	/* Disable interrupts */
-	__raw_writel(OMAP4_VAL_IRQDISABLE,
-		     keypad_data->base + OMAP4_KBD_IRQENABLE);
+	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
+						OMAP4_VAL_IRQDISABLE);
 
-	*new_state = __raw_readl(keypad_data->base + OMAP4_KBD_FULLCODE31_0);
-	*(new_state + 1) = __raw_readl(keypad_data->base
-						+ OMAP4_KBD_FULLCODE63_32);
+	*new_state = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE31_0);
+	*(new_state + 1) = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE63_32);
 
 	for (row = 0; row < keypad_data->rows; row++) {
 		changed = key_state[row] ^ keypad_data->key_state[row];
@@ -121,12 +193,13 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
 		sizeof(keypad_data->key_state));
 
 	/* clear pending interrupts */
-	__raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS),
-			keypad_data->base + OMAP4_KBD_IRQSTATUS);
+	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
+			kbd_read_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS));
 
 	/* enable interrupts */
-	__raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY,
-			keypad_data->base + OMAP4_KBD_IRQENABLE);
+	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
+			OMAP4_DEF_IRQENABLE_EVENTEN |
+				OMAP4_DEF_IRQENABLE_LONGKEY);
 
 	return IRQ_HANDLED;
 }
@@ -139,16 +212,19 @@ static int omap4_keypad_open(struct input_dev *input)
 
 	disable_irq(keypad_data->irq);
 
-	__raw_writel(OMAP4_VAL_FUNCTIONALCFG,
-			keypad_data->base + OMAP4_KBD_CTRL);
-	__raw_writel(OMAP4_VAL_DEBOUNCINGTIME,
-			keypad_data->base + OMAP4_KBD_DEBOUNCINGTIME);
-	__raw_writel(OMAP4_VAL_IRQDISABLE,
-			keypad_data->base + OMAP4_KBD_IRQSTATUS);
-	__raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY,
-			keypad_data->base + OMAP4_KBD_IRQENABLE);
-	__raw_writel(OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA,
-			keypad_data->base + OMAP4_KBD_WAKEUPENABLE);
+	keypad_data->revision = kbd_read_revision(keypad_data,
+			OMAP4_KBD_REVISION);
+	kbd_writel(keypad_data, OMAP4_KBD_CTRL,
+			OMAP4_VAL_FUNCTIONALCFG);
+	kbd_writel(keypad_data, OMAP4_KBD_DEBOUNCINGTIME,
+			OMAP4_VAL_DEBOUNCINGTIME);
+	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
+			OMAP4_VAL_IRQDISABLE);
+	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
+			OMAP4_DEF_IRQENABLE_EVENTEN |
+				OMAP4_DEF_IRQENABLE_LONGKEY);
+	kbd_writel(keypad_data, OMAP4_KBD_WAKEUPENABLE,
+			OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA);
 
 	enable_irq(keypad_data->irq);
 
@@ -162,12 +238,12 @@ static void omap4_keypad_close(struct input_dev *input)
 	disable_irq(keypad_data->irq);
 
 	/* Disable interrupts */
-	__raw_writel(OMAP4_VAL_IRQDISABLE,
-		     keypad_data->base + OMAP4_KBD_IRQENABLE);
+	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
+			OMAP4_VAL_IRQDISABLE);
 
 	/* clear pending interrupts */
-	__raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS),
-			keypad_data->base + OMAP4_KBD_IRQSTATUS);
+	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
+			kbd_read_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS));
 
 	enable_irq(keypad_data->irq);
 
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/2] Input: omap-keypad: dynamically handle register offsets
@ 2012-03-16 13:39   ` Sourav Poddar
  0 siblings, 0 replies; 19+ messages in thread
From: Sourav Poddar @ 2012-03-16 13:39 UTC (permalink / raw)
  To: dmitry.torokhov, linux-input, linux-arm-kernel, linux-kernel; +Cc: balbi

From: G, Manjunath Kondaiah <manjugk@ti.com>

Keypad controller register offsets are different for omap4
and omap5. Handle these offsets through static mapping and
assign these mappings during run time.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: G, Manjunath Kondaiah <manjugk@ti.com>
Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
---
 drivers/input/keyboard/Kconfig        |    6 +-
 drivers/input/keyboard/omap4-keypad.c |  122 ++++++++++++++++++++++++++------
 2 files changed, 102 insertions(+), 26 deletions(-)

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 1379daa..09d7d0b 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -510,10 +510,10 @@ config KEYBOARD_OMAP
 	  To compile this driver as a module, choose M here: the
 	  module will be called omap-keypad.
 
-config KEYBOARD_OMAP4
-	tristate "TI OMAP4 keypad support"
+config KEYBOARD_OMAP4+
+	tristate "TI OMAP4+ keypad support"
 	help
-	  Say Y here if you want to use the OMAP4 keypad.
+	  Say Y here if you want to use the OMAP4+ keypad.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called omap4-keypad.
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index e809ac0..6872495 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -68,6 +68,11 @@
 
 #define OMAP4_MASK_IRQSTATUSDISABLE	0xFFFF
 
+enum {
+	KBD_REVISION_OMAP4 = 0,
+	KBD_REVISION_OMAP5,
+};
+
 struct omap4_keypad {
 	struct input_dev *input;
 
@@ -76,11 +81,79 @@ struct omap4_keypad {
 
 	unsigned int rows;
 	unsigned int cols;
+	unsigned int revision;
 	unsigned int row_shift;
 	unsigned char key_state[8];
 	unsigned short keymap[];
 };
 
+static int kbd_read_irqstatus(struct omap4_keypad *keypad_data, u32 offset)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		return __raw_readl(keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		return __raw_readl(keypad_data->base + offset + 0x0c);
+
+	return -ENODEV;
+}
+
+static int kbd_write_irqstatus(struct omap4_keypad *keypad_data,
+						u32 offset, u32 value)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		return __raw_writel(value, keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		return __raw_writel(value, keypad_data->base + offset + 0x0c);
+
+	return -ENODEV;
+}
+
+static int kbd_write_irqenable(struct omap4_keypad *keypad_data,
+						u32 offset, u32 value)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		return __raw_writel(value, keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		return __raw_writel(value, keypad_data->base + offset + 0x0c);
+
+	return -ENODEV;
+}
+
+static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		return __raw_readl(keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		return __raw_readl(keypad_data->base + offset + 0x10);
+
+	return -ENODEV;
+}
+
+static void kbd_writel(struct omap4_keypad *keypad_data, u32 offset, u32 value)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		__raw_writel(value, keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		__raw_writel(value, keypad_data->base + offset + 0x10);
+}
+
+static int kbd_read_revision(struct omap4_keypad *keypad_data, u32 offset)
+{
+	int reg;
+	reg = __raw_readl(keypad_data->base + offset);
+	reg &= 0x03 << 30;
+	reg >>= 30;
+
+	switch (reg) {
+	case 1:
+		return KBD_REVISION_OMAP5;
+	case 0:
+		return KBD_REVISION_OMAP4;
+	default:
+		return -ENODEV;
+	}
+}
+
 /* Interrupt handler */
 static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
 {
@@ -91,12 +164,11 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
 	u32 *new_state = (u32 *) key_state;
 
 	/* Disable interrupts */
-	__raw_writel(OMAP4_VAL_IRQDISABLE,
-		     keypad_data->base + OMAP4_KBD_IRQENABLE);
+	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
+						OMAP4_VAL_IRQDISABLE);
 
-	*new_state = __raw_readl(keypad_data->base + OMAP4_KBD_FULLCODE31_0);
-	*(new_state + 1) = __raw_readl(keypad_data->base
-						+ OMAP4_KBD_FULLCODE63_32);
+	*new_state = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE31_0);
+	*(new_state + 1) = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE63_32);
 
 	for (row = 0; row < keypad_data->rows; row++) {
 		changed = key_state[row] ^ keypad_data->key_state[row];
@@ -121,12 +193,13 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
 		sizeof(keypad_data->key_state));
 
 	/* clear pending interrupts */
-	__raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS),
-			keypad_data->base + OMAP4_KBD_IRQSTATUS);
+	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
+			kbd_read_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS));
 
 	/* enable interrupts */
-	__raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY,
-			keypad_data->base + OMAP4_KBD_IRQENABLE);
+	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
+			OMAP4_DEF_IRQENABLE_EVENTEN |
+				OMAP4_DEF_IRQENABLE_LONGKEY);
 
 	return IRQ_HANDLED;
 }
@@ -139,16 +212,19 @@ static int omap4_keypad_open(struct input_dev *input)
 
 	disable_irq(keypad_data->irq);
 
-	__raw_writel(OMAP4_VAL_FUNCTIONALCFG,
-			keypad_data->base + OMAP4_KBD_CTRL);
-	__raw_writel(OMAP4_VAL_DEBOUNCINGTIME,
-			keypad_data->base + OMAP4_KBD_DEBOUNCINGTIME);
-	__raw_writel(OMAP4_VAL_IRQDISABLE,
-			keypad_data->base + OMAP4_KBD_IRQSTATUS);
-	__raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY,
-			keypad_data->base + OMAP4_KBD_IRQENABLE);
-	__raw_writel(OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA,
-			keypad_data->base + OMAP4_KBD_WAKEUPENABLE);
+	keypad_data->revision = kbd_read_revision(keypad_data,
+			OMAP4_KBD_REVISION);
+	kbd_writel(keypad_data, OMAP4_KBD_CTRL,
+			OMAP4_VAL_FUNCTIONALCFG);
+	kbd_writel(keypad_data, OMAP4_KBD_DEBOUNCINGTIME,
+			OMAP4_VAL_DEBOUNCINGTIME);
+	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
+			OMAP4_VAL_IRQDISABLE);
+	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
+			OMAP4_DEF_IRQENABLE_EVENTEN |
+				OMAP4_DEF_IRQENABLE_LONGKEY);
+	kbd_writel(keypad_data, OMAP4_KBD_WAKEUPENABLE,
+			OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA);
 
 	enable_irq(keypad_data->irq);
 
@@ -162,12 +238,12 @@ static void omap4_keypad_close(struct input_dev *input)
 	disable_irq(keypad_data->irq);
 
 	/* Disable interrupts */
-	__raw_writel(OMAP4_VAL_IRQDISABLE,
-		     keypad_data->base + OMAP4_KBD_IRQENABLE);
+	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
+			OMAP4_VAL_IRQDISABLE);
 
 	/* clear pending interrupts */
-	__raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS),
-			keypad_data->base + OMAP4_KBD_IRQSTATUS);
+	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
+			kbd_read_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS));
 
 	enable_irq(keypad_data->irq);
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

* [PATCH 2/2] Input: omap-keypad: dynamically handle register offsets
@ 2012-03-16 13:39   ` Sourav Poddar
  0 siblings, 0 replies; 19+ messages in thread
From: Sourav Poddar @ 2012-03-16 13:39 UTC (permalink / raw)
  To: linux-arm-kernel

From: G, Manjunath Kondaiah <manjugk@ti.com>

Keypad controller register offsets are different for omap4
and omap5. Handle these offsets through static mapping and
assign these mappings during run time.

Signed-off-by: Felipe Balbi <balbi@ti.com>
Signed-off-by: G, Manjunath Kondaiah <manjugk@ti.com>
Signed-off-by: Sourav Poddar <sourav.poddar@ti.com>
---
 drivers/input/keyboard/Kconfig        |    6 +-
 drivers/input/keyboard/omap4-keypad.c |  122 ++++++++++++++++++++++++++------
 2 files changed, 102 insertions(+), 26 deletions(-)

diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig
index 1379daa..09d7d0b 100644
--- a/drivers/input/keyboard/Kconfig
+++ b/drivers/input/keyboard/Kconfig
@@ -510,10 +510,10 @@ config KEYBOARD_OMAP
 	  To compile this driver as a module, choose M here: the
 	  module will be called omap-keypad.
 
-config KEYBOARD_OMAP4
-	tristate "TI OMAP4 keypad support"
+config KEYBOARD_OMAP4+
+	tristate "TI OMAP4+ keypad support"
 	help
-	  Say Y here if you want to use the OMAP4 keypad.
+	  Say Y here if you want to use the OMAP4+ keypad.
 
 	  To compile this driver as a module, choose M here: the
 	  module will be called omap4-keypad.
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index e809ac0..6872495 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -68,6 +68,11 @@
 
 #define OMAP4_MASK_IRQSTATUSDISABLE	0xFFFF
 
+enum {
+	KBD_REVISION_OMAP4 = 0,
+	KBD_REVISION_OMAP5,
+};
+
 struct omap4_keypad {
 	struct input_dev *input;
 
@@ -76,11 +81,79 @@ struct omap4_keypad {
 
 	unsigned int rows;
 	unsigned int cols;
+	unsigned int revision;
 	unsigned int row_shift;
 	unsigned char key_state[8];
 	unsigned short keymap[];
 };
 
+static int kbd_read_irqstatus(struct omap4_keypad *keypad_data, u32 offset)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		return __raw_readl(keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		return __raw_readl(keypad_data->base + offset + 0x0c);
+
+	return -ENODEV;
+}
+
+static int kbd_write_irqstatus(struct omap4_keypad *keypad_data,
+						u32 offset, u32 value)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		return __raw_writel(value, keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		return __raw_writel(value, keypad_data->base + offset + 0x0c);
+
+	return -ENODEV;
+}
+
+static int kbd_write_irqenable(struct omap4_keypad *keypad_data,
+						u32 offset, u32 value)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		return __raw_writel(value, keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		return __raw_writel(value, keypad_data->base + offset + 0x0c);
+
+	return -ENODEV;
+}
+
+static int kbd_readl(struct omap4_keypad *keypad_data, u32 offset)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		return __raw_readl(keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		return __raw_readl(keypad_data->base + offset + 0x10);
+
+	return -ENODEV;
+}
+
+static void kbd_writel(struct omap4_keypad *keypad_data, u32 offset, u32 value)
+{
+	if (keypad_data->revision == KBD_REVISION_OMAP4)
+		__raw_writel(value, keypad_data->base + offset);
+	else if (keypad_data->revision == KBD_REVISION_OMAP5)
+		__raw_writel(value, keypad_data->base + offset + 0x10);
+}
+
+static int kbd_read_revision(struct omap4_keypad *keypad_data, u32 offset)
+{
+	int reg;
+	reg = __raw_readl(keypad_data->base + offset);
+	reg &= 0x03 << 30;
+	reg >>= 30;
+
+	switch (reg) {
+	case 1:
+		return KBD_REVISION_OMAP5;
+	case 0:
+		return KBD_REVISION_OMAP4;
+	default:
+		return -ENODEV;
+	}
+}
+
 /* Interrupt handler */
 static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
 {
@@ -91,12 +164,11 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
 	u32 *new_state = (u32 *) key_state;
 
 	/* Disable interrupts */
-	__raw_writel(OMAP4_VAL_IRQDISABLE,
-		     keypad_data->base + OMAP4_KBD_IRQENABLE);
+	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
+						OMAP4_VAL_IRQDISABLE);
 
-	*new_state = __raw_readl(keypad_data->base + OMAP4_KBD_FULLCODE31_0);
-	*(new_state + 1) = __raw_readl(keypad_data->base
-						+ OMAP4_KBD_FULLCODE63_32);
+	*new_state = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE31_0);
+	*(new_state + 1) = kbd_readl(keypad_data, OMAP4_KBD_FULLCODE63_32);
 
 	for (row = 0; row < keypad_data->rows; row++) {
 		changed = key_state[row] ^ keypad_data->key_state[row];
@@ -121,12 +193,13 @@ static irqreturn_t omap4_keypad_interrupt(int irq, void *dev_id)
 		sizeof(keypad_data->key_state));
 
 	/* clear pending interrupts */
-	__raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS),
-			keypad_data->base + OMAP4_KBD_IRQSTATUS);
+	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
+			kbd_read_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS));
 
 	/* enable interrupts */
-	__raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY,
-			keypad_data->base + OMAP4_KBD_IRQENABLE);
+	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
+			OMAP4_DEF_IRQENABLE_EVENTEN |
+				OMAP4_DEF_IRQENABLE_LONGKEY);
 
 	return IRQ_HANDLED;
 }
@@ -139,16 +212,19 @@ static int omap4_keypad_open(struct input_dev *input)
 
 	disable_irq(keypad_data->irq);
 
-	__raw_writel(OMAP4_VAL_FUNCTIONALCFG,
-			keypad_data->base + OMAP4_KBD_CTRL);
-	__raw_writel(OMAP4_VAL_DEBOUNCINGTIME,
-			keypad_data->base + OMAP4_KBD_DEBOUNCINGTIME);
-	__raw_writel(OMAP4_VAL_IRQDISABLE,
-			keypad_data->base + OMAP4_KBD_IRQSTATUS);
-	__raw_writel(OMAP4_DEF_IRQENABLE_EVENTEN | OMAP4_DEF_IRQENABLE_LONGKEY,
-			keypad_data->base + OMAP4_KBD_IRQENABLE);
-	__raw_writel(OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA,
-			keypad_data->base + OMAP4_KBD_WAKEUPENABLE);
+	keypad_data->revision = kbd_read_revision(keypad_data,
+			OMAP4_KBD_REVISION);
+	kbd_writel(keypad_data, OMAP4_KBD_CTRL,
+			OMAP4_VAL_FUNCTIONALCFG);
+	kbd_writel(keypad_data, OMAP4_KBD_DEBOUNCINGTIME,
+			OMAP4_VAL_DEBOUNCINGTIME);
+	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
+			OMAP4_VAL_IRQDISABLE);
+	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
+			OMAP4_DEF_IRQENABLE_EVENTEN |
+				OMAP4_DEF_IRQENABLE_LONGKEY);
+	kbd_writel(keypad_data, OMAP4_KBD_WAKEUPENABLE,
+			OMAP4_DEF_WUP_EVENT_ENA | OMAP4_DEF_WUP_LONG_KEY_ENA);
 
 	enable_irq(keypad_data->irq);
 
@@ -162,12 +238,12 @@ static void omap4_keypad_close(struct input_dev *input)
 	disable_irq(keypad_data->irq);
 
 	/* Disable interrupts */
-	__raw_writel(OMAP4_VAL_IRQDISABLE,
-		     keypad_data->base + OMAP4_KBD_IRQENABLE);
+	kbd_write_irqenable(keypad_data, OMAP4_KBD_IRQENABLE,
+			OMAP4_VAL_IRQDISABLE);
 
 	/* clear pending interrupts */
-	__raw_writel(__raw_readl(keypad_data->base + OMAP4_KBD_IRQSTATUS),
-			keypad_data->base + OMAP4_KBD_IRQSTATUS);
+	kbd_write_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS,
+			kbd_read_irqstatus(keypad_data, OMAP4_KBD_IRQSTATUS));
 
 	enable_irq(keypad_data->irq);
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 19+ messages in thread

end of thread, other threads:[~2012-03-19  8:33 UTC | newest]

Thread overview: 19+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-03-16 14:26 [PATCH 0/2] Omap keypad cleanup and omap5 support Sourav Poddar
2012-03-16 14:26 ` Sourav Poddar
2012-03-16 14:26 ` [PATCH 1/2] input: keypad: move platform_data to <linux/platform_data> Sourav Poddar
2012-03-16 14:26   ` Sourav Poddar
2012-03-16 16:36   ` Dmitry Torokhov
2012-03-16 16:36     ` Dmitry Torokhov
2012-03-16 21:08     ` Felipe Balbi
2012-03-16 21:08       ` Felipe Balbi
2012-03-17  5:36       ` Dmitry Torokhov
2012-03-17  5:36         ` Dmitry Torokhov
2012-03-16 14:26 ` [PATCH 2/2] Input: omap-keypad: dynamically handle register offsets Sourav Poddar
2012-03-16 14:26   ` Sourav Poddar
2012-03-17  5:47   ` Dmitry Torokhov
2012-03-17  5:47     ` Dmitry Torokhov
     [not found]     ` <CAKdam54CudK-BoeAfOMrcHk51D9QsUbPhh5=Rqw5_ERCu2BpKA@mail.gmail.com>
2012-03-19  8:33       ` Felipe Balbi
2012-03-19  8:33         ` Felipe Balbi
  -- strict thread matches above, loose matches on Subject: below --
2012-03-16 13:39 [PATCH 0/2] Omap keypad cleanup and omap5 support Sourav Poddar
2012-03-16 13:39 ` [PATCH 2/2] Input: omap-keypad: dynamically handle register offsets Sourav Poddar
2012-03-16 13:39   ` Sourav Poddar
2012-03-16 13:39   ` Sourav Poddar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.