[ARM] tegra: stingray: boardfile - handle power-off failure (factory cable).
authorJames Wylder <james.wylder@motorola.com>
Wed, 16 Jun 2010 16:21:42 +0000 (11:21 -0500)
committerColin Cross <ccross@android.com>
Wed, 6 Oct 2010 23:33:08 +0000 (16:33 -0700)
With a factory cable plugged in, the power-off mechanisms are disabled.
This reproduces the behavior in sholes of spinning at power-off if
the factory cable is plugged in.

Signed-off-by: James Wylder <james.wylder@motorola.com>
arch/arm/mach-tegra/board-stingray.c

index 1ea0f76e5f262f74df180d5618acb946dfe346e5..fa3985e15c352e3f1dfeb28c1ad9c95c5231a0fb 100644 (file)
@@ -26,6 +26,7 @@
 #include <linux/pda_power.h>
 #include <linux/gpio.h>
 #include <linux/delay.h>
+#include <linux/reboot.h>
 #include <linux/i2c-tegra.h>
 
 #include <asm/mach-types.h>
@@ -396,15 +397,24 @@ static void __init tegra_stingray_fixup(struct machine_desc *desc, struct tag *t
 
 static void stingray_power_off(void)
 {
+       printk(KERN_INFO "stingray_pm_power_off...\n");
+
+       local_irq_disable();
+
+       /* signal WDI gpio to shutdown CPCAP, which will
+          cascade to all of the regulators. */
        gpio_direction_output(TEGRA_GPIO_PV7, 0);
+
+       do {} while (1);
+
+       local_irq_enable();
 }
 
 static void __init stingray_power_off_init(void)
 {
        tegra_gpio_enable(TEGRA_GPIO_PV7);
-       if (!gpio_request(TEGRA_GPIO_PV7, "wdi")) {
+       if (!gpio_request(TEGRA_GPIO_PV7, "wdi"))
                pm_power_off = stingray_power_off;
-       }
 }
 
 static int stingray_board_revision = STINGRAY_REVISION_UNKNOWN;