From 76fa4be11b079ff5aeac2f3365433859ffb69130 Mon Sep 17 00:00:00 2001 From: Marcel Ziswiler Date: Mon, 1 Dec 2014 17:48:15 +0100 Subject: apalis_t30: implement power button optionally acting as power-key Both the Apalis EvalBoard as well as Ixora allow their LTC2954 pushbutton on/off controller to optionally initiate orderly shutdown via GPIO interrupt on GPIO5 upon short power button press (short here meaning really short unless C137 resp. C35 is assembled). For this to work the following wiring is required: Apalis EvalBoard V1.1a X61-4 to X2-6 Ixora V1.0a X5-4 to X27-17 For systemd/logind to actually use this as a power-switch a custom udev rule /etc/udev/rules.d/70-power-switch-apalis_t30.rules as follows is required: # Specific rule for apalis_t30: # # Apalis T30's power button is not part of the kernel acpi subsystem. # Let's manually add the power-switch tag to control its behaviour with # systemd/logind ACTION=="remove", GOTO="power_apalis_t30_end" SUBSYSTEM=="input", KERNEL=="event1", TAG+="power-switch" LABEL="power_apalis_t30_end" --- arch/arm/mach-tegra/board-apalis_t30.c | 6 ++++++ arch/arm/mach-tegra/board-apalis_t30.h | 1 + 2 files changed, 7 insertions(+) diff --git a/arch/arm/mach-tegra/board-apalis_t30.c b/arch/arm/mach-tegra/board-apalis_t30.c index a114e4773e12..30d00a33bfa1 100644 --- a/arch/arm/mach-tegra/board-apalis_t30.c +++ b/arch/arm/mach-tegra/board-apalis_t30.c @@ -365,7 +365,9 @@ static struct gpio apalis_t30_gpios[] = { {APALIS_GPIO2, GPIOF_IN, "GPIO2 X1-3"}, {APALIS_GPIO3, GPIOF_IN, "GPIO3 X1-5"}, {APALIS_GPIO4, GPIOF_IN, "GPIO4 X1-7"}, +#ifndef POWER_GPIO {APALIS_GPIO5, GPIOF_IN, "GPIO5 X1-9"}, +#endif #ifndef FORCE_OFF_GPIO {APALIS_GPIO6, GPIOF_IN, "GPIO6 X1-11"}, #endif @@ -596,6 +598,10 @@ static void __init apalis_t30_i2c_init(void) } static struct gpio_keys_button apalis_t30_keys[] = { +#ifdef POWER_GPIO + GPIO_KEY(KEY_POWER, PS6, 1, 0), /* MXM3 pin 11 aka GPIO5, Ixora + X27-17/EvalBoard X2-6 */ +#endif GPIO_KEY(KEY_WAKEUP, PV1, 1, 1), /* MXM3 pin 37 aka WAKE1_MICO, Ixora X27-3/EvalBoard X2-24 */ }; diff --git a/arch/arm/mach-tegra/board-apalis_t30.h b/arch/arm/mach-tegra/board-apalis_t30.h index a62bab002ae0..c08ff32741b8 100644 --- a/arch/arm/mach-tegra/board-apalis_t30.h +++ b/arch/arm/mach-tegra/board-apalis_t30.h @@ -27,6 +27,7 @@ #include //#define FORCE_OFF_GPIO APALIS_GPIO6 +//#define POWER_GPIO APALIS_GPIO5 /* GPIO */ -- cgit v1.2.3