Lines Matching +full:idle +full:- +full:state

1 // SPDX-License-Identifier: GPL-2.0
21 * struct cpuidle_cooling_device - data for the idle cooling device
22 * @ii_dev: an atomic to keep track of the last task exiting the idle cycle
23 * @state: a normalized integer giving the state of the cooling device
27 unsigned long state; member
31 * cpuidle_cooling_runtime - Running time computation
32 * @idle_duration_us: CPU idle time to inject in microseconds
33 * @state: a percentile based number
35 * The running duration is computed from the idle injection duration
36 * which is fixed. If we reach 100% of idle injection ratio, that
38 * injection, that means we have equal duration for idle and for
43 * running = idle x ((100 / ratio) - 1)
47 * running = (idle x 100) / ratio - idle
50 * with 10ms of idle injection and 10ms of running duration.
55 unsigned long state) in cpuidle_cooling_runtime() argument
57 if (!state) in cpuidle_cooling_runtime()
60 return ((idle_duration_us * 100) / state) - idle_duration_us; in cpuidle_cooling_runtime()
64 * cpuidle_cooling_get_max_state - Get the maximum state
66 * @state : a pointer to the state variable to be filled
74 unsigned long *state) in cpuidle_cooling_get_max_state() argument
78 * cycle and the idle cycle could be different. We want to in cpuidle_cooling_get_max_state()
79 * unify that to an 0..100 interval, so the set state in cpuidle_cooling_get_max_state()
82 * The state 100% will make the cluster 100% ... idle. A 0% in cpuidle_cooling_get_max_state()
83 * injection ratio means no idle injection at all and 50% in cpuidle_cooling_get_max_state()
84 * means for 10ms of idle injection, we have 10ms of running in cpuidle_cooling_get_max_state()
87 *state = 100; in cpuidle_cooling_get_max_state()
93 * cpuidle_cooling_get_cur_state - Get the current cooling state
95 * @state: a pointer to the state
97 * The function just copies the state value from the private thermal
98 * cooling device structure, the mapping is 1 <-> 1.
103 unsigned long *state) in cpuidle_cooling_get_cur_state() argument
105 struct cpuidle_cooling_device *idle_cdev = cdev->devdata; in cpuidle_cooling_get_cur_state()
107 *state = idle_cdev->state; in cpuidle_cooling_get_cur_state()
113 * cpuidle_cooling_set_cur_state - Set the current cooling state
115 * @state: the target state
118 * in turn wakes up all the idle injection tasks belonging to the idle
119 * cooling device. In any case, it updates the internal state for the
125 unsigned long state) in cpuidle_cooling_set_cur_state() argument
127 struct cpuidle_cooling_device *idle_cdev = cdev->devdata; in cpuidle_cooling_set_cur_state()
128 struct idle_inject_device *ii_dev = idle_cdev->ii_dev; in cpuidle_cooling_set_cur_state()
129 unsigned long current_state = idle_cdev->state; in cpuidle_cooling_set_cur_state()
132 idle_cdev->state = state; in cpuidle_cooling_set_cur_state()
136 runtime_us = cpuidle_cooling_runtime(idle_duration_us, state); in cpuidle_cooling_set_cur_state()
140 if (current_state == 0 && state > 0) { in cpuidle_cooling_set_cur_state()
142 } else if (current_state > 0 && !state) { in cpuidle_cooling_set_cur_state()
150 * cpuidle_cooling_ops - thermal cooling device ops
164 * structure, the idle injection, initialize them and register the
184 ret = -ENOMEM; in __cpuidle_cooling_register()
188 ii_dev = idle_inject_register(drv->cpumask); in __cpuidle_cooling_register()
190 ret = -EINVAL; in __cpuidle_cooling_register()
194 of_property_read_u32(np, "duration-us", &idle_duration_us); in __cpuidle_cooling_register()
195 of_property_read_u32(np, "exit-latency-us", &latency_us); in __cpuidle_cooling_register()
200 idle_cdev->ii_dev = ii_dev; in __cpuidle_cooling_register()
202 dev = get_cpu_device(cpumask_first(drv->cpumask)); in __cpuidle_cooling_register()
204 name = kasprintf(GFP_KERNEL, "idle-%s", dev_name(dev)); in __cpuidle_cooling_register()
206 ret = -ENOMEM; in __cpuidle_cooling_register()
217 pr_debug("%s: Idle injection set with idle duration=%u, latency=%u\n", in __cpuidle_cooling_register()
235 * cpuidle_cooling_register - Idle cooling device initialization function
247 for_each_cpu(cpu, drv->cpumask) { in cpuidle_cooling_register()
251 cooling_node = of_get_child_by_name(cpu_node, "thermal-idle"); in cpuidle_cooling_register()
256 pr_debug("'thermal-idle' node not found for cpu%d\n", cpu); in cpuidle_cooling_register()