ARM: tegra: power: Set awake system CPU rate floor
Wen Yi [Mon, 12 Mar 2012 23:27:02 +0000 (16:27 -0700)]
Set CPU rate floor to 100MHz when the system is awake (after boot,
or on late resume). Remove the floor when the system enters early
suspend.

Bug 922351

Change-Id: Ibaca50791a5b04b4b4165ceac5018d4cfd7c1bcf
Signed-off-by: Alex Frid <afrid@nvidia.com>
Reviewed-on: http://git-master/r/89587
Reviewed-by: Rohan Somvanshi <rsomvanshi@nvidia.com>
Tested-by: Rohan Somvanshi <rsomvanshi@nvidia.com>

arch/arm/mach-tegra/pm.c

index 45b70b8..6e8b078 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/debugfs.h>
 #include <linux/delay.h>
 #include <linux/suspend.h>
+#include <linux/earlysuspend.h>
 #include <linux/slab.h>
 #include <linux/serial_reg.h>
 #include <linux/seq_file.h>
@@ -1298,3 +1299,28 @@ static int tegra_debug_uart_syscore_init(void)
        return 0;
 }
 arch_initcall(tegra_debug_uart_syscore_init);
+
+#ifdef CONFIG_HAS_EARLYSUSPEND
+static void pm_early_suspend(struct early_suspend *h)
+{
+       pm_qos_update_request(&awake_cpu_freq_req, PM_QOS_DEFAULT_VALUE);
+}
+
+static void pm_late_resume(struct early_suspend *h)
+{
+       pm_qos_update_request(&awake_cpu_freq_req, (s32)AWAKE_CPU_FREQ_MIN);
+}
+
+static struct early_suspend pm_early_suspender = {
+               .suspend = pm_early_suspend,
+               .resume = pm_late_resume,
+};
+
+static int pm_init_wake_behavior(void)
+{
+       register_early_suspend(&pm_early_suspender);
+       return 0;
+}
+
+late_initcall(pm_init_wake_behavior);
+#endif