Lines Matching +full:thermal +full:- +full:zones

1 // SPDX-License-Identifier: GPL-2.0-or-later
36 int ret = -1; in sysfs_set_ulong()
52 /* history of thermal data, used for control algo */
60 int ret = -1; in sysfs_get_ulong()
79 int ret = -1; in sysfs_get_string()
98 sysfs_get_string(path, "type", cdi->type); in probe_cdev()
99 sysfs_get_ulong(path, "max_state", &cdi->max_state); in probe_cdev()
100 sysfs_get_ulong(path, "cur_state", &cdi->cur_state); in probe_cdev()
104 cdi->type, cdi->max_state, cdi->cur_state, cdi->instance); in probe_cdev()
118 return -ENOENT; in str_to_trip_type()
121 /* scan and fill in trip point info for a thermal zone and trip point id */
129 return -EINVAL; in get_trip_point_data()
136 return -ENOENT; in get_trip_point_data()
162 return -1; in get_instance_id()
165 /* Find trip point info of a thermal zone */
174 /* check if trip point temp is non-zero in find_tzone_tp()
179 tzi->nr_trip_pts++; in find_tzone_tp()
187 return -1; in find_tzone_tp()
190 tzi->tp[tp_id].temp = temp_ulong; in find_tzone_tp()
207 if (nl->d_type == DT_LNK) { in find_tzone_cdev()
208 syslog(LOG_DEBUG, "TZ%d: cdev: %s cid %d\n", tz_id, nl->d_name, in find_tzone_cdev()
210 tzi->nr_cdev++; in find_tzone_cdev()
211 if (tzi->nr_cdev > ptdata.nr_cooling_dev) { in find_tzone_cdev()
213 tzi->nr_cdev); in find_tzone_cdev()
214 return -EINVAL; in find_tzone_cdev()
217 snprintf(cdev_name, sizeof(cdev_name) - 2, "%s/%s", in find_tzone_cdev()
218 tz_name, nl->d_name); in find_tzone_cdev()
221 sizeof(cdev_name_linked) - 1) != -1) { in find_tzone_cdev()
223 sizeof("device") - 1); in find_tzone_cdev()
226 tzi->cdev_binding |= (1 << cdev_id); in find_tzone_cdev()
231 snprintf(cdev_trip_name, sizeof(cdev_trip_name) - 1, in find_tzone_cdev()
232 "%s%s", nl->d_name, "_trip_point"); in find_tzone_cdev()
235 /* validate trip point range, e.g. trip could return -1 in find_tzone_cdev()
240 tzi->trip_binding[cdev_id] |= 1 << trip_instance; in find_tzone_cdev()
241 syslog(LOG_DEBUG, "cdev %s -> trip:%lu: 0x%lx %d\n", in find_tzone_cdev()
243 tzi->trip_binding[cdev_id], in find_tzone_cdev()
251 return -ENODEV; in find_tzone_cdev()
257 * Before calling scan_tzones, thermal sysfs must be probed to determine
258 * the number of thermal zones and cooling devices.
259 * We loop through each thermal zone and fill in tz_info struct, i.e.
261 root@jacob-chiefriver:~# tree -d /sys/class/thermal/thermal_zone0
262 /sys/class/thermal/thermal_zone0
263 |-- cdev0 -> ../cooling_device4
264 |-- cdev1 -> ../cooling_device3
265 |-- cdev10 -> ../cooling_device7
266 |-- cdev11 -> ../cooling_device6
267 |-- cdev12 -> ../cooling_device5
268 |-- cdev2 -> ../cooling_device2
269 |-- cdev3 -> ../cooling_device1
270 |-- cdev4 -> ../cooling_device0
271 |-- cdev5 -> ../cooling_device12
272 |-- cdev6 -> ../cooling_device11
273 |-- cdev7 -> ../cooling_device10
274 |-- cdev8 -> ../cooling_device9
275 |-- cdev9 -> ../cooling_device8
276 |-- device -> ../../../LNXSYSTM:00/device:62/LNXTHERM:00
277 |-- power
278 `-- subsystem -> ../../../../class/thermal
288 return -1; in scan_tzones()
296 syslog(LOG_INFO, "Thermal zone %s skipped\n", tz_name); in scan_tzones()
310 while (n--) { in scan_tzones()
313 if (find_tzone_tp(tz_name, namelist[n]->d_name, in scan_tzones()
316 temp_str = strstr(namelist[n]->d_name, "cdev"); in scan_tzones()
372 while (n--) in scan_cdevs()
391 fprintf(stderr, "\nNo thermal sysfs, exit\n"); in probe_thermal_sysfs()
392 return -1; in probe_thermal_sysfs()
396 syslog(LOG_ERR, "scandir failed in thermal sysfs"); in probe_thermal_sysfs()
398 /* detect number of thermal zones and cooling devices */ in probe_thermal_sysfs()
399 while (n--) { in probe_thermal_sysfs()
402 if (strstr(namelist[n]->d_name, CDEV)) { in probe_thermal_sysfs()
403 inst = get_instance_id(namelist[n]->d_name, 1, in probe_thermal_sysfs()
404 sizeof("device") - 1); in probe_thermal_sysfs()
412 namelist[n]->d_name, in probe_thermal_sysfs()
416 } else if (strstr(namelist[n]->d_name, TZONE)) { in probe_thermal_sysfs()
417 inst = get_instance_id(namelist[n]->d_name, 1, in probe_thermal_sysfs()
418 sizeof("zone") - 1); in probe_thermal_sysfs()
423 namelist[n]->d_name, in probe_thermal_sysfs()
438 fprintf(stderr, "\nNo thermal zones found, exit\n\n"); in probe_thermal_sysfs()
439 return -1; in probe_thermal_sysfs()
445 return -1; in probe_thermal_sysfs()
448 /* we still show thermal zone information if there is no cdev */ in probe_thermal_sysfs()
455 return -1; in probe_thermal_sysfs()
461 return -1; in probe_thermal_sysfs()
463 return -1; in probe_thermal_sysfs()
475 return -ENOENT; in zone_instance_to_index()
478 /* read temperature of all thermal zones */
487 syslog(LOG_ERR, "No thermal zones found!\n"); in update_thermal_data()
488 return -1; in update_thermal_data()
564 int ctrl_cdev_id = -1; in get_ctrl_state()
578 if (ctrl_cdev_id == -1) { in get_ctrl_state()