Lines Matching +full:cooling +full:- +full:device

1 // SPDX-License-Identifier: GPL-2.0
8 #define pr_fmt(fmt) "cpuidle cooling: " fmt
12 #include <linux/device.h>
20 * struct cpuidle_cooling_device - data for the idle cooling device
22 * @state: a normalized integer giving the state of the cooling device
30 * cpuidle_cooling_runtime - Running time computation
42 * running = idle x ((100 / ratio) - 1)
46 * running = (idle x 100) / ratio - idle
59 return ((idle_duration_us * 100) / state) - idle_duration_us; in cpuidle_cooling_runtime()
63 * cpuidle_cooling_get_max_state - Get the maximum state
64 * @cdev : the thermal cooling device
92 * cpuidle_cooling_get_cur_state - Get the current cooling state
93 * @cdev: the thermal cooling device
97 * cooling device structure, the mapping is 1 <-> 1.
104 struct cpuidle_cooling_device *idle_cdev = cdev->devdata; in cpuidle_cooling_get_cur_state()
106 *state = idle_cdev->state; in cpuidle_cooling_get_cur_state()
112 * cpuidle_cooling_set_cur_state - Set the current cooling state
113 * @cdev: the thermal cooling device
118 * cooling device. In any case, it updates the internal state for the
119 * cooling device.
126 struct cpuidle_cooling_device *idle_cdev = cdev->devdata; in cpuidle_cooling_set_cur_state()
127 struct idle_inject_device *ii_dev = idle_cdev->ii_dev; in cpuidle_cooling_set_cur_state()
128 unsigned long current_state = idle_cdev->state; in cpuidle_cooling_set_cur_state()
131 idle_cdev->state = state; in cpuidle_cooling_set_cur_state()
149 * cpuidle_cooling_ops - thermal cooling device ops
158 * __cpuidle_cooling_register: register the cooling device
160 * @np: a device node structure pointer used for the thermal binding
162 * This function is in charge of allocating the cpuidle cooling device
164 * cooling device to the thermal framework.
175 struct device *dev; in __cpuidle_cooling_register()
183 ret = -ENOMEM; in __cpuidle_cooling_register()
187 ii_dev = idle_inject_register(drv->cpumask); in __cpuidle_cooling_register()
189 ret = -EINVAL; in __cpuidle_cooling_register()
193 of_property_read_u32(np, "duration-us", &idle_duration_us); in __cpuidle_cooling_register()
194 of_property_read_u32(np, "exit-latency-us", &latency_us); in __cpuidle_cooling_register()
199 idle_cdev->ii_dev = ii_dev; in __cpuidle_cooling_register()
201 dev = get_cpu_device(cpumask_first(drv->cpumask)); in __cpuidle_cooling_register()
203 name = kasprintf(GFP_KERNEL, "idle-%s", dev_name(dev)); in __cpuidle_cooling_register()
205 ret = -ENOMEM; in __cpuidle_cooling_register()
234 * cpuidle_cooling_register - Idle cooling device initialization function
237 * This function is in charge of creating a cooling device per cpuidle
249 for_each_cpu(cpu, drv->cpumask) { in cpuidle_cooling_register()
253 cooling_node = of_get_child_by_name(cpu_node, "thermal-idle"); in cpuidle_cooling_register()
258 pr_debug("'thermal-idle' node not found for cpu%d\n", cpu); in cpuidle_cooling_register()
267 pr_err("Failed to register the cpuidle cooling device" \ in cpuidle_cooling_register()