1 /* $OpenBSD: ofw_thermal.h,v 1.3 2024/06/27 09:37:07 kettenis Exp $ */ 2 /* 3 * Copyright (c) 2019 Mark Kettenis 4 * 5 * Permission to use, copy, modify, and distribute this software for any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 */ 17 18 #ifndef _DEV_OFW_THERMAL_H_ 19 #define _DEV_OFW_THERMAL_H_ 20 21 struct thermal_sensor { 22 int ts_node; 23 void *ts_cookie; 24 25 int32_t (*ts_get_temperature)(void *, uint32_t *); 26 int (*ts_set_limit)(void *, uint32_t *, uint32_t); 27 28 LIST_ENTRY(thermal_sensor) ts_list; 29 uint32_t ts_phandle; 30 uint32_t ts_cells; 31 }; 32 33 #define THERMAL_SENSOR_MAX 0xffffffffU 34 35 struct cooling_device { 36 int cd_node; 37 void *cd_cookie; 38 39 uint32_t (*cd_get_level)(void *, uint32_t *); 40 void (*cd_set_level)(void *, uint32_t *, uint32_t); 41 42 LIST_ENTRY(cooling_device) cd_list; 43 uint32_t cd_phandle; 44 uint32_t cd_cells; 45 }; 46 47 #define THERMAL_NO_LIMIT 0xffffffffU 48 49 void thermal_sensor_register(struct thermal_sensor *); 50 void thermal_sensor_update(struct thermal_sensor *, uint32_t *); 51 void cooling_device_register(struct cooling_device *); 52 53 void thermal_init(void); 54 55 #endif /* _DEV_OFW_THERMAL_H_ */ 56