1 /* $NetBSD: dbcool_var.h,v 1.6 2009/11/02 21:37:44 christos Exp $ */
4 * Copyright (c) 2008 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
10 * Redistribution and use in source and binary forms, with or without
11 * modification, are permitted provided that the following conditions
13 * 1. Redistributions of source code must retain the above copyright
14 * notice, this list of conditions and the following disclaimer.
15 * 2. Redistributions in binary form must reproduce the above copyright
16 * notice, this list of conditions and the following disclaimer in the
17 * documentation and/or other materials provided with the distribution.
19 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29 * POSSIBILITY OF SUCH DAMAGE.
33 * A driver for dbCool(tm) family of environmental controllers
43 #include <sys/cdefs.h>
44 __KERNEL_RCSID(0, "$NetBSD: dbcool_var.h,v 1.6 2009/11/02 21:37:44 christos Exp $");
46 #include <dev/i2c/i2cvar.h>
48 #include <dev/sysmon/sysmonvar.h>
50 #include <dev/i2c/dbcool_reg.h>
60 enum dbc_sensor_type
{
68 #define DBCFLAG_TEMPOFFSET 0x0001
69 #define DBCFLAG_HAS_MAXDUTY 0x0002
70 #define DBCFLAG_HAS_SHDN 0x0004
71 #define DBCFLAG_MULTI_VCC 0x0008
72 #define DBCFLAG_4BIT_VER 0x0010
73 #define DBCFLAG_HAS_VID 0x0020
74 #define DBCFLAG_HAS_VID_SEL 0x0040
75 #define DBCFLAG_HAS_PECI 0x0080
76 #define DBCFLAG_ADM1027 0x1000
77 #define DBCFLAG_ADM1030 0x2000
78 #define DBCFLAG_ADT7466 0x4000
80 /* Maximum sensors for any dbCool device */
81 #define DBCOOL_MAXSENSORS 15
89 struct dbcool_sensor
{
90 enum dbc_sensor_type type
;
98 * The members of dbcool_power_control need to stay in the same order
99 * as the enum dbc_pwm_params above
101 struct dbcool_power_control
{
102 uint8_t power_regs
[DBC_PWM_LAST_PARAM
];
108 struct dbcool_chipset
{
111 void (*dc_writereg
)(struct dbcool_chipset
*, uint8_t, uint8_t);
112 uint8_t (*dc_readreg
)(struct dbcool_chipset
*, uint8_t);
113 struct chip_id
*dc_chip
;
116 struct dbcool_softc
{
118 struct sysmon_envsys
*sc_sme
;
119 struct dbcool_chipset sc_dc
;
120 envsys_data_t sc_sensor
[DBCOOL_MAXSENSORS
];
121 int sc_sysctl_num
[DBCOOL_MAXSENSORS
];
122 struct reg_list
*sc_regs
[DBCOOL_MAXSENSORS
];
123 int sc_nom_volt
[DBCOOL_MAXSENSORS
];
125 int64_t sc_supply_voltage
;
136 struct dbcool_sensor
*table
;
137 struct dbcool_power_control
*power
;
144 * Expose some routines for the macppc's ki2c match/attach routines
146 uint8_t dbcool_readreg(struct dbcool_chipset
*, uint8_t);
147 void dbcool_writereg(struct dbcool_chipset
*, uint8_t, uint8_t);
148 void dbcool_setup(device_t
);
149 int dbcool_chip_ident(struct dbcool_chipset
*);
150 bool dbcool_pmf_suspend(device_t
, pmf_qual_t
);
151 bool dbcool_pmf_resume(device_t
, pmf_qual_t
);
153 #endif /* def DBCOOLVAR_H */