Skip to contentSkip to conversation

cpufreq: drivers: Enable frequency invariance in qcom-cpufreq-hw

PATCH In review Douglas RAILLARD 3 participants 5 messages Aug 8, 2019 – Aug 19, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 cpufreq: drivers: Enable frequency invariance in qcom-cpufreq-hw

Add calls to arch_set_freq_scale() in qcom-cpufreq-hw driver to enable frequency invariance.

---
 drivers/cpufreq/qcom-cpufreq-hw.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/cpufreq/qcom-cpufreq-hw.c +9 -1
index 4b0b50403901..3bd3b8b268d9 100644
@@ -34,9 +34,12 @@ static int qcom_cpufreq_hw_target_index(struct cpufreq_policy *policy,
 					unsigned int index)
 {
 	void __iomem *perf_state_reg = policy->driver_data;
+	unsigned long freq = policy->freq_table[index].frequency;
 
 	writel_relaxed(index, perf_state_reg);
 
+	arch_set_freq_scale(policy->related_cpus, freq,
+			    policy->cpuinfo.max_freq);
 	return 0;
 }
 
@@ -63,6 +66,7 @@ static unsigned int qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy,
 {
 	void __iomem *perf_state_reg = policy->driver_data;
 	int index;
+	unsigned long freq;
 
 	index = policy->cached_resolved_idx;
 	if (index < 0)
@@ -70,7 +74,11 @@ static unsigned int qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy,
 
 	writel_relaxed(index, perf_state_reg);
 
-	return policy->freq_table[index].frequency;
+	freq = policy->freq_table[index].frequency;
+	arch_set_freq_scale(policy->related_cpus, freq,
+			    policy->cpuinfo.max_freq);
+
+	return freq;
 }
 
 static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev,
Signature · 1 line
2.22.0
Reviewed-by on v1 1/2
#1 lore raw

Hi Douglas,

Quoted 2 lines · Douglas RAILLARD

Add calls to arch_set_freq_scale() in qcom-cpufreq-hw driver to enable frequency invariance.

Is there a patch 2/2 ?

Quoted 46 lines
---
 drivers/cpufreq/qcom-cpufreq-hw.c | 10 +++++++++-
 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/cpufreq/qcom-cpufreq-hw.c +9 -1
index 4b0b50403901..3bd3b8b268d9 100644
@@ -34,9 +34,12 @@ static int qcom_cpufreq_hw_target_index(struct cpufreq_policy *policy,
 					unsigned int index)
 {
 	void __iomem *perf_state_reg = policy->driver_data;
+	unsigned long freq = policy->freq_table[index].frequency;
 
 	writel_relaxed(index, perf_state_reg);
 
+	arch_set_freq_scale(policy->related_cpus, freq,
+			    policy->cpuinfo.max_freq);
 	return 0;
 }
 
@@ -63,6 +66,7 @@ static unsigned int qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy,
 {
 	void __iomem *perf_state_reg = policy->driver_data;
 	int index;
+	unsigned long freq;
 
 	index = policy->cached_resolved_idx;
 	if (index < 0)
@@ -70,7 +74,11 @@ static unsigned int qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy,
 
 	writel_relaxed(index, perf_state_reg);
 
-	return policy->freq_table[index].frequency;
+	freq = policy->freq_table[index].frequency;
+	arch_set_freq_scale(policy->related_cpus, freq,
+			    policy->cpuinfo.max_freq);
+
+	return freq;
 }
 
 static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev,
Signature · 1 line
2.22.0

Thanks,
Quentin

#2 lore raw

Hi Quentin,

Quoted 7 lines · Quentin Perret

Hi Douglas,

Quoted 2 lines · Douglas RAILLARD

Add calls to arch_set_freq_scale() in qcom-cpufreq-hw driver to enable frequency invariance.

Is there a patch 2/2 ?

That slipped through when format-patch-ing unrelated commits, there is no 2nd patch.

Quoted 43 lines
Quoted 43 lines
---
  drivers/cpufreq/qcom-cpufreq-hw.c | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)
