ARM: tegra: Add tegra_pm_park_secondary_cpu()
authorDmitry Osipenko <digetx@gmail.com>
Mon, 24 Feb 2020 22:40:42 +0000 (01:40 +0300)
committerThierry Reding <treding@nvidia.com>
Thu, 12 Mar 2020 09:53:18 +0000 (10:53 +0100)
This function resembles tegra_cpu_die() of the hotplug code, but
this variant is more suitable to be used for CPU PM because it's made
specifically to be used by cpu_suspend(). In short this function puts
secondary CPU offline, it will be used by the new CPUIDLE driver.

Acked-by: Peter De Schrijver <pdeschrijver@nvidia.com>
Tested-by: Peter Geis <pgwipeout@gmail.com>
Tested-by: Jasper Korten <jja2000@gmail.com>
Tested-by: David Heidelberg <david@ixit.cz>
Tested-by: Nicolas Chauvet <kwizart@gmail.com>
Signed-off-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
arch/arm/mach-tegra/pm.c
arch/arm/mach-tegra/pm.h

index 3cab81b82866212b45e55e9194a0a7ca9b1f8019..f5ff3dd1dd812e1a22112e4aad1f809c741deace 100644 (file)
@@ -436,4 +436,18 @@ void __init tegra_init_suspend(void)
 
        suspend_set_ops(&tegra_suspend_ops);
 }
+
+int tegra_pm_park_secondary_cpu(unsigned long cpu)
+{
+       if (cpu > 0) {
+               tegra_disable_clean_inv_dcache(TEGRA_FLUSH_CACHE_LOUIS);
+
+               if (tegra_get_chip_id() == TEGRA20)
+                       tegra20_hotplug_shutdown();
+               else
+                       tegra30_hotplug_shutdown();
+       }
+
+       return -EINVAL;
+}
 #endif
index 569151b3edc0aa38cbb89d3b669fe0703ec32c06..9a790f00237fd129b3dccd964ec7946a08f5484c 100644 (file)
@@ -31,8 +31,13 @@ extern void (*tegra_tear_down_cpu)(void);
 
 #ifdef CONFIG_PM_SLEEP
 void tegra_init_suspend(void);
+int tegra_pm_park_secondary_cpu(unsigned long cpu);
 #else
 static inline void tegra_init_suspend(void) {}
+static inline int tegra_pm_park_secondary_cpu(unsigned long cpu)
+{
+       return -ENOTSUPP;
+}
 #endif
 
 #endif /* _MACH_TEGRA_PM_H_ */