From patchwork Fri Aug 3 01:26:03 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ike Panhc X-Patchwork-Id: 174831 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from chlorine.canonical.com (chlorine.canonical.com [91.189.94.204]) by ozlabs.org (Postfix) with ESMTP id 532B82C0040 for ; Fri, 3 Aug 2012 11:26:18 +1000 (EST) Received: from localhost ([127.0.0.1] helo=chlorine.canonical.com) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Sx6ea-0001Z6-7q; Fri, 03 Aug 2012 01:26:12 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by chlorine.canonical.com with esmtp (Exim 4.71) (envelope-from ) id 1Sx6eX-0001Z1-Pf for kernel-team@lists.ubuntu.com; Fri, 03 Aug 2012 01:26:09 +0000 Received: from 220-134-16-35.hinet-ip.hinet.net ([220.134.16.35] helo=canonical.com) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Sx6eW-0006e1-Oh for kernel-team@lists.ubuntu.com; Fri, 03 Aug 2012 01:26:09 +0000 From: Ike Panhc To: kernel-team@lists.ubuntu.com Subject: [PATCH 10/14] UBUNTU: SAUCE: ARM: highbank: add soft power and reset key event handling Date: Fri, 3 Aug 2012 09:26:03 +0800 Message-Id: <1343957163-5598-1-git-send-email-ike.pan@canonical.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1343956968-5248-1-git-send-email-ike.pan@canonical.com> References: <1343956968-5248-1-git-send-email-ike.pan@canonical.com> X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.13 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: kernel-team-bounces@lists.ubuntu.com Errors-To: kernel-team-bounces@lists.ubuntu.com From: Rob Herring BugLink: http://launchpad.net/bugs/1008345 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 d75b0a7..4ed8211 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 @@ -35,6 +37,7 @@ #include #include #include +#include #include "core.h" #include "sysregs.h" @@ -149,9 +152,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); }