Skip to contentSkip to conversation

CPUFreq: ARM big LITTLE Fixes

PATCH In review Viresh Kumar 2 participants 7 messages Apr 29, 2013 – May 2, 2013 CPU frequency scaling framework

lore
Share & tools
lore

Viresh Kumar

author maintainer
#0 lore raw

cover CPUFreq: ARM big LITTLE Fixes

Hi Rafael,

I know I am late for this merge window and you have already closed the gates :) If you can still take them, its good, otherwise we will push this for v3.10-rc2.

These are minor fixes for ARM big LITTLE cpufreq driver. It doesn't impact any other driver or cpufreq core and are fairly independent.

Viresh Kumar (5):
cpufreq: ARM big LITTLE: Select PM_OPP
cpufreq: ARM big LITTLE DT: Return correct transition latency
cpufreq: ARM big LITTLE DT: Return CPUFREQ_ETERNAL if clock-latency
isn't found
cpufreq: ARM big LITTLE: Move cpu_to_cluster() to arm_big_little.h
cpufreq: ARM big LITTLE: Improve print message

 drivers/cpufreq/Kconfig.arm         | 1 +
 drivers/cpufreq/arm_big_little.c    | 7 +------
 drivers/cpufreq/arm_big_little.h    | 5 +++++
 drivers/cpufreq/arm_big_little_dt.c | 9 +++++----
 4 files changed, 12 insertions(+), 10 deletions(-)
Signature · 1 line
1.7.12.rc2.18.g61b472e
author maintainer
#1 lore raw

PATCH 1/5 cpufreq: ARM big LITTLE: Select PM_OPP

ARM big LITTLE cpufreq driver uses opp layer for its functionality. Select it in Kconfig.

---
 drivers/cpufreq/Kconfig.arm | 1 +
 1 file changed, 1 insertion(+)
drivers/cpufreq/Kconfig.arm +1 -0
index bce2195..797cbd2 100644
@@ -5,6 +5,7 @@
 config ARM_BIG_LITTLE_CPUFREQ
 	tristate
 	depends on ARM_CPU_TOPOLOGY
+	select PM_OPP
 
 config ARM_DT_BL_CPUFREQ
 	tristate "Generic ARM big LITTLE CPUfreq driver probed via DT"
Signature · 1 line
1.7.12.rc2.18.g61b472e
author maintainer
#2 lore raw

PATCH 2/5 cpufreq: ARM big LITTLE DT: Return correct transition latency

In reply to Viresh Kumar

By mistake we are returning zero for successful call to dt_get_transition_latency(), whereas we should return transition_latency.

Fix it.

---
 drivers/cpufreq/arm_big_little_dt.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/arm_big_little_dt.c +1 -1
index 44be311..d5ae4d2 100644
@@ -78,7 +78,7 @@ static int dt_get_transition_latency(struct device *cpu_dev)
 		of_node_put(np);
 		of_node_put(parent);
 
-		return 0;
+		return transition_latency;
 	}
 
 	return -ENODEV;
Signature · 1 line
1.7.12.rc2.18.g61b472e
author maintainer
#3 lore raw

PATCH 3/5 cpufreq: ARM big LITTLE DT: Return CPUFREQ_ETERNAL if clock-latency isn't found

In reply to Viresh Kumar

If "/cpus" node isn't found or "clock-latency" isn't defined we are returning error currently. Lets return CPUFREQ_ETERNAL instead, so that we don't fail.

Flag appropriate messages to user in such cases.

---
 drivers/cpufreq/arm_big_little_dt.c | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)
drivers/cpufreq/arm_big_little_dt.c +4 -3
index d5ae4d2..173ed05 100644
@@ -66,8 +66,8 @@ static int dt_get_transition_latency(struct device *cpu_dev)
 
 	parent = of_find_node_by_path("/cpus");
 	if (!parent) {
-		pr_err("failed to find OF /cpus\n");
-		return -ENOENT;
+		pr_info("Failed to find OF /cpus. Use CPUFREQ_ETERNAL transition latency\n");
+		return CPUFREQ_ETERNAL;
 	}
 
 	for_each_child_of_node(parent, np) {
@@ -81,7 +81,8 @@ static int dt_get_transition_latency(struct device *cpu_dev)
 		return transition_latency;
 	}
 
