Skip to contentSkip to conversation

ARM: pxa168: add keypad support

PATCH Superseded Mark F. Brown 4 participants 20 messages Aug 26, 2010 – Sep 3, 2010

Subsystems (6)

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

cover ARM: pxa168: add keypad support

In order to add keypad support for pxa168

1) Make pxa27x_keypad.h accessible to mach-mmp
2) Add a special interrupt handler for pxa168 keypad interrupts This interrupt handler fixes an issue on the SoC that prevents the keypad driver from being able to clear the keypad interrupt.
3) Add initial board level support

Mark F. Brown (5):
ARM: pxa27x/pxa3xx: moved pxa27x_keypad.h to platform pxa directory
ARM: pxa168: added keypad support
ARM: pxa168: added wake clear register support for APMU
ARM: pxa168: added special case handler for keypad interrupts
ARM: pxa168: aspenite: add board support for keypad

 arch/arm/mach-mmp/aspenite.c                   |   27 +++++++++++
 arch/arm/mach-mmp/include/mach/mfp-pxa168.h    |    7 +++
 arch/arm/mach-mmp/include/mach/pxa168.h        |    7 +++
 arch/arm/mach-mmp/include/mach/regs-apmu.h     |   12 +++++
 arch/arm/mach-mmp/irq-pxa168.c                 |   23 +++++++++-
 arch/arm/mach-mmp/pxa168.c                     |    3 +
 arch/arm/mach-pxa/devices.c                    |    2 +-
 arch/arm/mach-pxa/em-x270.c                    |    2 +-
 arch/arm/mach-pxa/ezx.c                        |    2 +-
 arch/arm/mach-pxa/include/mach/pxa27x_keypad.h |   59 ------------------------
 arch/arm/mach-pxa/littleton.c                  |    2 +-
 arch/arm/mach-pxa/mainstone.c                  |    4 +-
 arch/arm/mach-pxa/mioa701.c                    |    2 +-
 arch/arm/mach-pxa/palmld.c                     |    2 +-
 arch/arm/mach-pxa/palmt5.c                     |    2 +-
 arch/arm/mach-pxa/palmtreo.c                   |    2 +-
 arch/arm/mach-pxa/palmtx.c                     |    2 +-
 arch/arm/mach-pxa/palmz72.c                    |    2 +-
 arch/arm/mach-pxa/tavorevb.c                   |    2 +-
 arch/arm/mach-pxa/z2.c                         |    2 +-
 arch/arm/mach-pxa/zylonite.c                   |    2 +-
 arch/arm/plat-pxa/include/plat/pxa27x_keypad.h |   59 ++++++++++++++++++++++++
 drivers/input/keyboard/Kconfig                 |    2 +-
 drivers/input/keyboard/pxa27x_keypad.c         |    2 +-
 24 files changed, 154 insertions(+), 77 deletions(-)
 delete mode 100644 arch/arm/mach-pxa/include/mach/pxa27x_keypad.h
 create mode 100644 arch/arm/plat-pxa/include/plat/pxa27x_keypad.h
#1 lore raw

PATCH 1/5 ARM: pxa27x/pxa3xx: moved pxa27x_keypad.h to platform pxa directory

mach-mmp utilizes pxa27x_keypad code so we need to move header to platform pxa directory.

---
 arch/arm/mach-pxa/devices.c                    |    2 +-
 arch/arm/mach-pxa/em-x270.c                    |    2 +-
 arch/arm/mach-pxa/ezx.c                        |    2 +-
 arch/arm/mach-pxa/include/mach/pxa27x_keypad.h |   59 ------------------------
 arch/arm/mach-pxa/littleton.c                  |    2 +-
 arch/arm/mach-pxa/mainstone.c                  |    4 +-
 arch/arm/mach-pxa/mioa701.c                    |    2 +-
 arch/arm/mach-pxa/palmld.c                     |    2 +-
 arch/arm/mach-pxa/palmt5.c                     |    2 +-
 arch/arm/mach-pxa/palmtreo.c                   |    2 +-
 arch/arm/mach-pxa/palmtx.c                     |    2 +-
 arch/arm/mach-pxa/palmz72.c                    |    2 +-
 arch/arm/mach-pxa/tavorevb.c                   |    2 +-
 arch/arm/mach-pxa/z2.c                         |    2 +-
 arch/arm/mach-pxa/zylonite.c                   |    2 +-
 arch/arm/plat-pxa/include/plat/pxa27x_keypad.h |   59 ++++++++++++++++++++++++
 drivers/input/keyboard/pxa27x_keypad.c         |    2 +-
 17 files changed, 75 insertions(+), 75 deletions(-)
 delete mode 100644 arch/arm/mach-pxa/include/mach/pxa27x_keypad.h
 create mode 100644 arch/arm/plat-pxa/include/plat/pxa27x_keypad.h
arch/arm/mach-pxa/devices.c +1 -1
index a2fc859..08b4103 100644
@@ -11,7 +11,7 @@
 #include <mach/mmc.h>
 #include <mach/irda.h>
 #include <mach/ohci.h>
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>
 #include <mach/pxa2xx_spi.h>
 #include <mach/camera.h>
 #include <mach/audio.h>
arch/arm/mach-pxa/em-x270.c +1 -1
index 0517c17..51286a7 100644
@@ -43,7 +43,7 @@
 #include <mach/pxafb.h>
 #include <mach/ohci.h>
 #include <mach/mmc.h>
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>
 #include <plat/i2c.h>
 #include <mach/camera.h>
 #include <mach/pxa2xx_spi.h>
arch/arm/mach-pxa/ezx.c +1 -1
index 3fe61f4..f997e84 100644
@@ -32,7 +32,7 @@
 #include <mach/ohci.h>
 #include <plat/i2c.h>
 #include <mach/hardware.h>
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>
 #include <mach/camera.h>
 
 #include "devices.h"
arch/arm/mach-pxa/include/mach/pxa27x_keypad.h deleted +0 -59

59 lines not on this page · raw message

arch/arm/mach-pxa/littleton.c +1 -1
index 83f3236..eb58506 100644
@@ -43,7 +43,7 @@
 #include <mach/pxafb.h>
 #include <mach/mmc.h>
 #include <mach/pxa2xx_spi.h>
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>
 #include <mach/littleton.h>
 #include <plat/i2c.h>
 #include <plat/pxa3xx_nand.h>
arch/arm/mach-pxa/mainstone.c +2 -2
index c2a8717..126dca1 100644
@@ -41,7 +41,7 @@
 #include <asm/mach/irq.h>
 #include <asm/mach/flash.h>
 
-#include <mach/pxa27x.h>
+#include <plat/pxa27x.h>
 #include <mach/gpio.h>
 #include <mach/mainstone.h>
 #include <mach/audio.h>
@@ -50,7 +50,7 @@
 #include <mach/mmc.h>
 #include <mach/irda.h>
 #include <mach/ohci.h>
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>
 
 #include "generic.h"
 #include "devices.h"
arch/arm/mach-pxa/mioa701.c +1 -1
index dc66942..ffb3f5a 100644
@@ -45,7 +45,7 @@
 
 #include <mach/pxa27x.h>
 #include <mach/regs-rtc.h>
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>
 #include <mach/pxafb.h>
 #include <mach/mmc.h>
 #include <mach/udc.h>
arch/arm/mach-pxa/palmld.c +1 -1
index 91038ee..3ff0c4a 100644
@@ -39,7 +39,7 @@
 #include <mach/mmc.h>
 #include <mach/pxafb.h>
 #include <mach/irda.h>
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>
 #include <mach/palmasoc.h>
 #include <mach/palm27x.h>
 
arch/arm/mach-pxa/palmt5.c +1 -1
index 1c28199..5b9f766 100644
@@ -39,7 +39,7 @@
 #include <mach/mmc.h>
 #include <mach/pxafb.h>
 #include <mach/irda.h>
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>
 #include <mach/udc.h>
 #include <mach/palmasoc.h>
 #include <mach/palm27x.h>
arch/arm/mach-pxa/palmtreo.c +1 -1
index 52defd5..f685a60 100644
@@ -39,7 +39,7 @@
 #include <mach/mmc.h>
 #include <mach/pxafb.h>
 #include <mach/irda.h>
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>
 #include <mach/udc.h>
 #include <mach/ohci.h>
 #include <mach/pxa2xx-regs.h>
arch/arm/mach-pxa/palmtx.c +1 -1
index 144dc2b..89a3792 100644
@@ -43,7 +43,7 @@
 #include <mach/mmc.h>
 #include <mach/pxafb.h>
 #include <mach/irda.h>
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>
 #include <mach/udc.h>
 #include <mach/palmasoc.h>
 #include <mach/palm27x.h>
arch/arm/mach-pxa/palmz72.c +1 -1
index 87e4b10..38f4425 100644
@@ -41,7 +41,7 @@
 #include <mach/mmc.h>
 #include <mach/pxafb.h>
 #include <mach/irda.h>
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>
 #include <mach/udc.h>
 #include <mach/palmasoc.h>
 #include <mach/palm27x.h>
arch/arm/mach-pxa/tavorevb.c +1 -1
index f02dcb5..0f440c9 100644
@@ -25,7 +25,7 @@
 
 #include <mach/pxa930.h>
 #include <mach/pxafb.h>
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>
 
 #include "devices.h"
 #include "generic.h"
arch/arm/mach-pxa/z2.c +1 -1
index f0d0228..8c44bc4 100644
@@ -37,7 +37,7 @@
 #include <mach/z2.h>
 #include <mach/pxafb.h>
 #include <mach/mmc.h>
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>
 #include <mach/pxa2xx_spi.h>
 
 #include <plat/i2c.h>
arch/arm/mach-pxa/zylonite.c +1 -1
index 2edad61..69df3ed 100644
@@ -30,7 +30,7 @@
 #include <mach/zylonite.h>
 #include <mach/mmc.h>
 #include <mach/ohci.h>
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>
 #include <plat/pxa3xx_nand.h>
 
 #include "devices.h"
arch/arm/plat-pxa/include/plat/pxa27x_keypad.h new file +59 -0

59 lines not on this page · raw message

drivers/input/keyboard/pxa27x_keypad.c +1 -1
index 0e53b3b..0610d10 100644
@@ -32,7 +32,7 @@
 #include <asm/mach/map.h>
 
 #include <mach/hardware.h>
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>
 /*
  * Keypad Controller registers
  */
Signature · 1 line
1.7.0.4
#2 lore raw

Re: [PATCH 1/5] ARM: pxa27x/pxa3xx: moved pxa27x_keypad.h to platform pxa directory

Quoted 2 lines · Mark F. Brown

mach-mmp utilizes pxa27x_keypad code so we need to move header to platform pxa directory.

Good move. I'm actually very inclined to move this into include/linux/input/.

And you may try '-M' when generating patches with 'git format-patch', and see the difference of the output.

Quoted 362 lines

---

