summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorJeremiah Lott <jeremiah.lott@timesys.com>2009-09-17 14:09:03 -0400
committerAndy Voltz <andy.voltz@timesys.com>2010-11-19 12:20:17 -0500
commit8848f75a1d7d9066b2b1f1e5ce01fe235c103989 (patch)
treef587c1a89d70b17ae82602a9a3187eb310a32d2b /arch
parentda86029125dff922a74e7dfb34c27308c60e1771 (diff)
Keypad driver for the mxc keypad controller. Forward ported from 2.6.22.
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-mx2/mx27lite.c55
-rw-r--r--arch/arm/plat-mxc/include/mach/keypad.h28
2 files changed, 78 insertions, 5 deletions
diff --git a/arch/arm/mach-mx2/mx27lite.c b/arch/arm/mach-mx2/mx27lite.c
index 5ef289ac0a8d..ad8bb0cf6a35 100644
--- a/arch/arm/mach-mx2/mx27lite.c
+++ b/arch/arm/mach-mx2/mx27lite.c
@@ -35,6 +35,7 @@
#include <mach/mxc_nand.h>
#include <mach/imxfb.h>
#include <mach/mxc_ehci.h>
+#include <mach/keypad.h>
#include "devices.h"
@@ -207,11 +208,6 @@ static struct imx_fb_platform_data logic_mbimx27_fb_data = {
.dmacr = 0x00020010,
};
-static struct platform_device *platform_devices[] __initdata = {
- &mx27lite_nor_mtd_device,
- &mxc_fec_device,
-};
-
/*
static struct mxc_usbh_platform_data usbotg_pdata = {
.portsc = MXC_EHCI_MODE_ULPI | MXC_EHCI_UTMI_8BIT,
@@ -229,6 +225,55 @@ static struct mxc_usbh_platform_data usbh2_pdata = {
.flags = MXC_EHCI_POWER_PINS_ENABLED,
};
+/*
+ * This array is used for mapping mx27 ADS keypad scancodes to input keyboard
+ * keycodes.
+ */
+static u16 mxckpd_keycodes[] = {
+ KEY_LEFT, KEY_ENTER, KEY_0, KEY_KPASTERISK,
+ KEY_DOWN, KEY_9, KEY_8, KEY_7,
+ KEY_UP, KEY_6, KEY_5, KEY_4,
+ KEY_RIGHT, KEY_3, KEY_2, KEY_1,
+};
+
+/*
+ * Even though the evb keypad is 6x6, only the first 4 row/column pins
+ * are available on the logic mx27 SOM.
+ */
+static struct keypad_data evb_4_by_4_keypad = {
+ .rowmax = 4,
+ .colmax = 4,
+ .irq = MXC_INT_KPP,
+ .learning = 0,
+ .delay = 2,
+ .matrix = mxckpd_keycodes,
+};
+
+static struct resource mxc_kpp_resources[] = {
+ [0] = {
+ .start = MXC_INT_KPP,
+ .end = MXC_INT_KPP,
+ .flags = IORESOURCE_IRQ,
+ }
+};
+
+/* mxc keypad driver */
+static struct platform_device mxc_keypad_device = {
+ .name = "mxc_keypad",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(mxc_kpp_resources),
+ .resource = mxc_kpp_resources,
+ .dev = {
+ .platform_data = &evb_4_by_4_keypad,
+ },
+};
+
+static struct platform_device *platform_devices[] __initdata = {
+ &mx27lite_nor_mtd_device,
+ &mxc_fec_device,
+ &mxc_keypad_device,
+};
+
static void __init mx27lite_init(void)
{
mxc_gpio_setup_multiple_pins(mx27lite_pins, ARRAY_SIZE(mx27lite_pins),
diff --git a/arch/arm/plat-mxc/include/mach/keypad.h b/arch/arm/plat-mxc/include/mach/keypad.h
new file mode 100644
index 000000000000..cfee65ab044a
--- /dev/null
+++ b/arch/arm/plat-mxc/include/mach/keypad.h
@@ -0,0 +1,28 @@
+/*
+ * include/asm-arm/mach/keypad.h
+ *
+ * Generic Keypad struct
+ *
+ * Author: Armin Kuster <Akuster@mvista.com>
+ *
+ * 2005 (c) MontaVista Software, Inc. This file is licensed under
+ * the terms of the GNU General Public License version 2. This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+
+#ifndef __ASM_MACH_KEYPAD_H_
+#define __ASM_MACH_KEYPAD_H_
+
+#include <linux/input.h>
+
+struct keypad_data {
+ u16 rowmax;
+ u16 colmax;
+ u32 irq;
+ u16 delay;
+ u16 learning;
+ u16 *matrix;
+};
+
+#endif /* __ARM_MACH_KEYPAD_H_ */