summaryrefslogtreecommitdiff
path: root/arch
diff options
context:
space:
mode:
authorEric Nelson <eric.nelson@boundarydevices.com>2013-06-13 15:53:45 -0700
committerEric Nelson <eric.nelson@boundarydevices.com>2013-06-13 15:53:45 -0700
commite6e1b5aeccf7c88a725440095f83dfa9459dbfca (patch)
tree6904a77211ec24c1e196275a01067699312ccf13 /arch
parentd682fa41ba5963b83988fc5ce9b7836761d5e7a2 (diff)
h: wait for power button press/release in pm_power_off
Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-mx6/board-mx6_h.c28
1 files changed, 28 insertions, 0 deletions
diff --git a/arch/arm/mach-mx6/board-mx6_h.c b/arch/arm/mach-mx6/board-mx6_h.c
index 7697db8ca5cc..b8c047c23ef4 100644
--- a/arch/arm/mach-mx6/board-mx6_h.c
+++ b/arch/arm/mach-mx6/board-mx6_h.c
@@ -65,6 +65,7 @@
#include <mach/ahci_sata.h>
#include <mach/ipu-v3.h>
#include <mach/mxc_asrc.h>
+#include <mach/system.h>
#include <linux/i2c/tsc2007.h>
#include <linux/wl12xx.h>
@@ -1057,6 +1058,32 @@ static struct platform_device platdev_leds_pwd = {
};
+static void poweroff(void)
+{
+#if defined(CONFIG_KEYBOARD_GPIO) || defined(CONFIG_KEYBOARD_GPIO_MODULE)
+ int waspressed = 0;
+ int i;
+ for (i=0; i < num_registered_fb; i++) {
+ if (registered_fb[i])
+ fb_blank(registered_fb[i],FB_BLANK_POWERDOWN);
+ }
+
+ while (1) {
+ int pressed=(0 == gpio_get_value(GP_KEY_ONOFF));
+ if (!pressed && waspressed) {
+ break;
+ }
+ if (waspressed != pressed) {
+ waspressed=pressed;
+ } else {
+ dsb();
+ isb();
+ }
+ }
+ arch_reset('h',"");
+#endif
+}
+
/*!
* Board specific initialization.
*/
@@ -1183,6 +1210,7 @@ static void __init board_init(void)
rate = clk_round_rate(clko2, 24000000);
clk_set_rate(clko2, rate);
clk_enable(clko2);
+ pm_power_off = poweroff;
imx6q_add_busfreq();
gpio_set_value(GP_WL_EN, 1); /* momentarily enable */