Linux Power Management development
 help / color / mirror / Atom feed
* [PATCH] cpufreq: arm_big_little: set lowest frequcency for cluster when no cpus in it
@ 2014-06-26 15:08 Thomas Abraham
  2014-06-26 15:38 ` Viresh Kumar
  0 siblings, 1 reply; 18+ messages in thread
From: Thomas Abraham @ 2014-06-26 15:08 UTC (permalink / raw)
  To: linux-pm; +Cc: viresh.kumar, sudeep.karkadanagesha, thomas.ab

From: Thomas Abraham <thomas.ab@samsung.com>

If there are no active cpus in a cluster, the clock frequency of the cluster
can be lowered to the lowest possible frequency for that cluster. This can
help reduce the output clock speed of the PLL clocking the cluster and
save power.

The get_table_min() function is also moved with this change to avoid forward
declaration. The function get_table_max() is also moved along with
get_table_min() so that these two functions are adjacent the code.

Signed-off-by: Thomas Abraham <thomas.ab@samsung.com>
---
 drivers/cpufreq/arm_big_little.c |   51 +++++++++++++++++++++-----------------
 1 file changed, 28 insertions(+), 23 deletions(-)

diff --git a/drivers/cpufreq/arm_big_little.c b/drivers/cpufreq/arm_big_little.c
index 1f4d4e3..4b1431f 100644
--- a/drivers/cpufreq/arm_big_little.c
+++ b/drivers/cpufreq/arm_big_little.c
@@ -75,6 +75,28 @@ static inline int cpu_to_cluster(int cpu)
 		MAX_CLUSTERS : raw_cpu_to_cluster(cpu);
 }
 
+/* get the minimum frequency in the cpufreq_frequency_table */
+static inline u32 get_table_min(struct cpufreq_frequency_table *table)
+{
+	struct cpufreq_frequency_table *pos;
+	uint32_t min_freq = ~0;
+	cpufreq_for_each_entry(pos, table)
+		if (pos->frequency < min_freq)
+			min_freq = pos->frequency;
+	return min_freq;
+}
+
+/* get the maximum frequency in the cpufreq_frequency_table */
+static inline u32 get_table_max(struct cpufreq_frequency_table *table)
+{
+	struct cpufreq_frequency_table *pos;
+	uint32_t max_freq = 0;
+	cpufreq_for_each_entry(pos, table)
+		if (pos->frequency > max_freq)
+			max_freq = pos->frequency;
+	return max_freq;
+}
+
 static unsigned int find_cluster_maxfreq(int cluster)
 {
 	int j;
@@ -170,9 +192,14 @@ bL_cpufreq_set_rate(u32 cpu, u32 old_cluster, u32 new_cluster, u32 rate)
 
 		mutex_lock(&cluster_lock[old_cluster]);
 
-		/* Set freq of old cluster if there are cpus left on it */
+		/*
+		 * Set freq of old cluster. If there are no cpus left on it,
+		 * set the lowest possible frequency for that cluster.
+		 */
 		new_rate = find_cluster_maxfreq(old_cluster);
 		new_rate = ACTUAL_FREQ(old_cluster, new_rate);
+		if (!new_rate)
+			new_rate = get_table_min(freq_table[old_cluster]);
 
 		if (new_rate) {
 			pr_debug("%s: Updating rate of old cluster: %d, to freq: %d\n",
@@ -223,28 +250,6 @@ static inline u32 get_table_count(struct cpufreq_frequency_table *table)
 	return count;
 }
 
-/* get the minimum frequency in the cpufreq_frequency_table */
-static inline u32 get_table_min(struct cpufreq_frequency_table *table)
-{
-	struct cpufreq_frequency_table *pos;
-	uint32_t min_freq = ~0;
-	cpufreq_for_each_entry(pos, table)
-		if (pos->frequency < min_freq)
-			min_freq = pos->frequency;
-	return min_freq;
-}
-
-/* get the maximum frequency in the cpufreq_frequency_table */
-static inline u32 get_table_max(struct cpufreq_frequency_table *table)
-{
-	struct cpufreq_frequency_table *pos;
-	uint32_t max_freq = 0;
-	cpufreq_for_each_entry(pos, table)
-		if (pos->frequency > max_freq)
-			max_freq = pos->frequency;
-	return max_freq;
-}
-
 static int merge_cluster_tables(void)
 {
 	int i, j, k = 0, count = 1;
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2014-07-01  3:01 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-26 15:08 [PATCH] cpufreq: arm_big_little: set lowest frequcency for cluster when no cpus in it Thomas Abraham
2014-06-26 15:38 ` Viresh Kumar
2014-06-26 15:57   ` Sudeep Holla
2014-06-26 18:25     ` Thomas Abraham
2014-06-26 18:57       ` Sudeep Holla
2014-06-27  6:11         ` Thomas Abraham
2014-06-27  6:48           ` Viresh Kumar
2014-06-27  8:44             ` Thomas Abraham
2014-06-27  8:57               ` Viresh Kumar
2014-06-27 10:07                 ` Thomas Abraham
2014-06-27 10:16                   ` Viresh Kumar
2014-06-27 10:53                     ` Thomas Abraham
2014-06-28  2:12             ` Nicolas Pitre
2014-06-30  4:52               ` Viresh Kumar
2014-06-30  8:32                 ` Thomas Abraham
2014-06-30  8:33                   ` Viresh Kumar
2014-07-01  3:01                     ` Nicolas Pitre
2014-07-01  2:14                 ` Nicolas Pitre

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox