Lines Matching +full:psci +full:- +full:1

1 // SPDX-License-Identifier: GPL-2.0-only
3 * PSCI CPU idle driver.
9 #define pr_fmt(fmt) "CPUidle PSCI: " fmt
20 #include <linux/psci.h>
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()
77 ret = psci_cpu_suspend_enter(state) ? -1 : idx; in __psci_enter_domain_idle_state()
134 dev = per_cpu_ptr(&psci_cpuidle_data, cpu)->dev; in psci_idle_syscore_switch()
145 /* Clear domain state to re-start fresh. */ in psci_idle_syscore_switch()
184 "cpuidle/psci:online", in psci_idle_init_cpuhp()
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()
215 pr_warn("Invalid PSCI power state %#x\n", *state); in psci_dt_parse_state_node()
216 return -EINVAL; in psci_dt_parse_state_node()
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()
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()
266 for (i = 1; i < state_count; i++) { 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()
300 * If the PSCI cpu_suspend function hook has not been initialized 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()
342 if (!enable_method || (strcmp(enable_method, "psci"))) 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()
372 * default archictectural back-end already executes wfi in psci_idle_init_cpu()
375 ret = dt_init_idle_driver(drv, psci_idle_state_match, 1); 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
403 * Initializes PSCI cpuidle driver for all CPUs, if any CPU fails
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()