xref: /openbsd/sys/dev/ofw/ofw_thermal.h (revision e5dd7070)
1 /*	$OpenBSD: ofw_thermal.h,v 1.2 2020/01/23 23:10:04 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 
27 	LIST_ENTRY(thermal_sensor) ts_list;
28 	uint32_t ts_phandle;
29 	uint32_t ts_cells;
30 };
31 
32 #define THERMAL_SENSOR_MAX	0xffffffffU
33 
34 struct cooling_device {
35 	int	cd_node;
36 	void	*cd_cookie;
37 
38 	uint32_t (*cd_get_level)(void *, uint32_t *);
39 	void	(*cd_set_level)(void *, uint32_t *, uint32_t);
40 
41 	LIST_ENTRY(cooling_device) cd_list;
42 	uint32_t cd_phandle;
43 	uint32_t cd_cells;
44 };
45 
46 #define THERMAL_NO_LIMIT	0xffffffffU
47 
48 void	thermal_sensor_register(struct thermal_sensor *);
49 void	thermal_sensor_update(struct thermal_sensor *, uint32_t *);
50 void	cooling_device_register(struct cooling_device *);
51 
52 void	thermal_init(void);
53 
54 #endif /* _DEV_OFW_THERMAL_H_ */
55