-	return -ENODEV;
+	pr_info("clock-latency isn't found, use CPUFREQ_ETERNAL transition latency\n");
+	return CPUFREQ_ETERNAL;
 }
 
 static struct cpufreq_arm_bL_ops dt_bL_ops = {
Signature · 1 line
1.7.12.rc2.18.g61b472e
author maintainer
#4 lore raw

PATCH 4/5 cpufreq: ARM big LITTLE: Move cpu_to_cluster() to arm_big_little.h

In reply to Viresh Kumar

This routine can be used by glue drivers and so better to keep it in arm_big_little.h file.

---
 drivers/cpufreq/arm_big_little.c | 5 -----
 drivers/cpufreq/arm_big_little.h | 5 +++++
 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/cpufreq/arm_big_little.c +0 -5
index dbdf677..fd7beed 100644
@@ -40,11 +40,6 @@ static struct clk *clk[MAX_CLUSTERS];
 static struct cpufreq_frequency_table *freq_table[MAX_CLUSTERS];
 static atomic_t cluster_usage[MAX_CLUSTERS] = {ATOMIC_INIT(0), ATOMIC_INIT(0)};
 
-static int cpu_to_cluster(int cpu)
-{
-	return topology_physical_package_id(cpu);
-}
-
 static unsigned int bL_cpufreq_get(unsigned int cpu)
 {
 	u32 cur_cluster = cpu_to_cluster(cpu);
drivers/cpufreq/arm_big_little.h +5 -0
index 70f18fc..79b2ce1 100644
@@ -34,6 +34,11 @@ struct cpufreq_arm_bL_ops {
 	int (*init_opp_table)(struct device *cpu_dev);
 };
 
+static inline int cpu_to_cluster(int cpu)
+{
+	return topology_physical_package_id(cpu);
+}
+
 int bL_cpufreq_register(struct cpufreq_arm_bL_ops *ops);
 void bL_cpufreq_unregister(struct cpufreq_arm_bL_ops *ops);
 
Signature · 1 line
1.7.12.rc2.18.g61b472e
author maintainer
#5 lore raw

PATCH 5/5 cpufreq: ARM big LITTLE: Improve print message

In reply to Viresh Kumar

Print message at the end of driver->init() doesn't carry "cpufreq" string at all and so is difficult to find in dmesg. Add function name in message to clearly state where the message is coming from.

---
 drivers/cpufreq/arm_big_little.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/arm_big_little.c +1 -1
index fd7beed..5d7f53f 100644
@@ -187,7 +187,7 @@ static int bL_cpufreq_init(struct cpufreq_policy *policy)
 
 	cpumask_copy(policy->cpus, topology_core_cpumask(policy->cpu));
 
-	dev_info(cpu_dev, "CPU %d initialized\n", policy->cpu);
+	dev_info(cpu_dev, "%s: CPU %d initialized\n", __func__, policy->cpu);
 	return 0;
 }
 
Signature · 1 line
1.7.12.rc2.18.g61b472e
#6 lore raw
In reply to Viresh Kumar
Quoted 16 lines · Viresh Kumar

Hi Rafael,

I know I am late for this merge window and you have already closed the gates :) If you can still take them, its good, otherwise we will push this for v3.10-rc2.

These are minor fixes for ARM big LITTLE cpufreq driver. It doesn't impact any other driver or cpufreq core and are fairly independent.

Viresh Kumar (5):
cpufreq: ARM big LITTLE: Select PM_OPP
cpufreq: ARM big LITTLE DT: Return correct transition latency
cpufreq: ARM big LITTLE DT: Return CPUFREQ_ETERNAL if clock-latency
isn't found
cpufreq: ARM big LITTLE: Move cpu_to_cluster() to arm_big_little.h
cpufreq: ARM big LITTLE: Improve print message

Quoted 5 lines
 drivers/cpufreq/Kconfig.arm         | 1 +
 drivers/cpufreq/arm_big_little.c    | 7 +------
 drivers/cpufreq/arm_big_little.h    | 5 +++++
 drivers/cpufreq/arm_big_little_dt.c | 9 +++++----
 4 files changed, 12 insertions(+), 10 deletions(-)

All 5 queued up for the v3.10-rc2 push.

Thanks,
Rafael

Signature · 2 lines
I speak only for myself.
Rafael J. Wysocki, Intel Open Source Technology Center.