ARM: tegra: restore voltage to nominal when reboot
Bo Yan [Mon, 2 May 2011 22:00:26 +0000 (15:00 -0700)]
At the time of reboot, all rails need to be set to nominal to ensure
the success of subsequent boot.

bug 821969   bug 797082

Original-Change-Id: Iee635c222619dfcb3e98f13e665ea2bd04e94245
Reviewed-on: http://git-master/r/30086
Reviewed-by: Bo Yan <byan@nvidia.com>
Tested-by: Bo Yan <byan@nvidia.com>
Reviewed-by: Varun Colbert <vcolbert@nvidia.com>
Tested-by: Varun Colbert <vcolbert@nvidia.com>

Rebase-Id: Racbc707a55e92261310e956707a850df1db00f72

arch/arm/mach-tegra/dvfs.c

index 3f43766..75e46c2 100644 (file)
@@ -32,6 +32,7 @@
 #include <linux/suspend.h>
 #include <linux/delay.h>
 #include <linux/clk/tegra.h>
+#include <linux/reboot.h>
 
 #include "board.h"
 #include "clock.h"
@@ -406,6 +407,23 @@ static struct notifier_block tegra_dvfs_nb = {
        .notifier_call = tegra_dvfs_pm_notify,
 };
 
+static int tegra_dvfs_reboot_notify(struct notifier_block *nb,
+                               unsigned long event, void *data)
+{
+       switch (event) {
+       case SYS_RESTART:
+       case SYS_HALT:
+       case SYS_POWER_OFF:
+               tegra_dvfs_suspend();
+               return NOTIFY_OK;
+       }
+       return NOTIFY_DONE;
+}
+
+static struct notifier_block tegra_dvfs_reboot_nb = {
+       .notifier_call = tegra_dvfs_reboot_notify,
+};
+
 /* must be called with dvfs lock held */
 static void __tegra_dvfs_rail_disable(struct dvfs_rail *rail)
 {
@@ -492,6 +510,7 @@ int __init tegra_dvfs_late_init(void)
        mutex_unlock(&dvfs_lock);
 
        register_pm_notifier(&tegra_dvfs_nb);
+       register_reboot_notifier(&tegra_dvfs_reboot_nb);
 
        return 0;
 }