[E3-hacking] [PATCH] OMAP: Fix omap-keypad by restoring old keypad.h without breaking omap2 boards that use matrix_keypad

Janusz Krzysztofik jkrzyszt at tis.icnet.pl
Wed Oct 21 19:09:37 BST 2009


Wednesday 21 October 2009 17:59:40 Tony Lindgren napisał(a):
> * Janusz Krzysztofik <jkrzyszt at tis.icnet.pl> [091021 07:21]:
> > Hi,
> > Commit 4f5433324d1e29cf234d5b1b14782c0fc2948298 had made machines that
> > use new matrix_keypad based drivers happy while breaking those that still
> > use old omap-keypad driver. The patch fixes omap-keypad device for my
> > Amstrad Delta (tested) and probably 11 more OMAP1 based machines. It
> > leaves a potential similiar problem on OMAP2 H4 machine not addressed.
> >
> > I would say that those new, matrix_keypad based drivers should be
> > corrected to simply not include arch/arm/plat-omap/include/mach/keypad.h,
> > which should keep serving omap-keypad based machines until they are all
> > upgraded to use matrix_keypad.
>
> Hmm, yeah let's try to do that instead.
> ...
>
> Maybe we should add:
>
> #warning: Please update the board to use matrix_keypad.h instead

Here you are.

Created against linux-2.6.32-rc5.
Compile tested with omap_3430sdp_defconfig and rx51_defconfig.

Signed-off-by: Janusz Krzysztofik <jkrzyszt at tis.icnet.pl>

---
diff -upr linux-2.6.32-rc5.orig/arch/arm/mach-omap2/board-3430sdp.c linux-2.6.32-rc5.fixed/arch/arm/mach-omap2/board-3430sdp.c
--- linux-2.6.32-rc5.orig/arch/arm/mach-omap2/board-3430sdp.c	2009-10-16 02:41:50.000000000 +0200
+++ linux-2.6.32-rc5.fixed/arch/arm/mach-omap2/board-3430sdp.c	2009-10-21 19:28:48.000000000 +0200
@@ -17,6 +17,7 @@
 #include <linux/platform_device.h>
 #include <linux/delay.h>
 #include <linux/input.h>
+#include <linux/input/matrix_keypad.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/ads7846.h>
 #include <linux/i2c/twl4030.h>
@@ -38,7 +39,6 @@
 #include <mach/gpmc.h>
 
 #include <mach/control.h>
-#include <mach/keypad.h>
 #include <mach/gpmc-smc91x.h>
 
 #include "sdram-qimonda-hyb18m512160af-6.h"
diff -upr linux-2.6.32-rc5.orig/arch/arm/mach-omap2/board-ldp.c linux-2.6.32-rc5.fixed/arch/arm/mach-omap2/board-ldp.c
--- linux-2.6.32-rc5.orig/arch/arm/mach-omap2/board-ldp.c	2009-10-16 02:41:50.000000000 +0200
+++ linux-2.6.32-rc5.fixed/arch/arm/mach-omap2/board-ldp.c	2009-10-21 19:30:03.000000000 +0200
@@ -16,6 +16,7 @@
 #include <linux/platform_device.h>
 #include <linux/delay.h>
 #include <linux/input.h>
+#include <linux/input/matrix_keypad.h>
 #include <linux/gpio_keys.h>
 #include <linux/workqueue.h>
 #include <linux/err.h>
@@ -41,7 +42,6 @@
 #include <asm/delay.h>
 #include <mach/control.h>
 #include <mach/usb.h>
-#include <mach/keypad.h>
 
 #include "mmc-twl4030.h"
 
diff -upr linux-2.6.32-rc5.orig/arch/arm/mach-omap2/board-omap3evm.c linux-2.6.32-rc5.fixed/arch/arm/mach-omap2/board-omap3evm.c
--- linux-2.6.32-rc5.orig/arch/arm/mach-omap2/board-omap3evm.c	2009-10-16 02:41:50.000000000 +0200
+++ linux-2.6.32-rc5.fixed/arch/arm/mach-omap2/board-omap3evm.c	2009-10-21 19:30:16.000000000 +0200
@@ -20,6 +20,7 @@
 #include <linux/clk.h>
 #include <linux/gpio.h>
 #include <linux/input.h>
+#include <linux/input/matrix_keypad.h>
 #include <linux/leds.h>
 
 #include <linux/spi/spi.h>
@@ -37,7 +38,6 @@
 #include <mach/usb.h>
 #include <mach/common.h>
 #include <mach/mcspi.h>
-#include <mach/keypad.h>
 
 #include "sdram-micron-mt46h32m32lf-6.h"
 #include "mmc-twl4030.h"
