summaryrefslogtreecommitdiff
path: root/sys/dev/ofw/ofw_thermal.h
blob: dc7769c4978888edd120fb04f18a833ee6c3c2bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
/*	$OpenBSD: ofw_thermal.h,v 1.1 2019/07/02 20:12:11 kettenis Exp $	*/
/*
 * Copyright (c) 2019 Mark Kettenis
 *
 * Permission to use, copy, modify, and distribute this software for any
 * purpose with or without fee is hereby granted, provided that the above
 * copyright notice and this permission notice appear in all copies.
 *
 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
 */

#ifndef _DEV_OFW_THERMAL_H_
#define _DEV_OFW_THERMAL_H_

struct thermal_sensor {
	int	ts_node;
	void	*ts_cookie;

	int32_t	(*ts_get_temperature)(void *, uint32_t *);

	LIST_ENTRY(thermal_sensor) ts_list;
	uint32_t ts_phandle;
	uint32_t ts_cells;
};

#define THERMAL_SENSOR_MAX	0xffffffffU

struct cooling_device {
	int	cd_node;
	void	*cd_cookie;

	uint32_t (*cd_get_level)(void *, uint32_t *);
	void	(*cd_set_level)(void *, uint32_t *, uint32_t);

	LIST_ENTRY(cooling_device) cd_list;
	uint32_t cd_phandle;
	uint32_t cd_cells;
};

#define THERMAL_NO_LIMIT	0xffffffffU

void	thermal_sensor_register(struct thermal_sensor *);
void	cooling_device_register(struct cooling_device *);

void	thermal_init(void);

#endif /* _DEV_OFW_THERMAL_H_ */