From patchwork Tue Aug 7 12:35:28 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [2/5] UBUNTU: SAUCE: ARM: highbank: add soft power and reset key event handling From: Ike Panhc X-Patchwork-Id: 175619 Message-Id: <1344342928-20225-1-git-send-email-ike.pan@canonical.com> To: kernel-team@lists.ubuntu.com Date: Tue, 7 Aug 2012 20:35:28 +0800 From: Rob Herring BugLink: http://launchpad.net/bugs/1033853 Power and reset keys come from management processor via ipc messages. Passing them to userspace does not work in a non-desktop environment as acpid is used in that case. So we handle the keys directly. Signed-off-by: Rob Herring Signed-off-by: Ike Panhc --- arch/arm/mach-highbank/highbank.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c index 689838c..cfca498 100644 --- a/arch/arm/mach-highbank/highbank.c +++ b/arch/arm/mach-highbank/highbank.c @@ -15,6 +15,7 @@ */ #include #include +#include #include #include #include @@ -22,6 +23,7 @@ #include #include #include +#include #include #include @@ -34,6 +36,7 @@ #include #include #include +#include #include "core.h" #include "sysregs.h" @@ -142,9 +145,28 @@ static void highbank_power_off(void) cpu_do_idle(); } +static int hb_keys_notifier(struct notifier_block *nb, unsigned long event, void *data) +{ + u32 key = *(u32 *)data; + + if (event != 0x1000) + return 0; + + if (key == KEY_POWER) + orderly_poweroff(false); + else if (key == 0xffff) + ctrl_alt_del(); + + return 0; +} +static struct notifier_block hb_keys_nb = { + .notifier_call = hb_keys_notifier, +}; + static void __init highbank_init(void) { pm_power_off = highbank_power_off; + pl320_ipc_register_notifier(&hb_keys_nb); of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); }