Lines Matching +full:drv +full:- +full:1

1 // SPDX-License-Identifier: GPL-2.0-only
29 #include "cpuidle-psci.h"
54 struct cpuidle_driver *drv, int idx, in __psci_enter_domain_idle_state() argument
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()
92 struct cpuidle_driver *drv, int idx) in psci_enter_domain_idle_state() argument
94 return __psci_enter_domain_idle_state(dev, drv, idx, false); in psci_enter_domain_idle_state()
98 struct cpuidle_driver *drv, in psci_enter_s2idle_domain_idle_state() argument
101 return __psci_enter_domain_idle_state(dev, drv, idx, true); in psci_enter_s2idle_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()
192 struct cpuidle_driver *drv, int idx) in psci_enter_idle_state() argument
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()
222 static int psci_dt_cpu_init_topology(struct cpuidle_driver *drv, in psci_dt_cpu_init_topology() argument
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()
251 static int psci_dt_cpu_init_idle(struct device *dev, struct cpuidle_driver *drv, in psci_dt_cpu_init_idle() argument
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()
284 ret = psci_dt_cpu_init_topology(drv, data, state_count, cpu); 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()
293 static int psci_cpu_init_idle(struct device *dev, struct cpuidle_driver *drv, in psci_cpu_init_idle() argument
304 return -EOPNOTSUPP; in psci_cpu_init_idle()
308 return -ENODEV; in psci_cpu_init_idle()
310 ret = psci_dt_cpu_init_idle(dev, drv, cpu_node, state_count, cpu); in psci_cpu_init_idle()
321 dt_idle_detach_cpu(data->dev); in psci_cpu_deinit_idle()
328 struct cpuidle_driver *drv; in psci_idle_init_cpu() local
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()
349 drv = devm_kzalloc(dev, sizeof(*drv), GFP_KERNEL); in psci_idle_init_cpu()
350 if (!drv) 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()
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()
382 ret = psci_cpu_init_idle(dev, drv, cpu, ret); in psci_idle_init_cpu()
388 ret = cpuidle_register(drv, NULL); in psci_idle_init_cpu()
392 cpuidle_cooling_register(drv); in psci_idle_init_cpu()
401 * psci_idle_probe - Initializes PSCI cpuidle driver
410 struct cpuidle_driver *drv; in psci_cpuidle_probe() local
414 ret = psci_idle_init_cpu(&pdev->dev, cpu); in psci_cpuidle_probe()
424 while (--cpu >= 0) { in psci_cpuidle_probe()
426 drv = cpuidle_get_cpu_driver(dev); in psci_cpuidle_probe()
427 cpuidle_unregister(drv); in psci_cpuidle_probe()
437 .name = "psci-cpuidle",
450 pdev = platform_device_register_simple("psci-cpuidle", -1, NULL, 0); in psci_idle_init()