drivers/cpufreq/qcom-cpufreq-hw.c +9 -1
index 4b0b50403901..3bd3b8b268d9 100644
@@ -34,9 +34,12 @@ static int qcom_cpufreq_hw_target_index(struct cpufreq_policy *policy,
  					unsigned int index)
  {
  	void __iomem *perf_state_reg = policy->driver_data;
+	unsigned long freq = policy->freq_table[index].frequency;
 
  	writel_relaxed(index, perf_state_reg);
 
+	arch_set_freq_scale(policy->related_cpus, freq,
+			    policy->cpuinfo.max_freq);
  	return 0;
  }
 
@@ -63,6 +66,7 @@ static unsigned int qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy,
  {
  	void __iomem *perf_state_reg = policy->driver_data;
  	int index;
+	unsigned long freq;
 
  	index = policy->cached_resolved_idx;
  	if (index < 0)
@@ -70,7 +74,11 @@ static unsigned int qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy,
 
  	writel_relaxed(index, perf_state_reg);
 
-	return policy->freq_table[index].frequency;
+	freq = policy->freq_table[index].frequency;
+	arch_set_freq_scale(policy->related_cpus, freq,
+			    policy->cpuinfo.max_freq);
+
+	return freq;
  }
 
Quoted 9 lines
Quoted 3 lines
drivers/cpufreq/qcom-cpufreq-hw.c +0 -0
  static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev,
Signature · 1 line
2.22.0

Thanks,
Quentin

Thanks,
Douglas

#3 lore raw
Quoted 55 lines · Douglas Raillard

Hi Quentin,

Quoted 7 lines · Quentin Perret

Hi Douglas,

Quoted 2 lines · Douglas RAILLARD

Add calls to arch_set_freq_scale() in qcom-cpufreq-hw driver to enable frequency invariance.

Is there a patch 2/2 ?

That slipped through when format-patch-ing unrelated commits, there is no 2nd patch.

Quoted 42 lines
Quoted 39 lines
---
  drivers/cpufreq/qcom-cpufreq-hw.c | 10 +++++++++-
  1 file changed, 9 insertions(+), 1 deletion(-)
drivers/cpufreq/qcom-cpufreq-hw.c +9 -1
index 4b0b50403901..3bd3b8b268d9 100644
@@ -34,9 +34,12 @@ static int qcom_cpufreq_hw_target_index(struct cpufreq_policy *policy,
  					unsigned int index)
  {
  	void __iomem *perf_state_reg = policy->driver_data;
+	unsigned long freq = policy->freq_table[index].frequency;
  	writel_relaxed(index, perf_state_reg);
+	arch_set_freq_scale(policy->related_cpus, freq,
+			    policy->cpuinfo.max_freq);
  	return 0;
  }
@@ -63,6 +66,7 @@ static unsigned int qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy,
  {
  	void __iomem *perf_state_reg = policy->driver_data;
  	int index;
+	unsigned long freq;
  	index = policy->cached_resolved_idx;
  	if (index < 0)
@@ -70,7 +74,11 @@ static unsigned int qcom_cpufreq_hw_fast_switch(struct cpufreq_policy *policy,
  	writel_relaxed(index, perf_state_reg);
-	return policy->freq_table[index].frequency;
+	freq = policy->freq_table[index].frequency;
+	arch_set_freq_scale(policy->related_cpus, freq,
+			    policy->cpuinfo.max_freq);
+
+	return freq;
  }
  static int qcom_cpufreq_hw_read_lut(struct device *cpu_dev,
Signature · 1 line
2.22.0
Quoted 6 lines
Quoted 3 lines

Thanks,
Quentin

Thanks,
Douglas

Actually, one nit, the $subject should probably be formatted as:

cpufreq: qcom-hw: invoke frequency-invariance setter function

for consistency with other patches in this area.

Thanks,
Quentin

maintainer
#4 lore raw
Quoted 5 lines · Quentin Perret

Actually, one nit, the $subject should probably be formatted as:

cpufreq: qcom-hw: invoke frequency-invariance setter function

for consistency with other patches in this area.

Applied with these changes. Thanks.

Signature · 1 line
viresh