Lines Matching +full:thermal +full:- +full:zones
1 // SPDX-License-Identifier: GPL-2.0-or-later
35 int ret = -1; in sysfs_set_ulong()
51 /* history of thermal data, used for control algo */
59 int ret = -1; in sysfs_get_ulong()
78 int ret = -1; in sysfs_get_string()
97 sysfs_get_string(path, "type", cdi->type); in probe_cdev()
98 sysfs_get_ulong(path, "max_state", &cdi->max_state); in probe_cdev()
99 sysfs_get_ulong(path, "cur_state", &cdi->cur_state); in probe_cdev()
103 cdi->type, cdi->max_state, cdi->cur_state, cdi->instance); in probe_cdev()
117 return -ENOENT; in str_to_trip_type()
120 /* scan and fill in trip point info for a thermal zone and trip point id */
128 return -EINVAL; in get_trip_point_data()
135 return -ENOENT; in get_trip_point_data()
161 return -1; in get_instance_id()
164 /* Find trip point info of a thermal zone */
173 /* check if trip point temp is non-zero in find_tzone_tp()
178 tzi->nr_trip_pts++; in find_tzone_tp()
186 return -1; in find_tzone_tp()
189 tzi->tp[tp_id].temp = temp_ulong; in find_tzone_tp()
206 if (nl->d_type == DT_LNK) { in find_tzone_cdev()
207 syslog(LOG_DEBUG, "TZ%d: cdev: %s cid %d\n", tz_id, nl->d_name, in find_tzone_cdev()
209 tzi->nr_cdev++; in find_tzone_cdev()
210 if (tzi->nr_cdev > ptdata.nr_cooling_dev) { in find_tzone_cdev()
212 tzi->nr_cdev); in find_tzone_cdev()
213 return -EINVAL; in find_tzone_cdev()
216 snprintf(cdev_name, 256, "%s/%s", tz_name, nl->d_name); in find_tzone_cdev()
219 sizeof(cdev_name_linked) - 1) != -1) { in find_tzone_cdev()
221 sizeof("device") - 1); in find_tzone_cdev()
224 tzi->cdev_binding |= (1 << cdev_id); in find_tzone_cdev()
229 snprintf(cdev_trip_name, 256, "%s%s", nl->d_name, in find_tzone_cdev()
233 /* validate trip point range, e.g. trip could return -1 in find_tzone_cdev()
238 tzi->trip_binding[cdev_id] |= 1 << trip_instance; in find_tzone_cdev()
239 syslog(LOG_DEBUG, "cdev %s -> trip:%lu: 0x%lx %d\n", in find_tzone_cdev()
241 tzi->trip_binding[cdev_id], in find_tzone_cdev()
249 return -ENODEV; in find_tzone_cdev()
255 * Before calling scan_tzones, thermal sysfs must be probed to determine
256 * the number of thermal zones and cooling devices.
257 * We loop through each thermal zone and fill in tz_info struct, i.e.
259 root@jacob-chiefriver:~# tree -d /sys/class/thermal/thermal_zone0
260 /sys/class/thermal/thermal_zone0
261 |-- cdev0 -> ../cooling_device4
262 |-- cdev1 -> ../cooling_device3
263 |-- cdev10 -> ../cooling_device7
264 |-- cdev11 -> ../cooling_device6
265 |-- cdev12 -> ../cooling_device5
266 |-- cdev2 -> ../cooling_device2
267 |-- cdev3 -> ../cooling_device1
268 |-- cdev4 -> ../cooling_device0
269 |-- cdev5 -> ../cooling_device12
270 |-- cdev6 -> ../cooling_device11
271 |-- cdev7 -> ../cooling_device10
272 |-- cdev8 -> ../cooling_device9
273 |-- cdev9 -> ../cooling_device8
274 |-- device -> ../../../LNXSYSTM:00/device:62/LNXTHERM:00
275 |-- power
276 `-- subsystem -> ../../../../class/thermal
286 return -1; in scan_tzones()
294 syslog(LOG_INFO, "Thermal zone %s skipped\n", tz_name); in scan_tzones()
308 while (n--) { in scan_tzones()
311 if (find_tzone_tp(tz_name, namelist[n]->d_name, in scan_tzones()
314 temp_str = strstr(namelist[n]->d_name, "cdev"); in scan_tzones()
370 while (n--) in scan_cdevs()
389 fprintf(stderr, "\nNo thermal sysfs, exit\n"); in probe_thermal_sysfs()
390 return -1; in probe_thermal_sysfs()
394 syslog(LOG_ERR, "scandir failed in thermal sysfs"); in probe_thermal_sysfs()
396 /* detect number of thermal zones and cooling devices */ in probe_thermal_sysfs()
397 while (n--) { in probe_thermal_sysfs()
400 if (strstr(namelist[n]->d_name, CDEV)) { in probe_thermal_sysfs()
401 inst = get_instance_id(namelist[n]->d_name, 1, in probe_thermal_sysfs()
402 sizeof("device") - 1); in probe_thermal_sysfs()
410 namelist[n]->d_name, in probe_thermal_sysfs()
414 } else if (strstr(namelist[n]->d_name, TZONE)) { in probe_thermal_sysfs()
415 inst = get_instance_id(namelist[n]->d_name, 1, in probe_thermal_sysfs()
416 sizeof("zone") - 1); in probe_thermal_sysfs()
421 namelist[n]->d_name, in probe_thermal_sysfs()
436 fprintf(stderr, "\nNo thermal zones found, exit\n\n"); in probe_thermal_sysfs()
437 return -1; in probe_thermal_sysfs()
443 return -1; in probe_thermal_sysfs()
446 /* we still show thermal zone information if there is no cdev */ in probe_thermal_sysfs()
453 return -1; in probe_thermal_sysfs()
459 return -1; in probe_thermal_sysfs()
461 return -1; in probe_thermal_sysfs()
473 return -ENOENT; in zone_instance_to_index()
476 /* read temperature of all thermal zones */
485 syslog(LOG_ERR, "No thermal zones found!\n"); in update_thermal_data()
486 return -1; in update_thermal_data()
562 int ctrl_cdev_id = -1; in get_ctrl_state()
576 if (ctrl_cdev_id == -1) { in get_ctrl_state()