Lines Matching +full:suspend +full:- +full:to +full:- +full:idle
1 // SPDX-License-Identifier: GPL-2.0-only
3 * PSCI CPU idle driver.
29 #include "cpuidle-psci.h"
58 u32 *states = data->psci_states; in __psci_enter_domain_idle_state()
59 struct device *pd_dev = data->dev; in __psci_enter_domain_idle_state()
65 return -1; in __psci_enter_domain_idle_state()
67 /* Do runtime PM to manage a hierarchical CPU toplogy. */ in __psci_enter_domain_idle_state()
77 ret = psci_cpu_suspend_enter(state) ? -1 : idx; in __psci_enter_domain_idle_state()
86 /* Clear the domain state to start fresh when back from idle. */ in __psci_enter_domain_idle_state()
120 /* Clear domain state to start fresh at next online. */ in psci_idle_cpuhp_down()
127 static void psci_idle_syscore_switch(bool suspend) in psci_idle_syscore_switch() argument
134 dev = per_cpu_ptr(&psci_cpuidle_data, cpu)->dev; in psci_idle_syscore_switch()
136 if (dev && suspend) { in psci_idle_syscore_switch()
145 /* Clear domain state to re-start fresh. */ in psci_idle_syscore_switch()
166 .suspend = psci_idle_syscore_suspend,
200 { .compatible = "arm,idle-state",
207 int err = of_property_read_u32(np, "arm,psci-suspend-param", state); in psci_dt_parse_state_node()
210 pr_warn("%pOF missing arm,psci-suspend-param property\n", np); in psci_dt_parse_state_node()
216 return -EINVAL; in psci_dt_parse_state_node()
226 /* Currently limit the hierarchical topology to be used in OSI mode. */ in psci_dt_cpu_init_topology()
230 data->dev = dt_idle_attach_cpu(cpu, "psci"); in psci_dt_cpu_init_topology()
231 if (IS_ERR_OR_NULL(data->dev)) in psci_dt_cpu_init_topology()
232 return PTR_ERR_OR_ZERO(data->dev); in psci_dt_cpu_init_topology()
237 * Using the deepest state for the CPU to trigger a potential selection in psci_dt_cpu_init_topology()
239 * deeper states. On PREEMPT_RT the hierarchical topology is limited to in psci_dt_cpu_init_topology()
242 drv->states[state_count - 1].enter_s2idle = psci_enter_s2idle_domain_idle_state; in psci_dt_cpu_init_topology()
244 drv->states[state_count - 1].enter = psci_enter_domain_idle_state; in psci_dt_cpu_init_topology()
264 return -ENOMEM; in psci_dt_cpu_init_idle()
267 state_node = of_get_cpu_state_node(cpu_node, i - 1); in psci_dt_cpu_init_idle()
277 pr_debug("psci-power-state %#x index %d\n", psci_states[i], i); in psci_dt_cpu_init_idle()
281 return -ENODEV; in psci_dt_cpu_init_idle()
288 /* Idle states parsed correctly, store them in the per-cpu struct. */ in psci_dt_cpu_init_idle()
289 data->psci_states = psci_states; in psci_dt_cpu_init_idle()
301 * idle states must not be enabled, so bail out in psci_cpu_init_idle()
304 return -EOPNOTSUPP; in psci_cpu_init_idle()
308 return -ENODEV; in psci_cpu_init_idle()
321 dt_idle_detach_cpu(data->dev); in psci_cpu_deinit_idle()
335 return -ENODEV; in psci_idle_init_cpu()
338 * Check whether the enable-method for the cpu is PSCI, fail in psci_idle_init_cpu()
341 enable_method = of_get_property(cpu_node, "enable-method", NULL); in psci_idle_init_cpu()
343 ret = -ENODEV; in psci_idle_init_cpu()
351 return -ENOMEM; in psci_idle_init_cpu()
353 drv->name = "psci_idle"; in psci_idle_init_cpu()
354 drv->owner = THIS_MODULE; in psci_idle_init_cpu()
355 drv->cpumask = (struct cpumask *)cpumask_of(cpu); in psci_idle_init_cpu()
358 * PSCI idle states relies on architectural WFI to be represented as in psci_idle_init_cpu()
361 drv->states[0].enter = psci_enter_idle_state; in psci_idle_init_cpu()
362 drv->states[0].exit_latency = 1; in psci_idle_init_cpu()
363 drv->states[0].target_residency = 1; in psci_idle_init_cpu()
364 drv->states[0].power_usage = UINT_MAX; in psci_idle_init_cpu()
365 strcpy(drv->states[0].name, "WFI"); in psci_idle_init_cpu()
366 strcpy(drv->states[0].desc, "ARM WFI"); in psci_idle_init_cpu()
369 * If no DT idle states are detected (ret == 0) let the driver in psci_idle_init_cpu()
370 * initialization fail accordingly since there is no reason to in psci_idle_init_cpu()
371 * initialize the idle driver if only wfi is supported, the in psci_idle_init_cpu()
372 * default archictectural back-end already executes wfi in psci_idle_init_cpu()
373 * on idle entry. in psci_idle_init_cpu()
377 return ret ? : -ENODEV; in psci_idle_init_cpu()
380 * Initialize PSCI idle states. in psci_idle_init_cpu()
384 pr_err("CPU %d failed to PSCI idle\n", cpu); in psci_idle_init_cpu()
401 * psci_idle_probe - Initializes PSCI cpuidle driver
404 * to register cpuidle driver then rollback to cancel all CPUs
414 ret = psci_idle_init_cpu(&pdev->dev, cpu); in psci_cpuidle_probe()
424 while (--cpu >= 0) { in psci_cpuidle_probe()
437 .name = "psci-cpuidle",
450 pdev = platform_device_register_simple("psci-cpuidle", -1, NULL, 0); in psci_idle_init()