From a5beb70b78f1648bf27a568a73755149e0038d26 Mon Sep 17 00:00:00 2001 From: vikasr Date: Fri, 13 May 2011 17:32:49 -0700 Subject: ARM: tegra: cardhu: Power button to unlock screen Made changes in the code to include PM269's power button to lock and unlock the screen. Bug 824765 Original-Change-Id: I6cead8cfd2a84ffa6ba5ef654e690f2f675a3c77 Reviewed-on: http://git-master/r/31607 Reviewed-by: Daniel Willemsen Tested-by: Vikas Ramesh Kedigehalli Rebase-Id: R46af0c6c7b5baff9e72fe144eaa0127a05fa9de8 --- arch/arm/mach-tegra/board-cardhu-kbc.c | 40 ++++++++++++++++++++++++++-------- 1 file changed, 31 insertions(+), 9 deletions(-) (limited to 'arch/arm/mach-tegra/board-cardhu-kbc.c') diff --git a/arch/arm/mach-tegra/board-cardhu-kbc.c b/arch/arm/mach-tegra/board-cardhu-kbc.c index 42b74cde6d8a..d5b5fbb2114b 100644 --- a/arch/arm/mach-tegra/board-cardhu-kbc.c +++ b/arch/arm/mach-tegra/board-cardhu-kbc.c @@ -136,6 +136,23 @@ int __init cardhu_scroll_init(void) .debounce_interval = 10, \ } +static struct gpio_keys_button cardhu_keys_pm269[] = { + [0] = GPIO_KEY(KEY_POWER, PV0, 1), +}; + +static struct gpio_keys_platform_data cardhu_keys_pm269_platform_data = { + .buttons = cardhu_keys_pm269, + .nbuttons = ARRAY_SIZE(cardhu_keys_pm269), +}; + +static struct platform_device cardhu_keys_pm269_device = { + .name = "gpio-keys", + .id = 0, + .dev = { + .platform_data = &cardhu_keys_pm269_platform_data, + }, +}; + static struct gpio_keys_button cardhu_keys_e1198[] = { [0] = GPIO_KEY(KEY_HOME, PQ0, 0), [1] = GPIO_KEY(KEY_BACK, PQ1, 0), @@ -148,7 +165,7 @@ static struct gpio_keys_button cardhu_keys_e1198[] = { static struct gpio_keys_platform_data cardhu_keys_e1198_platform_data = { .buttons = cardhu_keys_e1198, - .nbuttons = ARRAY_SIZE(cardhu_keys_e1198), + .nbuttons = ARRAY_SIZE(cardhu_keys_e1198), }; static struct platform_device cardhu_keys_e1198_device = { @@ -170,7 +187,7 @@ static struct gpio_keys_button cardhu_keys_e1291[] = { static struct gpio_keys_platform_data cardhu_keys_e1291_platform_data = { .buttons = cardhu_keys_e1291, - .nbuttons = ARRAY_SIZE(cardhu_keys_e1291), + .nbuttons = ARRAY_SIZE(cardhu_keys_e1291), }; static struct platform_device cardhu_keys_e1291_device = { @@ -216,7 +233,8 @@ int __init cardhu_keys_init(void) tegra_get_board_info(&board_info); if (!((board_info.board_id == BOARD_E1198) || - (board_info.board_id == BOARD_E1291))) + (board_info.board_id == BOARD_E1291) || + (board_info.board_id == BOARD_PM269))) return 0; pr_info("Registering gpio keys\n"); @@ -228,13 +246,17 @@ int __init cardhu_keys_init(void) platform_device_register(&cardhu_keys_e1291_device); platform_device_register(&cardhu_int_keys_e1291_device); - return 0; - } + } else if (board_info.board_id == BOARD_PM269) { + for (i = 0; i < ARRAY_SIZE(cardhu_keys_pm269); i++) + tegra_gpio_enable(cardhu_keys_pm269[i].gpio); - /* For E1198 */ - for (i = 0; i < ARRAY_SIZE(cardhu_keys_e1198); i++) - tegra_gpio_enable(cardhu_keys_e1198[i].gpio); + platform_device_register(&cardhu_keys_pm269_device); + } else { + /* For E1198 */ + for (i = 0; i < ARRAY_SIZE(cardhu_keys_e1198); i++) + tegra_gpio_enable(cardhu_keys_e1198[i].gpio); - platform_device_register(&cardhu_keys_e1198_device); + platform_device_register(&cardhu_keys_e1198_device); + } return 0; } -- cgit v1.2.3