From patchwork Tue Dec 3 18:58:23 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 3278241 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 7E6D1C0D4A for ; Tue, 3 Dec 2013 18:59:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 684C420412 for ; Tue, 3 Dec 2013 18:59:37 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 868DC203EC for ; Tue, 3 Dec 2013 18:59:36 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VnvBo-0006cv-AR; Tue, 03 Dec 2013 18:59:20 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VnvBl-0005AS-Tz; Tue, 03 Dec 2013 18:59:17 +0000 Received: from mail-ie0-f170.google.com ([209.85.223.170]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VnvBj-00059N-AK for linux-arm-kernel@lists.infradead.org; Tue, 03 Dec 2013 18:59:15 +0000 Received: by mail-ie0-f170.google.com with SMTP id qd12so24905602ieb.15 for ; Tue, 03 Dec 2013 10:58:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=qADgEuJ64SwmVRWsM8Lw+WCuNz5BO35tlWzQ3wOdX5A=; b=K6Vb8YABqUHR/jcWyUlsrGVklKdnw2pmdkcDPbokLsDbuWXAW8+H/jaeqivRASh/ax F3qPbg1l5ZGxmU5RAjzkdd4zISsb/8ziPmhy1XOfCPSmxaSbCZ6fCyvMVGh1y6kiUWUO qlk8VgGFaS9f/DPih/BjtVYFDvvjRUg3u8ZEhu7CFhNLJ8z2hHzEOtSEpzvJOm7Tmyqb HcOu8V0G0fmIicFAFwhR1hV6qZe8w1Xu1y3dca0HZqaoLe5+KKMIHS0DL7blRmElle3J tp1ykKKEXeQ9TQayA7zBp3mqU3e8n6StNGo0Pk7dZyZsb5DUNo+uPixTlacEPASdheZB uySw== X-Received: by 10.50.128.137 with SMTP id no9mr4203001igb.36.1386097129144; Tue, 03 Dec 2013 10:58:49 -0800 (PST) Received: from rob-laptop.calxeda.com ([173.226.190.126]) by mx.google.com with ESMTPSA id jk5sm4504440igb.0.2013.12.03.10.58.48 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 03 Dec 2013 10:58:48 -0800 (PST) From: Rob Herring To: arm@kernel.org Subject: [PATCH] ARM: highbank: add soft power and reset key event handling Date: Tue, 3 Dec 2013 12:58:23 -0600 Message-Id: <1386097103-26025-1-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.8.3.2 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20131203_135915_396615_A23569FE X-CRM114-Status: GOOD ( 15.59 ) X-Spam-Score: -2.5 (--) Cc: Rob Herring , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.1 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Rob Herring 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 --- Olof, Kevin, This is something that has been in some distro kernels for some time and fell thru the cracks to upstream being dependent on pl320 driver. I would like this to be tagged for stable, so it gets picked up by distros where it has been inadvertently dropped. Rob arch/arm/mach-highbank/highbank.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/arch/arm/mach-highbank/highbank.c b/arch/arm/mach-highbank/highbank.c index b3d7e56..bd3bf66 100644 --- a/arch/arm/mach-highbank/highbank.c +++ b/arch/arm/mach-highbank/highbank.c @@ -17,12 +17,15 @@ #include #include #include +#include #include #include +#include #include #include #include #include +#include #include #include @@ -130,6 +133,24 @@ static struct platform_device highbank_cpuidle_device = { .name = "cpuidle-calxeda", }; +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) { struct device_node *np; @@ -145,6 +166,8 @@ static void __init highbank_init(void) bus_register_notifier(&platform_bus_type, &highbank_platform_nb); bus_register_notifier(&amba_bustype, &highbank_amba_nb); + pl320_ipc_register_notifier(&hb_keys_nb); + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); if (psci_ops.cpu_suspend)