diff mbox series

cpufreq: tegra194: add online/offline hooks

Message ID 20230825111920.8257-1-sumitg@nvidia.com
State Accepted
Commit a3aa97be69a7cc14ddc2bb0add0b9c51cb74bf83
Headers show
Series cpufreq: tegra194: add online/offline hooks | expand

Commit Message

Sumit Gupta Aug. 25, 2023, 11:19 a.m. UTC
Implement the light-weight tear down and bring up helpers to reduce the
amount of work to do on CPU offline/online operation.
This change helps to make the hotplugging paths much faster.

Suggested-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
Link: https://lore.kernel.org/lkml/20230816033402.3abmugb5goypvllm@vireshk-i7/
---
 drivers/cpufreq/tegra194-cpufreq.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

Comments

Viresh Kumar Aug. 28, 2023, 6:14 a.m. UTC | #1
On 25-08-23, 16:49, Sumit Gupta wrote:
> Implement the light-weight tear down and bring up helpers to reduce the
> amount of work to do on CPU offline/online operation.
> This change helps to make the hotplugging paths much faster.
> 
> Suggested-by: Viresh Kumar <viresh.kumar@linaro.org>
> Signed-off-by: Sumit Gupta <sumitg@nvidia.com>
> Link: https://lore.kernel.org/lkml/20230816033402.3abmugb5goypvllm@vireshk-i7/
> ---
>  drivers/cpufreq/tegra194-cpufreq.c | 17 +++++++++++++++++
>  1 file changed, 17 insertions(+)
> 
> diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
> index 66a9c23544db..09582696b83d 100644
> --- a/drivers/cpufreq/tegra194-cpufreq.c
> +++ b/drivers/cpufreq/tegra194-cpufreq.c
> @@ -510,6 +510,21 @@ static int tegra194_cpufreq_init(struct cpufreq_policy *policy)
>  	return 0;
>  }
>  
> +static int tegra194_cpufreq_online(struct cpufreq_policy *policy)
> +{
> +	/* We did light-weight tear down earlier, nothing to do here */
> +	return 0;
> +}
> +
> +static int tegra194_cpufreq_offline(struct cpufreq_policy *policy)
> +{
> +	/*
> +	 * Preserve policy->driver_data and don't free resources on light-weight
> +	 * tear down.
> +	 */
> +	return 0;
> +}
> +
>  static int tegra194_cpufreq_exit(struct cpufreq_policy *policy)
>  {
>  	struct device *cpu_dev = get_cpu_device(policy->cpu);
> @@ -548,6 +563,8 @@ static struct cpufreq_driver tegra194_cpufreq_driver = {
>  	.get = tegra194_get_speed,
>  	.init = tegra194_cpufreq_init,
>  	.exit = tegra194_cpufreq_exit,
> +	.online = tegra194_cpufreq_online,
> +	.offline = tegra194_cpufreq_offline,
>  	.attr = cpufreq_generic_attr,
>  };

Applied. Thanks.
diff mbox series

Patch

diff --git a/drivers/cpufreq/tegra194-cpufreq.c b/drivers/cpufreq/tegra194-cpufreq.c
index 66a9c23544db..09582696b83d 100644
--- a/drivers/cpufreq/tegra194-cpufreq.c
+++ b/drivers/cpufreq/tegra194-cpufreq.c
@@ -510,6 +510,21 @@  static int tegra194_cpufreq_init(struct cpufreq_policy *policy)
 	return 0;
 }
 
+static int tegra194_cpufreq_online(struct cpufreq_policy *policy)
+{
+	/* We did light-weight tear down earlier, nothing to do here */
+	return 0;
+}
+
+static int tegra194_cpufreq_offline(struct cpufreq_policy *policy)
+{
+	/*
+	 * Preserve policy->driver_data and don't free resources on light-weight
+	 * tear down.
+	 */
+	return 0;
+}
+
 static int tegra194_cpufreq_exit(struct cpufreq_policy *policy)
 {
 	struct device *cpu_dev = get_cpu_device(policy->cpu);
@@ -548,6 +563,8 @@  static struct cpufreq_driver tegra194_cpufreq_driver = {
 	.get = tegra194_get_speed,
 	.init = tegra194_cpufreq_init,
 	.exit = tegra194_cpufreq_exit,
+	.online = tegra194_cpufreq_online,
+	.offline = tegra194_cpufreq_offline,
 	.attr = cpufreq_generic_attr,
 };