summaryrefslogtreecommitdiff
path: root/drivers/cpuidle/cpuidle-psci-domain.c
diff options
context:
space:
mode:
authorUlf Hansson <ulf.hansson@linaro.org>2020-11-03 16:06:27 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2020-11-10 20:42:01 +0100
commit670c90def03429a228229420fa48a17913fdcc0d (patch)
treeb1b43ae851e4f8a042e31a9ee13d53f557942246 /drivers/cpuidle/cpuidle-psci-domain.c
parentb9795a3e4e1cbf521bbb5ef240eb47803c303b02 (diff)
cpuidle: psci: Enable suspend-to-idle for PSCI OSI mode
To select domain idlestates for cpuidle-psci when OSI mode has been enabled, the PM domains via genpd are being managed through runtime PM. This works fine for the regular idlepath, but it doesn't during system wide suspend. More precisely, the domain idlestates becomes temporarily disabled, which is because the PM core disables runtime PM for devices during system wide suspend. Later in the system suspend phase, genpd intends to deal with this from its ->suspend_noirq() callback, but this doesn't work as expected for a device corresponding to a CPU, because the domain idlestates needs to be selected on a per CPU basis (the PM core doesn't invoke the callbacks like that). To address this problem, let's enable the syscore flag for the corresponding CPU device that becomes successfully attached to its PM domain (applicable only in OSI mode). This informs the PM core to skip invoke the system wide suspend/resume callbacks for the device, thus also prevents genpd from screwing up its internal state of it. Moreover, to properly select a domain idlestate for the CPUs during suspend-to-idle, let's assign a specific ->enter_s2idle() callback for the corresponding domain idlestate (applicable only in OSI mode). From that callback, let's invoke dev_pm_genpd_suspend|resume(), as this allows a domain idlestate to be selected for the current CPU by genpd. Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/cpuidle/cpuidle-psci-domain.c')
-rw-r--r--drivers/cpuidle/cpuidle-psci-domain.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/drivers/cpuidle/cpuidle-psci-domain.c b/drivers/cpuidle/cpuidle-psci-domain.c
index 4a031c62f92a..ff2c3f8e4668 100644
--- a/drivers/cpuidle/cpuidle-psci-domain.c
+++ b/drivers/cpuidle/cpuidle-psci-domain.c
@@ -327,6 +327,8 @@ struct device *psci_dt_attach_cpu(int cpu)
if (cpu_online(cpu))
pm_runtime_get_sync(dev);
+ dev_pm_syscore_device(dev, true);
+
return dev;
}