?arch/arm/mach-pxa/devices.c ? ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/mach-pxa/em-x270.c ? ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/mach-pxa/ezx.c ? ? ? ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/mach-pxa/include/mach/pxa27x_keypad.h | ? 59 ------------------------
?arch/arm/mach-pxa/littleton.c ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/mach-pxa/mainstone.c ? ? ? ? ? ? ? ? ?| ? ?4 +-
?arch/arm/mach-pxa/mioa701.c ? ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/mach-pxa/palmld.c ? ? ? ? ? ? ? ? ? ? | ? ?2 +-
?arch/arm/mach-pxa/palmt5.c ? ? ? ? ? ? ? ? ? ? | ? ?2 +-
?arch/arm/mach-pxa/palmtreo.c ? ? ? ? ? ? ? ? ? | ? ?2 +-
?arch/arm/mach-pxa/palmtx.c ? ? ? ? ? ? ? ? ? ? | ? ?2 +-
?arch/arm/mach-pxa/palmz72.c ? ? ? ? ? ? ? ? ? ?| ? ?2 +-
?arch/arm/mach-pxa/tavorevb.c ? ? ? ? ? ? ? ? ? | ? ?2 +-
?arch/arm/mach-pxa/z2.c ? ? ? ? ? ? ? ? ? ? ? ? | ? ?2 +-
?arch/arm/mach-pxa/zylonite.c ? ? ? ? ? ? ? ? ? | ? ?2 +-
?arch/arm/plat-pxa/include/plat/pxa27x_keypad.h | ? 59 ++++++++++++++++++++++++
?drivers/input/keyboard/pxa27x_keypad.c ? ? ? ? | ? ?2 +-

?17 files changed, 75 insertions(+), 75 deletions(-) ?delete mode 100644 arch/arm/mach-pxa/include/mach/pxa27x_keypad.h ?create mode 100644 arch/arm/plat-pxa/include/plat/pxa27x_keypad.h

arch/arm/mach-pxa/devices.c +0 -0
index a2fc859..08b4103 100644
@@ -11,7 +11,7 @@

?#include <mach/mmc.h>
?#include <mach/irda.h>
?#include <mach/ohci.h>

arch/arm/mach-pxa/devices.c +1 -1
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>

?#include <mach/pxa2xx_spi.h>
?#include <mach/camera.h>
?#include <mach/audio.h>

arch/arm/mach-pxa/em-x270.c +0 -0
index 0517c17..51286a7 100644
@@ -43,7 +43,7 @@

?#include <mach/pxafb.h>
?#include <mach/ohci.h>
?#include <mach/mmc.h>

arch/arm/mach-pxa/em-x270.c +1 -1
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>

?#include <plat/i2c.h>
?#include <mach/camera.h>
?#include <mach/pxa2xx_spi.h>

arch/arm/mach-pxa/ezx.c +0 -0
index 3fe61f4..f997e84 100644
@@ -32,7 +32,7 @@

?#include <mach/ohci.h>
?#include <plat/i2c.h>
?#include <mach/hardware.h>

arch/arm/mach-pxa/ezx.c +1 -1
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>

?#include <mach/camera.h>

?#include "devices.h"

arch/arm/mach-pxa/include/mach/pxa27x_keypad.h deleted +0 -59
deleted file mode 100644
index 7b4eadc..0000000
@@ -1,59 +0,0 @@
-#ifndef __ASM_ARCH_PXA27x_KEYPAD_H
-#define __ASM_ARCH_PXA27x_KEYPAD_H
-
-#include <linux/input.h>
-#include <linux/input/matrix_keypad.h>
-
-#define MAX_MATRIX_KEY_ROWS ? ?(8)
-#define MAX_MATRIX_KEY_COLS ? ?(8)
-#define MATRIX_ROW_SHIFT ? ? ? (3)
-#define MAX_DIRECT_KEY_NUM ? ? (8)
-
-/* pxa3xx keypad platform specific parameters
- *
- * NOTE:
- * 1. direct_key_num indicates the number of keys in the direct keypad
- * ? ?_plus_ the number of rotary-encoder sensor inputs, ?this can be
- * ? ?left as 0 if only rotary encoders are enabled, ?the driver will
- * ? ?automatically calculate this
- *
- * 2. direct_key_map is the key code map for the direct keys, if rotary
- * ? ?encoder(s) are enabled, direct key 0/1(2/3) will be ignored
- *
- * 3. rotary can be either interpreted as a relative input event (e.g.
- * ? ?REL_WHEEL/REL_HWHEEL) or specific keys (e.g. UP/DOWN/LEFT/RIGHT)
- *
- * 4. matrix key and direct key will use the same debounce_interval by
- * ? ?default, which should be sufficient in most cases
- */
-struct pxa27x_keypad_platform_data {
-
- ? ? ? /* code map for the matrix keys */
- ? ? ? unsigned int ? ?matrix_key_rows;
- ? ? ? unsigned int ? ?matrix_key_cols;
- ? ? ? unsigned int ? ?*matrix_key_map;
- ? ? ? int ? ? ? ? ? ? matrix_key_map_size;
-
- ? ? ? /* direct keys */
- ? ? ? int ? ? ? ? ? ? direct_key_num;
- ? ? ? unsigned int ? ?direct_key_map[MAX_DIRECT_KEY_NUM];
-
- ? ? ? /* rotary encoders 0 */
- ? ? ? int ? ? ? ? ? ? enable_rotary0;
- ? ? ? int ? ? ? ? ? ? rotary0_rel_code;
- ? ? ? int ? ? ? ? ? ? rotary0_up_key;
- ? ? ? int ? ? ? ? ? ? rotary0_down_key;
-
- ? ? ? /* rotary encoders 1 */
- ? ? ? int ? ? ? ? ? ? enable_rotary1;
- ? ? ? int ? ? ? ? ? ? rotary1_rel_code;
- ? ? ? int ? ? ? ? ? ? rotary1_up_key;
- ? ? ? int ? ? ? ? ? ? rotary1_down_key;
-
- ? ? ? /* key debounce interval */
- ? ? ? unsigned int ? ?debounce_interval;
-};
-
-extern void pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info);
-
-#endif /* __ASM_ARCH_PXA27x_KEYPAD_H */
arch/arm/mach-pxa/littleton.c +0 -0
index 83f3236..eb58506 100644
@@ -43,7 +43,7 @@

?#include <mach/pxafb.h>
?#include <mach/mmc.h>
?#include <mach/pxa2xx_spi.h>

arch/arm/mach-pxa/littleton.c +1 -1
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>

?#include <mach/littleton.h>
?#include <plat/i2c.h>
?#include <plat/pxa3xx_nand.h>

arch/arm/mach-pxa/mainstone.c +0 -0
index c2a8717..126dca1 100644
@@ -41,7 +41,7 @@

?#include <asm/mach/irq.h>
?#include <asm/mach/flash.h>

arch/arm/mach-pxa/mainstone.c +1 -1
-#include <mach/pxa27x.h>
+#include <plat/pxa27x.h>

?#include <mach/gpio.h>
?#include <mach/mainstone.h>
?#include <mach/audio.h>

arch/arm/mach-pxa/mainstone.c +0 -0
@@ -50,7 +50,7 @@

?#include <mach/mmc.h>
?#include <mach/irda.h>
?#include <mach/ohci.h>

arch/arm/mach-pxa/mainstone.c +1 -1
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>

?#include "generic.h"
?#include "devices.h"

arch/arm/mach-pxa/mioa701.c +0 -0
index dc66942..ffb3f5a 100644
@@ -45,7 +45,7 @@
 

?#include <mach/pxa27x.h>
?#include <mach/regs-rtc.h>

arch/arm/mach-pxa/mioa701.c +1 -1
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>

?#include <mach/pxafb.h>
?#include <mach/mmc.h>
?#include <mach/udc.h>

arch/arm/mach-pxa/palmld.c +0 -0
index 91038ee..3ff0c4a 100644
@@ -39,7 +39,7 @@

?#include <mach/mmc.h>
?#include <mach/pxafb.h>
?#include <mach/irda.h>

arch/arm/mach-pxa/palmld.c +1 -1
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>

?#include <mach/palmasoc.h>
?#include <mach/palm27x.h>

arch/arm/mach-pxa/palmt5.c +0 -0
index 1c28199..5b9f766 100644
@@ -39,7 +39,7 @@

?#include <mach/mmc.h>
?#include <mach/pxafb.h>
?#include <mach/irda.h>

arch/arm/mach-pxa/palmt5.c +1 -1
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>

?#include <mach/udc.h>
?#include <mach/palmasoc.h>
?#include <mach/palm27x.h>

arch/arm/mach-pxa/palmtreo.c +0 -0
index 52defd5..f685a60 100644
@@ -39,7 +39,7 @@

?#include <mach/mmc.h>
?#include <mach/pxafb.h>
?#include <mach/irda.h>

arch/arm/mach-pxa/palmtreo.c +1 -1
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>

?#include <mach/udc.h>
?#include <mach/ohci.h>
?#include <mach/pxa2xx-regs.h>

arch/arm/mach-pxa/palmtx.c +0 -0
index 144dc2b..89a3792 100644
@@ -43,7 +43,7 @@

?#include <mach/mmc.h>
?#include <mach/pxafb.h>
?#include <mach/irda.h>

arch/arm/mach-pxa/palmtx.c +1 -1
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>

?#include <mach/udc.h>
?#include <mach/palmasoc.h>
?#include <mach/palm27x.h>

arch/arm/mach-pxa/palmz72.c +0 -0
index 87e4b10..38f4425 100644
@@ -41,7 +41,7 @@

?#include <mach/mmc.h>
?#include <mach/pxafb.h>
?#include <mach/irda.h>

arch/arm/mach-pxa/palmz72.c +1 -1
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>

?#include <mach/udc.h>
?#include <mach/palmasoc.h>
?#include <mach/palm27x.h>

arch/arm/mach-pxa/tavorevb.c +0 -0
index f02dcb5..0f440c9 100644
@@ -25,7 +25,7 @@
 

?#include <mach/pxa930.h>
?#include <mach/pxafb.h>

arch/arm/mach-pxa/tavorevb.c +1 -1
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>

?#include "devices.h"
?#include "generic.h"

arch/arm/mach-pxa/z2.c +0 -0
index f0d0228..8c44bc4 100644
@@ -37,7 +37,7 @@

?#include <mach/z2.h>
?#include <mach/pxafb.h>
?#include <mach/mmc.h>

arch/arm/mach-pxa/z2.c +1 -1
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>

?#include <mach/pxa2xx_spi.h>

?#include <plat/i2c.h>

arch/arm/mach-pxa/zylonite.c +0 -0
index 2edad61..69df3ed 100644
@@ -30,7 +30,7 @@

?#include <mach/zylonite.h>
?#include <mach/mmc.h>
?#include <mach/ohci.h>

arch/arm/mach-pxa/zylonite.c +1 -1
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>

?#include <plat/pxa3xx_nand.h>

?#include "devices.h"

