summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorJeremiah Lott <jeremiah.lott@timesys.com>2009-09-17 14:09:03 -0400
committerJeremiah Lott <jeremiah.lott@timesys.com>2009-09-21 14:34:53 -0400
commit021f317a8e9ee3fd8d962a645e83a240657df462 (patch)
tree487aa80213572b274d7003b8ced10cfcacf6ddcb /arch
parent72b96f8d45fe155036c7c7d6412c8f27ee16a8bd (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_ */