From patchwork Wed Dec 4 17:05:17 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 3283771 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 A388CC0D4A for ; Wed, 4 Dec 2013 17:06:06 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 887442018A for ; Wed, 4 Dec 2013 17:06:05 +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 B518920184 for ; Wed, 4 Dec 2013 17:06:00 +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 1VoFtb-0001gd-EP; Wed, 04 Dec 2013 17:05:55 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1VoFtY-0002Re-T6; Wed, 04 Dec 2013 17:05:52 +0000 Received: from mail-ie0-x233.google.com ([2607:f8b0:4001:c03::233]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1VoFtV-0002QE-Lk for linux-arm-kernel@lists.infradead.org; Wed, 04 Dec 2013 17:05:50 +0000 Received: by mail-ie0-f179.google.com with SMTP id x13so27044398ief.38 for ; Wed, 04 Dec 2013 09:05:26 -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=y54frZoou4ahm9B8xxiStibER2WdXubajEw7UyWdJOw=; b=Ux0ptDETxt3LW9XakscR6XF879kHMaLyx8E8beJUo8i1L6gKXrKxBXB0ftdQB36I/8 NmgqLKJnVIvKOgIMfgj0I4ekCSvL9Npvh95e/iXbTb1+67n610jph7gtItvaOCgbEaFt J1qQUVe2jDps+fygCcWICRGwcdZOiIWxkAC2ok7uyMUvEjVdrxN4UAVLosJPRilzYM51 ZhaW530WaIPoYEEVV9A945f/cw9HhWqTwviLD9amPRFiIeLsgfPbY16+zkMeqvfTboTR x0emF7do5QjLBFAQQQE30CNgLCm5eH665VbnjCzLgk4/1Eov+wm904sdmqCNplhbUCPF N18Q== X-Received: by 10.50.136.165 with SMTP id qb5mr1975622igb.2.1386176726278; Wed, 04 Dec 2013 09:05:26 -0800 (PST) Received: from rob-laptop.calxeda.com ([173.226.190.126]) by mx.google.com with ESMTPSA id k6sm5129467igx.8.2013.12.04.09.05.25 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 04 Dec 2013 09:05:25 -0800 (PST) From: Rob Herring To: arm@kernel.org Subject: [PATCH v2] ARM: highbank: handle soft poweroff and reset key events Date: Wed, 4 Dec 2013 11:05:17 -0600 Message-Id: <1386176717-1023-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-20131204_120549_832047_99F0A7E3 X-CRM114-Status: GOOD ( 14.38 ) X-Spam-Score: -1.8 (-) 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 Graceful reboot and poweroff via IPMI commands to the management processor don't work. Power and reset keys are events from the management processor which are generated via IPC messages. Passing the keys to userspace does not work as neither acpid nor a desktop environment are present. This adds a notifier handler for the IPC messages so the kernel can handle the key events directly and IPMI graceful shutdown will work. Signed-off-by: Rob Herring --- v2: Re-word the commit msg to give better description of the issue. 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)