arch/arm/plat-pxa/include/plat/pxa27x_keypad.h new file +59 -0
new file mode 100644
index 0000000..7b4eadc
@@ -0,0 +1,59 @@
+#ifndef __ASM_ARCH_PXA27x_KEYPAD_H
+#define __ASM_ARCH_PXA27x_KEYPAD_H
+
+#include <linux/input.h>
+#include <linux/input/matrix_keypad.h>
+
+#define MAX_MATRIX_KEY_ROWS ? ?(8)
+#define MAX_MATRIX_KEY_COLS ? ?(8)
+#define MATRIX_ROW_SHIFT ? ? ? (3)
+#define MAX_DIRECT_KEY_NUM ? ? (8)
+
+/* pxa3xx keypad platform specific parameters
+ *
+ * NOTE:
+ * 1. direct_key_num indicates the number of keys in the direct keypad
+ * ? ?_plus_ the number of rotary-encoder sensor inputs, ?this can be
+ * ? ?left as 0 if only rotary encoders are enabled, ?the driver will
+ * ? ?automatically calculate this
+ *
+ * 2. direct_key_map is the key code map for the direct keys, if rotary
+ * ? ?encoder(s) are enabled, direct key 0/1(2/3) will be ignored
+ *
+ * 3. rotary can be either interpreted as a relative input event (e.g.
+ * ? ?REL_WHEEL/REL_HWHEEL) or specific keys (e.g. UP/DOWN/LEFT/RIGHT)
+ *
+ * 4. matrix key and direct key will use the same debounce_interval by
+ * ? ?default, which should be sufficient in most cases
+ */
+struct pxa27x_keypad_platform_data {
+
+ ? ? ? /* code map for the matrix keys */
+ ? ? ? unsigned int ? ?matrix_key_rows;
+ ? ? ? unsigned int ? ?matrix_key_cols;
+ ? ? ? unsigned int ? ?*matrix_key_map;
+ ? ? ? int ? ? ? ? ? ? matrix_key_map_size;
+
+ ? ? ? /* direct keys */
+ ? ? ? int ? ? ? ? ? ? direct_key_num;
+ ? ? ? unsigned int ? ?direct_key_map[MAX_DIRECT_KEY_NUM];
+
+ ? ? ? /* rotary encoders 0 */
+ ? ? ? int ? ? ? ? ? ? enable_rotary0;
+ ? ? ? int ? ? ? ? ? ? rotary0_rel_code;
+ ? ? ? int ? ? ? ? ? ? rotary0_up_key;
+ ? ? ? int ? ? ? ? ? ? rotary0_down_key;
+
+ ? ? ? /* rotary encoders 1 */
+ ? ? ? int ? ? ? ? ? ? enable_rotary1;
+ ? ? ? int ? ? ? ? ? ? rotary1_rel_code;
+ ? ? ? int ? ? ? ? ? ? rotary1_up_key;
+ ? ? ? int ? ? ? ? ? ? rotary1_down_key;
+
+ ? ? ? /* key debounce interval */
+ ? ? ? unsigned int ? ?debounce_interval;
+};
+
+extern void pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info);
+
+#endif /* __ASM_ARCH_PXA27x_KEYPAD_H */
drivers/input/keyboard/pxa27x_keypad.c +0 -0
index 0e53b3b..0610d10 100644
@@ -32,7 +32,7 @@

?#include <asm/mach/map.h>

?#include <mach/hardware.h>

drivers/input/keyboard/pxa27x_keypad.c +1 -1
-#include <mach/pxa27x_keypad.h>
+#include <plat/pxa27x_keypad.h>

?/*
?* Keypad Controller registers
?*/
--
1.7.0.4

#3 lore raw

PATCH 2/5 ARM: pxa168: added keypad support

In reply to Mark F. Brown
---
 arch/arm/mach-mmp/include/mach/mfp-pxa168.h |    7 +++++++
 arch/arm/mach-mmp/include/mach/pxa168.h     |    7 +++++++
 arch/arm/mach-mmp/pxa168.c                  |    3 +++
 drivers/input/keyboard/Kconfig              |    2 +-
 4 files changed, 18 insertions(+), 1 deletions(-)
arch/arm/mach-mmp/include/mach/mfp-pxa168.h +7 -0
index ded43c4..4621067 100644
@@ -289,4 +289,11 @@
 #define GPIO86_PWM1_OUT		MFP_CFG(GPIO86, AF2)
 #define GPIO86_PWM2_OUT		MFP_CFG(GPIO86, AF3)
 
+/* Keypad */
+#define GPIO109_KP_MKIN1        MFP_CFG(GPIO109, AF7)
+#define GPIO110_KP_MKIN0        MFP_CFG(GPIO110, AF7)
+#define GPIO111_KP_MKOUT7       MFP_CFG(GPIO111, AF7)
+#define GPIO112_KP_MKOUT6       MFP_CFG(GPIO112, AF7)
+#define GPIO121_KP_MKIN4        MFP_CFG(GPIO121, AF7)
+
 #endif /* __ASM_MACH_MFP_PXA168_H */
arch/arm/mach-mmp/include/mach/pxa168.h +7 -0
index 220738f..f34e663 100644
@@ -11,6 +11,7 @@ extern void __init pxa168_init_irq(void);
 #include <plat/i2c.h>
 #include <plat/pxa3xx_nand.h>
 #include <video/pxa168fb.h>
+#include <plat/pxa27x_keypad.h>
 
 extern struct pxa_device_desc pxa168_device_uart1;
 extern struct pxa_device_desc pxa168_device_uart2;
@@ -27,6 +28,7 @@ extern struct pxa_device_desc pxa168_device_ssp4;
 extern struct pxa_device_desc pxa168_device_ssp5;
 extern struct pxa_device_desc pxa168_device_nand;
 extern struct pxa_device_desc pxa168_device_fb;
+extern struct pxa_device_desc pxa168_device_keypad;
 
 static inline int pxa168_add_uart(int id)
 {
@@ -105,4 +107,9 @@ static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
 	return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
 }
 
+static inline int pxa168_add_keypad(struct pxa27x_keypad_platform_data *data)
+{
+	return pxa_register_device(&pxa168_device_keypad, data, sizeof(*data));
+}
+
 #endif /* __ASM_MACH_PXA168_H */
arch/arm/mach-mmp/pxa168.c +3 -0
index eaebf66..2fa16fb 100644
@@ -77,6 +77,7 @@ static APBC_CLK(ssp2, PXA168_SSP2, 4, 0);
 static APBC_CLK(ssp3, PXA168_SSP3, 4, 0);
 static APBC_CLK(ssp4, PXA168_SSP4, 4, 0);
 static APBC_CLK(ssp5, PXA168_SSP5, 4, 0);
+static APBC_CLK(keypad, PXA168_KPC, 0, 32000);
 
 static APMU_CLK(nand, NAND, 0x01db, 208000000);
 static APMU_CLK(lcd, LCD, 0x7f, 312000000);
@@ -98,6 +99,7 @@ static struct clk_lookup pxa168_clkregs[] = {
 	INIT_CLKREG(&clk_ssp5, "pxa168-ssp.4", NULL),
 	INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
 	INIT_CLKREG(&clk_lcd, "pxa168-fb", NULL),
+	INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL),
 };
 
 static int __init pxa168_init(void)
@@ -150,3 +152,4 @@ PXA168_DEVICE(ssp3, "pxa168-ssp", 2, SSP3, 0xd401f000, 0x40, 56, 57);
 PXA168_DEVICE(ssp4, "pxa168-ssp", 3, SSP4, 0xd4020000, 0x40, 58, 59);
 PXA168_DEVICE(ssp5, "pxa168-ssp", 4, SSP5, 0xd4021000, 0x40, 60, 61);
 PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8);
+PXA168_DEVICE(keypad, "pxa27x-keypad", -1, KEYPAD, 0xd4012000, 0x4c);
drivers/input/keyboard/Kconfig +1 -1
index 9cc488d..aa037fe 100644
@@ -338,7 +338,7 @@ config KEYBOARD_OPENCORES
 
 config KEYBOARD_PXA27x
 	tristate "PXA27x/PXA3xx keypad support"
-	depends on PXA27x || PXA3xx
+	depends on PXA27x || PXA3xx || ARCH_MMP
 	help
 	  Enable support for PXA27x/PXA3xx keypad controller.
 
Signature · 1 line
1.7.0.4
maintainer
#4 lore raw

Re: [PATCH 2/5] ARM: pxa168: added keypad support

Quoted 87 lines · Mark F. Brown

---

?arch/arm/mach-mmp/include/mach/mfp-pxa168.h | ? ?7 +++++++
?arch/arm/mach-mmp/include/mach/pxa168.h ? ? | ? ?7 +++++++
?arch/arm/mach-mmp/pxa168.c ? ? ? ? ? ? ? ? ?| ? ?3 +++
?drivers/input/keyboard/Kconfig ? ? ? ? ? ? ?| ? ?2 +-

?4 files changed, 18 insertions(+), 1 deletions(-)

arch/arm/mach-mmp/include/mach/mfp-pxa168.h +7 -0
index ded43c4..4621067 100644
@@ -289,4 +289,11 @@
 ?#define GPIO86_PWM1_OUT ? ? ? ? ? ? ? ?MFP_CFG(GPIO86, AF2)
 ?#define GPIO86_PWM2_OUT ? ? ? ? ? ? ? ?MFP_CFG(GPIO86, AF3)
 
+/* Keypad */
+#define GPIO109_KP_MKIN1 ? ? ? ?MFP_CFG(GPIO109, AF7)
+#define GPIO110_KP_MKIN0 ? ? ? ?MFP_CFG(GPIO110, AF7)
+#define GPIO111_KP_MKOUT7 ? ? ? MFP_CFG(GPIO111, AF7)
+#define GPIO112_KP_MKOUT6 ? ? ? MFP_CFG(GPIO112, AF7)
+#define GPIO121_KP_MKIN4 ? ? ? ?MFP_CFG(GPIO121, AF7)
+

?#endif /* __ASM_MACH_MFP_PXA168_H */

arch/arm/mach-mmp/include/mach/pxa168.h +0 -0
index 220738f..f34e663 100644
@@ -11,6 +11,7 @@ extern void __init pxa168_init_irq(void);

?#include <plat/i2c.h>
?#include <plat/pxa3xx_nand.h>
?#include <video/pxa168fb.h>
+#include <plat/pxa27x_keypad.h>

?extern struct pxa_device_desc pxa168_device_uart1; ?extern struct pxa_device_desc pxa168_device_uart2;

arch/arm/mach-mmp/include/mach/pxa168.h +6 -0
@@ -27,6 +28,7 @@ extern struct pxa_device_desc pxa168_device_ssp4;
 ?extern struct pxa_device_desc pxa168_device_ssp5;
 ?extern struct pxa_device_desc pxa168_device_nand;
 ?extern struct pxa_device_desc pxa168_device_fb;
+extern struct pxa_device_desc pxa168_device_keypad;
 
 ?static inline int pxa168_add_uart(int id)
 ?{
@@ -105,4 +107,9 @@ static inline int pxa168_add_fb(struct pxa168fb_mach_info *mi)
 ? ? ? ?return pxa_register_device(&pxa168_device_fb, mi, sizeof(*mi));
 ?}
 
+static inline int pxa168_add_keypad(struct pxa27x_keypad_platform_data *data)
+{
+ ? ? ? return pxa_register_device(&pxa168_device_keypad, data, sizeof(*data));
+}
+

?#endif /* __ASM_MACH_PXA168_H */

arch/arm/mach-mmp/pxa168.c +3 -0
index eaebf66..2fa16fb 100644
@@ -77,6 +77,7 @@ static APBC_CLK(ssp2, PXA168_SSP2, 4, 0);
 ?static APBC_CLK(ssp3, PXA168_SSP3, 4, 0);
 ?static APBC_CLK(ssp4, PXA168_SSP4, 4, 0);
 ?static APBC_CLK(ssp5, PXA168_SSP5, 4, 0);
+static APBC_CLK(keypad, PXA168_KPC, 0, 32000);
 
 ?static APMU_CLK(nand, NAND, 0x01db, 208000000);
 ?static APMU_CLK(lcd, LCD, 0x7f, 312000000);
