aboutsummaryrefslogtreecommitdiffstats
path: root/arch/x86/platform/mrst/mrst.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/x86/platform/mrst/mrst.c')
-rw-r--r--arch/x86/platform/mrst/mrst.c188
1 files changed, 188 insertions, 0 deletions
diff --git a/arch/x86/platform/mrst/mrst.c b/arch/x86/platform/mrst/mrst.c
index d38d7275b14..88c0f780bca 100644
--- a/arch/x86/platform/mrst/mrst.c
+++ b/arch/x86/platform/mrst/mrst.c
@@ -21,6 +21,8 @@
#include <linux/spi/dw_spi.h>
#include <linux/i2c.h>
#include <linux/i2c/pca953x.h>
+#include <linux/i2c/tc35894xbg.h>
+#include <linux/gpio.h>
#include <linux/gpio_keys.h>
#include <linux/input.h>
#include <linux/platform_device.h>
@@ -550,6 +552,190 @@ static void __init *lis331dl_platform_data(void *info)
return &intr2nd_pdata;
}
+static void tc35894xbg_reset_ctrl(struct i2c_client *client, int value)
+{
+ struct tc35894xbg_platform_data *pdata = client->dev.platform_data;
+ if (pdata == NULL) {
+ printk(KERN_ERR "Missing platform data for TC35894XBG\n");
+ return;
+ }
+
+ if (pdata->gpio_reset != -1)
+ gpio_set_value(pdata->gpio_reset, value);
+}
+
+static const unsigned short tc35894xbg_icdk_keymap[] = {
+ /* Row 0 */
+ KEY_1, KEY_2, KEY_3, KEY_4,
+ KEY_5, KEY_6, KEY_7, KEY_8,
+ /* Row 1 */
+ KEY_Q, KEY_W, KEY_E, KEY_R,
+ KEY_T, KEY_Y, KEY_U, KEY_I,
+ /* Row 2 */
+ KEY_A, KEY_S, KEY_D, KEY_F,
+ KEY_G, KEY_H, KEY_J, KEY_K,
+ /* Row 3 */
+ KEY_LEFTSHIFT, KEY_Z, KEY_X, KEY_C,
+ KEY_V, KEY_B, KEY_N, KEY_M,
+ /* Row 4 */
+ KEY_9, KEY_FN, KEY_LEFTALT, KEY_SPACE,
+ KEY_DELETE, KEY_LEFT, KEY_DOWN, KEY_RIGHT,
+ /* Row 5 */
+ KEY_LEFTCTRL, KEY_O, KEY_L, KEY_UP,
+ KEY_0, KEY_P, KEY_BACKSPACE, KEY_ENTER,
+ KEY_RIGHTSHIFT,
+};
+
+static const unsigned short tc35894xbg_icdk_fnkeymap[] = {
+ /* Row 0 */
+ KEY_GRAVE, KEY_AT, KEY_NUMBER_SIGN, KEY_DOLLAR_SIGN,
+ KEY_PERCENT, KEY_NOR, KEY_AMPERSAND, KEY_KPASTERISK,
+ /* Row 1 */
+ KEY_BAR, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+ KEY_RESERVED, KEY_BACKSLASH, KEY_SLASH, KEY_PLUS,
+ /* Row 2 */
+ KEY_TAB, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+ KEY_APOSTROPHE, KEY_SEMICOLON, KEY_COLON, KEY_COMMA,
+ /* Row 3 */
+ KEY_CAPSLOCK, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+ KEY_DOT, KEY_UNDERSCORE, KEY_EXCLAM, KEY_QUESTION,
+ /* Row 4 */
+ KEY_LEFTBRACE, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+ KEY_RESERVED, KEY_RESERVED, KEY_PAGEDOWN, KEY_RESERVED,
+ /* Row 5 */
+ KEY_RESERVED, KEY_MINUS, KEY_QUOTE_DBL, KEY_PAGEUP,
+ KEY_RIGHTBRACE, KEY_EQUAL, KEY_RESERVED, KEY_RESERVED,
+ KEY_RIGHTSHIFT,
+};
+
+/*
+ * Since there is no SYM key, we use a value that is not part
+ * of the key input file.
+ */
+#define KEY_SYM (0xFE)
+static const unsigned short tc35894xbg_ncdk_keymap[] = {
+ /* Row 0 */
+ KEY_RIGHTSHIFT, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+ KEY_RESERVED, KEY_RESERVED, KEY_SPACE, KEY_RESERVED,
+ /* Row 1 */
+ KEY_LEFTSHIFT, KEY_VOLUMEUP, KEY_VOLUMEDOWN, KEY_RESERVED,
+ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+ /* Row 2 */
+ KEY_SYM, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+ /* Row 3 */
+ KEY_FN, KEY_Z, KEY_X, KEY_O,
+ KEY_Y, KEY_B, KEY_T, KEY_P,
+ /* Row 4 */
+ KEY_LEFTCTRL, KEY_A, KEY_S, KEY_I,
+ KEY_K, KEY_COMMA, KEY_PAGEUP, KEY_ENTER,
+ /* Row 5 */
+ KEY_BACKSPACE, KEY_Q, KEY_D, KEY_U,
+ KEY_J, KEY_M, KEY_LEFT, KEY_AT,
+ /* Row 6 */
+ KEY_RESERVED, KEY_W, KEY_C, KEY_L,
+ KEY_H, KEY_N, KEY_RIGHT, KEY_F,
+ /* Row 7 */
+ KEY_RESERVED, KEY_E, KEY_V, KEY_QUESTION,
+ KEY_G, KEY_DOT, KEY_PAGEDOWN, KEY_R,
+
+};
+
+static const unsigned short tc35894xbg_ncdk_symkeymap[] = {
+ /* Row 0 */
+ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+ /* Row 1 */
+ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+ /* Row 2 */
+ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_RESERVED,
+ /* Row 3 */
+ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_9,
+ KEY_6, KEY_RESERVED, KEY_5, KEY_0,
+ /* Row 4 */
+ KEY_RESERVED, KEY_RESERVED, KEY_RESERVED, KEY_8,
+ KEY_NUMBER_SIGN, KEY_SEMICOLON, KEY_RESERVED, KEY_RESERVED,
+ /* Row 5 */
+ KEY_RESERVED, KEY_1, KEY_RESERVED, KEY_7,
+ KEY_PLUS, KEY_RIGHTBRACE, KEY_RESERVED, KEY_SLASH,
+ /* Row 6 */
+ KEY_RESERVED, KEY_2, KEY_RESERVED, KEY_KPASTERISK,
+ KEY_MINUS, KEY_LEFTBRACE, KEY_RESERVED, KEY_RESERVED,
+ /* Row 7 */
+ KEY_RESERVED, KEY_3, KEY_RESERVED, KEY_EXCLAM,
+ KEY_AMPERSAND, KEY_COLON, KEY_RESERVED, KEY_4,
+};
+
+static struct tc35894xbg_platform_data tc35894xbg_ncdk_data = {
+ .debounce_time = 0xA3, /* Set to 9.68ms */
+ .settle_time = 0xA3, /* Set to 9.68ms */
+ .col_setting = 0x7F, /* col 8:0 */
+ .rowcol_setting = 0xFE, /* row 7:0 */
+ .keymap_size = 64,
+ .size_x = 8,
+ .size_y = 8,
+ .function_key = 24,
+ .right_shift_key = 0,
+ .n_keymaps = 2
+};
+
+static struct tc35894xbg_platform_data tc35894xbg_icdk_data = {
+ .debounce_time = 0xA3, /* Set to 9.68ms */
+ .settle_time = 0xA3, /* Set to 9.68ms */
+ .col_setting = 0xFF, /* col 7:0 */
+ .rowcol_setting = 0xFF, /* row 5:0 */
+ .keymap_size = 49,
+ .size_x = 6,
+ .size_y = 8,
+ .function_key = 33,
+ .right_shift_key = 48
+};
+
+static void *tc35894xbg_platform_data(struct i2c_board_info *i2c_info,
+ const unsigned short *keymap0, int keymap0sz,
+ const unsigned short *keymap1, int keymap1sz,
+ struct tc35894xbg_platform_data* tc_data)
+
+{
+ tc_data->gpio_irq = get_gpio_by_name("keypad-intr");
+ tc_data->gpio_reset = get_gpio_by_name("keypad-reset");
+
+ printk(KERN_INFO "Nokia: keypad-intr on %d, keypad-reset on %d\n",
+ tc_data->gpio_irq, tc_data->gpio_reset);
+
+ if ((tc_data->gpio_irq == -1 || tc_data->gpio_reset == -1)) {
+ printk(KERN_ERR "Missing GPIOs for TC35894XBG\n");
+ return NULL;
+ }
+
+ i2c_info->irq = tc_data->gpio_irq + MRST_IRQ_OFFSET;
+
+ memcpy(&tc_data->keymap[0], keymap0, keymap0sz);
+ memcpy(&tc_data->keymap[1], keymap1, keymap1sz);
+
+ tc_data->reset_ctrl = tc35894xbg_reset_ctrl;
+
+ return tc_data;
+}
+
+void *tc35894xbg_i_platform_data(void *info)
+{
+ return tc35894xbg_platform_data((struct i2c_board_info *)info,
+ tc35894xbg_icdk_keymap, sizeof(tc35894xbg_icdk_keymap),
+ tc35894xbg_icdk_fnkeymap, sizeof(tc35894xbg_icdk_fnkeymap),
+ &tc35894xbg_icdk_data);
+}
+
+void *tc35894xbg_n_platform_data(void *info)
+{
+ return tc35894xbg_platform_data((struct i2c_board_info*)info,
+ tc35894xbg_ncdk_keymap, sizeof(tc35894xbg_ncdk_keymap),
+ tc35894xbg_ncdk_symkeymap, sizeof(tc35894xbg_ncdk_symkeymap),
+ &tc35894xbg_ncdk_data);
+}
+
static const struct devs_id __initconst device_ids[] = {
{"pmic_gpio", SFI_DEV_TYPE_SPI, 1, &pmic_gpio_platform_data},
{"pmic_gpio", SFI_DEV_TYPE_IPC, 1, &pmic_gpio_platform_data},
@@ -559,6 +745,8 @@ static const struct devs_id __initconst device_ids[] = {
{"i2c_max7315_2", SFI_DEV_TYPE_I2C, 1, &max7315_platform_data},
{"emc1403", SFI_DEV_TYPE_I2C, 1, &emc1403_platform_data},
{"i2c_accel", SFI_DEV_TYPE_I2C, 0, &lis331dl_platform_data},
+ {"i2c_TC35894-nEB1", SFI_DEV_TYPE_I2C, 0, &tc35894xbg_n_platform_data},
+ {"i2c_TC35894-i", SFI_DEV_TYPE_I2C, 0, &tc35894xbg_i_platform_data},
{},
};