diff options
author | Wei Ni <wni@nvidia.com> | 2011-09-02 17:46:58 +0800 |
---|---|---|
committer | Varun Colbert <vcolbert@nvidia.com> | 2011-09-09 18:56:22 -0700 |
commit | 0d881bb0e388bdc3b2f5f81140bc827bbff6feb4 (patch) | |
tree | 0db5fdafc8aff6f9a82505409ffe913c93131b6c /arch | |
parent | f988c97564f9ecf4b78f4e935e2cfc4ca1b6db0e (diff) |
arm: tegra: harmony: Enable power button to wake up system
Register gpio power key as wakeup source, so the power button can wake up
the system from lp1.
Bug=869245
TEST=set suspend_mode to lp1, then run "echo mem > /sys/power/state"
to suspend, press power button to wake up system.
Change-Id: I4752ef5503e2bab2c9d5c5f444d09367b22831da
Signed-off-by: Wei Ni <wni@nvidia.com>
Reviewed-on: http://git-master/r/50488
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>
Diffstat (limited to 'arch')
-rw-r--r-- | arch/arm/mach-tegra/board-harmony-pinmux.c | 2 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-harmony.c | 38 | ||||
-rw-r--r-- | arch/arm/mach-tegra/board-harmony.h | 2 |
3 files changed, 41 insertions, 1 deletions
diff --git a/arch/arm/mach-tegra/board-harmony-pinmux.c b/arch/arm/mach-tegra/board-harmony-pinmux.c index d3e7146014be..06773b09c1e4 100644 --- a/arch/arm/mach-tegra/board-harmony-pinmux.c +++ b/arch/arm/mach-tegra/board-harmony-pinmux.c @@ -139,7 +139,7 @@ static __initdata struct tegra_pingroup_config harmony_pinmux[] = { {TEGRA_PINGROUP_SPIH, TEGRA_MUX_SPI2_ALT, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_UAA, TEGRA_MUX_ULPI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_UAB, TEGRA_MUX_ULPI, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, - {TEGRA_PINGROUP_UAC, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_TRISTATE}, + {TEGRA_PINGROUP_UAC, TEGRA_MUX_RSVD2, TEGRA_PUPD_NORMAL, TEGRA_TRI_NORMAL}, {TEGRA_PINGROUP_UAD, TEGRA_MUX_IRDA, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_UCA, TEGRA_MUX_UARTC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, {TEGRA_PINGROUP_UCB, TEGRA_MUX_UARTC, TEGRA_PUPD_PULL_UP, TEGRA_TRI_TRISTATE}, diff --git a/arch/arm/mach-tegra/board-harmony.c b/arch/arm/mach-tegra/board-harmony.c index ec040c3da009..0f0d0eb6dc08 100644 --- a/arch/arm/mach-tegra/board-harmony.c +++ b/arch/arm/mach-tegra/board-harmony.c @@ -25,7 +25,10 @@ #include <linux/pda_power.h> #include <linux/i2c.h> #include <linux/i2c-tegra.h> +#include <linux/input.h> #include <linux/io.h> +#include <linux/gpio.h> +#include <linux/gpio_keys.h> #include <linux/delay.h> #include <linux/gpio.h> #include <linux/platform_data/tegra_usb.h> @@ -171,6 +174,30 @@ static struct plat_serial8250_port debug_uart_platform_data[] = { } }; +static struct gpio_keys_button harmony_gpio_keys_buttons[] = { + { + .code = KEY_POWER, + .gpio = TEGRA_GPIO_POWERKEY, + .active_low = 1, + .desc = "Power", + .type = EV_KEY, + .wakeup = 1, + }, +}; + +static struct gpio_keys_platform_data harmony_gpio_keys = { + .buttons = harmony_gpio_keys_buttons, + .nbuttons = ARRAY_SIZE(harmony_gpio_keys_buttons), +}; + +static struct platform_device harmony_gpio_keys_device = { + .name = "gpio-keys", + .id = -1, + .dev = { + .platform_data = &harmony_gpio_keys, + } +}; + static struct platform_device debug_uart = { .name = "serial8250", .id = PLAT8250_DEV_PLATFORM, @@ -179,6 +206,14 @@ static struct platform_device debug_uart = { }, }; +static void harmony_keys_init(void) +{ + int i; + + for (i = 0; i < ARRAY_SIZE(harmony_gpio_keys_buttons); i++) + tegra_gpio_enable(harmony_gpio_keys_buttons[i].gpio); +} + /* PDA power */ static struct pda_power_pdata pda_power_pdata = { }; @@ -269,6 +304,7 @@ static struct platform_device *harmony_devices[] __initdata = { &tegra_nand_device, &tegra_udc_device, &pda_power_device, + &harmony_gpio_keys_device, &tegra_ehci3_device, &tegra_spi_device1, &tegra_spi_device2, @@ -412,6 +448,8 @@ static void __init tegra_harmony_init(void) harmony_pinmux_init(); + harmony_keys_init(); + harmony_regulator_init(); tegra_ehci3_device.dev.platform_data = &tegra_ehci_pdata; diff --git a/arch/arm/mach-tegra/board-harmony.h b/arch/arm/mach-tegra/board-harmony.h index c8645ca44338..be7f8939ab99 100644 --- a/arch/arm/mach-tegra/board-harmony.h +++ b/arch/arm/mach-tegra/board-harmony.h @@ -28,6 +28,8 @@ #define TEGRA_GPIO_WLAN_PWR_LOW TEGRA_GPIO_PK5 #define TEGRA_GPIO_WLAN_RST_LOW TEGRA_GPIO_PK6 +#define TEGRA_GPIO_POWERKEY TEGRA_GPIO_PV2 + void harmony_pinmux_init(void); int harmony_panel_init(void); int harmony_sdhci_init(void); |