aboutsummaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorJayeeta Banerjee <jayeeta.banerjee@stericsson.com>2010-06-02 18:43:50 +0530
committerJohn Rigby <john.rigby@linaro.org>2010-09-02 22:45:34 -0600
commitbd539294b4bf3b155f160d2b208d7f69ad9654e3 (patch)
tree846a533c022495394c25293ce16be52d113275c9 /arch
parentc7af1612a0cc5841b07d5ac81d8a14727d3e4396 (diff)
downloadlinux-2.6.34-ux500-bd539294b4bf3b155f160d2b208d7f69ad9654e3.tar.gz
Add support for TC35893 Keypad Controller
This patch adds support for NUIB keypad. The driver supports both polling and interrupt mode. Default mode is interrupt mode. The keypad mapping is kept same as ST UIB keypad. ST-Ericsson ID: AP261147 Signed-off-by: Jayeeta Banerjee <jayeeta.banerjee@stericsson.com> Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/740 Reviewed-by: Linus WALLEIJ <linus.walleij@stericsson.com> Signed-off-by: Mian Yousaf Kaukab <mian.yousaf.kaukab@stericsson.com> Change-Id: I2a61ee4eee8007aa251372ff29b84e70615756df Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/2403 Reviewed-by: Jonas ABERG <jonas.aberg@stericsson.com>
Diffstat (limited to 'arch')
-rwxr-xr-xarch/arm/mach-ux500/board-mop500.c348
-rwxr-xr-xarch/arm/mach-ux500/include/mach/tc35893-keypad.h46
2 files changed, 332 insertions, 62 deletions
diff --git a/arch/arm/mach-ux500/board-mop500.c b/arch/arm/mach-ux500/board-mop500.c
index c72b3699c9c..be675a34473 100755
--- a/arch/arm/mach-ux500/board-mop500.c
+++ b/arch/arm/mach-ux500/board-mop500.c
@@ -38,6 +38,7 @@
#include <mach/mmc.h>
#include <mach/setup.h>
#include <mach/i2c.h>
+#include <mach/tc35893-keypad.h>
#include <video/mcde_display.h>
#include <video/mcde_display-generic_dsi.h>
@@ -132,6 +133,270 @@ static struct gpio_altfun_data gpio_altfun_table[] = {
#endif
};
+
+/*
+ * Initializes the key scan table (lookup table) as per pre-defined scan
+ * codes to be passed to upper layer with respective key codes
+ */
+u8 const kpd_lookup_tbl1[MAX_KPROW][MAX_KPROW] = {
+ {
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_9,
+ KEY_RESERVED,
+ KEY_RESERVED
+ },
+ {
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_POWER,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED
+ },
+ {
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_7,
+ KEY_VOLUMEUP,
+ KEY_RIGHT,
+ KEY_BACK,
+ KEY_RESERVED
+ },
+ {
+ KEY_RESERVED,
+ KEY_3,
+ KEY_RESERVED,
+ KEY_DOWN,
+ KEY_LEFT,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED
+ },
+ {
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_UP,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_SEND,
+ KEY_RESERVED
+ },
+ {
+ KEY_MENU,
+ KEY_RESERVED,
+ KEY_END,
+ KEY_VOLUMEDOWN,
+ KEY_0,
+ KEY_1,
+ KEY_RESERVED,
+ KEY_RESERVED
+ },
+ {
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_ENTER
+ },
+ {
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_2,
+ KEY_RESERVED
+ }
+};
+
+
+/*
+ * Alternative keymap for seperate applications, can be enabled from sysfs
+ */
+u8 const kpd_lookup_tbl2[MAX_KPROW][MAX_KPROW] = {
+ {
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_9,
+ KEY_RESERVED,
+ KEY_RESERVED
+ },
+ {
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_ENTER,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED
+ },
+ {
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_7,
+ KEY_KPDOT,
+ KEY_6,
+ KEY_BACK,
+ KEY_RESERVED
+ },
+ {
+ KEY_RESERVED,
+ KEY_3,
+ KEY_RESERVED,
+ KEY_8,
+ KEY_4,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED
+ },
+ {
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_5,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_LEFT,
+ KEY_RESERVED
+ },
+ {
+ KEY_UP,
+ KEY_RESERVED,
+ KEY_RIGHT,
+ KEY_MENU,
+ KEY_0,
+ KEY_1,
+ KEY_RESERVED,
+ KEY_RESERVED
+ },
+ {
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_DOWN
+ },
+ {
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_2,
+ KEY_RESERVED
+ }
+};
+
+/*
+ * Initializes the key scan table (lookup table) as per schematic of
+ * the NUIB. Pre-defined scan codes to be passed to upper layer
+ * for each valid key in the matrix.
+ */
+
+u8 const kpd_lookup_tbl3[TC_KPD_ROWS][TC_KPD_COLUMNS] = {
+ {
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_BACK,
+ KEY_RESERVED,
+ KEY_RESERVED
+ },
+ {
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_1,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED
+ },
+ {
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_9,
+ KEY_RESERVED,
+ KEY_RESERVED
+ },
+ {
+ KEY_RESERVED,
+ KEY_END,
+ KEY_RESERVED,
+ KEY_RIGHT,
+ KEY_2,
+ KEY_DOWN,
+ KEY_RESERVED,
+ KEY_RESERVED
+ },
+ {
+ KEY_RESERVED,
+ KEY_POWER,
+ KEY_3,
+ KEY_0,
+ KEY_RESERVED,
+ KEY_SEND,
+ KEY_RESERVED,
+ KEY_RESERVED
+ },
+ {
+ KEY_ENTER,
+ KEY_RESERVED,
+ KEY_UP,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_7,
+ KEY_RESERVED,
+ KEY_RESERVED
+ },
+ {
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_VOLUMEUP,
+ KEY_RESERVED,
+ KEY_VOLUMEDOWN,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_MENU
+ },
+ {
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_RESERVED,
+ KEY_LEFT,
+ KEY_RESERVED
+ }
+};
+
static struct stmpe2401_platform_data stmpe_data = {
.gpio_base = U8500_NR_GPIO,
.irq = GPIO_TO_IRQ(217),
@@ -152,6 +417,22 @@ static struct tc35892_platform_data tc35892_data = {
.irq = GPIO_TO_IRQ(217),
};
+static struct tc35893_platform_data tc35893_data = {
+ .kcode_tbl = (u8 *)kpd_lookup_tbl3,
+ .krow = TC_KPD_ROWS,
+ .kcol = TC_KPD_COLUMNS,
+ .debounce_period = TC_KPD_DEBOUNCE_PERIOD,
+ .settle_time = TC_KPD_SETTLE_TIME,
+ .irqtype = (IRQF_TRIGGER_FALLING),
+ .irq = GPIO_TO_IRQ(218),
+ .enable_wakeup = true,
+#ifdef CONFIG_TC_KEYPAD_POLL
+ .op_mode = 1,
+#elif CONFIG_TC_KEYPAD_INTR
+ .op_mode = 0,
+#endif
+};
+
static struct lp5521_platform_data lp5521_data = {
.mode = LP5521_MODE_DIRECT_CONTROL,
.label = "uib-led",
@@ -457,6 +738,11 @@ static struct i2c_board_info __initdata u8500_i2c0_devices[] = {
.platform_data = &stmpe1601_data,
},
{
+ /* TC35893 keypad */
+ I2C_BOARD_INFO("tc35893-kp", 0x44),
+ .platform_data = &tc35893_data,
+ },
+ {
I2C_BOARD_INFO("av8100", 0x70),
.platform_data = &av8100_plat_data,
},
@@ -566,68 +852,6 @@ extern irqreturn_t u8500_kp_intrhandler(/*int irq,*/ void *dev_id);
extern struct mutex u8500_keymap_mutex;
extern u8 u8500_keymap; /* Default keymap is keymap 0 */
-/*
- * Initializes the key scan table (lookup table) as per pre-defined the scan
- * codes to be passed to upper layer with respective key codes
- */
-u8 const kpd_lookup_tbl1[MAX_KPROW][MAX_KPROW] = {
- {KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
- KEY_RESERVED, KEY_9, KEY_RESERVED, KEY_RESERVED},
- {KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
- KEY_POWER, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED},
- {KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_7,
- KEY_VOLUMEUP, KEY_RIGHT, KEY_BACK, KEY_RESERVED},
- {KEY_RESERVED, KEY_3, KEY_RESERVED, KEY_DOWN,
- KEY_LEFT, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED},
- {KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_UP,
- KEY_RESERVED, KEY_RESERVED, KEY_SEND, KEY_RESERVED},
- {KEY_MENU, KEY_RESERVED, KEY_END, KEY_VOLUMEDOWN,
- KEY_0, KEY_1, KEY_RESERVED, KEY_RESERVED},
- {KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
- KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_ENTER},
- {KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
- KEY_RESERVED, KEY_RESERVED, KEY_2, KEY_RESERVED}
-};
-
-
-/*
- * Alternative keymap for seperate applications, can be enabled from sysfs
- */
-u8 const kpd_lookup_tbl2[MAX_KPROW][MAX_KPROW] = {
- {KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
- KEY_RESERVED, KEY_9, KEY_RESERVED, KEY_RESERVED},
- {KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
- KEY_ENTER, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED},
- {KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_7,
- KEY_KPDOT, KEY_6, KEY_BACK, KEY_RESERVED},
- {KEY_RESERVED, KEY_3, KEY_RESERVED, KEY_8,
- KEY_4, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED},
- {KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_5,
- KEY_RESERVED, KEY_RESERVED, KEY_LEFT, KEY_RESERVED},
- {KEY_UP, KEY_RESERVED, KEY_RIGHT, KEY_MENU,
- KEY_0, KEY_1, KEY_RESERVED, KEY_RESERVED},
- {KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
- KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_DOWN},
- {KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
- KEY_RESERVED, KEY_RESERVED, KEY_2, KEY_RESERVED}
-};
-
-
-/*
- * Key table for a complete 8X8 keyboard
-{KEY_ESC, KEY_F1, KEY_F2, KEY_F3, KEY_F4, KEY_F5, KEY_F6, KEY_SPACE},
-{KEY_GRAVE, KEY_1, KEY_2, KEY_3, KEY_4, KEY_5, KEY_6, KEY_7},
-{KEY_8, KEY_9, KEY_0, KEY_MINUS, KEY_EQUAL, KEY_BACKSPACE, KEY_INSERT,
-KEY_HOME},
-{KEY_TAB, KEY_Q, KEY_W, KEY_E, KEY_R, KEY_T, KEY_Y, KEY_U},
-{KEY_I, KEY_O, KEY_P, KEY_LEFTBRACE, KEY_RIGHTBRACE, KEY_BACKSLASH,
-KEY_DELETE, KEY_END},
-{KEY_CAPSLOCK, KEY_A, KEY_S, KEY_D, KEY_F, KEY_G, KEY_H, KEY_J},
-{KEY_K, KEY_L, KEY_SEMICOLON, KEY_APOSTROPHE, KEY_ENTER, KEY_DOT,
-KEY_COMMA, KEY_SLASH},
-{KEY_LEFTSHIFT, KEY_Z, KEY_X, KEY_C, KEY_V, KEY_B, KEY_N, KEY_M}
-};
-*/
diff --git a/arch/arm/mach-ux500/include/mach/tc35893-keypad.h b/arch/arm/mach-ux500/include/mach/tc35893-keypad.h
new file mode 100755
index 00000000000..be66de2ee99
--- /dev/null
+++ b/arch/arm/mach-ux500/include/mach/tc35893-keypad.h
@@ -0,0 +1,46 @@
+/*
+ * Copyright (C) ST-Ericsson SA 2010
+ *
+ * License Terms: GNU General Public License, version 2
+ * Author: Jayeeta Banerjee <jayeeta.banerjee@stericsson.com> for ST-Ericsson
+ */
+
+#ifndef __TC35893_KEYPAD_H
+#define __TC35893_KEYPAD_H
+
+/*
+ * Keypad related platform specific constants
+ * These values may be modified for fine tuning
+ */
+#define TC_KPD_ROWS 0x8
+#define TC_KPD_COLUMNS 0x8
+#define TC_KPD_DEBOUNCE_PERIOD 0xA3
+#define TC_KPD_SETTLE_TIME 0xA3
+
+/**
+ * struct tc35893_platform_data - data structure for platform specific data
+ * @kcode_tbl: lookup table for keycodes
+ * @krow: mask for available rows, value is 0xFF
+ * @kcol: mask for available columns, value is 0xFF
+ * @debounce_period: platform specific debounce time
+ * @settle_time: platform specific settle down time
+ * @irqtype: type of interrupt, falling or rising edge
+ * @irq: irq no,
+ * @enable_wakeup: specifies if keypad event can wake up system from sleep
+ * @scan_enable: represents keypad hardware scan enable status
+ * @op_mode: Specifies polling of interrupt mode
+ */
+struct tc35893_platform_data {
+ u8 *kcode_tbl;
+ u8 krow;
+ u8 kcol;
+ u8 debounce_period;
+ u8 settle_time;
+ unsigned long irqtype;
+ int irq;
+ bool enable_wakeup;
+ unsigned char scan_enable;
+ int op_mode;
+};
+
+#endif /*__TC35893_KEYPAD_H*/