Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
/* $NetBSD: nslm7x.c,v 1.30 2007/03/11 15:03:08 xtraeme Exp $ */
|
2000-02-25 05:17:43 +03:00
|
|
|
|
|
|
|
/*-
|
|
|
|
* Copyright (c) 2000 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
|
|
|
* by Bill Squier.
|
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2001-11-13 16:14:31 +03:00
|
|
|
#include <sys/cdefs.h>
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
__KERNEL_RCSID(0, "$NetBSD: nslm7x.c,v 1.30 2007/03/11 15:03:08 xtraeme Exp $");
|
2001-11-13 16:14:31 +03:00
|
|
|
|
2000-02-25 05:17:43 +03:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/proc.h>
|
|
|
|
#include <sys/device.h>
|
|
|
|
#include <sys/conf.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
|
|
|
|
#include <machine/bus.h>
|
|
|
|
|
|
|
|
#include <dev/isa/isareg.h>
|
|
|
|
#include <dev/isa/isavar.h>
|
|
|
|
|
2000-06-24 04:37:19 +04:00
|
|
|
#include <dev/sysmon/sysmonvar.h>
|
|
|
|
|
2000-02-25 05:17:43 +03:00
|
|
|
#include <dev/ic/nslm7xvar.h>
|
|
|
|
|
|
|
|
#include <machine/intr.h>
|
|
|
|
|
|
|
|
#if defined(LMDEBUG)
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
#define DPRINTF(x) do { printf x; } while (0)
|
2000-02-25 05:17:43 +03:00
|
|
|
#else
|
|
|
|
#define DPRINTF(x)
|
|
|
|
#endif
|
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
/*
|
|
|
|
* LM78-compatible chips can typically measure voltages up to 4.096 V.
|
|
|
|
* To measure higher voltages the input is attenuated with (external)
|
|
|
|
* resistors. Negative voltages are measured using inverting op amps
|
|
|
|
* and resistors. So we have to convert the sensor values back to
|
|
|
|
* real voltages by applying the appropriate resistor factor.
|
|
|
|
*/
|
|
|
|
#define RFACT_NONE 10000
|
|
|
|
#define RFACT(x, y) (RFACT_NONE * ((x) + (y)) / (y))
|
|
|
|
#define NRFACT(x, y) (-RFACT_NONE * (x) / (y))
|
|
|
|
|
2000-06-24 04:37:19 +04:00
|
|
|
const struct envsys_range lm_ranges[] = { /* sc->sensors sub-intervals */
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
/* for each unit type */
|
2000-02-25 05:17:43 +03:00
|
|
|
{ 7, 7, ENVSYS_STEMP },
|
|
|
|
{ 8, 10, ENVSYS_SFANRPM },
|
|
|
|
{ 1, 0, ENVSYS_SVOLTS_AC }, /* None */
|
|
|
|
{ 0, 6, ENVSYS_SVOLTS_DC },
|
|
|
|
{ 1, 0, ENVSYS_SOHMS }, /* None */
|
|
|
|
{ 1, 0, ENVSYS_SWATTS }, /* None */
|
|
|
|
{ 1, 0, ENVSYS_SAMPS } /* None */
|
|
|
|
};
|
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
static int lm_match(struct lm_softc *);
|
|
|
|
static int wb_match(struct lm_softc *);
|
|
|
|
static int def_match(struct lm_softc *);
|
2000-07-28 01:49:22 +04:00
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
static void lm_generic_banksel(struct lm_softc *, int);
|
|
|
|
static void lm_setup_sensors(struct lm_softc *, struct lm_sensor *);
|
2000-08-03 01:50:37 +04:00
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
static void lm_refresh_sensor_data(struct lm_softc *);
|
|
|
|
static void lm_refresh_volt(struct lm_softc *, int);
|
|
|
|
static void lm_refresh_temp(struct lm_softc *, int);
|
|
|
|
static void lm_refresh_fanrpm(struct lm_softc *, int);
|
2000-08-03 01:50:37 +04:00
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
static void wb_refresh_sensor_data(struct lm_softc *);
|
|
|
|
static void wb_w83637hf_refresh_vcore(struct lm_softc *, int);
|
|
|
|
static void wb_refresh_nvolt(struct lm_softc *, int);
|
|
|
|
static void wb_w83627ehf_refresh_nvolt(struct lm_softc *, int);
|
|
|
|
static void wb_refresh_temp(struct lm_softc *, int);
|
|
|
|
static void wb_refresh_fanrpm(struct lm_softc *, int);
|
|
|
|
static void wb_w83792d_refresh_fanrpm(struct lm_softc *, int);
|
2000-08-03 01:50:37 +04:00
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
static void as_refresh_temp(struct lm_softc *, int);
|
2000-07-31 02:23:53 +04:00
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
static int lm_gtredata(struct sysmon_envsys *, struct envsys_tre_data *);
|
|
|
|
static int generic_streinfo_fan(struct lm_softc *, struct envsys_basic_info *,
|
2005-02-04 05:10:35 +03:00
|
|
|
int, struct envsys_basic_info *);
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
static int lm_streinfo(struct sysmon_envsys *, struct envsys_basic_info *);
|
|
|
|
static int wb781_streinfo(struct sysmon_envsys *, struct envsys_basic_info *);
|
|
|
|
static int wb782_streinfo(struct sysmon_envsys *, struct envsys_basic_info *);
|
2000-07-28 01:49:22 +04:00
|
|
|
|
|
|
|
struct lm_chip {
|
2005-02-04 05:10:35 +03:00
|
|
|
int (*chip_match)(struct lm_softc *);
|
2000-07-28 01:49:22 +04:00
|
|
|
};
|
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
static struct lm_chip lm_chips[] = {
|
2000-08-03 01:50:37 +04:00
|
|
|
{ wb_match },
|
|
|
|
{ lm_match },
|
|
|
|
{ def_match } /* Must be last */
|
2000-07-28 01:49:22 +04:00
|
|
|
};
|
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
static struct lm_sensor lm78_sensors[] = {
|
|
|
|
/* Voltage */
|
|
|
|
{ "VCore A", ENVSYS_SVOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "VCore B", ENVSYS_SVOLTS_DC, 0, 0x21, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "+3.3V", ENVSYS_SVOLTS_DC, 0, 0x22, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "+5V", ENVSYS_SVOLTS_DC, 0, 0x23, lm_refresh_volt, RFACT(68, 100) },
|
|
|
|
{ "+12V", ENVSYS_SVOLTS_DC, 0, 0x24, lm_refresh_volt, RFACT(30, 10) },
|
|
|
|
{ "-12V", ENVSYS_SVOLTS_DC, 0, 0x25, lm_refresh_volt, NRFACT(240, 60) },
|
|
|
|
{ "-5V", ENVSYS_SVOLTS_DC, 0, 0x26, lm_refresh_volt, NRFACT(100, 60) },
|
|
|
|
|
|
|
|
/* Temperature */
|
|
|
|
{ "Temp0", ENVSYS_STEMP, 0, 0x27, lm_refresh_temp },
|
|
|
|
|
|
|
|
/* Fans */
|
|
|
|
{ "Fan0", ENVSYS_SFANRPM, 0, 0x28, lm_refresh_fanrpm },
|
|
|
|
{ "Fan1", ENVSYS_SFANRPM, 0, 0x29, lm_refresh_fanrpm },
|
|
|
|
{ "Fan2", ENVSYS_SFANRPM, 0, 0x2a, lm_refresh_fanrpm },
|
|
|
|
|
|
|
|
{ NULL }
|
|
|
|
};
|
2000-02-25 05:17:43 +03:00
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
static struct lm_sensor w83627hf_sensors[] = {
|
|
|
|
/* Voltage */
|
|
|
|
{ "VCore A", ENVSYS_SVOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "VCore B", ENVSYS_SVOLTS_DC, 0, 0x21, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "+3.3V", ENVSYS_SVOLTS_DC, 0, 0x22, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "+5V", ENVSYS_SVOLTS_DC, 0, 0x23, lm_refresh_volt, RFACT(34, 50) },
|
|
|
|
{ "+12V", ENVSYS_SVOLTS_DC, 0, 0x24, lm_refresh_volt, RFACT(28, 10) },
|
|
|
|
{ "-12V", ENVSYS_SVOLTS_DC, 0, 0x25, wb_refresh_nvolt, RFACT(232, 56) },
|
|
|
|
{ "-5V", ENVSYS_SVOLTS_DC, 0, 0x26, wb_refresh_nvolt, RFACT(120, 56) },
|
|
|
|
{ "5VSB", ENVSYS_SVOLTS_DC, 5, 0x50, lm_refresh_volt, RFACT(17, 33) },
|
|
|
|
{ "VBAT", ENVSYS_SVOLTS_DC, 5, 0x51, lm_refresh_volt, RFACT_NONE },
|
|
|
|
|
|
|
|
/* Temperature */
|
|
|
|
{ "Temp0", ENVSYS_STEMP, 0, 0x27, lm_refresh_temp },
|
|
|
|
{ "Temp1", ENVSYS_STEMP, 1, 0x50, wb_refresh_temp },
|
|
|
|
{ "Temp2", ENVSYS_STEMP, 2, 0x50, wb_refresh_temp },
|
|
|
|
|
|
|
|
/* Fans */
|
|
|
|
{ "Fan0", ENVSYS_SFANRPM, 0, 0x28, wb_refresh_fanrpm },
|
|
|
|
{ "Fan1", ENVSYS_SFANRPM, 0, 0x29, wb_refresh_fanrpm },
|
|
|
|
{ "Fan2", ENVSYS_SFANRPM, 0, 0x2a, wb_refresh_fanrpm },
|
|
|
|
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The W83627EHF can measure voltages up to 2.048 V instead of the
|
|
|
|
* traditional 4.096 V. For measuring positive voltages, this can be
|
|
|
|
* accounted for by halving the resistor factor. Negative voltages
|
|
|
|
* need special treatment, also because the reference voltage is 2.048 V
|
|
|
|
* instead of the traditional 3.6 V.
|
|
|
|
*/
|
|
|
|
static struct lm_sensor w83627ehf_sensors[] = {
|
|
|
|
/* Voltage */
|
|
|
|
{ "VCore", ENVSYS_SVOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE / 2},
|
|
|
|
{ "+12V", ENVSYS_SVOLTS_DC, 0, 0x21, lm_refresh_volt, RFACT(56, 10) / 2 },
|
|
|
|
{ "+3.3V", ENVSYS_SVOLTS_DC, 0, 0x22, lm_refresh_volt, RFACT(34, 34) / 2 },
|
|
|
|
{ "+3.3V", ENVSYS_SVOLTS_DC, 0, 0x23, lm_refresh_volt, RFACT(34, 24) / 2 },
|
|
|
|
{ "-12V", ENVSYS_SVOLTS_DC, 0, 0x24, wb_w83627ehf_refresh_nvolt },
|
|
|
|
{ "Unknown", ENVSYS_SVOLTS_DC, 0, 0x25, lm_refresh_volt, RFACT_NONE / 2 },
|
|
|
|
{ "Unknown", ENVSYS_SVOLTS_DC, 0, 0x26, lm_refresh_volt, RFACT_NONE / 2 },
|
|
|
|
{ "3.3VSB", ENVSYS_SVOLTS_DC, 5, 0x50, lm_refresh_volt, RFACT(34, 34) / 2 },
|
|
|
|
{ "VBAT", ENVSYS_SVOLTS_DC, 5, 0x51, lm_refresh_volt, RFACT_NONE / 2 },
|
|
|
|
{ "Unknown", ENVSYS_SVOLTS_DC, 5, 0x52, lm_refresh_volt, RFACT_NONE / 2 },
|
|
|
|
|
|
|
|
/* Temperature */
|
|
|
|
{ "Temp0", ENVSYS_STEMP, 0, 0x27, lm_refresh_temp },
|
|
|
|
{ "Temp1", ENVSYS_STEMP, 1, 0x50, wb_refresh_temp },
|
|
|
|
{ "Temp2", ENVSYS_STEMP, 2, 0x50, wb_refresh_temp },
|
|
|
|
|
|
|
|
/* Fans */
|
|
|
|
{ "Fan0", ENVSYS_SFANRPM, 0, 0x28, wb_refresh_fanrpm },
|
|
|
|
{ "Fan1", ENVSYS_SFANRPM, 0, 0x29, wb_refresh_fanrpm },
|
|
|
|
{ "Fan2", ENVSYS_SFANRPM, 0, 0x2a, wb_refresh_fanrpm },
|
|
|
|
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct lm_sensor w83627dhg_sensors[] = {
|
|
|
|
/* Voltage */
|
|
|
|
{ "VCore", ENVSYS_SVOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE / 2 },
|
|
|
|
{ "+12V", ENVSYS_SVOLTS_DC, 0, 0x21, lm_refresh_volt, RFACT(56, 10) / 2 },
|
|
|
|
{ "+3.3V", ENVSYS_SVOLTS_DC, 0, 0x22, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "+5V", ENVSYS_SVOLTS_DC, 0, 0x23, lm_refresh_volt, RFACT(17, 33) },
|
|
|
|
/*
|
|
|
|
* Disable the following sensors for now, I'm not sure which one
|
|
|
|
* is -12, -5, 3.3VSB or 5VSB.
|
|
|
|
*/
|
|
|
|
#if 0
|
|
|
|
{ "-12V", ENVSYS_SVOLTS_DC, 0, 0x24, wb_w83627ehf_refresh_nvolt },
|
|
|
|
{ "-5V", ENVSYS_SVOLTS_DC, 0, 0x25, wb_refresh_nvolt, RFACT(120, 56) },
|
|
|
|
{ "3.3VSB", ENVSYS_SVOLTS_DC, 0, 0x26, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "5VSB", ENVSYS_SVOLTS_DC, 5, 0x50, lm_refresh_volt, RFACT_NONE },
|
|
|
|
#endif
|
|
|
|
{ "VBAT", ENVSYS_SVOLTS_DC, 5, 0x51, lm_refresh_volt, RFACT_NONE },
|
2000-02-25 05:17:43 +03:00
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
/* Temperature */
|
|
|
|
{ "System Temp", ENVSYS_STEMP, 0, 0x27, lm_refresh_temp },
|
|
|
|
{ "CPU Temp", ENVSYS_STEMP, 1, 0x50, wb_refresh_temp },
|
|
|
|
{ "Aux Temp", ENVSYS_STEMP, 2, 0x50, wb_refresh_temp },
|
|
|
|
|
|
|
|
/* Fans */
|
|
|
|
{ "System Fan", ENVSYS_SFANRPM, 0, 0x28, wb_refresh_fanrpm },
|
|
|
|
{ "CPU Fan", ENVSYS_SFANRPM, 0, 0x29, wb_refresh_fanrpm },
|
|
|
|
{ "Aux Fan", ENVSYS_SFANRPM, 0, 0x2a, wb_refresh_fanrpm },
|
|
|
|
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct lm_sensor w83637hf_sensors[] = {
|
|
|
|
/* Voltage */
|
|
|
|
{ "VCore", ENVSYS_SVOLTS_DC, 0, 0x20, wb_w83637hf_refresh_vcore },
|
|
|
|
{ "+12V", ENVSYS_SVOLTS_DC, 0, 0x21, lm_refresh_volt, RFACT(28, 10) },
|
|
|
|
{ "+3.3V", ENVSYS_SVOLTS_DC, 0, 0x22, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "+5V", ENVSYS_SVOLTS_DC, 0, 0x23, lm_refresh_volt, RFACT(34, 51) },
|
|
|
|
{ "-12V", ENVSYS_SVOLTS_DC, 0, 0x24, wb_refresh_nvolt, RFACT(232, 56) },
|
|
|
|
{ "5VSB", ENVSYS_SVOLTS_DC, 5, 0x50, lm_refresh_volt, RFACT(34, 51) },
|
|
|
|
{ "VBAT", ENVSYS_SVOLTS_DC, 5, 0x51, lm_refresh_volt, RFACT_NONE },
|
|
|
|
|
|
|
|
/* Temperature */
|
|
|
|
{ "Temp0", ENVSYS_STEMP, 0, 0x27, lm_refresh_temp },
|
|
|
|
{ "Temp1", ENVSYS_STEMP, 1, 0x50, wb_refresh_temp },
|
|
|
|
{ "Temp2", ENVSYS_STEMP, 2, 0x50, wb_refresh_temp },
|
|
|
|
|
|
|
|
/* Fans */
|
|
|
|
{ "Fan0", ENVSYS_SFANRPM, 0, 0x28, wb_refresh_fanrpm },
|
|
|
|
{ "Fan1", ENVSYS_SFANRPM, 0, 0x29, wb_refresh_fanrpm },
|
|
|
|
{ "Fan2", ENVSYS_SFANRPM, 0, 0x2a, wb_refresh_fanrpm },
|
|
|
|
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct lm_sensor w83697hf_sensors[] = {
|
|
|
|
/* Voltage */
|
|
|
|
{ "VCore", ENVSYS_SVOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "+3.3V", ENVSYS_SVOLTS_DC, 0, 0x22, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "+5V", ENVSYS_SVOLTS_DC, 0, 0x23, lm_refresh_volt, RFACT(34, 50) },
|
|
|
|
{ "+12V", ENVSYS_SVOLTS_DC, 0, 0x24, lm_refresh_volt, RFACT(28, 10) },
|
|
|
|
{ "-12V", ENVSYS_SVOLTS_DC, 0, 0x25, wb_refresh_nvolt, RFACT(232, 56) },
|
|
|
|
{ "-5V", ENVSYS_SVOLTS_DC, 0, 0x26, wb_refresh_nvolt, RFACT(120, 56) },
|
|
|
|
{ "5VSB", ENVSYS_SVOLTS_DC, 5, 0x50, lm_refresh_volt, RFACT(17, 33) },
|
|
|
|
{ "VBAT", ENVSYS_SVOLTS_DC, 5, 0x51, lm_refresh_volt, RFACT_NONE },
|
|
|
|
|
|
|
|
/* Temperature */
|
|
|
|
{ "Temp0", ENVSYS_STEMP, 0, 0x27, lm_refresh_temp },
|
|
|
|
{ "Temp1", ENVSYS_STEMP, 1, 0x50, wb_refresh_temp },
|
|
|
|
|
|
|
|
/* Fans */
|
|
|
|
{ "Fan0", ENVSYS_SFANRPM, 0, 0x28, wb_refresh_fanrpm },
|
|
|
|
{ "Fan1", ENVSYS_SFANRPM, 0, 0x29, wb_refresh_fanrpm },
|
|
|
|
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The datasheet doesn't mention the (internal) resistors used for the
|
|
|
|
* +5V, but using the values from the W83782D datasheets seems to
|
|
|
|
* provide sensible results.
|
|
|
|
*/
|
|
|
|
static struct lm_sensor w83781d_sensors[] = {
|
|
|
|
/* Voltage */
|
|
|
|
{ "VCore A", ENVSYS_SVOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "VCore B", ENVSYS_SVOLTS_DC, 0, 0x21, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "+3.3V", ENVSYS_SVOLTS_DC, 0, 0x22, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "+5V", ENVSYS_SVOLTS_DC, 0, 0x23, lm_refresh_volt, RFACT(34, 50) },
|
|
|
|
{ "+12V", ENVSYS_SVOLTS_DC, 0, 0x24, lm_refresh_volt, RFACT(28, 10) },
|
|
|
|
{ "-12V", ENVSYS_SVOLTS_DC, 0, 0x25, lm_refresh_volt, NRFACT(2100, 604) },
|
|
|
|
{ "-5V", ENVSYS_SVOLTS_DC, 0, 0x26, lm_refresh_volt, NRFACT(909, 604) },
|
|
|
|
|
|
|
|
/* Temperature */
|
|
|
|
{ "Temp0", ENVSYS_STEMP, 0, 0x27, lm_refresh_temp },
|
|
|
|
{ "Temp1", ENVSYS_STEMP, 1, 0x50, wb_refresh_temp },
|
|
|
|
{ "Temp2", ENVSYS_STEMP, 2, 0x50, wb_refresh_temp },
|
|
|
|
|
|
|
|
/* Fans */
|
|
|
|
{ "Fan0", ENVSYS_SFANRPM, 0, 0x28, lm_refresh_fanrpm },
|
|
|
|
{ "Fan1", ENVSYS_SFANRPM, 0, 0x29, lm_refresh_fanrpm },
|
|
|
|
{ "Fan2", ENVSYS_SFANRPM, 0, 0x2a, lm_refresh_fanrpm },
|
|
|
|
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct lm_sensor w83782d_sensors[] = {
|
|
|
|
/* Voltage */
|
|
|
|
{ "VCore", ENVSYS_SVOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "VINR0", ENVSYS_SVOLTS_DC, 0, 0x21, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "+3.3V", ENVSYS_SVOLTS_DC, 0, 0x22, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "+5V", ENVSYS_SVOLTS_DC, 0, 0x23, lm_refresh_volt, RFACT(34, 50) },
|
|
|
|
{ "+12V", ENVSYS_SVOLTS_DC, 0, 0x24, lm_refresh_volt, RFACT(28, 10) },
|
|
|
|
{ "-12V", ENVSYS_SVOLTS_DC, 0, 0x25, wb_refresh_nvolt, RFACT(232, 56) },
|
|
|
|
{ "-5V", ENVSYS_SVOLTS_DC, 0, 0x26, wb_refresh_nvolt, RFACT(120, 56) },
|
|
|
|
{ "5VSB", ENVSYS_SVOLTS_DC, 5, 0x50, lm_refresh_volt, RFACT(17, 33) },
|
|
|
|
{ "VBAT", ENVSYS_SVOLTS_DC, 5, 0x51, lm_refresh_volt, RFACT_NONE },
|
|
|
|
|
|
|
|
/* Temperature */
|
|
|
|
{ "Temp0", ENVSYS_STEMP, 0, 0x27, lm_refresh_temp },
|
|
|
|
{ "Temp1", ENVSYS_STEMP, 1, 0x50, wb_refresh_temp },
|
|
|
|
{ "Temp2", ENVSYS_STEMP, 2, 0x50, wb_refresh_temp },
|
|
|
|
|
|
|
|
/* Fans */
|
|
|
|
{ "Fan0", ENVSYS_SFANRPM, 0, 0x28, wb_refresh_fanrpm },
|
|
|
|
{ "Fan1", ENVSYS_SFANRPM, 0, 0x29, wb_refresh_fanrpm },
|
|
|
|
{ "Fan2", ENVSYS_SFANRPM, 0, 0x2a, wb_refresh_fanrpm },
|
|
|
|
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct lm_sensor w83783s_sensors[] = {
|
|
|
|
/* Voltage */
|
|
|
|
{ "VCore", ENVSYS_SVOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "+3.3V", ENVSYS_SVOLTS_DC, 0, 0x22, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "+5V", ENVSYS_SVOLTS_DC, 0, 0x23, lm_refresh_volt, RFACT(34, 50) },
|
|
|
|
{ "+12V", ENVSYS_SVOLTS_DC, 0, 0x24, lm_refresh_volt, RFACT(28, 10) },
|
|
|
|
{ "-12V", ENVSYS_SVOLTS_DC, 0, 0x25, wb_refresh_nvolt, RFACT(232, 56) },
|
|
|
|
{ "-5V", ENVSYS_SVOLTS_DC, 0, 0x26, wb_refresh_nvolt, RFACT(120, 56) },
|
|
|
|
|
|
|
|
/* Temperature */
|
|
|
|
{ "Temp0", ENVSYS_STEMP, 0, 0x27, lm_refresh_temp },
|
|
|
|
{ "Temp1", ENVSYS_STEMP, 1, 0x50, wb_refresh_temp },
|
|
|
|
|
|
|
|
/* Fans */
|
|
|
|
{ "Fan0", ENVSYS_SFANRPM, 0, 0x28, wb_refresh_fanrpm },
|
|
|
|
{ "Fan1", ENVSYS_SFANRPM, 0, 0x29, wb_refresh_fanrpm },
|
|
|
|
{ "Fan2", ENVSYS_SFANRPM, 0, 0x2a, wb_refresh_fanrpm },
|
|
|
|
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct lm_sensor w83791d_sensors[] = {
|
|
|
|
/* Voltage */
|
|
|
|
{ "VCore", ENVSYS_SVOLTS_DC, 0, 0x20, lm_refresh_volt, 10000 },
|
|
|
|
{ "VINR0", ENVSYS_SVOLTS_DC, 0, 0x21, lm_refresh_volt, 10000 },
|
|
|
|
{ "+3.3V", ENVSYS_SVOLTS_DC, 0, 0x22, lm_refresh_volt, 10000 },
|
|
|
|
{ "+5V", ENVSYS_SVOLTS_DC, 0, 0x23, lm_refresh_volt, RFACT(34, 50) },
|
|
|
|
{ "+12V", ENVSYS_SVOLTS_DC, 0, 0x24, lm_refresh_volt, RFACT(28, 10) },
|
|
|
|
{ "-12V", ENVSYS_SVOLTS_DC, 0, 0x25, wb_refresh_nvolt, RFACT(232, 56) },
|
|
|
|
{ "-5V", ENVSYS_SVOLTS_DC, 0, 0x26, wb_refresh_nvolt, RFACT(120, 56) },
|
|
|
|
{ "5VSB", ENVSYS_SVOLTS_DC, 0, 0xb0, lm_refresh_volt, RFACT(17, 33) },
|
|
|
|
{ "VBAT", ENVSYS_SVOLTS_DC, 0, 0xb1, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "VINR1", ENVSYS_SVOLTS_DC, 0, 0xb2, lm_refresh_volt, RFACT_NONE },
|
|
|
|
|
|
|
|
/* Temperature */
|
|
|
|
{ "Temp0", ENVSYS_STEMP, 0, 0x27, lm_refresh_temp },
|
|
|
|
{ "Temp1", ENVSYS_STEMP, 0, 0xc0, wb_refresh_temp },
|
|
|
|
{ "Temp2", ENVSYS_STEMP, 0, 0xc8, wb_refresh_temp },
|
|
|
|
|
|
|
|
/* Fans */
|
|
|
|
{ "Fan0", ENVSYS_SFANRPM, 0, 0x28, wb_refresh_fanrpm },
|
|
|
|
{ "Fan1", ENVSYS_SFANRPM, 0, 0x29, wb_refresh_fanrpm },
|
|
|
|
{ "Fan2", ENVSYS_SFANRPM, 0, 0x2a, wb_refresh_fanrpm },
|
|
|
|
{ "Fan3", ENVSYS_SFANRPM, 0, 0xba, wb_refresh_fanrpm },
|
|
|
|
{ "Fan4", ENVSYS_SFANRPM, 0, 0xbb, wb_refresh_fanrpm },
|
|
|
|
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct lm_sensor w83792d_sensors[] = {
|
|
|
|
/* Voltage */
|
|
|
|
{ "VCore A", ENVSYS_SVOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "VCore B", ENVSYS_SVOLTS_DC, 0, 0x21, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "+3.3V", ENVSYS_SVOLTS_DC, 0, 0x22, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "-5V", ENVSYS_SVOLTS_DC, 0, 0x23, wb_refresh_nvolt, RFACT(120, 56) },
|
|
|
|
{ "+12V", ENVSYS_SVOLTS_DC, 0, 0x24, lm_refresh_volt, RFACT(28, 10) },
|
|
|
|
{ "-12V", ENVSYS_SVOLTS_DC, 0, 0x25, wb_refresh_nvolt, RFACT(232, 56) },
|
|
|
|
{ "+5V", ENVSYS_SVOLTS_DC, 0, 0x26, lm_refresh_volt, RFACT(34, 50) },
|
|
|
|
{ "5VSB", ENVSYS_SVOLTS_DC, 0, 0xb0, lm_refresh_volt, RFACT(17, 33) },
|
|
|
|
{ "VBAT", ENVSYS_SVOLTS_DC, 0, 0xb1, lm_refresh_volt, RFACT_NONE },
|
|
|
|
|
|
|
|
/* Temperature */
|
|
|
|
{ "Temp0", ENVSYS_STEMP, 0, 0x27, lm_refresh_temp },
|
|
|
|
{ "Temp1", ENVSYS_STEMP, 0, 0xc0, wb_refresh_temp },
|
|
|
|
{ "Temp2", ENVSYS_STEMP, 0, 0xc8, wb_refresh_temp },
|
|
|
|
|
|
|
|
/* Fans */
|
|
|
|
{ "Fan0", ENVSYS_SFANRPM, 0, 0x28, wb_w83792d_refresh_fanrpm },
|
|
|
|
{ "Fan1", ENVSYS_SFANRPM, 0, 0x29, wb_w83792d_refresh_fanrpm },
|
|
|
|
{ "Fan2", ENVSYS_SFANRPM, 0, 0x2a, wb_w83792d_refresh_fanrpm },
|
|
|
|
{ "Fan3", ENVSYS_SFANRPM, 0, 0xb8, wb_w83792d_refresh_fanrpm },
|
|
|
|
{ "Fan4", ENVSYS_SFANRPM, 0, 0xb9, wb_w83792d_refresh_fanrpm },
|
|
|
|
{ "Fan5", ENVSYS_SFANRPM, 0, 0xba, wb_w83792d_refresh_fanrpm },
|
|
|
|
{ "Fan6", ENVSYS_SFANRPM, 0, 0xbe, wb_w83792d_refresh_fanrpm },
|
|
|
|
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static struct lm_sensor as99127f_sensors[] = {
|
|
|
|
/* Voltage */
|
|
|
|
{ "VCore A", ENVSYS_SVOLTS_DC, 0, 0x20, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "VCore B", ENVSYS_SVOLTS_DC, 0, 0x21, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "+3.3V", ENVSYS_SVOLTS_DC, 0, 0x22, lm_refresh_volt, RFACT_NONE },
|
|
|
|
{ "+5V", ENVSYS_SVOLTS_DC, 0, 0x23, lm_refresh_volt, RFACT(34, 50) },
|
|
|
|
{ "+12V", ENVSYS_SVOLTS_DC, 0, 0x24, lm_refresh_volt, RFACT(28, 10) },
|
|
|
|
{ "-12V", ENVSYS_SVOLTS_DC, 0, 0x25, wb_refresh_nvolt, RFACT(232, 56) },
|
|
|
|
{ "-5V", ENVSYS_SVOLTS_DC, 0, 0x26, wb_refresh_nvolt, RFACT(120, 56) },
|
|
|
|
|
|
|
|
/* Temperature */
|
|
|
|
{ "Temp0", ENVSYS_STEMP, 0, 0x27, lm_refresh_temp },
|
|
|
|
{ "Temp1", ENVSYS_STEMP, 1, 0x50, as_refresh_temp },
|
|
|
|
{ "Temp2", ENVSYS_STEMP, 2, 0x50, as_refresh_temp },
|
|
|
|
|
|
|
|
/* Fans */
|
|
|
|
{ "Fan0", ENVSYS_SFANRPM, 0, 0x28, lm_refresh_fanrpm },
|
|
|
|
{ "Fan1", ENVSYS_SFANRPM, 0, 0x29, lm_refresh_fanrpm },
|
|
|
|
{ "Fan2", ENVSYS_SFANRPM, 0, 0x2a, lm_refresh_fanrpm },
|
|
|
|
|
|
|
|
{ NULL }
|
|
|
|
};
|
|
|
|
|
|
|
|
static void
|
|
|
|
lm_generic_banksel(struct lm_softc *lmsc, int bank)
|
|
|
|
{
|
2002-11-15 17:55:41 +03:00
|
|
|
(*lmsc->lm_writereg)(lmsc, WB_BANKSEL, bank);
|
2000-02-25 05:17:43 +03:00
|
|
|
}
|
|
|
|
|
2000-03-07 21:39:14 +03:00
|
|
|
/*
|
|
|
|
* bus independent probe
|
|
|
|
*/
|
|
|
|
int
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
lm_probe(bus_space_tag_t iot, bus_space_handle_t ioh)
|
2000-03-07 21:39:14 +03:00
|
|
|
{
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
uint8_t cr;
|
2000-03-07 21:39:14 +03:00
|
|
|
int rv;
|
|
|
|
|
|
|
|
/* Check for some power-on defaults */
|
|
|
|
bus_space_write_1(iot, ioh, LMC_ADDR, LMD_CONFIG);
|
|
|
|
|
|
|
|
/* Perform LM78 reset */
|
|
|
|
bus_space_write_1(iot, ioh, LMC_DATA, 0x80);
|
|
|
|
|
|
|
|
/* XXX - Why do I have to reselect the register? */
|
|
|
|
bus_space_write_1(iot, ioh, LMC_ADDR, LMD_CONFIG);
|
|
|
|
cr = bus_space_read_1(iot, ioh, LMC_DATA);
|
|
|
|
|
|
|
|
/* XXX - spec says *only* 0x08! */
|
2005-10-15 04:41:48 +04:00
|
|
|
if ((cr == 0x08) || (cr == 0x01) || (cr == 0x03))
|
2000-03-07 21:39:14 +03:00
|
|
|
rv = 1;
|
|
|
|
else
|
|
|
|
rv = 0;
|
|
|
|
|
|
|
|
DPRINTF(("lm: rv = %d, cr = %x\n", rv, cr));
|
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
return rv;
|
2000-03-07 21:39:14 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2000-02-25 05:17:43 +03:00
|
|
|
/*
|
|
|
|
* pre: lmsc contains valid busspace tag and handle
|
|
|
|
*/
|
|
|
|
void
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
lm_attach(struct lm_softc *lmsc)
|
2000-02-25 05:17:43 +03:00
|
|
|
{
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
uint32_t i;
|
2000-02-25 05:17:43 +03:00
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
for (i = 0; i < __arraycount(lm_chips); i++)
|
2000-07-28 01:49:22 +04:00
|
|
|
if (lm_chips[i].chip_match(lmsc))
|
|
|
|
break;
|
2000-02-25 05:17:43 +03:00
|
|
|
|
|
|
|
/* Start the monitoring loop */
|
2002-11-15 17:55:41 +03:00
|
|
|
(*lmsc->lm_writereg)(lmsc, LMD_CONFIG, 0x01);
|
2000-02-25 05:17:43 +03:00
|
|
|
|
|
|
|
/* Indicate we have never read the registers */
|
|
|
|
timerclear(&lmsc->lastread);
|
|
|
|
|
|
|
|
/* Initialize sensors */
|
2000-07-28 01:49:22 +04:00
|
|
|
for (i = 0; i < lmsc->numsensors; ++i) {
|
2000-02-25 05:17:43 +03:00
|
|
|
lmsc->sensors[i].sensor = lmsc->info[i].sensor = i;
|
|
|
|
lmsc->sensors[i].validflags = (ENVSYS_FVALID|ENVSYS_FCURVALID);
|
|
|
|
lmsc->info[i].validflags = ENVSYS_FVALID;
|
|
|
|
lmsc->sensors[i].warnflags = ENVSYS_WARN_OK;
|
|
|
|
}
|
2000-06-24 04:37:19 +04:00
|
|
|
/*
|
|
|
|
* Hook into the System Monitor.
|
|
|
|
*/
|
|
|
|
lmsc->sc_sysmon.sme_ranges = lm_ranges;
|
|
|
|
lmsc->sc_sysmon.sme_sensor_info = lmsc->info;
|
|
|
|
lmsc->sc_sysmon.sme_sensor_data = lmsc->sensors;
|
|
|
|
lmsc->sc_sysmon.sme_cookie = lmsc;
|
2000-02-25 05:17:43 +03:00
|
|
|
|
2000-06-24 04:37:19 +04:00
|
|
|
lmsc->sc_sysmon.sme_gtredata = lm_gtredata;
|
2000-07-28 01:49:22 +04:00
|
|
|
/* sme_streinfo set in chip-specific attach */
|
2000-02-25 05:17:43 +03:00
|
|
|
|
2000-07-28 01:49:22 +04:00
|
|
|
lmsc->sc_sysmon.sme_nsensors = lmsc->numsensors;
|
2000-06-24 04:37:19 +04:00
|
|
|
lmsc->sc_sysmon.sme_envsys_version = 1000;
|
2000-02-25 05:17:43 +03:00
|
|
|
|
2000-06-24 04:37:19 +04:00
|
|
|
if (sysmon_envsys_register(&lmsc->sc_sysmon))
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
aprint_error("%s: unable to register with sysmon\n",
|
2000-06-24 04:37:19 +04:00
|
|
|
lmsc->sc_dev.dv_xname);
|
2000-02-25 05:17:43 +03:00
|
|
|
}
|
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
static int
|
|
|
|
lm_match(struct lm_softc *sc)
|
2000-07-28 01:49:22 +04:00
|
|
|
{
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
const char *model = NULL;
|
|
|
|
int chipid;
|
2000-07-28 01:49:22 +04:00
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
/* See if we have an LM78/LM78J/LM79 or LM81 */
|
|
|
|
chipid = (*sc->lm_readreg)(sc, LMD_CHIPID) & LM_ID_MASK;
|
|
|
|
switch(chipid) {
|
2000-07-28 01:49:22 +04:00
|
|
|
case LM_ID_LM78:
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
model = "LM78";
|
2000-07-28 01:49:22 +04:00
|
|
|
break;
|
|
|
|
case LM_ID_LM78J:
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
model = "LM78J";
|
2000-07-28 01:49:22 +04:00
|
|
|
break;
|
|
|
|
case LM_ID_LM79:
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
model = "LM79";
|
2000-07-28 01:49:22 +04:00
|
|
|
break;
|
2002-04-05 20:11:47 +04:00
|
|
|
case LM_ID_LM81:
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
model = "LM81";
|
2002-04-05 20:11:47 +04:00
|
|
|
break;
|
2000-07-28 01:49:22 +04:00
|
|
|
default:
|
|
|
|
return 0;
|
|
|
|
}
|
2000-02-25 05:17:43 +03:00
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
aprint_normal(": National Semiconductor %s Hardware monitor\n", model);
|
2000-07-28 01:49:22 +04:00
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
lm_setup_sensors(sc, lm78_sensors);
|
|
|
|
sc->sc_sysmon.sme_streinfo = lm_streinfo;
|
|
|
|
sc->refresh_sensor_data = lm_refresh_sensor_data;
|
2000-07-28 01:49:22 +04:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
static int
|
|
|
|
def_match(struct lm_softc *sc)
|
2000-07-28 01:49:22 +04:00
|
|
|
{
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
int chipid;
|
2000-07-28 01:49:22 +04:00
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
chipid = (*sc->lm_readreg)(sc, LMD_CHIPID) & LM_ID_MASK;
|
|
|
|
aprint_error(": Unknown chip (ID %d)\n", chipid);
|
2000-02-25 05:17:43 +03:00
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
lm_setup_sensors(sc, lm78_sensors);
|
2000-07-28 01:49:22 +04:00
|
|
|
sc->sc_sysmon.sme_streinfo = lm_streinfo;
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
sc->refresh_sensor_data = lm_refresh_sensor_data;
|
|
|
|
return 1;
|
2000-02-25 05:17:43 +03:00
|
|
|
}
|
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
static int
|
|
|
|
wb_match(struct lm_softc *sc)
|
2000-07-28 01:49:22 +04:00
|
|
|
{
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
const char *model;
|
|
|
|
int banksel, vendid, devid;
|
|
|
|
|
|
|
|
model = NULL;
|
2000-07-31 02:23:53 +04:00
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
/* Read vendor ID */
|
|
|
|
banksel = (*sc->lm_readreg)(sc, WB_BANKSEL);
|
|
|
|
lm_generic_banksel(sc, WB_BANKSEL_HBAC);
|
2000-07-31 02:23:53 +04:00
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
vendid = (*sc->lm_readreg)(sc, WB_VENDID) << 8;
|
|
|
|
lm_generic_banksel(sc, 0);
|
|
|
|
vendid |= (*sc->lm_readreg)(sc, WB_VENDID);
|
|
|
|
DPRINTF(("winbond vend id 0x%x\n", vendid));
|
|
|
|
if (vendid != WB_VENDID_WINBOND && vendid != WB_VENDID_ASUS)
|
|
|
|
return 0;
|
2000-07-31 02:23:53 +04:00
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
/* Read device/chip ID */
|
|
|
|
lm_generic_banksel(sc, WB_BANKSEL_B0);
|
|
|
|
devid = (*sc->lm_readreg)(sc, LMD_CHIPID);
|
|
|
|
sc->chipid = (*sc->lm_readreg)(sc, WB_BANK0_CHIPID);
|
|
|
|
lm_generic_banksel(sc, banksel);
|
|
|
|
DPRINTF(("winbond chip id 0x%x\n", sc->chipid));
|
|
|
|
|
|
|
|
switch(sc->chipid) {
|
|
|
|
case WB_CHIPID_W83627HF:
|
|
|
|
model = "W83627HF";
|
|
|
|
lm_setup_sensors(sc, w83627hf_sensors);
|
|
|
|
break;
|
|
|
|
case WB_CHIPID_W83627THF:
|
|
|
|
model = "W83627THF";
|
|
|
|
lm_setup_sensors(sc, w83637hf_sensors);
|
|
|
|
break;
|
|
|
|
case WB_CHIPID_W83627EHF:
|
|
|
|
model = "W83627EHF";
|
|
|
|
lm_setup_sensors(sc, w83627ehf_sensors);
|
|
|
|
break;
|
|
|
|
case WB_CHIPID_W83627DHG:
|
|
|
|
model = "W83627DHG";
|
|
|
|
lm_setup_sensors(sc, w83627dhg_sensors);
|
|
|
|
break;
|
|
|
|
case WB_CHIPID_W83637HF:
|
|
|
|
model = "W83637HF";
|
|
|
|
lm_generic_banksel(sc, WB_BANKSEL_B0);
|
|
|
|
if ((*sc->lm_readreg)(sc, WB_BANK0_CONFIG) & WB_CONFIG_VMR9)
|
|
|
|
sc->vrm9 = 1;
|
|
|
|
lm_generic_banksel(sc, banksel);
|
|
|
|
lm_setup_sensors(sc, w83637hf_sensors);
|
|
|
|
break;
|
|
|
|
case WB_CHIPID_W83697HF:
|
|
|
|
model = "W83697HF";
|
|
|
|
lm_setup_sensors(sc, w83697hf_sensors);
|
|
|
|
break;
|
|
|
|
case WB_CHIPID_W83781D:
|
|
|
|
case WB_CHIPID_W83781D_2:
|
|
|
|
model = "W83781D";
|
|
|
|
lm_setup_sensors(sc, w83781d_sensors);
|
2000-07-31 02:23:53 +04:00
|
|
|
sc->sc_sysmon.sme_streinfo = wb781_streinfo;
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
break;
|
|
|
|
case WB_CHIPID_W83782D:
|
|
|
|
model = "W83782D";
|
|
|
|
lm_setup_sensors(sc, w83782d_sensors);
|
2000-08-03 01:50:37 +04:00
|
|
|
sc->sc_sysmon.sme_streinfo = wb782_streinfo;
|
2000-07-31 02:23:53 +04:00
|
|
|
break;
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
case WB_CHIPID_W83783S:
|
|
|
|
model = "W83783S";
|
|
|
|
lm_setup_sensors(sc, w83783s_sensors);
|
|
|
|
break;
|
|
|
|
case WB_CHIPID_W83791D:
|
|
|
|
model = "W83791D";
|
|
|
|
lm_setup_sensors(sc, w83791d_sensors);
|
2000-07-31 02:23:53 +04:00
|
|
|
break;
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
case WB_CHIPID_W83791SD:
|
|
|
|
model = "W83791SD";
|
|
|
|
break;
|
|
|
|
case WB_CHIPID_W83792D:
|
|
|
|
model = "W83792D";
|
|
|
|
lm_setup_sensors(sc, w83792d_sensors);
|
|
|
|
break;
|
|
|
|
case WB_CHIPID_AS99127F:
|
|
|
|
if (vendid == WB_VENDID_ASUS) {
|
|
|
|
model = "AS99127F";
|
|
|
|
lm_setup_sensors(sc, w83781d_sensors);
|
|
|
|
} else {
|
|
|
|
model = "AS99127F rev 2";
|
|
|
|
lm_setup_sensors(sc, as99127f_sensors);
|
|
|
|
}
|
2005-10-15 04:41:48 +04:00
|
|
|
break;
|
2000-07-31 02:23:53 +04:00
|
|
|
default:
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
aprint_normal(": unknown Winbond chip (ID 0x%x)\n",
|
|
|
|
sc->chipid);
|
|
|
|
/* Handle as a standard LM78. */
|
|
|
|
lm_setup_sensors(sc, lm78_sensors);
|
|
|
|
sc->refresh_sensor_data = lm_refresh_sensor_data;
|
2000-07-31 02:23:53 +04:00
|
|
|
return 1;
|
|
|
|
}
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
|
|
|
|
aprint_normal(": Winbond %s Hardware monitor\n", model);
|
|
|
|
|
|
|
|
sc->sc_sysmon.sme_streinfo = lm_streinfo;
|
|
|
|
sc->refresh_sensor_data = wb_refresh_sensor_data;
|
2000-08-03 01:50:37 +04:00
|
|
|
return 1;
|
|
|
|
}
|
2000-07-28 01:49:22 +04:00
|
|
|
|
2000-08-03 01:50:37 +04:00
|
|
|
static void
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
lm_setup_sensors(struct lm_softc *sc, struct lm_sensor *sensors)
|
2000-08-03 01:50:37 +04:00
|
|
|
{
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; sensors[i].desc; i++) {
|
|
|
|
sc->sensors[i].units = sc->info[i].units = sensors[i].type;
|
|
|
|
strlcpy(sc->info[i].desc, sensors[i].desc,
|
|
|
|
sizeof(sc->info[i].desc));
|
|
|
|
sc->numsensors++;
|
|
|
|
}
|
|
|
|
sc->lm_sensors = sensors;
|
2000-08-03 01:50:37 +04:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
lm_refresh_sensor_data(struct lm_softc *sc)
|
2000-08-03 01:50:37 +04:00
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
/* Refresh our stored data for every sensor */
|
|
|
|
for (i = 0; i < sc->numsensors; i++)
|
|
|
|
sc->lm_sensors[i].refresh(sc, i);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
lm_refresh_volt(struct lm_softc *sc, int n)
|
|
|
|
{
|
|
|
|
int data;
|
|
|
|
|
|
|
|
data = (*sc->lm_readreg)(sc, sc->lm_sensors[n].reg);
|
|
|
|
DPRINTF(("%s: volt[%d] 0x%x\n", __func__, n, data));
|
|
|
|
sc->sensors[n].cur.data_s = (data << 4);
|
|
|
|
sc->sensors[n].cur.data_s *= sc->lm_sensors[n].rfact;
|
|
|
|
sc->sensors[n].cur.data_s /= 10;
|
|
|
|
sc->info[n].rfact = sc->lm_sensors[n].rfact;
|
|
|
|
}
|
|
|
|
|
|
|
|
#define INVALIDATE_SENSOR(x) \
|
|
|
|
do { \
|
|
|
|
sc->sensors[(x)].validflags &= ~ENVSYS_FCURVALID; \
|
|
|
|
sc->sensors[(x)].cur.data_us = 0; \
|
|
|
|
} while (/* CONSTCOND */ 0)
|
|
|
|
|
|
|
|
static void
|
|
|
|
lm_refresh_temp(struct lm_softc *sc, int n)
|
|
|
|
{
|
|
|
|
int sdata;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The data sheet suggests that the range of the temperature
|
|
|
|
* sensor is between -55 degC and +125 degC.
|
|
|
|
*/
|
|
|
|
sdata = (*sc->lm_readreg)(sc, sc->lm_sensors[n].reg);
|
|
|
|
if (sdata > 0x7d && sdata < 0xc9) {
|
|
|
|
INVALIDATE_SENSOR(n);
|
|
|
|
} else {
|
|
|
|
if (sdata & 0x80)
|
|
|
|
sdata -= 0x100;
|
|
|
|
sc->sensors[n].validflags |= (ENVSYS_FVALID|ENVSYS_FCURVALID);
|
|
|
|
sc->sensors[n].cur.data_us = sdata * 1000000 + 273150000;
|
2000-08-03 01:50:37 +04:00
|
|
|
}
|
|
|
|
}
|
2000-07-28 01:49:22 +04:00
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
static void
|
|
|
|
lm_refresh_fanrpm(struct lm_softc *sc, int n)
|
|
|
|
{
|
|
|
|
int data, divisor = 1;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* We might get more accurate fan readings by adjusting the
|
|
|
|
* divisor, but that might interfere with APM or other SMM
|
|
|
|
* BIOS code reading the fan speeds.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/* FAN3 has a fixed fan divisor. */
|
|
|
|
if (sc->lm_sensors[n].reg == LMD_FAN1 ||
|
|
|
|
sc->lm_sensors[n].reg == LMD_FAN2) {
|
|
|
|
data = (*sc->lm_readreg)(sc, LMD_VIDFAN);
|
|
|
|
if (sc->lm_sensors[n].reg == LMD_FAN1)
|
|
|
|
divisor = (data >> 4) & 0x03;
|
|
|
|
else
|
|
|
|
divisor = (data >> 6) & 0x03;
|
|
|
|
}
|
|
|
|
|
|
|
|
data = (*sc->lm_readreg)(sc, sc->lm_sensors[n].reg);
|
|
|
|
if (data == 0xff || data == 0x00) {
|
|
|
|
INVALIDATE_SENSOR(n);
|
|
|
|
} else {
|
|
|
|
sc->sensors[n].validflags |= (ENVSYS_FVALID|ENVSYS_FCURVALID);
|
|
|
|
sc->sensors[n].cur.data_us = 1350000 / (data << divisor);
|
|
|
|
}
|
|
|
|
}
|
2000-07-28 01:49:22 +04:00
|
|
|
|
2000-08-03 01:50:37 +04:00
|
|
|
static void
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
wb_refresh_sensor_data(struct lm_softc *sc)
|
2000-08-03 01:50:37 +04:00
|
|
|
{
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
int banksel, bank, i;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Properly save and restore bank selection register.
|
|
|
|
*/
|
|
|
|
|
|
|
|
banksel = bank = sc->lm_readreg(sc, WB_BANKSEL);
|
|
|
|
for (i = 0; i < sc->numsensors; i++) {
|
|
|
|
if (bank != sc->lm_sensors[i].bank) {
|
|
|
|
bank = sc->lm_sensors[i].bank;
|
|
|
|
lm_generic_banksel(sc, bank);
|
|
|
|
}
|
|
|
|
sc->lm_sensors[i].refresh(sc, i);
|
2000-07-28 01:49:22 +04:00
|
|
|
}
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
lm_generic_banksel(sc, banksel);
|
2000-07-28 01:49:22 +04:00
|
|
|
}
|
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
static void
|
|
|
|
wb_w83637hf_refresh_vcore(struct lm_softc *sc, int n)
|
|
|
|
{
|
|
|
|
int data;
|
|
|
|
|
|
|
|
data = (*sc->lm_readreg)(sc, sc->lm_sensors[n].reg);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Depending on the voltage detection method,
|
|
|
|
* one of the following formulas is used:
|
|
|
|
* VRM8 method: value = raw * 0.016V
|
|
|
|
* VRM9 method: value = raw * 0.00488V + 0.70V
|
|
|
|
*/
|
|
|
|
if (sc->vrm9)
|
|
|
|
sc->sensors[n].cur.data_s = (data * 4880) + 700000;
|
|
|
|
else
|
|
|
|
sc->sensors[n].cur.data_s = (data * 16000);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
wb_refresh_nvolt(struct lm_softc *sc, int n)
|
|
|
|
{
|
|
|
|
int data;
|
|
|
|
|
|
|
|
data = (*sc->lm_readreg)(sc, sc->lm_sensors[n].reg);
|
|
|
|
sc->sensors[n].cur.data_s = ((data << 4) - WB_VREF);
|
|
|
|
sc->sensors[n].cur.data_s *= sc->lm_sensors[n].rfact;
|
|
|
|
sc->sensors[n].cur.data_s /= 10;
|
|
|
|
sc->sensors[n].cur.data_s += WB_VREF * 1000;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
wb_w83627ehf_refresh_nvolt(struct lm_softc *sc, int n)
|
|
|
|
{
|
|
|
|
int data;
|
|
|
|
|
|
|
|
data = (*sc->lm_readreg)(sc, sc->lm_sensors[n].reg);
|
|
|
|
sc->sensors[n].cur.data_s = ((data << 3) - WB_W83627EHF_VREF);
|
|
|
|
sc->sensors[n].cur.data_s *= RFACT(232, 10);
|
|
|
|
sc->sensors[n].cur.data_s /= 10;
|
|
|
|
sc->sensors[n].cur.data_s += WB_W83627EHF_VREF * 1000;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
wb_refresh_temp(struct lm_softc *sc, int n)
|
|
|
|
{
|
|
|
|
int sdata;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The data sheet suggests that the range of the temperature
|
|
|
|
* sensor is between -55 degC and +125 degC. However, values
|
|
|
|
* around -48 degC seem to be a very common bogus values.
|
|
|
|
* Since such values are unreasonably low, we use -45 degC for
|
|
|
|
* the lower limit instead.
|
|
|
|
*/
|
|
|
|
sdata = (*sc->lm_readreg)(sc, sc->lm_sensors[n].reg) << 1;
|
|
|
|
sdata += (*sc->lm_readreg)(sc, sc->lm_sensors[n].reg + 1) >> 7;
|
|
|
|
if (sdata > 0x0fa && sdata < 0x1a6) {
|
|
|
|
INVALIDATE_SENSOR(n);
|
|
|
|
} else {
|
|
|
|
if (sdata & 0x100)
|
|
|
|
sdata -= 0x200;
|
|
|
|
sc->sensors[n].validflags |= (ENVSYS_FVALID|ENVSYS_FCURVALID);
|
|
|
|
sc->sensors[n].cur.data_us = sdata * 500000 + 273150000;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
wb_refresh_fanrpm(struct lm_softc *sc, int n)
|
|
|
|
{
|
|
|
|
int fan, data, divisor = 0;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* This is madness; the fan divisor bits are scattered all
|
|
|
|
* over the place.
|
|
|
|
*/
|
|
|
|
|
|
|
|
if (sc->lm_sensors[n].reg == LMD_FAN1 ||
|
|
|
|
sc->lm_sensors[n].reg == LMD_FAN2 ||
|
|
|
|
sc->lm_sensors[n].reg == LMD_FAN3) {
|
|
|
|
data = (*sc->lm_readreg)(sc, WB_BANK0_VBAT);
|
|
|
|
fan = (sc->lm_sensors[n].reg - LMD_FAN1);
|
|
|
|
if ((data >> 5) & (1 << fan))
|
|
|
|
divisor |= 0x04;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (sc->lm_sensors[n].reg == LMD_FAN1 ||
|
|
|
|
sc->lm_sensors[n].reg == LMD_FAN2) {
|
|
|
|
data = (*sc->lm_readreg)(sc, LMD_VIDFAN);
|
|
|
|
if (sc->lm_sensors[n].reg == LMD_FAN1)
|
|
|
|
divisor |= (data >> 4) & 0x03;
|
|
|
|
else
|
|
|
|
divisor |= (data >> 6) & 0x03;
|
|
|
|
} else if (sc->lm_sensors[n].reg == LMD_FAN3) {
|
|
|
|
data = (*sc->lm_readreg)(sc, WB_PIN);
|
|
|
|
divisor |= (data >> 6) & 0x03;
|
|
|
|
} else if (sc->lm_sensors[n].reg == WB_BANK0_FAN4 ||
|
|
|
|
sc->lm_sensors[n].reg == WB_BANK0_FAN5) {
|
|
|
|
data = (*sc->lm_readreg)(sc, WB_BANK0_FAN45);
|
|
|
|
if (sc->lm_sensors[n].reg == WB_BANK0_FAN4)
|
|
|
|
divisor |= (data >> 0) & 0x07;
|
|
|
|
else
|
|
|
|
divisor |= (data >> 4) & 0x07;
|
|
|
|
}
|
|
|
|
|
|
|
|
data = (*sc->lm_readreg)(sc, sc->lm_sensors[n].reg);
|
|
|
|
if (data == 0xff || data == 0x00) {
|
|
|
|
INVALIDATE_SENSOR(n);
|
|
|
|
} else {
|
|
|
|
sc->sensors[n].validflags |= (ENVSYS_FVALID|ENVSYS_FCURVALID);
|
|
|
|
sc->sensors[n].cur.data_us = 1350000 / (data << divisor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
wb_w83792d_refresh_fanrpm(struct lm_softc *sc, int n)
|
|
|
|
{
|
|
|
|
int reg, shift, data, divisor = 1;
|
|
|
|
|
|
|
|
shift = 0;
|
|
|
|
|
|
|
|
switch (sc->lm_sensors[n].reg) {
|
|
|
|
case 0x28:
|
|
|
|
reg = 0x47; shift = 0;
|
|
|
|
break;
|
|
|
|
case 0x29:
|
|
|
|
reg = 0x47; shift = 4;
|
|
|
|
break;
|
|
|
|
case 0x2a:
|
|
|
|
reg = 0x5b; shift = 0;
|
|
|
|
break;
|
|
|
|
case 0xb8:
|
|
|
|
reg = 0x5b; shift = 4;
|
|
|
|
break;
|
|
|
|
case 0xb9:
|
|
|
|
reg = 0x5c; shift = 0;
|
|
|
|
break;
|
|
|
|
case 0xba:
|
|
|
|
reg = 0x5c; shift = 4;
|
|
|
|
break;
|
|
|
|
case 0xbe:
|
|
|
|
reg = 0x9e; shift = 0;
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
reg = 0;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
data = (*sc->lm_readreg)(sc, sc->lm_sensors[n].reg);
|
|
|
|
if (data == 0xff || data == 0x00) {
|
|
|
|
INVALIDATE_SENSOR(n);
|
|
|
|
} else {
|
|
|
|
if (reg != 0)
|
|
|
|
divisor = ((*sc->lm_readreg)(sc, reg) >> shift) & 0x7;
|
|
|
|
sc->sensors[n].validflags |= (ENVSYS_FVALID|ENVSYS_FCURVALID);
|
|
|
|
sc->sensors[n].cur.data_us = 1350000 / (data << divisor);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
as_refresh_temp(struct lm_softc *sc, int n)
|
|
|
|
{
|
|
|
|
int sdata;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* It seems a shorted temperature diode produces an all-ones
|
|
|
|
* bit pattern.
|
|
|
|
*/
|
|
|
|
sdata = (*sc->lm_readreg)(sc, sc->lm_sensors[n].reg) << 1;
|
|
|
|
sdata += (*sc->lm_readreg)(sc, sc->lm_sensors[n].reg + 1) >> 7;
|
|
|
|
if (sdata == 0x1ff) {
|
|
|
|
INVALIDATE_SENSOR(n);
|
|
|
|
} else {
|
|
|
|
if (sdata & 0x100)
|
|
|
|
sdata -= 0x200;
|
|
|
|
sc->sensors[n].validflags |= (ENVSYS_FVALID|ENVSYS_FCURVALID);
|
|
|
|
sc->sensors[n].cur.data_us = sdata * 500000 + 273150000;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
#undef INVALIDATE_SENSOR
|
|
|
|
|
|
|
|
static int
|
|
|
|
lm_gtredata(struct sysmon_envsys *sme, envsys_tre_data_t *tred)
|
2000-07-28 01:49:22 +04:00
|
|
|
{
|
2006-06-08 02:33:33 +04:00
|
|
|
static const struct timeval onepointfive = { 1, 500000 };
|
|
|
|
struct timeval t, utv;
|
|
|
|
struct lm_softc *sc = sme->sme_cookie;
|
|
|
|
|
|
|
|
/* read new values at most once every 1.5 seconds */
|
|
|
|
getmicrouptime(&utv);
|
|
|
|
timeradd(&sc->lastread, &onepointfive, &t);
|
|
|
|
if (timercmp(&utv, &t, >)) {
|
|
|
|
sc->lastread = utv;
|
|
|
|
sc->refresh_sensor_data(sc);
|
2006-06-08 14:56:49 +04:00
|
|
|
}
|
2006-06-08 02:33:33 +04:00
|
|
|
|
|
|
|
*tred = sc->sensors[tred->sensor];
|
|
|
|
|
|
|
|
return 0;
|
2000-07-28 01:49:22 +04:00
|
|
|
}
|
2000-02-25 05:17:43 +03:00
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
static int
|
|
|
|
generic_streinfo_fan(struct lm_softc *sc, envsys_basic_info_t *info, int n,
|
|
|
|
envsys_basic_info_t *binfo)
|
2000-07-31 02:23:53 +04:00
|
|
|
{
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
uint8_t sdata;
|
2000-07-31 02:23:53 +04:00
|
|
|
int divisor;
|
|
|
|
|
|
|
|
/* FAN1 and FAN2 can have divisors set, but not FAN3 */
|
|
|
|
if ((sc->info[binfo->sensor].units == ENVSYS_SFANRPM)
|
2002-03-30 16:37:41 +03:00
|
|
|
&& (n < 2)) {
|
2000-07-31 02:23:53 +04:00
|
|
|
if (binfo->rpms == 0) {
|
|
|
|
binfo->validflags = 0;
|
2004-07-24 22:59:16 +04:00
|
|
|
return 0;
|
2000-07-31 02:23:53 +04:00
|
|
|
}
|
|
|
|
|
2002-03-30 16:37:41 +03:00
|
|
|
/* write back the nominal FAN speed */
|
|
|
|
info->rpms = binfo->rpms;
|
|
|
|
|
2000-07-31 02:23:53 +04:00
|
|
|
/* 153 is the nominal FAN speed value */
|
|
|
|
divisor = 1350000 / (binfo->rpms * 153);
|
|
|
|
|
|
|
|
/* ...but we need lg(divisor) */
|
|
|
|
if (divisor <= 1)
|
|
|
|
divisor = 0;
|
|
|
|
else if (divisor <= 2)
|
|
|
|
divisor = 1;
|
|
|
|
else if (divisor <= 4)
|
|
|
|
divisor = 2;
|
|
|
|
else
|
|
|
|
divisor = 3;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* FAN1 div is in bits <5:4>, FAN2 div is
|
|
|
|
* in <7:6>
|
|
|
|
*/
|
2002-11-15 17:55:41 +03:00
|
|
|
sdata = (*sc->lm_readreg)(sc, LMD_VIDFAN);
|
2002-03-30 16:37:41 +03:00
|
|
|
if ( n == 0 ) { /* FAN1 */
|
2000-07-31 02:23:53 +04:00
|
|
|
divisor <<= 4;
|
|
|
|
sdata = (sdata & 0xCF) | divisor;
|
|
|
|
} else { /* FAN2 */
|
|
|
|
divisor <<= 6;
|
|
|
|
sdata = (sdata & 0x3F) | divisor;
|
|
|
|
}
|
|
|
|
|
2002-11-15 17:55:41 +03:00
|
|
|
(*sc->lm_writereg)(sc, LMD_VIDFAN, sdata);
|
2000-07-31 02:23:53 +04:00
|
|
|
}
|
2004-07-24 22:59:16 +04:00
|
|
|
return 0;
|
2000-07-31 02:23:53 +04:00
|
|
|
|
|
|
|
}
|
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
static int
|
|
|
|
lm_streinfo(struct sysmon_envsys *sme, envsys_basic_info_t *binfo)
|
2000-07-28 01:49:22 +04:00
|
|
|
{
|
|
|
|
struct lm_softc *sc = sme->sme_cookie;
|
|
|
|
|
|
|
|
if (sc->info[binfo->sensor].units == ENVSYS_SVOLTS_DC)
|
|
|
|
sc->info[binfo->sensor].rfact = binfo->rfact;
|
|
|
|
else {
|
2000-07-31 02:23:53 +04:00
|
|
|
if (sc->info[binfo->sensor].units == ENVSYS_SFANRPM) {
|
|
|
|
generic_streinfo_fan(sc, &sc->info[binfo->sensor],
|
|
|
|
binfo->sensor - 8, binfo);
|
|
|
|
}
|
2004-07-24 22:59:16 +04:00
|
|
|
strlcpy(sc->info[binfo->sensor].desc, binfo->desc,
|
2000-07-31 02:23:53 +04:00
|
|
|
sizeof(sc->info[binfo->sensor].desc));
|
|
|
|
binfo->validflags = ENVSYS_FVALID;
|
|
|
|
}
|
2004-07-24 22:59:16 +04:00
|
|
|
return 0;
|
2000-07-31 02:23:53 +04:00
|
|
|
}
|
2000-07-28 01:49:22 +04:00
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
static int
|
|
|
|
wb781_streinfo(struct sysmon_envsys *sme, envsys_basic_info_t *binfo)
|
2000-07-31 02:23:53 +04:00
|
|
|
{
|
|
|
|
struct lm_softc *sc = sme->sme_cookie;
|
2002-03-30 16:37:41 +03:00
|
|
|
int divisor;
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
uint8_t sdata;
|
2002-03-30 16:37:41 +03:00
|
|
|
int i;
|
2000-07-28 01:49:22 +04:00
|
|
|
|
2000-07-31 02:23:53 +04:00
|
|
|
if (sc->info[binfo->sensor].units == ENVSYS_SVOLTS_DC)
|
|
|
|
sc->info[binfo->sensor].rfact = binfo->rfact;
|
|
|
|
else {
|
|
|
|
if (sc->info[binfo->sensor].units == ENVSYS_SFANRPM) {
|
2002-03-30 16:37:41 +03:00
|
|
|
if (binfo->rpms == 0) {
|
|
|
|
binfo->validflags = 0;
|
2004-07-24 22:59:16 +04:00
|
|
|
return 0;
|
2002-03-30 16:37:41 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
/* write back the nominal FAN speed */
|
|
|
|
sc->info[binfo->sensor].rpms = binfo->rpms;
|
|
|
|
|
|
|
|
/* 153 is the nominal FAN speed value */
|
|
|
|
divisor = 1350000 / (binfo->rpms * 153);
|
|
|
|
|
|
|
|
/* ...but we need lg(divisor) */
|
|
|
|
for (i = 0; i < 7; i++) {
|
|
|
|
if (divisor <= (1 << i))
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
divisor = i;
|
|
|
|
|
|
|
|
if (binfo->sensor == 10 || binfo->sensor == 11) {
|
|
|
|
/*
|
|
|
|
* FAN1 div is in bits <5:4>, FAN2 div
|
|
|
|
* is in <7:6>
|
|
|
|
*/
|
2002-11-15 17:55:41 +03:00
|
|
|
sdata = (*sc->lm_readreg)(sc, LMD_VIDFAN);
|
2002-03-30 16:37:41 +03:00
|
|
|
if ( binfo->sensor == 10 ) { /* FAN1 */
|
|
|
|
sdata = (sdata & 0xCF) |
|
|
|
|
((divisor & 0x3) << 4);
|
|
|
|
} else { /* FAN2 */
|
|
|
|
sdata = (sdata & 0x3F) |
|
|
|
|
((divisor & 0x3) << 6);
|
|
|
|
}
|
2002-11-15 17:55:41 +03:00
|
|
|
(*sc->lm_writereg)(sc, LMD_VIDFAN, sdata);
|
2002-03-30 16:37:41 +03:00
|
|
|
} else {
|
|
|
|
/* FAN3 is in WB_PIN <7:6> */
|
2002-11-15 17:55:41 +03:00
|
|
|
sdata = (*sc->lm_readreg)(sc, WB_PIN);
|
2002-03-30 16:37:41 +03:00
|
|
|
sdata = (sdata & 0x3F) |
|
|
|
|
((divisor & 0x3) << 6);
|
2002-11-15 17:55:41 +03:00
|
|
|
(*sc->lm_writereg)(sc, WB_PIN, sdata);
|
2002-03-30 16:37:41 +03:00
|
|
|
}
|
2000-07-31 02:23:53 +04:00
|
|
|
}
|
2004-07-24 22:59:16 +04:00
|
|
|
strlcpy(sc->info[binfo->sensor].desc, binfo->desc,
|
2000-07-31 02:23:53 +04:00
|
|
|
sizeof(sc->info[binfo->sensor].desc));
|
|
|
|
binfo->validflags = ENVSYS_FVALID;
|
2000-07-28 01:49:22 +04:00
|
|
|
}
|
2004-07-24 22:59:16 +04:00
|
|
|
return 0;
|
2000-07-28 01:49:22 +04:00
|
|
|
}
|
|
|
|
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
static int
|
|
|
|
wb782_streinfo(struct sysmon_envsys *sme, envsys_basic_info_t *binfo)
|
2000-06-24 04:37:19 +04:00
|
|
|
{
|
2000-07-28 01:49:22 +04:00
|
|
|
struct lm_softc *sc = sme->sme_cookie;
|
|
|
|
int divisor;
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
uint8_t sdata;
|
2000-07-28 01:49:22 +04:00
|
|
|
int i;
|
2000-02-25 05:17:43 +03:00
|
|
|
|
2000-07-28 01:49:22 +04:00
|
|
|
if (sc->info[binfo->sensor].units == ENVSYS_SVOLTS_DC)
|
|
|
|
sc->info[binfo->sensor].rfact = binfo->rfact;
|
|
|
|
else {
|
|
|
|
if (sc->info[binfo->sensor].units == ENVSYS_SFANRPM) {
|
2000-06-24 04:37:19 +04:00
|
|
|
if (binfo->rpms == 0) {
|
|
|
|
binfo->validflags = 0;
|
2004-07-24 22:59:16 +04:00
|
|
|
return 0;
|
2000-02-25 05:17:43 +03:00
|
|
|
}
|
|
|
|
|
2002-03-30 16:37:41 +03:00
|
|
|
/* write back the nominal FAN speed */
|
|
|
|
sc->info[binfo->sensor].rpms = binfo->rpms;
|
|
|
|
|
2000-06-24 04:37:19 +04:00
|
|
|
/* 153 is the nominal FAN speed value */
|
|
|
|
divisor = 1350000 / (binfo->rpms * 153);
|
|
|
|
|
|
|
|
/* ...but we need lg(divisor) */
|
2000-07-28 01:49:22 +04:00
|
|
|
for (i = 0; i < 7; i++) {
|
|
|
|
if (divisor <= (1 << i))
|
|
|
|
break;
|
2000-02-25 05:17:43 +03:00
|
|
|
}
|
2000-07-28 01:49:22 +04:00
|
|
|
divisor = i;
|
|
|
|
|
|
|
|
if (binfo->sensor == 12 || binfo->sensor == 13) {
|
|
|
|
/*
|
|
|
|
* FAN1 div is in bits <5:4>, FAN2 div
|
|
|
|
* is in <7:6>
|
|
|
|
*/
|
2002-11-15 17:55:41 +03:00
|
|
|
sdata = (*sc->lm_readreg)(sc, LMD_VIDFAN);
|
2000-07-28 01:49:22 +04:00
|
|
|
if ( binfo->sensor == 12 ) { /* FAN1 */
|
|
|
|
sdata = (sdata & 0xCF) |
|
|
|
|
((divisor & 0x3) << 4);
|
|
|
|
} else { /* FAN2 */
|
|
|
|
sdata = (sdata & 0x3F) |
|
|
|
|
((divisor & 0x3) << 6);
|
|
|
|
}
|
2002-11-15 17:55:41 +03:00
|
|
|
(*sc->lm_writereg)(sc, LMD_VIDFAN, sdata);
|
2000-07-28 01:49:22 +04:00
|
|
|
} else {
|
|
|
|
/* FAN3 is in WB_PIN <7:6> */
|
2002-11-15 17:55:41 +03:00
|
|
|
sdata = (*sc->lm_readreg)(sc, WB_PIN);
|
2000-07-28 01:49:22 +04:00
|
|
|
sdata = (sdata & 0x3F) |
|
|
|
|
((divisor & 0x3) << 6);
|
2002-11-15 17:55:41 +03:00
|
|
|
(*sc->lm_writereg)(sc, WB_PIN, sdata);
|
2000-07-28 01:49:22 +04:00
|
|
|
}
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
/* Bit 2 of divisor is in WB_BANK0_VBAT */
|
|
|
|
lm_generic_banksel(sc, WB_BANKSEL_B0);
|
|
|
|
sdata = (*sc->lm_readreg)(sc, WB_BANK0_VBAT);
|
2000-07-28 01:49:22 +04:00
|
|
|
sdata &= ~(0x20 << (binfo->sensor - 12));
|
|
|
|
sdata |= (divisor & 0x4) << (binfo->sensor - 9);
|
Update for the nslm7x driver:
* For each supported chip, there's a struct lm_sensor array
that specifies the sensor data, like reg, bank, descr, rfact.
* Rather than having 3 functions to setup the voltage, temp and fan
sensors, just have one that will do all the three steps looking at
its struct lm_sensor members, simplifying a lot the code.
and more things that I can remember, our code now is synced with
OpenBSD, IMHO much better to understand and maintain in the future.
Supported chips added with the new code include:
* Winbond: W83627EHF, W83627DHG, W83637HF, W83783S, W83791D, W83791SD,
W83792D.
* Asus AS9912F.
My new mobo with the Winbond W83627DHG chip correctly reports
the values now:
lm0 at isa0 port 0x290-0x297: Winbond W83627DHG Hardware monitor
[juan@nocturno][~]> envstat -r
VCore: 1.232 V
+12V: 12.091 V
+3.3V: 3.264 V
+5V: 4.945 V
VBAT: 3.728 V
System Temp: 36.000 degC
CPU Temp: 29.500 degC
Aux Temp: 22.000 degC
CPU Fan: 1591 RPM
[juan@nocturno][~]>
2007-03-11 18:03:08 +03:00
|
|
|
(*sc->lm_writereg)(sc, WB_BANK0_VBAT, sdata);
|
2000-02-25 05:17:43 +03:00
|
|
|
}
|
|
|
|
|
2004-07-24 22:59:16 +04:00
|
|
|
strlcpy(sc->info[binfo->sensor].desc, binfo->desc,
|
2000-06-24 04:37:19 +04:00
|
|
|
sizeof(sc->info[binfo->sensor].desc));
|
|
|
|
binfo->validflags = ENVSYS_FVALID;
|
2000-02-25 05:17:43 +03:00
|
|
|
}
|
2004-07-24 22:59:16 +04:00
|
|
|
return 0;
|
|
|
|
}
|