[PATCH 10/14] UBUNTU: SAUCE: ARM: highbank: add soft power and reset key event handling
Ike Panhc
ike.pan at canonical.com
Fri Aug 3 01:26:03 UTC 2012
From: Rob Herring <rob.herring at calxeda.com>
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 <rob.herring at calxeda.com>
Signed-off-by: Ike Panhc <ike.pan at canonical.com>
---
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 <linux/clk.h>
#include <linux/clkdev.h>
+#include <linux/input.h>
#include <linux/io.h>
#include <linux/irq.h>
#include <linux/irqdomain.h>
@@ -22,6 +23,7 @@
#include <linux/of_irq.h>
#include <linux/of_platform.h>
#include <linux/of_address.h>
+#include <linux/reboot.h>
#include <linux/smp.h>
#include <asm/cacheflush.h>
@@ -35,6 +37,7 @@
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <asm/mach/time.h>
+#include <mach/pl320-ipc.h>
#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);
}
--
1.7.9.5
More information about the kernel-team
mailing list