xref: /netbsd-src/sys/arch/macppc/dev/fancontrolvar.h (revision 4547d98da48785374856e74ae04001f3b2e4bbe4)
1*4547d98dSmacallan /* $NetBSD: fancontrolvar.h,v 1.2 2021/07/30 22:07:14 macallan Exp $ */
2c16eabe0Smacallan 
3c16eabe0Smacallan /*-
4c16eabe0Smacallan  * Copyright (c) 2021 Michael Lorenz
5c16eabe0Smacallan  * All rights reserved.
6c16eabe0Smacallan  *
7c16eabe0Smacallan  * Redistribution and use in source and binary forms, with or without
8c16eabe0Smacallan  * modification, are permitted provided that the following conditions
9c16eabe0Smacallan  * are met:
10c16eabe0Smacallan  * 1. Redistributions of source code must retain the above copyright
11c16eabe0Smacallan  *    notice, this list of conditions and the following disclaimer.
12c16eabe0Smacallan  * 2. Redistributions in binary form must reproduce the above copyright
13c16eabe0Smacallan  *    notice, this list of conditions and the following disclaimer in the
14c16eabe0Smacallan  *    documentation and/or other materials provided with the distribution.
15c16eabe0Smacallan  *
16c16eabe0Smacallan  * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
17c16eabe0Smacallan  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
18c16eabe0Smacallan  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
19c16eabe0Smacallan  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
20c16eabe0Smacallan  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
21c16eabe0Smacallan  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
22c16eabe0Smacallan  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
23c16eabe0Smacallan  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
24c16eabe0Smacallan  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
25c16eabe0Smacallan  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
26c16eabe0Smacallan  * POSSIBILITY OF SUCH DAMAGE.
27c16eabe0Smacallan  */
28c16eabe0Smacallan 
29c16eabe0Smacallan #ifndef FANCONTROLVAR_H
30c16eabe0Smacallan #define FANCONTROLVAR_H
31c16eabe0Smacallan 
32c16eabe0Smacallan #define FANCONTROL_MAX_FANS 10
33c16eabe0Smacallan 
34c16eabe0Smacallan typedef struct _fancontrol_fan_data {
35c16eabe0Smacallan 	const char *name;
36c16eabe0Smacallan 	int num, min_rpm, max_rpm;
37c16eabe0Smacallan } fancontrol_fan_data;
38c16eabe0Smacallan 
39c16eabe0Smacallan typedef struct _fancontrol_zone {
40c16eabe0Smacallan 	void *cookie;
41c16eabe0Smacallan 	const char *name;
42c16eabe0Smacallan 	bool (*filter)(const envsys_data_t *);
43c16eabe0Smacallan 	int (*get_rpm)(void *, int);
44c16eabe0Smacallan 	int (*set_rpm)(void *, int, int);
45c16eabe0Smacallan 	int nfans;
46c16eabe0Smacallan 	fancontrol_fan_data fans[FANCONTROL_MAX_FANS];
47c16eabe0Smacallan 	int Tmin, Tmax;		/* temperature range in this zone */
48c16eabe0Smacallan } fancontrol_zone_t;
49c16eabe0Smacallan 
50c16eabe0Smacallan int fancontrol_adjust_zone(fancontrol_zone_t *);
51*4547d98dSmacallan int fancontrol_init_zone(fancontrol_zone_t *, struct sysctlnode *);
52c16eabe0Smacallan 
53c16eabe0Smacallan #endif /* FANCONTROLVAR_H */
54