ARM: tegra: tegratab: add lid and pen detect switch support
Youngjin Kim [Thu, 2 May 2013 12:41:57 +0000 (21:41 +0900)]
Add GPIOs for lid and stylus pen hall sensors to gpio key
platform data as switch.

Bug 1279288

Change-Id: Idd0bc903354970352b0f451595249d1209569924
Signed-off-by: Youngjin Kim <nkim@nvidia.com>
Reviewed-on: http://git-master/r/224883
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Bo Kim <bok@nvidia.com>
Reviewed-by: Jake Park <jakep@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Robert Collins <rcollins@nvidia.com>
Reviewed-by: Bharat Nihalani <bnihalani@nvidia.com>

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

index 9dd5d1d..4fec928 100644 (file)
                .debounce_interval = 10,        \
        }
 
+#define GPIO_SW(_id, _gpio, _active_low, _iswake)   \
+       {                                           \
+               .code = _id,                        \
+               .gpio = TEGRA_GPIO_##_gpio,         \
+               .irq = -1,                          \
+               .type = EV_SW,                      \
+               .desc = #_id,                       \
+               .active_low = _active_low,          \
+               .wakeup = _iswake,                  \
+               .debounce_interval = 0,             \
+       }
+
 static struct gpio_keys_button tegratab_e1569_keys[] = {
        [0] = GPIO_KEY(KEY_POWER, PQ0, 1),
        [1] = GPIO_KEY(KEY_VOLUMEUP, PR2, 0),
@@ -52,6 +64,8 @@ static struct gpio_keys_button tegratab_p1640_keys[] = {
        [0] = GPIO_KEY(KEY_POWER, PQ0, 1),
        [1] = GPIO_KEY(KEY_VOLUMEUP, PR2, 0),
        [2] = GPIO_KEY(KEY_VOLUMEDOWN, PQ2, 0),
+       [3] = GPIO_SW(SW_LID, PC7, 1, 1),
+       [4] = GPIO_SW(SW_TABLET_MODE, PQ1, 0, 0),
 };
 
 static int tegratab_wakeup_key(void)
@@ -62,7 +76,7 @@ static int tegratab_wakeup_key(void)
                + PMC_WAKE2_STATUS) << 32;
        if (status & ((u64)1 << TEGRA_WAKE_GPIO_PQ0))
                wakeup_key = KEY_POWER;
-       else if (status & ((u64)1 << TEGRA_WAKE_GPIO_PS0))
+       else if (status & ((u64)1 << TEGRA_WAKE_GPIO_PC7))
                wakeup_key = SW_LID;
        else
                wakeup_key = KEY_RESERVED;