@@ -98,6 +99,7 @@ static struct clk_lookup pxa168_clkregs[] = {
 ? ? ? ?INIT_CLKREG(&clk_ssp5, "pxa168-ssp.4", NULL),
 ? ? ? ?INIT_CLKREG(&clk_nand, "pxa3xx-nand", NULL),
 ? ? ? ?INIT_CLKREG(&clk_lcd, "pxa168-fb", NULL),
+ ? ? ? INIT_CLKREG(&clk_keypad, "pxa27x-keypad", NULL),
 ?};
 
 ?static int __init pxa168_init(void)
@@ -150,3 +152,4 @@ PXA168_DEVICE(ssp3, "pxa168-ssp", 2, SSP3, 0xd401f000, 0x40, 56, 57);
 ?PXA168_DEVICE(ssp4, "pxa168-ssp", 3, SSP4, 0xd4020000, 0x40, 58, 59);
 ?PXA168_DEVICE(ssp5, "pxa168-ssp", 4, SSP5, 0xd4021000, 0x40, 60, 61);
 ?PXA168_DEVICE(fb, "pxa168-fb", -1, LCD, 0xd420b000, 0x1c8);
+PXA168_DEVICE(keypad, "pxa27x-keypad", -1, KEYPAD, 0xd4012000, 0x4c);
drivers/input/keyboard/Kconfig +0 -0
index 9cc488d..aa037fe 100644
@@ -338,7 +338,7 @@ config KEYBOARD_OPENCORES
 

?config KEYBOARD_PXA27x
? ? ? ?tristate "PXA27x/PXA3xx keypad support"

Quoted 8 lines
- ? ? ? depends on PXA27x || PXA3xx
+ ? ? ? depends on PXA27x || PXA3xx || ARCH_MMP

? ? ? ?help
? ? ? ? ?Enable support for PXA27x/PXA3xx keypad controller.

--
1.7.0.4

It seems good. Acked

#5 lore raw

PATCH 3/5 ARM: pxa168: added wake clear register support for APMU

In reply to Mark F. Brown
---
 arch/arm/mach-mmp/include/mach/regs-apmu.h |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
arch/arm/mach-mmp/include/mach/regs-apmu.h +12 -0
index 9190305..ac47023 100644
@@ -33,4 +33,16 @@
 #define APMU_FNRST_DIS	(1 << 1)
 #define APMU_AXIRST_DIS	(1 << 0)
 
+/* Wake Clear Register */
+#define APMU_WAKE_CLR	APMU_REG(0x07c)
+
+#define APMU_PXA168_KP_WAKE_CLR		(1 << 7)
+#define APMU_PXA168_CFI_WAKE_CLR	(1 << 6)
+#define APMU_PXA168_XD_WAKE_CLR		(1 << 5)
+#define APMU_PXA168_MSP_WAKE_CLR	(1 << 4)
+#define APMU_PXA168_SD4_WAKE_CLR	(1 << 3)
+#define APMU_PXA168_SD3_WAKE_CLR	(1 << 2)
+#define APMU_PXA168_SD2_WAKE_CLR	(1 << 1)
+#define APMU_PXA168_SD1_WAKE_CLR	(1 << 0)
+
 #endif /* __ASM_MACH_REGS_APMU_H */
Signature · 1 line
1.7.0.4
#6 lore raw

PATCH 3/5 ARM: pxa168: added wake clear register support for APMU

In reply to Mark F. Brown
---
 arch/arm/mach-mmp/include/mach/regs-apmu.h |   12 ++++++++++++
 1 files changed, 12 insertions(+), 0 deletions(-)
arch/arm/mach-mmp/include/mach/regs-apmu.h +12 -0
index 9190305..ac47023 100644
@@ -33,4 +33,16 @@
 #define APMU_FNRST_DIS	(1 << 1)
 #define APMU_AXIRST_DIS	(1 << 0)
 
+/* Wake Clear Register */
+#define APMU_WAKE_CLR	APMU_REG(0x07c)
+
+#define APMU_PXA168_KP_WAKE_CLR		(1 << 7)
+#define APMU_PXA168_CFI_WAKE_CLR	(1 << 6)
+#define APMU_PXA168_XD_WAKE_CLR		(1 << 5)
+#define APMU_PXA168_MSP_WAKE_CLR	(1 << 4)
+#define APMU_PXA168_SD4_WAKE_CLR	(1 << 3)
+#define APMU_PXA168_SD3_WAKE_CLR	(1 << 2)
+#define APMU_PXA168_SD2_WAKE_CLR	(1 << 1)
+#define APMU_PXA168_SD1_WAKE_CLR	(1 << 0)
+
 #endif /* __ASM_MACH_REGS_APMU_H */
Signature · 1 line
1.7.0.4
#7 lore raw

PATCH 4/5 ARM: pxa168: added special case handler for keypad interrupts

In reply to Mark F. Brown
---
 arch/arm/mach-mmp/irq-pxa168.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
arch/arm/mach-mmp/irq-pxa168.c +22 -1
index 52ff2f0..bfb0984 100644
@@ -17,6 +17,8 @@
 #include <linux/io.h>
 
 #include <mach/regs-icu.h>
+#include <mach/regs-apmu.h>
+#include <mach/cputype.h>
 
 #include "common.h"
 
@@ -42,6 +44,19 @@ static struct irq_chip icu_irq_chip = {
 	.unmask	= icu_unmask_irq,
 };
 
+void handle_pxa168_keypad_irq(unsigned int irq, struct irq_desc *desc)
+{
+	uint32_t val;
+	uint32_t mask = APMU_PXA168_KP_WAKE_CLR;
+
+	/* clear keypad wake event */
+	val = __raw_readl(APMU_WAKE_CLR);
+	__raw_writel(val |  mask, APMU_WAKE_CLR);
+
+	/* handle irq */
+	handle_level_irq(irq, desc);
+}
+
 void __init icu_init_irq(void)
 {
 	int irq;
@@ -49,7 +64,13 @@ void __init icu_init_irq(void)
 	for (irq = 0; irq < 64; irq++) {
 		icu_mask_irq(irq);
 		set_irq_chip(irq, &icu_irq_chip);
-		set_irq_handler(irq, handle_level_irq);
+
+		/* special handler for keypad */
+		if (cpu_is_pxa168() && irq == IRQ_PXA168_KEYPAD)
+			set_irq_handler(irq, handle_pxa168_keypad_irq);
+		else
+			set_irq_handler(irq, handle_level_irq);
+
 		set_irq_flags(irq, IRQF_VALID);
 	}
 }
Signature · 1 line
1.7.0.4
maintainer
#8 lore raw

Re: [PATCH 4/5] ARM: pxa168: added special case handler for keypad interrupts

Quoted 25 lines · Mark F. Brown

---
?arch/arm/mach-mmp/irq-pxa168.c | ? 23 ++++++++++++++++++++++- ?1 files changed, 22 insertions(+), 1 deletions(-)

arch/arm/mach-mmp/irq-pxa168.c +0 -0
index 52ff2f0..bfb0984 100644
@@ -17,6 +17,8 @@

?#include <linux/io.h>

?#include <mach/regs-icu.h>

arch/arm/mach-mmp/irq-pxa168.c +2 -0
+#include <mach/regs-apmu.h>
+#include <mach/cputype.h>

?#include "common.h"

arch/arm/mach-mmp/irq-pxa168.c +3 -0
@@ -42,6 +44,19 @@ static struct irq_chip icu_irq_chip = {
 ? ? ? ?.unmask = icu_unmask_irq,
 ?};
 
