diff mbox series

[v4,6/7] cpufreq: qcom-hw: Allow getting the maximum transition latency for OPPs

Message ID 20210119174557.227318-7-angelogioacchino.delregno@somainline.org
State Superseded
Headers show
Series cpufreq-qcom-hw: Implement full OSM programming | expand

Commit Message

AngeloGioacchino Del Regno Jan. 19, 2021, 5:45 p.m. UTC
In order to fine-tune the frequency scaling from various governors,
allow to set a maximum transition latency from OPPs, which may be
different depending on the SoC.

Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>
---
 drivers/cpufreq/qcom-cpufreq-hw.c | 7 +++++++
 1 file changed, 7 insertions(+)

Comments

Bjorn Andersson April 19, 2021, 7:19 p.m. UTC | #1
On Tue 19 Jan 11:45 CST 2021, AngeloGioacchino Del Regno wrote:

> In order to fine-tune the frequency scaling from various governors,

> allow to set a maximum transition latency from OPPs, which may be

> different depending on the SoC.

> 


Acked-by: Bjorn Andersson <bjorn.andersson@linaro.org>


Regards,
Bjorn

> Signed-off-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@somainline.org>

> ---

>  drivers/cpufreq/qcom-cpufreq-hw.c | 7 +++++++

>  1 file changed, 7 insertions(+)

> 

> diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c

> index a92959bb7b50..5f67da796f6c 100644

> --- a/drivers/cpufreq/qcom-cpufreq-hw.c

> +++ b/drivers/cpufreq/qcom-cpufreq-hw.c

> @@ -1401,6 +1401,7 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)

>  	void __iomem *base;

>  	struct qcom_cpufreq_data *data;

>  	const char *fdom_resname;

> +	unsigned int transition_latency;

>  	int cpu_count, index, ret;

>  

>  	cpu_dev = get_cpu_device(policy->cpu);

> @@ -1478,6 +1479,12 @@ static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)

>  		goto error;

>  	}

>  

> +	transition_latency = dev_pm_opp_get_max_transition_latency(cpu_dev);

> +	if (!transition_latency)

> +		transition_latency = CPUFREQ_ETERNAL;

> +

> +	policy->cpuinfo.transition_latency = transition_latency;

> +

>  	dev_pm_opp_of_register_em(cpu_dev, policy->cpus);

>  

>  	if (policy_has_boost_freq(policy)) {

> -- 

> 2.30.0

>
diff mbox series

Patch

diff --git a/drivers/cpufreq/qcom-cpufreq-hw.c b/drivers/cpufreq/qcom-cpufreq-hw.c
index a92959bb7b50..5f67da796f6c 100644
--- a/drivers/cpufreq/qcom-cpufreq-hw.c
+++ b/drivers/cpufreq/qcom-cpufreq-hw.c
@@ -1401,6 +1401,7 @@  static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
 	void __iomem *base;
 	struct qcom_cpufreq_data *data;
 	const char *fdom_resname;
+	unsigned int transition_latency;
 	int cpu_count, index, ret;
 
 	cpu_dev = get_cpu_device(policy->cpu);
@@ -1478,6 +1479,12 @@  static int qcom_cpufreq_hw_cpu_init(struct cpufreq_policy *policy)
 		goto error;
 	}
 
+	transition_latency = dev_pm_opp_get_max_transition_latency(cpu_dev);
+	if (!transition_latency)
+		transition_latency = CPUFREQ_ETERNAL;
+
+	policy->cpuinfo.transition_latency = transition_latency;
+
 	dev_pm_opp_of_register_em(cpu_dev, policy->cpus);
 
 	if (policy_has_boost_freq(policy)) {