diff mbox series

[5/8] cpufreq: omap: Use auto-registration for energy model

Message ID a17b0f64c3a4cd84a126b3315539c13b15b4738c.1628579170.git.viresh.kumar@linaro.org (mailing list archive)
State New, archived
Headers show
Series cpufreq: Auto-register with energy model | expand

Commit Message

Viresh Kumar Aug. 10, 2021, 7:36 a.m. UTC
Use the CPUFREQ_REGISTER_WITH_EM flag to allow cpufreq core to
automatically register with the energy model.

This allows removal of boiler plate code from the driver and fixes the
unregistration part as well.

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
---
 drivers/cpufreq/omap-cpufreq.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Lukasz Luba Aug. 10, 2021, 10:24 a.m. UTC | #1
On 8/10/21 8:36 AM, Viresh Kumar wrote:
> Use the CPUFREQ_REGISTER_WITH_EM flag to allow cpufreq core to
> automatically register with the energy model.
> 
> This allows removal of boiler plate code from the driver and fixes the
> unregistration part as well.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>   drivers/cpufreq/omap-cpufreq.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c
> index e035ee216b0f..303136f97773 100644
> --- a/drivers/cpufreq/omap-cpufreq.c
> +++ b/drivers/cpufreq/omap-cpufreq.c
> @@ -131,7 +131,6 @@ static int omap_cpu_init(struct cpufreq_policy *policy)
>   
>   	/* FIXME: what's the actual transition time? */
>   	cpufreq_generic_init(policy, freq_table, 300 * 1000);
> -	dev_pm_opp_of_register_em(mpu_dev, policy->cpus);
>   
>   	return 0;
>   }
> @@ -144,7 +143,8 @@ static int omap_cpu_exit(struct cpufreq_policy *policy)
>   }
>   
>   static struct cpufreq_driver omap_driver = {
> -	.flags		= CPUFREQ_NEED_INITIAL_FREQ_CHECK,
> +	.flags		= CPUFREQ_NEED_INITIAL_FREQ_CHECK |
> +			  CPUFREQ_REGISTER_WITH_EM,
>   	.verify		= cpufreq_generic_frequency_table_verify,
>   	.target_index	= omap_target,
>   	.get		= cpufreq_generic_get,
> 

Reviewed-by: Lukasz Luba <lukasz.luba@arm.com>
diff mbox series

Patch

diff --git a/drivers/cpufreq/omap-cpufreq.c b/drivers/cpufreq/omap-cpufreq.c
index e035ee216b0f..303136f97773 100644
--- a/drivers/cpufreq/omap-cpufreq.c
+++ b/drivers/cpufreq/omap-cpufreq.c
@@ -131,7 +131,6 @@  static int omap_cpu_init(struct cpufreq_policy *policy)
 
 	/* FIXME: what's the actual transition time? */
 	cpufreq_generic_init(policy, freq_table, 300 * 1000);
-	dev_pm_opp_of_register_em(mpu_dev, policy->cpus);
 
 	return 0;
 }
@@ -144,7 +143,8 @@  static int omap_cpu_exit(struct cpufreq_policy *policy)
 }
 
 static struct cpufreq_driver omap_driver = {
-	.flags		= CPUFREQ_NEED_INITIAL_FREQ_CHECK,
+	.flags		= CPUFREQ_NEED_INITIAL_FREQ_CHECK |
+			  CPUFREQ_REGISTER_WITH_EM,
 	.verify		= cpufreq_generic_frequency_table_verify,
 	.target_index	= omap_target,
 	.get		= cpufreq_generic_get,