+void handle_pxa168_keypad_irq(unsigned int irq, struct irq_desc *desc)
+{
+ ? ? ? uint32_t val;

arch/arm/mach-mmp/irq-pxa168.c static struct irq_chip icu_irq_chip = { · line 59

Quoted 10 lines
arch/arm/mach-mmp/irq-pxa168.c +10 -0
+ ? ? ? uint32_t mask = APMU_PXA168_KP_WAKE_CLR;
+
+ ? ? ? /* clear keypad wake event */
+ ? ? ? val = __raw_readl(APMU_WAKE_CLR);
+ ? ? ? __raw_writel(val | ?mask, APMU_WAKE_CLR);
+
+ ? ? ? /* handle irq */
+ ? ? ? handle_level_irq(irq, desc);
+}
+

Why should you clear wakeup event status in IRQ handler? If system is resumed by keypad event, you should clear this wakeup source in resume code. I think that IRQ code should not be binded with wakeup event at here.

Quoted 27 lines
arch/arm/mach-mmp/irq-pxa168.c +7 -2
 ?void __init icu_init_irq(void)
 ?{
 ? ? ? ?int irq;
@@ -49,7 +64,13 @@ void __init icu_init_irq(void)
 ? ? ? ?for (irq = 0; irq < 64; irq++) {
 ? ? ? ? ? ? ? ?icu_mask_irq(irq);
 ? ? ? ? ? ? ? ?set_irq_chip(irq, &icu_irq_chip);
- ? ? ? ? ? ? ? set_irq_handler(irq, handle_level_irq);
+
+ ? ? ? ? ? ? ? /* special handler for keypad */
+ ? ? ? ? ? ? ? if (cpu_is_pxa168() && irq == IRQ_PXA168_KEYPAD)
+ ? ? ? ? ? ? ? ? ? ? ? set_irq_handler(irq, handle_pxa168_keypad_irq);
+ ? ? ? ? ? ? ? else
+ ? ? ? ? ? ? ? ? ? ? ? set_irq_handler(irq, handle_level_irq);
+
 ? ? ? ? ? ? ? ?set_irq_flags(irq, IRQF_VALID);
 ? ? ? ?}
 ?}
--

1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html Please read the FAQ at ?http://www.tux.org/lkml/

#9 lore raw

Re: [PATCH 4/5] ARM: pxa168: added special case handler for keypad interrupts

Quoted 63 lines · Haojian Zhuang
Quoted 25 lines · Mark F. Brown

---
?arch/arm/mach-mmp/irq-pxa168.c | ? 23 ++++++++++++++++++++++- ?1 files changed, 22 insertions(+), 1 deletions(-)

arch/arm/mach-mmp/irq-pxa168.c +0 -0
index 52ff2f0..bfb0984 100644
@@ -17,6 +17,8 @@

?#include <linux/io.h>

?#include <mach/regs-icu.h>

arch/arm/mach-mmp/irq-pxa168.c +2 -0
+#include <mach/regs-apmu.h>
+#include <mach/cputype.h>

?#include "common.h"

arch/arm/mach-mmp/irq-pxa168.c +3 -0
@@ -42,6 +44,19 @@ static struct irq_chip icu_irq_chip = {
 ? ? ? ?.unmask = icu_unmask_irq,
 ?};
 
+void handle_pxa168_keypad_irq(unsigned int irq, struct irq_desc *desc)
+{
+ ? ? ? uint32_t val;

arch/arm/mach-mmp/irq-pxa168.c static struct irq_chip icu_irq_chip = { · line 59

Quoted 10 lines
arch/arm/mach-mmp/irq-pxa168.c +10 -0
+ ? ? ? uint32_t mask = APMU_PXA168_KP_WAKE_CLR;
+
+ ? ? ? /* clear keypad wake event */
+ ? ? ? val = __raw_readl(APMU_WAKE_CLR);
+ ? ? ? __raw_writel(val | ?mask, APMU_WAKE_CLR);
+
+ ? ? ? /* handle irq */
+ ? ? ? handle_level_irq(irq, desc);
+}
+

Why should you clear wakeup event status in IRQ handler? If system is resumed by keypad event, you should clear this wakeup source in resume code. I think that IRQ code should not be binded with wakeup event at here.

Quoted 21 lines
arch/arm/mach-mmp/irq-pxa168.c +7 -2
 ?void __init icu_init_irq(void)
 ?{
 ? ? ? ?int irq;
@@ -49,7 +64,13 @@ void __init icu_init_irq(void)
 ? ? ? ?for (irq = 0; irq < 64; irq++) {
 ? ? ? ? ? ? ? ?icu_mask_irq(irq);
 ? ? ? ? ? ? ? ?set_irq_chip(irq, &icu_irq_chip);
- ? ? ? ? ? ? ? set_irq_handler(irq, handle_level_irq);
+
+ ? ? ? ? ? ? ? /* special handler for keypad */
+ ? ? ? ? ? ? ? if (cpu_is_pxa168() && irq == IRQ_PXA168_KEYPAD)
+ ? ? ? ? ? ? ? ? ? ? ? set_irq_handler(irq, handle_pxa168_keypad_irq);
+ ? ? ? ? ? ? ? else
+ ? ? ? ? ? ? ? ? ? ? ? set_irq_handler(irq, handle_level_irq);
+
 ? ? ? ? ? ? ? ?set_irq_flags(irq, IRQF_VALID);
 ? ? ? ?}
 ?}
--

1.7.0.4

Quoted 7 lines
Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html Please read the FAQ at ?http://www.tux.org/lkml/

Haojian, this is an usual case, but without that clear wake event you will not be able to clear the keypad interrupt. For my push to open source I re-wrote the workaround code and added it as a special case IRQ handler. In the Marvell pxa168 code base it is actually located in the keypad interrupt handler as the function clear_wakeup(). I felt it was better to isolate this code in the mmp common code base instead.

Regards,
-- Mark

#10 lore raw

Re: [PATCH 4/5] ARM: pxa168: added special case handler for keypad interrupts

Quoted 73 lines · Mark F. Brown
Quoted 63 lines · Haojian Zhuang
Quoted 25 lines · Mark F. Brown

---
?arch/arm/mach-mmp/irq-pxa168.c | ? 23 ++++++++++++++++++++++- ?1 files changed, 22 insertions(+), 1 deletions(-)

arch/arm/mach-mmp/irq-pxa168.c +0 -0
index 52ff2f0..bfb0984 100644
@@ -17,6 +17,8 @@

?#include <linux/io.h>

?#include <mach/regs-icu.h>

arch/arm/mach-mmp/irq-pxa168.c +2 -0
+#include <mach/regs-apmu.h>
+#include <mach/cputype.h>

?#include "common.h"

arch/arm/mach-mmp/irq-pxa168.c +3 -0
@@ -42,6 +44,19 @@ static struct irq_chip icu_irq_chip = {
 ? ? ? ?.unmask = icu_unmask_irq,
 ?};
 
+void handle_pxa168_keypad_irq(unsigned int irq, struct irq_desc *desc)
+{
+ ? ? ? uint32_t val;

arch/arm/mach-mmp/irq-pxa168.c static struct irq_chip icu_irq_chip = { · line 59

Quoted 10 lines
arch/arm/mach-mmp/irq-pxa168.c +10 -0
+ ? ? ? uint32_t mask = APMU_PXA168_KP_WAKE_CLR;
+
+ ? ? ? /* clear keypad wake event */
+ ? ? ? val = __raw_readl(APMU_WAKE_CLR);
+ ? ? ? __raw_writel(val | ?mask, APMU_WAKE_CLR);
+
+ ? ? ? /* handle irq */
+ ? ? ? handle_level_irq(irq, desc);
+}
+

Why should you clear wakeup event status in IRQ handler? If system is resumed by keypad event, you should clear this wakeup source in resume code. I think that IRQ code should not be binded with wakeup event at here.

Quoted 21 lines
arch/arm/mach-mmp/irq-pxa168.c +7 -2
 ?void __init icu_init_irq(void)
 ?{
 ? ? ? ?int irq;
@@ -49,7 +64,13 @@ void __init icu_init_irq(void)
 ? ? ? ?for (irq = 0; irq < 64; irq++) {
 ? ? ? ? ? ? ? ?icu_mask_irq(irq);
 ? ? ? ? ? ? ? ?set_irq_chip(irq, &icu_irq_chip);
- ? ? ? ? ? ? ? set_irq_handler(irq, handle_level_irq);
+
+ ? ? ? ? ? ? ? /* special handler for keypad */
+ ? ? ? ? ? ? ? if (cpu_is_pxa168() && irq == IRQ_PXA168_KEYPAD)
+ ? ? ? ? ? ? ? ? ? ? ? set_irq_handler(irq, handle_pxa168_keypad_irq);
+ ? ? ? ? ? ? ? else
+ ? ? ? ? ? ? ? ? ? ? ? set_irq_handler(irq, handle_level_irq);
+
 ? ? ? ? ? ? ? ?set_irq_flags(irq, IRQF_VALID);
 ? ? ? ?}
 ?}
--

1.7.0.4

Quoted 7 lines
Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html Please read the FAQ at ?http://www.tux.org/lkml/

Quoted 6 lines

Haojian, this is an usual case, but without that clear wake event you will not be able to clear the keypad interrupt. For my push to open source I re-wrote the workaround code and added it as a special case IRQ handler. In the Marvell pxa168 code base it is actually located in the keypad interrupt handler as the function clear_wakeup(). I felt it was better to isolate this code in the mmp common code base instead.

I'd rather the irq handler not being changed and use platform_data instead. How about something below:

(quoted diff) +0 -0

b/arch/arm/mach-mmp/include/mach/pxa168.h
index 27e1bc7..d2b7946 100644

arch/arm/mach-mmp/include/mach/pxa168.h +1 -0
@@ -5,6 +5,7 @@ struct sys_timer;
 
 extern struct sys_timer pxa168_timer;
 extern void __init pxa168_init_irq(void);
+extern void pxa168_clear_keypad_wakeup(void);
 
 #include <linux/i2c.h>
 #include <mach/devices.h>
@@ -97,4 +98,10 @@ static inline int pxa168_add_nand(struct

pxa3xx_nand_platform_data *info)
{
return pxa_register_device(&pxa168_device_nand, info, sizeof(*info));
}
+
+static inline int pxa168_add_keypad(struct pxa27x_keypad_platform_data *info) +{
+ info->clear_wakeup = pxa168_clear_keypad_wakeup;
+ return pxa_register_device(&pxa168_device_keypad, info, sizeof(*info));
+}
#endif /* __ASM_MACH_PXA168_H */

(quoted diff) +0 -0

b/arch/arm/mach-pxa/include/mach/pxa27x_keypad.h
index 7b4eadc..3a6bfe7 100644

arch/arm/mach-pxa/include/mach/pxa27x_keypad.h +1 -0
@@ -52,6 +52,7 @@ struct pxa27x_keypad_platform_data {
 
 	/* key debounce interval */
 	unsigned int	debounce_interval;
+	void		(*clear_wakeup);
 };
 
 extern void pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info);
(quoted diff) +0 -0

b/drivers/input/keyboard/pxa27x_keypad.c
index f32404f..3fb94fe 100644

drivers/input/keyboard/pxa27x_keypad.c +0 -0
@@ -330,10 +330,20 @@ static void pxa27x_keypad_scan_direct(struct

pxa27x_keypad *keypad)
keypad->direct_key_state = new_state;
}

+static void clear_wakeup(struct pxa27x_keypad *keypad) +{
+ struct pxa27x_keypad_platform_data *pdata = keypad->pdata;
+
+ if (pdata->clear_wakeup)
+ (pdata->clear_wakeup)();
+}
+
static irqreturn_t pxa27x_keypad_irq_handler(int irq, void *dev_id) {
struct pxa27x_keypad *keypad = dev_id;
- unsigned long kpc = keypad_readl(KPC);
+ unsigned long kpc;
+
+ kpc = keypad_readl(KPC);

if (kpc & KPC_DI)
pxa27x_keypad_scan_direct(keypad);

#11 lore raw

Re: [PATCH 4/5] ARM: pxa168: added special case handler for keypad interrupts

Quoted 149 lines · Eric Miao
Quoted 73 lines · Mark F. Brown
Quoted 63 lines · Haojian Zhuang
Quoted 25 lines · Mark F. Brown

---
?arch/arm/mach-mmp/irq-pxa168.c | ? 23 ++++++++++++++++++++++- ?1 files changed, 22 insertions(+), 1 deletions(-)

arch/arm/mach-mmp/irq-pxa168.c +0 -0
index 52ff2f0..bfb0984 100644
@@ -17,6 +17,8 @@

?#include <linux/io.h>

?#include <mach/regs-icu.h>

arch/arm/mach-mmp/irq-pxa168.c +2 -0
+#include <mach/regs-apmu.h>
+#include <mach/cputype.h>

?#include "common.h"

arch/arm/mach-mmp/irq-pxa168.c +3 -0
@@ -42,6 +44,19 @@ static struct irq_chip icu_irq_chip = {
 ? ? ? ?.unmask = icu_unmask_irq,
 ?};
 
+void handle_pxa168_keypad_irq(unsigned int irq, struct irq_desc *desc)
+{
+ ? ? ? uint32_t val;

arch/arm/mach-mmp/irq-pxa168.c static struct irq_chip icu_irq_chip = { · line 59

Quoted 10 lines
arch/arm/mach-mmp/irq-pxa168.c +10 -0
+ ? ? ? uint32_t mask = APMU_PXA168_KP_WAKE_CLR;
+
+ ? ? ? /* clear keypad wake event */
+ ? ? ? val = __raw_readl(APMU_WAKE_CLR);
+ ? ? ? __raw_writel(val | ?mask, APMU_WAKE_CLR);
+
+ ? ? ? /* handle irq */
+ ? ? ? handle_level_irq(irq, desc);
+}
+

Why should you clear wakeup event status in IRQ handler? If system is resumed by keypad event, you should clear this wakeup source in resume code. I think that IRQ code should not be binded with wakeup event at here.

Quoted 21 lines
arch/arm/mach-mmp/irq-pxa168.c +7 -2
 ?void __init icu_init_irq(void)
 ?{
 ? ? ? ?int irq;
@@ -49,7 +64,13 @@ void __init icu_init_irq(void)
 ? ? ? ?for (irq = 0; irq < 64; irq++) {
 ? ? ? ? ? ? ? ?icu_mask_irq(irq);
 ? ? ? ? ? ? ? ?set_irq_chip(irq, &icu_irq_chip);
- ? ? ? ? ? ? ? set_irq_handler(irq, handle_level_irq);
+
+ ? ? ? ? ? ? ? /* special handler for keypad */
+ ? ? ? ? ? ? ? if (cpu_is_pxa168() && irq == IRQ_PXA168_KEYPAD)
+ ? ? ? ? ? ? ? ? ? ? ? set_irq_handler(irq, handle_pxa168_keypad_irq);
+ ? ? ? ? ? ? ? else
+ ? ? ? ? ? ? ? ? ? ? ? set_irq_handler(irq, handle_level_irq);
+
 ? ? ? ? ? ? ? ?set_irq_flags(irq, IRQF_VALID);
 ? ? ? ?}
 ?}
--

1.7.0.4

Quoted 7 lines
Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html Please read the FAQ at ?http://www.tux.org/lkml/

Quoted 6 lines

Haojian, this is an usual case, but without that clear wake event you will not be able to clear the keypad interrupt. For my push to open source I re-wrote the workaround code and added it as a special case IRQ handler. In the Marvell pxa168 code base it is actually located in the keypad interrupt handler as the function clear_wakeup(). I felt it was better to isolate this code in the mmp common code base instead.

I'd rather the irq handler not being changed and use platform_data instead. How about something below:

arch/arm/mach-mmp/include/mach/pxa168.h +1 -0
index 27e1bc7..d2b7946 100644
@@ -5,6 +5,7 @@ struct sys_timer;
 
 ?extern struct sys_timer pxa168_timer;
 ?extern void __init pxa168_init_irq(void);
+extern void pxa168_clear_keypad_wakeup(void);
 

?#include <linux/i2c.h>
?#include <mach/devices.h>

arch/arm/mach-mmp/include/mach/pxa168.h +6 -0
@@ -97,4 +98,10 @@ static inline int pxa168_add_nand(struct
 pxa3xx_nand_platform_data *info)
 ?{
 ? ? ? ?return pxa_register_device(&pxa168_device_nand, info, sizeof(*info));
 ?}
+
+static inline int pxa168_add_keypad(struct pxa27x_keypad_platform_data *info)
+{
+ ? ? ? info->clear_wakeup = pxa168_clear_keypad_wakeup;
+ ? ? ? return pxa_register_device(&pxa168_device_keypad, info, sizeof(*info));
+}

?#endif /* __ASM_MACH_PXA168_H */

arch/arm/mach-pxa/include/mach/pxa27x_keypad.h +0 -0
index 7b4eadc..3a6bfe7 100644
@@ -52,6 +52,7 @@ struct pxa27x_keypad_platform_data {
 

? ? ? ?/* key debounce interval */
? ? ? ?unsigned int ? ?debounce_interval;
+ ? ? ? void ? ? ? ? ? ?(*clear_wakeup);
?};

?extern void pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info);

drivers/input/keyboard/pxa27x_keypad.c +11 -1
index f32404f..3fb94fe 100644
@@ -330,10 +330,20 @@ static void pxa27x_keypad_scan_direct(struct
 pxa27x_keypad *keypad)
 ? ? ? ?keypad->direct_key_state = new_state;
 ?}
 
+static void clear_wakeup(struct pxa27x_keypad *keypad)
+{
+ ? ? ? struct pxa27x_keypad_platform_data *pdata = keypad->pdata;
+
+ ? ? ? if (pdata->clear_wakeup)
+ ? ? ? ? ? ? ? (pdata->clear_wakeup)();
+}
+
 ?static irqreturn_t pxa27x_keypad_irq_handler(int irq, void *dev_id)
 ?{
 ? ? ? ?struct pxa27x_keypad *keypad = dev_id;
- ? ? ? unsigned long kpc = keypad_readl(KPC);
+ ? ? ? unsigned long kpc;
+
+ ? ? ? kpc = keypad_readl(KPC);
 
 ? ? ? ?if (kpc & KPC_DI)
Quoted 2 lines

? ? ? ? ? ? ? ?pxa27x_keypad_scan_direct(keypad);

Ok if you are fine with that I will make that change and resubmit!

Regards,
-- Mark

#12 lore raw

Re: [PATCH 4/5] ARM: pxa168: added special case handler for keypad interrupts

Quoted 149 lines · Mark F. Brown
Quoted 148 lines · Eric Miao
Quoted 73 lines · Mark F. Brown
Quoted 63 lines · Haojian Zhuang
Quoted 25 lines · Mark F. Brown

---
?arch/arm/mach-mmp/irq-pxa168.c | ? 23 ++++++++++++++++++++++- ?1 files changed, 22 insertions(+), 1 deletions(-)

arch/arm/mach-mmp/irq-pxa168.c +0 -0
index 52ff2f0..bfb0984 100644
@@ -17,6 +17,8 @@

?#include <linux/io.h>

?#include <mach/regs-icu.h>

arch/arm/mach-mmp/irq-pxa168.c +2 -0
+#include <mach/regs-apmu.h>
+#include <mach/cputype.h>

?#include "common.h"

arch/arm/mach-mmp/irq-pxa168.c +3 -0
@@ -42,6 +44,19 @@ static struct irq_chip icu_irq_chip = {
 ? ? ? ?.unmask = icu_unmask_irq,
 ?};
 
+void handle_pxa168_keypad_irq(unsigned int irq, struct irq_desc *desc)
+{
+ ? ? ? uint32_t val;

arch/arm/mach-mmp/irq-pxa168.c static struct irq_chip icu_irq_chip = { · line 59

Quoted 10 lines
arch/arm/mach-mmp/irq-pxa168.c +10 -0
+ ? ? ? uint32_t mask = APMU_PXA168_KP_WAKE_CLR;
+
+ ? ? ? /* clear keypad wake event */
+ ? ? ? val = __raw_readl(APMU_WAKE_CLR);
+ ? ? ? __raw_writel(val | ?mask, APMU_WAKE_CLR);
+
+ ? ? ? /* handle irq */
+ ? ? ? handle_level_irq(irq, desc);
+}
+

Why should you clear wakeup event status in IRQ handler? If system is resumed by keypad event, you should clear this wakeup source in resume code. I think that IRQ code should not be binded with wakeup event at here.

Quoted 21 lines
arch/arm/mach-mmp/irq-pxa168.c +7 -2
 ?void __init icu_init_irq(void)
 ?{
 ? ? ? ?int irq;
@@ -49,7 +64,13 @@ void __init icu_init_irq(void)
 ? ? ? ?for (irq = 0; irq < 64; irq++) {
 ? ? ? ? ? ? ? ?icu_mask_irq(irq);
 ? ? ? ? ? ? ? ?set_irq_chip(irq, &icu_irq_chip);
- ? ? ? ? ? ? ? set_irq_handler(irq, handle_level_irq);
+
+ ? ? ? ? ? ? ? /* special handler for keypad */
+ ? ? ? ? ? ? ? if (cpu_is_pxa168() && irq == IRQ_PXA168_KEYPAD)
+ ? ? ? ? ? ? ? ? ? ? ? set_irq_handler(irq, handle_pxa168_keypad_irq);
+ ? ? ? ? ? ? ? else
+ ? ? ? ? ? ? ? ? ? ? ? set_irq_handler(irq, handle_level_irq);
+
 ? ? ? ? ? ? ? ?set_irq_flags(irq, IRQF_VALID);
 ? ? ? ?}
 ?}
--

1.7.0.4

Quoted 7 lines
Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html Please read the FAQ at ?http://www.tux.org/lkml/

Quoted 6 lines

Haojian, this is an usual case, but without that clear wake event you will not be able to clear the keypad interrupt. For my push to open source I re-wrote the workaround code and added it as a special case IRQ handler. In the Marvell pxa168 code base it is actually located in the keypad interrupt handler as the function clear_wakeup(). I felt it was better to isolate this code in the mmp common code base instead.

I'd rather the irq handler not being changed and use platform_data instead. How about something below:

arch/arm/mach-mmp/include/mach/pxa168.h +1 -0
index 27e1bc7..d2b7946 100644
@@ -5,6 +5,7 @@ struct sys_timer;
 
 ?extern struct sys_timer pxa168_timer;
 ?extern void __init pxa168_init_irq(void);
+extern void pxa168_clear_keypad_wakeup(void);
 

?#include <linux/i2c.h>
?#include <mach/devices.h>

arch/arm/mach-mmp/include/mach/pxa168.h +6 -0
@@ -97,4 +98,10 @@ static inline int pxa168_add_nand(struct
 pxa3xx_nand_platform_data *info)
 ?{
 ? ? ? ?return pxa_register_device(&pxa168_device_nand, info, sizeof(*info));
 ?}
+
+static inline int pxa168_add_keypad(struct pxa27x_keypad_platform_data *info)
+{
+ ? ? ? info->clear_wakeup = pxa168_clear_keypad_wakeup;
+ ? ? ? return pxa_register_device(&pxa168_device_keypad, info, sizeof(*info));
+}

?#endif /* __ASM_MACH_PXA168_H */

arch/arm/mach-pxa/include/mach/pxa27x_keypad.h +0 -0
index 7b4eadc..3a6bfe7 100644
@@ -52,6 +52,7 @@ struct pxa27x_keypad_platform_data {
 

? ? ? ?/* key debounce interval */
? ? ? ?unsigned int ? ?debounce_interval;
+ ? ? ? void ? ? ? ? ? ?(*clear_wakeup);
?};

?extern void pxa_set_keypad_info(struct pxa27x_keypad_platform_data *info);

drivers/input/keyboard/pxa27x_keypad.c +11 -1
index f32404f..3fb94fe 100644
@@ -330,10 +330,20 @@ static void pxa27x_keypad_scan_direct(struct
 pxa27x_keypad *keypad)
 ? ? ? ?keypad->direct_key_state = new_state;
 ?}
 
+static void clear_wakeup(struct pxa27x_keypad *keypad)
+{
+ ? ? ? struct pxa27x_keypad_platform_data *pdata = keypad->pdata;
+
+ ? ? ? if (pdata->clear_wakeup)
+ ? ? ? ? ? ? ? (pdata->clear_wakeup)();
+}
+
 ?static irqreturn_t pxa27x_keypad_irq_handler(int irq, void *dev_id)
 ?{
 ? ? ? ?struct pxa27x_keypad *keypad = dev_id;
- ? ? ? unsigned long kpc = keypad_readl(KPC);
+ ? ? ? unsigned long kpc;
+
+ ? ? ? kpc = keypad_readl(KPC);
 
Quoted 6 lines
Quoted 3 lines
drivers/input/keyboard/pxa27x_keypad.c +0 -0
 ? ? ? ?if (kpc & KPC_DI)

? ? ? ? ? ? ? ?pxa27x_keypad_scan_direct(keypad);

Ok if you are fine with that I will make that change and resubmit!

Thanks.

#13 lore raw

PATCH 4/5 ARM: pxa168: added special case handler for keypad interrupts

In reply to Mark F. Brown
---
 arch/arm/mach-mmp/irq-pxa168.c |   23 ++++++++++++++++++++++-
 1 files changed, 22 insertions(+), 1 deletions(-)
arch/arm/mach-mmp/irq-pxa168.c +22 -1
index 52ff2f0..bfb0984 100644
@@ -17,6 +17,8 @@
 #include <linux/io.h>
 
 #include <mach/regs-icu.h>
+#include <mach/regs-apmu.h>
+#include <mach/cputype.h>
 
 #include "common.h"
 
@@ -42,6 +44,19 @@ static struct irq_chip icu_irq_chip = {
 	.unmask	= icu_unmask_irq,
 };
 
+void handle_pxa168_keypad_irq(unsigned int irq, struct irq_desc *desc)
+{
+	uint32_t val;
+	uint32_t mask = APMU_PXA168_KP_WAKE_CLR;
+
+	/* clear keypad wake event */
+	val = __raw_readl(APMU_WAKE_CLR);
+	__raw_writel(val |  mask, APMU_WAKE_CLR);
+
+	/* handle irq */
+	handle_level_irq(irq, desc);
+}
+
 void __init icu_init_irq(void)
 {
 	int irq;
@@ -49,7 +64,13 @@ void __init icu_init_irq(void)
 	for (irq = 0; irq < 64; irq++) {
 		icu_mask_irq(irq);
 		set_irq_chip(irq, &icu_irq_chip);
-		set_irq_handler(irq, handle_level_irq);
+
+		/* special handler for keypad */
+		if (cpu_is_pxa168() && irq == IRQ_PXA168_KEYPAD)
+			set_irq_handler(irq, handle_pxa168_keypad_irq);
+		else
+			set_irq_handler(irq, handle_level_irq);
+
 		set_irq_flags(irq, IRQF_VALID);
 	}
 }
Signature · 1 line
1.7.0.4
#14 lore raw

PATCH 5/5 ARM: pxa168: aspenite: add board support for keypad

In reply to Mark F. Brown
---
 arch/arm/mach-mmp/aspenite.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
arch/arm/mach-mmp/aspenite.c +27 -0
index 9e1bd6b..1b788c5 100644
@@ -24,6 +24,8 @@
 #include <mach/pxa168.h>
 #include <mach/gpio.h>
 #include <video/pxa168fb.h>
+#include <linux/input.h>
+#include <plat/pxa27x_keypad.h>
 
 #include "common.h"
 
@@ -97,6 +99,13 @@ static unsigned long common_pin_config[] __initdata = {
 	GPIO81_LCD_DD21,
 	GPIO82_LCD_DD22,
 	GPIO83_LCD_DD23,
+
+	/* Keypad */
+	GPIO109_KP_MKIN1,
+	GPIO110_KP_MKIN0,
+	GPIO111_KP_MKOUT7,
+	GPIO112_KP_MKOUT6,
+	GPIO121_KP_MKIN4,
 };
 
 static struct smc91x_platdata smc91x_info = {
@@ -193,6 +202,23 @@ struct pxa168fb_mach_info aspenite_lcd_info = {
 	.invert_pixclock	= 0,
 };
 
+static unsigned int aspenite_matrix_key_map[] = {
+	KEY(0, 6, KEY_UP),	/* SW 4 */
+	KEY(0, 7, KEY_DOWN),	/* SW 5 */
+	KEY(1, 6, KEY_LEFT),	/* SW 6 */
+	KEY(1, 7, KEY_RIGHT),	/* SW 7 */
+	KEY(4, 6, KEY_ENTER),	/* SW 8 */
+	KEY(4, 7, KEY_ESC),	/* SW 9 */
+};
+
+static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = {
+	.matrix_key_rows	= 8,
+	.matrix_key_cols	= 8,
+	.matrix_key_map		= aspenite_matrix_key_map,
+	.matrix_key_map_size	= ARRAY_SIZE(aspenite_matrix_key_map),
+	.debounce_interval	= 30,
+};
+
 static void __init common_init(void)
 {
 	mfp_config(ARRAY_AND_SIZE(common_pin_config));
@@ -203,6 +229,7 @@ static void __init common_init(void)
 	pxa168_add_ssp(1);
 	pxa168_add_nand(&aspenite_nand_info);
 	pxa168_add_fb(&aspenite_lcd_info);
+	pxa168_add_keypad(&aspenite_keypad_info);
 
 	/* off-chip devices */
 	platform_device_register(&smc91x_device);
Signature · 1 line
1.7.0.4
maintainer
#15 lore raw

Re: [PATCH 5/5] ARM: pxa168: aspenite: add board support for keypad

Quoted 38 lines · Mark F. Brown

---
?arch/arm/mach-mmp/aspenite.c | ? 27 +++++++++++++++++++++++++++ ?1 files changed, 27 insertions(+), 0 deletions(-)

arch/arm/mach-mmp/aspenite.c +0 -0
index 9e1bd6b..1b788c5 100644
@@ -24,6 +24,8 @@

?#include <mach/pxa168.h>
?#include <mach/gpio.h>
?#include <video/pxa168fb.h>

arch/arm/mach-mmp/aspenite.c +2 -0
+#include <linux/input.h>
+#include <plat/pxa27x_keypad.h>

?#include "common.h"

arch/arm/mach-mmp/aspenite.c +9 -0
@@ -97,6 +99,13 @@ static unsigned long common_pin_config[] __initdata = {
 ? ? ? ?GPIO81_LCD_DD21,
 ? ? ? ?GPIO82_LCD_DD22,
 ? ? ? ?GPIO83_LCD_DD23,
+
+ ? ? ? /* Keypad */
+ ? ? ? GPIO109_KP_MKIN1,
+ ? ? ? GPIO110_KP_MKIN0,
+ ? ? ? GPIO111_KP_MKOUT7,
+ ? ? ? GPIO112_KP_MKOUT6,
+ ? ? ? GPIO121_KP_MKIN4,
 ?};
 
 ?static struct smc91x_platdata smc91x_info = {
@@ -193,6 +202,23 @@ struct pxa168fb_mach_info aspenite_lcd_info = {
 ? ? ? ?.invert_pixclock ? ? ? ?= 0,
 ?};
 
+static unsigned int aspenite_matrix_key_map[] = {
+ ? ? ? KEY(0, 6, KEY_UP), ? ? ?/* SW 4 */

arch/arm/mach-mmp/aspenite.c struct pxa168fb_mach_info aspenite_lcd_info = { · line 216

Quoted 10 lines
arch/arm/mach-mmp/aspenite.c +10 -0
+ ? ? ? KEY(0, 7, KEY_DOWN), ? ?/* SW 5 */
+ ? ? ? KEY(1, 6, KEY_LEFT), ? ?/* SW 6 */
+ ? ? ? KEY(1, 7, KEY_RIGHT), ? /* SW 7 */
+ ? ? ? KEY(4, 6, KEY_ENTER), ? /* SW 8 */
+ ? ? ? KEY(4, 7, KEY_ESC), ? ? /* SW 9 */
+};
+
+static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = {
+ ? ? ? .matrix_key_rows ? ? ? ?= 8,
+ ? ? ? .matrix_key_cols ? ? ? ?= 8,

It seems that maxium columns is 5, not 8.

Quoted 25 lines
arch/arm/mach-mmp/aspenite.c +6 -0
+ ? ? ? .matrix_key_map ? ? ? ? = aspenite_matrix_key_map,
+ ? ? ? .matrix_key_map_size ? ?= ARRAY_SIZE(aspenite_matrix_key_map),
+ ? ? ? .debounce_interval ? ? ?= 30,
+};
+
 ?static void __init common_init(void)
 ?{
 ? ? ? ?mfp_config(ARRAY_AND_SIZE(common_pin_config));
@@ -203,6 +229,7 @@ static void __init common_init(void)
 ? ? ? ?pxa168_add_ssp(1);
 ? ? ? ?pxa168_add_nand(&aspenite_nand_info);
 ? ? ? ?pxa168_add_fb(&aspenite_lcd_info);
+ ? ? ? pxa168_add_keypad(&aspenite_keypad_info);
 

? ? ? ?/* off-chip devices */
? ? ? ?platform_device_register(&smc91x_device);
--
1.7.0.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html Please read the FAQ at ?http://www.tux.org/lkml/

#16 lore raw

Re: [PATCH 5/5] ARM: pxa168: aspenite: add board support for keypad

Quoted 70 lines · Haojian Zhuang
Quoted 38 lines · Mark F. Brown

---
?arch/arm/mach-mmp/aspenite.c | ? 27 +++++++++++++++++++++++++++ ?1 files changed, 27 insertions(+), 0 deletions(-)

arch/arm/mach-mmp/aspenite.c +0 -0
index 9e1bd6b..1b788c5 100644
@@ -24,6 +24,8 @@

?#include <mach/pxa168.h>
?#include <mach/gpio.h>
?#include <video/pxa168fb.h>

arch/arm/mach-mmp/aspenite.c +2 -0
+#include <linux/input.h>
+#include <plat/pxa27x_keypad.h>

?#include "common.h"

arch/arm/mach-mmp/aspenite.c +9 -0
@@ -97,6 +99,13 @@ static unsigned long common_pin_config[] __initdata = {
 ? ? ? ?GPIO81_LCD_DD21,
 ? ? ? ?GPIO82_LCD_DD22,
 ? ? ? ?GPIO83_LCD_DD23,
+
+ ? ? ? /* Keypad */
+ ? ? ? GPIO109_KP_MKIN1,
+ ? ? ? GPIO110_KP_MKIN0,
+ ? ? ? GPIO111_KP_MKOUT7,
+ ? ? ? GPIO112_KP_MKOUT6,
+ ? ? ? GPIO121_KP_MKIN4,
 ?};
 
 ?static struct smc91x_platdata smc91x_info = {
@@ -193,6 +202,23 @@ struct pxa168fb_mach_info aspenite_lcd_info = {
 ? ? ? ?.invert_pixclock ? ? ? ?= 0,
 ?};
 
+static unsigned int aspenite_matrix_key_map[] = {
+ ? ? ? KEY(0, 6, KEY_UP), ? ? ?/* SW 4 */

arch/arm/mach-mmp/aspenite.c struct pxa168fb_mach_info aspenite_lcd_info = { · line 216

Quoted 10 lines
arch/arm/mach-mmp/aspenite.c +10 -0
+ ? ? ? KEY(0, 7, KEY_DOWN), ? ?/* SW 5 */
+ ? ? ? KEY(1, 6, KEY_LEFT), ? ?/* SW 6 */
+ ? ? ? KEY(1, 7, KEY_RIGHT), ? /* SW 7 */
+ ? ? ? KEY(4, 6, KEY_ENTER), ? /* SW 8 */
+ ? ? ? KEY(4, 7, KEY_ESC), ? ? /* SW 9 */
+};
+
+static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = {
+ ? ? ? .matrix_key_rows ? ? ? ?= 8,
+ ? ? ? .matrix_key_cols ? ? ? ?= 8,

It seems that maxium columns is 5, not 8.

Quoted 19 lines
arch/arm/mach-mmp/aspenite.c +6 -0
+ ? ? ? .matrix_key_map ? ? ? ? = aspenite_matrix_key_map,
+ ? ? ? .matrix_key_map_size ? ?= ARRAY_SIZE(aspenite_matrix_key_map),
+ ? ? ? .debounce_interval ? ? ?= 30,
+};
+
 ?static void __init common_init(void)
 ?{
 ? ? ? ?mfp_config(ARRAY_AND_SIZE(common_pin_config));
@@ -203,6 +229,7 @@ static void __init common_init(void)
 ? ? ? ?pxa168_add_ssp(1);
 ? ? ? ?pxa168_add_nand(&aspenite_nand_info);
 ? ? ? ?pxa168_add_fb(&aspenite_lcd_info);
+ ? ? ? pxa168_add_keypad(&aspenite_keypad_info);
 

? ? ? ?/* off-chip devices */
? ? ? ?platform_device_register(&smc91x_device);
--
1.7.0.4

Quoted 7 lines
Quoted 6 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html Please read the FAQ at ?http://www.tux.org/lkml/

The maximum keypad columns are 8 and the maximum keypad rows are 5 for Aspenite. I will correct that in my patch resubmission!

Regards,
-- Mark

#17 lore raw

Re: [PATCH 5/5] ARM: pxa168: aspenite: add board support for keypad

Dne P? 3. z??? 2010 06:50:28 Mark F. Brown napsal(a):

Quoted 4 lines

On Tue, Aug 31, 2010 at 1:00 AM, Haojian Zhuang

Quoted 1 line · <[email protected]> wrote:

On Thu, Aug 26, 2010 at 5:18 PM, Mark F. Brown <[email protected]>

Quoted 70 lines · wrote:
Quoted 70 lines
Quoted 38 lines
---
 arch/arm/mach-mmp/aspenite.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
arch/arm/mach-mmp/aspenite.c +11 -0
index 9e1bd6b..1b788c5 100644
@@ -24,6 +24,8 @@
 #include <mach/pxa168.h>
 #include <mach/gpio.h>
 #include <video/pxa168fb.h>
+#include <linux/input.h>
+#include <plat/pxa27x_keypad.h>
 
 #include "common.h"
 
@@ -97,6 +99,13 @@ static unsigned long common_pin_config[] __initdata =
 { GPIO81_LCD_DD21,
       GPIO82_LCD_DD22,
       GPIO83_LCD_DD23,
+
+       /* Keypad */
+       GPIO109_KP_MKIN1,
+       GPIO110_KP_MKIN0,
+       GPIO111_KP_MKOUT7,
+       GPIO112_KP_MKOUT6,
+       GPIO121_KP_MKIN4,
 };
 
 static struct smc91x_platdata smc91x_info = {
@@ -193,6 +202,23 @@ struct pxa168fb_mach_info aspenite_lcd_info = {
       .invert_pixclock        = 0,
 };
 
+static unsigned int aspenite_matrix_key_map[] = {
+       KEY(0, 6, KEY_UP),      /* SW 4 */

arch/arm/mach-mmp/aspenite.c struct pxa168fb_mach_info aspenite_lcd_info = { · line 216

Quoted 10 lines
arch/arm/mach-mmp/aspenite.c +9 -0
+       KEY(0, 7, KEY_DOWN),    /* SW 5 */
+       KEY(1, 6, KEY_LEFT),    /* SW 6 */
+       KEY(1, 7, KEY_RIGHT),   /* SW 7 */
+       KEY(4, 6, KEY_ENTER),   /* SW 8 */
+       KEY(4, 7, KEY_ESC),     /* SW 9 */
+};
+
+static struct pxa27x_keypad_platform_data aspenite_keypad_info
 __initdata = { +       .matrix_key_rows        = 8,
+       .matrix_key_cols        = 8,

It seems that maxium columns is 5, not 8.

Quoted 19 lines
arch/arm/mach-mmp/aspenite.c +6 -1
+       .matrix_key_map         = aspenite_matrix_key_map,
+       .matrix_key_map_size    = ARRAY_SIZE(aspenite_matrix_key_map),
+       .debounce_interval      = 30,
+};
+
 static void __init common_init(void)
 {
       mfp_config(ARRAY_AND_SIZE(common_pin_config));
@@ -203,6 +229,7 @@ static void __init common_init(void)
       pxa168_add_ssp(1);
       pxa168_add_nand(&aspenite_nand_info);
       pxa168_add_fb(&aspenite_lcd_info);
+       pxa168_add_keypad(&aspenite_keypad_info);
 
       /* off-chip devices */
       platform_device_register(&smc91x_device);
--

1.7.0.4

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/

The maximum keypad columns are 8 and the maximum keypad rows are 5 for Aspenite. I will correct that in my patch resubmission!

Eric, did you merge this already ? If so, we'll need a separate patch here?

Quoted 7 lines

Regards,
-- Mark
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#18 lore raw

Re: [PATCH 5/5] ARM: pxa168: aspenite: add board support for keypad

Quoted 85 lines · Marek Vasut

Dne P? 3. z??? 2010 06:50:28 Mark F. Brown napsal(a):

Quoted 4 lines

On Tue, Aug 31, 2010 at 1:00 AM, Haojian Zhuang

Quoted 1 line · <[email protected]> wrote:

On Thu, Aug 26, 2010 at 5:18 PM, Mark F. Brown <[email protected]>

Quoted 70 lines · wrote:
Quoted 70 lines
Quoted 38 lines

---
?arch/arm/mach-mmp/aspenite.c | ? 27 +++++++++++++++++++++++++++ ?1 files changed, 27 insertions(+), 0 deletions(-)

arch/arm/mach-mmp/aspenite.c +0 -0
index 9e1bd6b..1b788c5 100644
@@ -24,6 +24,8 @@

?#include <mach/pxa168.h>
?#include <mach/gpio.h>
?#include <video/pxa168fb.h>

arch/arm/mach-mmp/aspenite.c +2 -0
+#include <linux/input.h>
+#include <plat/pxa27x_keypad.h>

?#include "common.h"

arch/arm/mach-mmp/aspenite.c +9 -0
@@ -97,6 +99,13 @@ static unsigned long common_pin_config[] __initdata =
 { GPIO81_LCD_DD21,
 ? ? ? ?GPIO82_LCD_DD22,
 ? ? ? ?GPIO83_LCD_DD23,
+
+ ? ? ? /* Keypad */
+ ? ? ? GPIO109_KP_MKIN1,
+ ? ? ? GPIO110_KP_MKIN0,
+ ? ? ? GPIO111_KP_MKOUT7,
+ ? ? ? GPIO112_KP_MKOUT6,
+ ? ? ? GPIO121_KP_MKIN4,
 ?};
 
 ?static struct smc91x_platdata smc91x_info = {
@@ -193,6 +202,23 @@ struct pxa168fb_mach_info aspenite_lcd_info = {
 ? ? ? ?.invert_pixclock ? ? ? ?= 0,
 ?};
 
+static unsigned int aspenite_matrix_key_map[] = {
+ ? ? ? KEY(0, 6, KEY_UP), ? ? ?/* SW 4 */

arch/arm/mach-mmp/aspenite.c struct pxa168fb_mach_info aspenite_lcd_info = { · line 216

Quoted 10 lines
arch/arm/mach-mmp/aspenite.c +9 -0
+ ? ? ? KEY(0, 7, KEY_DOWN), ? ?/* SW 5 */
+ ? ? ? KEY(1, 6, KEY_LEFT), ? ?/* SW 6 */
+ ? ? ? KEY(1, 7, KEY_RIGHT), ? /* SW 7 */
+ ? ? ? KEY(4, 6, KEY_ENTER), ? /* SW 8 */
+ ? ? ? KEY(4, 7, KEY_ESC), ? ? /* SW 9 */
+};
+
+static struct pxa27x_keypad_platform_data aspenite_keypad_info
 __initdata = { + ? ? ? .matrix_key_rows ? ? ? ?= 8,
+ ? ? ? .matrix_key_cols ? ? ? ?= 8,

It seems that maxium columns is 5, not 8.

Quoted 19 lines
arch/arm/mach-mmp/aspenite.c +5 -0
+ ? ? ? .matrix_key_map ? ? ? ? = aspenite_matrix_key_map,
+ ? ? ? .matrix_key_map_size ? ?= ARRAY_SIZE(aspenite_matrix_key_map),
+ ? ? ? .debounce_interval ? ? ?= 30,
+};
+
 ?static void __init common_init(void)
 ?{

? ? ? ?mfp_config(ARRAY_AND_SIZE(common_pin_config));

arch/arm/mach-mmp/aspenite.c +1 -0
@@ -203,6 +229,7 @@ static void __init common_init(void)
 ? ? ? ?pxa168_add_ssp(1);
 ? ? ? ?pxa168_add_nand(&aspenite_nand_info);
 ? ? ? ?pxa168_add_fb(&aspenite_lcd_info);
+ ? ? ? pxa168_add_keypad(&aspenite_keypad_info);
 

? ? ? ?/* off-chip devices */
? ? ? ?platform_device_register(&smc91x_device);
--
1.7.0.4

Quoted 8 lines
Quoted 5 lines
Quoted 5 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo at vger.kernel.org More majordomo info at ?http://vger.kernel.org/majordomo-info.html Please read the FAQ at ?http://www.tux.org/lkml/

The maximum keypad columns are 8 and the maximum keypad rows are 5 for Aspenite. I will correct that in my patch resubmission!

Quoted 2 lines

Eric, did you merge this already ? If so, we'll need a separate patch here?

Nope. Together with Mark's other change to the pxa27x_keypad platform_data for the wakeup cleanup in IRQ, I'd expect a v2 series of this patchset.

Quoted 8 lines
Quoted 7 lines

Regards,
-- Mark
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in the body of a message to majordomo at vger.kernel.org
More majordomo info at ?http://vger.kernel.org/majordomo-info.html

#19 lore raw

PATCH 5/5 ARM: pxa168: aspenite: add board support for keypad

In reply to Mark F. Brown
---
 arch/arm/mach-mmp/aspenite.c |   27 +++++++++++++++++++++++++++
 1 files changed, 27 insertions(+), 0 deletions(-)
arch/arm/mach-mmp/aspenite.c +27 -0
index 9e1bd6b..1b788c5 100644
@@ -24,6 +24,8 @@
 #include <mach/pxa168.h>
 #include <mach/gpio.h>
 #include <video/pxa168fb.h>
+#include <linux/input.h>
+#include <plat/pxa27x_keypad.h>
 
 #include "common.h"
 
@@ -97,6 +99,13 @@ static unsigned long common_pin_config[] __initdata = {
 	GPIO81_LCD_DD21,
 	GPIO82_LCD_DD22,
 	GPIO83_LCD_DD23,
+
+	/* Keypad */
+	GPIO109_KP_MKIN1,
+	GPIO110_KP_MKIN0,
+	GPIO111_KP_MKOUT7,
+	GPIO112_KP_MKOUT6,
+	GPIO121_KP_MKIN4,
 };
 
 static struct smc91x_platdata smc91x_info = {
@@ -193,6 +202,23 @@ struct pxa168fb_mach_info aspenite_lcd_info = {
 	.invert_pixclock	= 0,
 };
 
+static unsigned int aspenite_matrix_key_map[] = {
+	KEY(0, 6, KEY_UP),	/* SW 4 */
+	KEY(0, 7, KEY_DOWN),	/* SW 5 */
+	KEY(1, 6, KEY_LEFT),	/* SW 6 */
+	KEY(1, 7, KEY_RIGHT),	/* SW 7 */
+	KEY(4, 6, KEY_ENTER),	/* SW 8 */
+	KEY(4, 7, KEY_ESC),	/* SW 9 */
+};
+
+static struct pxa27x_keypad_platform_data aspenite_keypad_info __initdata = {
+	.matrix_key_rows	= 8,
+	.matrix_key_cols	= 8,
+	.matrix_key_map		= aspenite_matrix_key_map,
+	.matrix_key_map_size	= ARRAY_SIZE(aspenite_matrix_key_map),
+	.debounce_interval	= 30,
+};
+
 static void __init common_init(void)
 {
 	mfp_config(ARRAY_AND_SIZE(common_pin_config));
@@ -203,6 +229,7 @@ static void __init common_init(void)
 	pxa168_add_ssp(1);
 	pxa168_add_nand(&aspenite_nand_info);
 	pxa168_add_fb(&aspenite_lcd_info);
+	pxa168_add_keypad(&aspenite_keypad_info);
 
 	/* off-chip devices */
 	platform_device_register(&smc91x_device);
Signature · 1 line
1.7.0.4