ARM: tegra: KBC: support long press power key 1001SKU
aghuge [Wed, 19 Dec 2012 11:57:53 +0000 (16:57 +0530)]
Added support for long press power key functonality

Reviewed-on: http://git-master/r/172776
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
(cherry picked from commit 15d63caf7a656fb56ae9790f243c4b37c80b25b0)

Change-Id: I71be76eea1d6572c84447fd626f490fdc08da027
Signed-off-by: aghuge <aghuge@nvidia.com>
Reviewed-on: http://git-master/r/173314
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
Tested-by: Laxman Dewangan <ldewangan@nvidia.com>

arch/arm/mach-tegra/board-dalmore-kbc.c

index 3335813..ae277eb 100644 (file)
@@ -37,6 +37,9 @@
 #define DALMORE_ROW_COUNT      3
 #define DALMORE_COL_COUNT      3
 
+#define DALMORE_ROW_COUNT_1001 1
+#define DALMORE_COL_COUNT_1001 1
+
 static const u32 kbd_keymap[] = {
        KEY(0, 0, KEY_POWER),
        KEY(0, 1, KEY_HOME),
@@ -54,6 +57,15 @@ static const struct matrix_keymap_data keymap_data = {
        .keymap_size    = ARRAY_SIZE(kbd_keymap),
 };
 
+static const u32 kbd_keymap_1001[] = {
+       KEY(0, 0, KEY_POWER),
+};
+
+static const struct matrix_keymap_data keymap_data_1001 = {
+       .keymap         = kbd_keymap_1001,
+       .keymap_size    = ARRAY_SIZE(kbd_keymap_1001),
+};
+
 static struct tegra_kbc_wake_key dalmore_wake_cfg[] = {
        [0] = {
                .row = 0,
@@ -75,6 +87,20 @@ static struct tegra_kbc_platform_data dalmore_kbc_platform_data = {
 #endif
 };
 
+static struct tegra_kbc_platform_data dalmore_kbc_platform_data_1001 = {
+       .debounce_cnt = 20 * 32, /* 20 ms debaunce time */
+       .repeat_cnt = 1,
+       .scan_count = 30,
+       .wakeup = true,
+       .keymap_data = &keymap_data_1001,
+       .wake_cnt = 1,
+       .wake_cfg = &dalmore_wake_cfg[0],
+       .wakeup_key = KEY_POWER,
+#ifdef CONFIG_ANDROID
+       .disable_ev_rep = true,
+#endif
+};
+
 #define GPIO_KEY(_id, _gpio, _iswake)           \
        {                                       \
                .code = _id,                    \
@@ -118,11 +144,9 @@ static struct gpio_keys_button dalmore_e1611_1000_keys[] = {
 };
 
 static struct gpio_keys_button dalmore_e1611_1001_keys[] = {
-       [0] = GPIO_IKEY(KEY_POWER, PALMAS_TEGRA_IRQ_BASE +
-                       PALMAS_PWRON_IRQ, 1, 100),
-       [1] = GPIO_KEY(KEY_VOLUMEUP, PR2, 0),
-       [2] = GPIO_KEY(KEY_VOLUMEDOWN, PR1, 0),
-       [3] = {
+       [0] = GPIO_KEY(KEY_VOLUMEUP, PR2, 0),
+       [1] = GPIO_KEY(KEY_VOLUMEDOWN, PR1, 0),
+       [2] = {
                .code = SW_LID,
                .gpio = TEGRA_GPIO_HALL,
                .irq = -1,
@@ -175,24 +199,47 @@ static struct platform_device dalmore_e1611_1001_keys_device = {
 
 static void __init dalmore_register_kbc(void)
 {
-       struct tegra_kbc_platform_data *data = &dalmore_kbc_platform_data;
-       int i;
+       struct board_info board_info;
 
-       tegra_kbc_device.dev.platform_data = &dalmore_kbc_platform_data;
-       pr_info("Registering tegra-kbc\n");
+       if (board_info.board_id == BOARD_E1611 && board_info.sku != 1001) {
+               struct tegra_kbc_platform_data *data = &dalmore_kbc_platform_data;
+               int i;
 
-       BUG_ON((KBC_MAX_ROW + KBC_MAX_COL) > KBC_MAX_GPIO);
-       for (i = 0; i < DALMORE_ROW_COUNT; i++) {
-               data->pin_cfg[i].num = i;
-               data->pin_cfg[i].type = PIN_CFG_ROW;
-       }
-       for (i = 0; i < DALMORE_COL_COUNT; i++) {
-               data->pin_cfg[i + KBC_PIN_GPIO_11].num = i;
-               data->pin_cfg[i + KBC_PIN_GPIO_11].type = PIN_CFG_COL;
-       }
+               tegra_kbc_device.dev.platform_data = &dalmore_kbc_platform_data;
+               pr_info("Registering tegra-kbc\n");
+
+               BUG_ON((KBC_MAX_ROW + KBC_MAX_COL) > KBC_MAX_GPIO);
+               for (i = 0; i < DALMORE_ROW_COUNT; i++) {
+                       data->pin_cfg[i].num = i;
+                       data->pin_cfg[i].type = PIN_CFG_ROW;
+               }
+               for (i = 0; i < DALMORE_COL_COUNT; i++) {
+                       data->pin_cfg[i + KBC_PIN_GPIO_11].num = i;
+                       data->pin_cfg[i + KBC_PIN_GPIO_11].type = PIN_CFG_COL;
+               }
 
-       platform_device_register(&tegra_kbc_device);
-       pr_info("Registering successful tegra-kbc\n");
+               platform_device_register(&tegra_kbc_device);
+               pr_info("Registering successful tegra-kbc\n");
+       } else {
+               struct tegra_kbc_platform_data *data = &dalmore_kbc_platform_data_1001;
+               int i;
+
+               tegra_kbc_device.dev.platform_data = &dalmore_kbc_platform_data_1001;
+               pr_info("Registering tegra-kbc\n");
+
+               BUG_ON((KBC_MAX_ROW + KBC_MAX_COL) > KBC_MAX_GPIO);
+               for (i = 0; i < DALMORE_ROW_COUNT_1001; i++) {
+                       data->pin_cfg[i].num = i;
+                       data->pin_cfg[i].type = PIN_CFG_ROW;
+               }
+               for (i = 0; i < DALMORE_COL_COUNT_1001; i++) {
+                       data->pin_cfg[i + KBC_PIN_GPIO_11].num = i;
+                       data->pin_cfg[i + KBC_PIN_GPIO_11].type = PIN_CFG_COL;
+               }
+
+               platform_device_register(&tegra_kbc_device);
+               pr_info("Registering successful tegra-kbc\n");
+       }
 }
 
 int __init dalmore_kbc_init(void)
@@ -210,6 +257,7 @@ int __init dalmore_kbc_init(void)
                        platform_device_register(
                                &dalmore_e1611_1000_keys_device);
                } else {
+                       dalmore_register_kbc();
                        platform_device_register(
                                &dalmore_e1611_1001_keys_device);
                }