ARM: tegra11x: Add flag to force C0NC power gating
Bo Yan [Tue, 27 Nov 2012 23:29:08 +0000 (15:29 -0800)]
The bit 2 of fast_cluster_power_down_mode now dictates whether to
force the power down mode specified in b[0-1]. If bit 2 is 0, then
b[0-1] specifies the deepest cluster power state in idle, the cluster
idle power state doesn't need to go to that level every time. If bit
2 is 1, then b[0-1] forces cluster idle power state to that level.

bug 1181412

Change-Id: I36aacc2d5318c7054d32d662c150530c51a4e9a5
Signed-off-by: Bo Yan <byan@nvidia.com>
Reviewed-on: http://git-master/r/166718
Reviewed-by: Mrutyunjay Sawant <msawant@nvidia.com>
Tested-by: Mrutyunjay Sawant <msawant@nvidia.com>

arch/arm/mach-tegra/cpuidle-t11x.c
arch/arm/mach-tegra/sleep.h

index 2610256..ff3bd6b 100644 (file)
@@ -284,8 +284,11 @@ static bool tegra_cpu_cluster_power_down(struct cpuidle_device *dev,
                flag = (fast_cluster_power_down_mode
                        << TEGRA_POWER_CLUSTER_PART_SHIFT)
                        & TEGRA_POWER_CLUSTER_PART_MASK;
-               if ((request < tegra_min_residency_crail()) &&
-                       (flag != TEGRA_POWER_CLUSTER_PART_MASK))
+
+               if (((request < tegra_min_residency_crail()) &&
+                       (flag != TEGRA_POWER_CLUSTER_PART_MASK)) &&
+                       ((fast_cluster_power_down_mode &
+                       TEGRA_POWER_CLUSTER_FORCE_MASK) == 0))
                        flag = TEGRA_POWER_CLUSTER_PART_NONCPU;
 
                if (flag == TEGRA_POWER_CLUSTER_PART_CRAIL) {
@@ -479,10 +482,15 @@ bool tegra11x_idle_power_down(struct cpuidle_device *dev,
                        power_gating_cpu_only = true;
        } else if (!cpu_gating_only &&
                (num_online_cpus() == 1) &&
-               tegra_rail_off_is_allowed() &&
-               (request > tegra_min_residency_noncpu()))
+               tegra_rail_off_is_allowed()) {
+               if (fast_cluster_power_down_mode &&
+                       TEGRA_POWER_CLUSTER_FORCE_MASK)
+                       power_gating_cpu_only = cpu_gating_only;
+               else if (request > tegra_min_residency_noncpu())
                        power_gating_cpu_only = false;
-       else
+               else
+                       power_gating_cpu_only = true;
+       } else
                power_gating_cpu_only = true;
 
        if (power_gating_cpu_only)
index e704879..b144b10 100644 (file)
@@ -50,6 +50,8 @@
 #define TEGRA_POWER_CLUSTER_PART_DEFAULT 0
 #endif
 #define TEGRA_POWER_CLUSTER_PART_SHIFT 24
+#define TEGRA_POWER_CLUSTER_FORCE_SHIFT        2
+#define TEGRA_POWER_CLUSTER_FORCE_MASK (1 << TEGRA_POWER_CLUSTER_FORCE_SHIFT)
 
 #define TEGRA_POWER_SDRAM_SELFREFRESH  (1 << 26) /* SDRAM is in self-refresh */
 #define TEGRA_POWER_HOTPLUG_SHUTDOWN   (1 << 27) /* Hotplug shutdown */