ARM: tegra: cardhu: add support for lid switch
Rhyland Klein [Thu, 2 Aug 2012 19:09:15 +0000 (15:09 -0400)]
Chromeos testing includes verifying the lid switch is functional.
While cardhu's don't have lids, this can be tested via the
lid_switch dip switch on the debug board. Add support for the lid
switch via gpio_keys.

bug 1027716

Signed-off-by: Rhyland Klein <rklein@nvidia.com>
Change-Id: I7b2e31798b6cfa0715980ddd93dd6b5292ca20d3
Reviewed-on: http://git-master/r/120445
Reviewed-by: Automatic_Commit_Validation_User
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>

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

index c397140..ce9b22c 100644 (file)
@@ -122,6 +122,17 @@ int __init cardhu_scroll_init(void)
                .debounce_interval = 10,        \
        }
 
+#define GPIO_SW_KEY(_id, _gpio, _iswake)       \
+       {                                       \
+               .code = _id,                    \
+               .gpio = _gpio,                  \
+               .active_low = 1,                \
+               .desc = #_id,                   \
+               .type = EV_SW,                  \
+               .wakeup = _iswake,              \
+               .debounce_interval = 1,         \
+       }
+
 #define GPIO_IKEY(_id, _irq, _iswake, _deb)    \
        {                                       \
                .code = _id,                    \
@@ -165,6 +176,7 @@ static struct gpio_keys_button cardhu_keys_e1291[] = {
        [4] = GPIO_KEY(KEY_BACK, PQ0, 0),
        [5] = GPIO_KEY(KEY_MENU, PQ1, 0),
        [6] = GPIO_IKEY(KEY_POWER, TPS6591X_IRQ_BASE + TPS6591X_INT_PWRON, 1, 100),
+       [7] = GPIO_SW_KEY(SW_LID, TPS6591X_GPIO_5, 0),
 };
 
 static struct gpio_keys_button cardhu_keys_e1291_a04[] = {
@@ -176,6 +188,7 @@ static struct gpio_keys_button cardhu_keys_e1291_a04[] = {
        [5] = GPIO_KEY(KEY_MENU, PQ1, 0),
        [6] = GPIO_KEY(KEY_RESERVED, PV0, 1),
        [7] = GPIO_IKEY(KEY_POWER, TPS6591X_IRQ_BASE + TPS6591X_INT_PWRON, 1, 100),
+       [8] = GPIO_SW_KEY(SW_LID, TPS6591X_GPIO_5, 0),
 };
 
 static struct gpio_keys_platform_data cardhu_keys_e1291_pdata = {