diff -upr linux-2.6.32-rc5.orig/arch/arm/mach-omap2/board-omap3pandora.c linux-2.6.32-rc5.fixed/arch/arm/mach-omap2/board-omap3pandora.c
--- linux-2.6.32-rc5.orig/arch/arm/mach-omap2/board-omap3pandora.c	2009-10-16 02:41:50.000000000 +0200
+++ linux-2.6.32-rc5.fixed/arch/arm/mach-omap2/board-omap3pandora.c	2009-10-21 19:28:03.000000000 +0200
@@ -27,6 +27,7 @@
 #include <linux/i2c/twl4030.h>
 #include <linux/leds.h>
 #include <linux/input.h>
+#include <linux/input/matrix_keypad.h>
 #include <linux/gpio_keys.h>
 
 #include <asm/mach-types.h>
@@ -39,7 +40,6 @@
 #include <mach/hardware.h>
 #include <mach/mcspi.h>
 #include <mach/usb.h>
-#include <mach/keypad.h>
 #include <mach/mux.h>
 
 #include "sdram-micron-mt46h32m32lf-6.h"
diff -upr linux-2.6.32-rc5.orig/arch/arm/mach-omap2/board-rx51-peripherals.c linux-2.6.32-rc5.fixed/arch/arm/mach-omap2/board-rx51-peripherals.c
--- linux-2.6.32-rc5.orig/arch/arm/mach-omap2/board-rx51-peripherals.c	2009-10-16 02:41:50.000000000 +0200
+++ linux-2.6.32-rc5.fixed/arch/arm/mach-omap2/board-rx51-peripherals.c	2009-10-21 19:29:31.000000000 +0200
@@ -12,6 +12,7 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/input.h>
+#include <linux/input/matrix_keypad.h>
 #include <linux/spi/spi.h>
 #include <linux/i2c.h>
 #include <linux/i2c/twl4030.h>
@@ -27,7 +28,6 @@
 #include <mach/common.h>
 #include <mach/dma.h>
 #include <mach/gpmc.h>
-#include <mach/keypad.h>
 #include <mach/onenand.h>
 #include <mach/gpmc-smc91x.h>
 
diff -upr linux-2.6.32-rc5.orig/arch/arm/mach-omap2/board-rx51.c linux-2.6.32-rc5.fixed/arch/arm/mach-omap2/board-rx51.c
--- linux-2.6.32-rc5.orig/arch/arm/mach-omap2/board-rx51.c	2009-10-16 02:41:50.000000000 +0200
+++ linux-2.6.32-rc5.fixed/arch/arm/mach-omap2/board-rx51.c	2009-10-21 19:25:33.000000000 +0200
@@ -26,7 +26,6 @@
 #include <mach/mux.h>
 #include <mach/board.h>
 #include <mach/common.h>
-#include <mach/keypad.h>
 #include <mach/dma.h>
 #include <mach/gpmc.h>
 #include <mach/usb.h>
diff -upr linux-2.6.32-rc5.orig/arch/arm/mach-omap2/board-zoom2.c linux-2.6.32-rc5.fixed/arch/arm/mach-omap2/board-zoom2.c
--- linux-2.6.32-rc5.orig/arch/arm/mach-omap2/board-zoom2.c	2009-10-16 02:41:50.000000000 +0200
+++ linux-2.6.32-rc5.fixed/arch/arm/mach-omap2/board-zoom2.c	2009-10-21 19:29:52.000000000 +0200
@@ -13,6 +13,7 @@
 #include <linux/init.h>
 #include <linux/platform_device.h>
 #include <linux/input.h>
+#include <linux/input/matrix_keypad.h>
 #include <linux/gpio.h>
 #include <linux/i2c/twl4030.h>
 #include <linux/regulator/machine.h>
@@ -22,7 +23,6 @@
 
 #include <mach/common.h>
 #include <mach/usb.h>
-#include <mach/keypad.h>
 
 #include "mmc-twl4030.h"
 #include "sdram-micron-mt46h32m32lf-6.h"
diff -upr linux-2.6.32-rc5.orig/arch/arm/plat-omap/include/mach/keypad.h linux-2.6.32-rc5.fixed/arch/arm/plat-omap/include/mach/keypad.h
--- linux-2.6.32-rc5.orig/arch/arm/plat-omap/include/mach/keypad.h	2009-10-16 02:41:50.000000000 +0200
+++ linux-2.6.32-rc5.fixed/arch/arm/plat-omap/include/mach/keypad.h	2009-10-21 19:41:35.000000000 +0200
@@ -10,7 +10,7 @@
 #ifndef ASMARM_ARCH_KEYPAD_H
 #define ASMARM_ARCH_KEYPAD_H
 
-#include <linux/input/matrix_keypad.h>
+#warning: Please update the board to use matrix_keypad.h instead
 
 struct omap_kp_platform_data {
 	int rows;
@@ -37,6 +37,9 @@ struct omap_kp_platform_data {
 
 #define KEY_PERSISTENT		0x00800000
 #define KEYNUM_MASK		0x00EFFFFF
+#define KEY(col, row, val) (((col) << 28) | ((row) << 24) | (val))
+#define PERSISTENT_KEY(col, row) (((col) << 28) | ((row) << 24) | \
+						KEY_PERSISTENT)
 
 #endif
 



More information about the e3-hacking mailing list