From 4dcb88898c04a6ab1dc985c385f4cbcdd30b27bd Mon Sep 17 00:00:00 2001 From: "Mark D. Studebaker" Date: Wed, 18 Oct 2000 00:34:07 +0000 Subject: [PATCH] (mds) MTP008 driver patch from Kris Van Hees. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@909 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CONTRIBUTORS | 2 + README | 1 + etc/sensors.conf.eg | 38 ++++++++ kernel/include/sensors.h | 39 ++++++++ lib/chips.c | 117 ++++++++++++++++++++++- lib/chips.h | 47 ++++++++++ prog/detect/sensors-detect | 31 +++++-- prog/sensors/chips.c | 185 +++++++++++++++++++++++++++++++++++++ prog/sensors/chips.h | 1 + prog/sensors/main.c | 2 + 10 files changed, 456 insertions(+), 7 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 88c9725b..7e52254a 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -54,3 +54,5 @@ problems. just-an-i2c-extension approach. * Chen-Yuan Wu Author of the adm1025 driver. +* Kris Van Hees + Author of the mtp008 chip driver. diff --git a/README b/README index 7c981e13..06401516 100644 --- a/README +++ b/README @@ -56,6 +56,7 @@ At least the following hardware sensor chips are supported: Genesys Logic GL518SM (rev 00, 80), GL520SM, GL523SM Intel Xeon processor embedded sensors Maxim MAX1617 and MAX1617A + Myson MTP008 National Semicoductor LM75, LM77, LM78, LM78-J, LM79, LM80, LM81, LM84, and LM87 SiS 5595 embedded sensors diff --git a/etc/sensors.conf.eg b/etc/sensors.conf.eg index f563a640..0c6d7c5a 100644 --- a/etc/sensors.conf.eg +++ b/etc/sensors.conf.eg @@ -566,3 +566,41 @@ chip "via686a-*" #compute "3.3V" 1.02*@ , @/1.02 #compute "5.0V" 1.009*@ , @/1.009 #compute "12V" 1.04*@ , @/1.04 + +chip "mtp008-*" + +# The values below should be correct if you own a Tyan S1834D motherboard. If +# not, please contact us, so we can figure out better readings. + +# For positive voltages outside the 0..4.09V range (in2..in4), two resistors +# are used, with the following formula (R1,R2: resistor values, Vs: read +# voltage, Vin: pin voltage) +# Vin = Vs * (R2 / (R1 + R2)) +# For negative voltages (in5) two resistors are used, with the following +# formula (R3,R4: resistor values, Vs: read voltage, Vin: pin voltage) +# Vin = ((4.096 - Vs) * (R3 / (R3 + R4))) + Vs + +# Here are the official MTP008 data sheet values: +# Vs R1,R3 R2,R4 Vin +# +12.0 28000 10000 +3.16 +# -12.0 232000 56000 +0.96 +# -5.0 120000 56000 +1.20 + + label in0 "VCore1" + label in1 "+3.3V" + label in2 "+12V" + label in3 "Vcore2" + ignore in4 + label in5 "-12V" + label in6 "Vtt" + + label fan1 "CPUFAN1" + label fan2 "CPUFAN2" + label fan3 "CPUFAN3" + + label temp1 "CPU1 Temp" + label temp2 "CPU2 Temp" + ignore temp3 + + compute in2 @ * 38 / 10, @ * 10 / 38 + compute in5 (@ * 36 - 118.61) / 7, (118.61 + 7 * @) / 36 diff --git a/kernel/include/sensors.h b/kernel/include/sensors.h index 051b053d..dbd5a90d 100644 --- a/kernel/include/sensors.h +++ b/kernel/include/sensors.h @@ -401,6 +401,7 @@ extern inline int SENSORS_LIMIT(long value, long low, long high) #define I2C_DRIVERID_ADM1025 1020 #define I2C_DRIVERID_LM87 1021 #define I2C_DRIVERID_PCF8574 1022 +#define I2C_DRIVERID_MTP008 1023 /* Sysctl IDs */ #ifdef DEV_HWMON @@ -776,5 +777,43 @@ struct sensors_chips_data { #define PCF8574_SYSCTL_STAT 1000 +#define MTP008_SYSCTL_IN0 1000 /* Volts * 100 */ +#define MTP008_SYSCTL_IN1 1001 +#define MTP008_SYSCTL_IN2 1002 +#define MTP008_SYSCTL_IN3 1003 +#define MTP008_SYSCTL_IN4 1004 +#define MTP008_SYSCTL_IN5 1005 +#define MTP008_SYSCTL_IN6 1006 +#define MTP008_SYSCTL_FAN1 1101 /* Rotations/min */ +#define MTP008_SYSCTL_FAN2 1102 +#define MTP008_SYSCTL_FAN3 1103 +#define MTP008_SYSCTL_TEMP1 1200 /* Degrees Celcius * 10 */ +#define MTP008_SYSCTL_TEMP2 1201 /* Degrees Celcius * 10 */ +#define MTP008_SYSCTL_TEMP3 1202 /* Degrees Celcius * 10 */ +#define MTP008_SYSCTL_VID 1300 /* Volts * 100 */ +#define MTP008_SYSCTL_PWM1 1401 +#define MTP008_SYSCTL_PWM2 1402 +#define MTP008_SYSCTL_PWM3 1403 +#define MTP008_SYSCTL_SENS1 1501 /* 1, 2, or Beta (3000-5000) */ +#define MTP008_SYSCTL_SENS2 1502 +#define MTP008_SYSCTL_SENS3 1503 +#define MTP008_SYSCTL_FAN_DIV 2000 /* 1, 2, 4 or 8 */ +#define MTP008_SYSCTL_ALARMS 2001 /* bitvector */ +#define MTP008_SYSCTL_BEEP 2002 /* bitvector */ + +#define MTP008_ALARM_IN0 0x0001 +#define MTP008_ALARM_IN1 0x0002 +#define MTP008_ALARM_IN2 0x0004 +#define MTP008_ALARM_IN3 0x0008 +#define MTP008_ALARM_IN4 0x0100 +#define MTP008_ALARM_IN5 0x0200 +#define MTP008_ALARM_IN6 0x0400 +#define MTP008_ALARM_FAN1 0x0040 +#define MTP008_ALARM_FAN2 0x0080 +#define MTP008_ALARM_FAN3 0x0800 +#define MTP008_ALARM_TEMP1 0x0010 +#define MTP008_ALARM_TEMP2 0x0100 +#define MTP008_ALARM_TEMP3 0x0200 + #endif /* def SENSORS_SENSORS_H */ diff --git a/lib/chips.c b/lib/chips.c index 06dfe2a2..03bf91c1 100644 --- a/lib/chips.c +++ b/lib/chips.c @@ -1857,6 +1857,121 @@ static sensors_chip_feature lm87_features[] = { 0 } }; +static sensors_chip_feature mtp008_features[] = + { + { SENSORS_MTP008_IN0, "in0", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, + SENSORS_MODE_R, MTP008_SYSCTL_IN0, VALUE(3), 2 }, + { SENSORS_MTP008_IN1, "in1", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, + SENSORS_MODE_R, MTP008_SYSCTL_IN1, VALUE(3), 2 }, + { SENSORS_MTP008_IN2, "in2", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, + SENSORS_MODE_R, MTP008_SYSCTL_IN2, VALUE(3), 2 }, + { SENSORS_MTP008_IN3, "in3", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, + SENSORS_MODE_R, MTP008_SYSCTL_IN3, VALUE(3), 2 }, + { SENSORS_MTP008_IN4, "in4", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, + SENSORS_MODE_R, MTP008_SYSCTL_IN4, VALUE(3), 2 }, + { SENSORS_MTP008_IN5, "in5", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, + SENSORS_MODE_R, MTP008_SYSCTL_IN5, VALUE(3), 2 }, + { SENSORS_MTP008_IN6, "in6", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, + SENSORS_MODE_R, MTP008_SYSCTL_IN6, VALUE(3), 2 }, + { SENSORS_MTP008_IN0_MIN, "in0_min", SENSORS_MTP008_IN0, + SENSORS_MTP008_IN0, SENSORS_MODE_RW, + MTP008_SYSCTL_IN0, VALUE(1), 2 }, + { SENSORS_MTP008_IN1_MIN, "in1_min", SENSORS_MTP008_IN1, + SENSORS_MTP008_IN1, SENSORS_MODE_RW, + MTP008_SYSCTL_IN1, VALUE(1), 2 }, + { SENSORS_MTP008_IN2_MIN, "in2_min", SENSORS_MTP008_IN2, + SENSORS_MTP008_IN2, SENSORS_MODE_RW, + MTP008_SYSCTL_IN2, VALUE(1), 2 }, + { SENSORS_MTP008_IN3_MIN, "in3_min", SENSORS_MTP008_IN3, + SENSORS_MTP008_IN3, SENSORS_MODE_RW, + MTP008_SYSCTL_IN3, VALUE(1), 2 }, + { SENSORS_MTP008_IN4_MIN, "in4_min", SENSORS_MTP008_IN4, + SENSORS_MTP008_IN4, SENSORS_MODE_RW, + MTP008_SYSCTL_IN4, VALUE(1), 2 }, + { SENSORS_MTP008_IN5_MIN, "in5_min", SENSORS_MTP008_IN5, + SENSORS_MTP008_IN5, SENSORS_MODE_RW, + MTP008_SYSCTL_IN5, VALUE(1), 2 }, + { SENSORS_MTP008_IN6_MIN, "in6_min", SENSORS_MTP008_IN6, + SENSORS_MTP008_IN6, SENSORS_MODE_RW, + MTP008_SYSCTL_IN6, VALUE(1), 2 }, + { SENSORS_MTP008_IN0_MAX, "in0_max", SENSORS_MTP008_IN0, + SENSORS_MTP008_IN0, SENSORS_MODE_RW, + MTP008_SYSCTL_IN0, VALUE(2), 2 }, + { SENSORS_MTP008_IN1_MAX, "in1_max", SENSORS_MTP008_IN1, + SENSORS_MTP008_IN1, SENSORS_MODE_RW, + MTP008_SYSCTL_IN1, VALUE(2), 2 }, + { SENSORS_MTP008_IN2_MAX, "in2_max", SENSORS_MTP008_IN2, + SENSORS_MTP008_IN2, SENSORS_MODE_RW, + MTP008_SYSCTL_IN2, VALUE(2), 2 }, + { SENSORS_MTP008_IN3_MAX, "in3_max", SENSORS_MTP008_IN3, + SENSORS_MTP008_IN3, SENSORS_MODE_RW, + MTP008_SYSCTL_IN3, VALUE(2), 2 }, + { SENSORS_MTP008_IN4_MAX, "in4_max", SENSORS_MTP008_IN4, + SENSORS_MTP008_IN4, SENSORS_MODE_RW, + MTP008_SYSCTL_IN4, VALUE(2), 2 }, + { SENSORS_MTP008_IN5_MAX, "in5_max", SENSORS_MTP008_IN5, + SENSORS_MTP008_IN5, SENSORS_MODE_RW, + MTP008_SYSCTL_IN5, VALUE(2), 2 }, + { SENSORS_MTP008_IN6_MAX, "in6_max", SENSORS_MTP008_IN6, + SENSORS_MTP008_IN6, SENSORS_MODE_RW, + MTP008_SYSCTL_IN6, VALUE(2), 2 }, + { SENSORS_MTP008_FAN1, "fan1", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, + SENSORS_MODE_R, MTP008_SYSCTL_FAN1, VALUE(2), 0 }, + { SENSORS_MTP008_FAN2, "fan2", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, + SENSORS_MODE_R, MTP008_SYSCTL_FAN2, VALUE(2), 0 }, + { SENSORS_MTP008_FAN3, "fan3", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, + SENSORS_MODE_R, MTP008_SYSCTL_FAN3, VALUE(2), 0 }, + { SENSORS_MTP008_FAN1_MIN, "fan1_limit", SENSORS_MTP008_FAN1, + SENSORS_MTP008_FAN1, SENSORS_MODE_RW, + MTP008_SYSCTL_FAN1, VALUE(1), 0 }, + { SENSORS_MTP008_FAN2_MIN, "fan2_limit", SENSORS_MTP008_FAN2, + SENSORS_MTP008_FAN2, SENSORS_MODE_RW, + MTP008_SYSCTL_FAN2, VALUE(1), 0 }, + { SENSORS_MTP008_FAN3_MIN, "fan3_limit", SENSORS_MTP008_FAN3, + SENSORS_MTP008_FAN3, SENSORS_MODE_RW, + MTP008_SYSCTL_FAN3, VALUE(1), 0 }, + { SENSORS_MTP008_TEMP1, "temp1", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, + SENSORS_MODE_R, MTP008_SYSCTL_TEMP1, VALUE(3), 1 }, + { SENSORS_MTP008_TEMP2, "temp2", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, + SENSORS_MODE_R, MTP008_SYSCTL_TEMP2, VALUE(3), 1 }, + { SENSORS_MTP008_TEMP3, "temp3", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, + SENSORS_MODE_R, MTP008_SYSCTL_TEMP3, VALUE(3), 1 }, + { SENSORS_MTP008_TEMP1_OVER, "temp1_over", SENSORS_MTP008_TEMP1, + SENSORS_MTP008_TEMP1, SENSORS_MODE_RW, + MTP008_SYSCTL_TEMP1, VALUE(1), 1 }, + { SENSORS_MTP008_TEMP2_OVER, "temp2_over", SENSORS_MTP008_TEMP2, + SENSORS_MTP008_TEMP2, SENSORS_MODE_RW, + MTP008_SYSCTL_TEMP2, VALUE(1), 1 }, + { SENSORS_MTP008_TEMP3_OVER, "temp3_over", SENSORS_MTP008_TEMP3, + SENSORS_MTP008_TEMP3, SENSORS_MODE_RW, + MTP008_SYSCTL_TEMP3, VALUE(1), 1 }, + { SENSORS_MTP008_TEMP1_HYST, "temp1_hyst", SENSORS_MTP008_TEMP1, + SENSORS_MTP008_TEMP1, SENSORS_MODE_RW, + MTP008_SYSCTL_TEMP1, VALUE(2), 1 }, + { SENSORS_MTP008_TEMP2_HYST, "temp2_hyst", SENSORS_MTP008_TEMP2, + SENSORS_MTP008_TEMP2, SENSORS_MODE_RW, + MTP008_SYSCTL_TEMP2, VALUE(2), 1 }, + { SENSORS_MTP008_TEMP3_HYST, "temp3_hyst", SENSORS_MTP008_TEMP3, + SENSORS_MTP008_TEMP3, SENSORS_MODE_RW, + MTP008_SYSCTL_TEMP3, VALUE(2), 1 }, + { SENSORS_MTP008_VID, "vid", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, + SENSORS_MODE_R, MTP008_SYSCTL_VID, VALUE(1), 2 }, + { SENSORS_MTP008_FAN1_DIV, "fan1_div", SENSORS_NO_MAPPING, + SENSORS_NO_MAPPING, SENSORS_MODE_RW, + MTP008_SYSCTL_FAN_DIV, VALUE(1), 0 }, + { SENSORS_MTP008_FAN2_DIV, "fan2_div", SENSORS_NO_MAPPING, + SENSORS_NO_MAPPING, SENSORS_MODE_RW, + MTP008_SYSCTL_FAN_DIV, VALUE(2), 0 }, + { SENSORS_MTP008_FAN3_DIV, "fan3_div", SENSORS_NO_MAPPING, + SENSORS_NO_MAPPING, SENSORS_MODE_RW, + MTP008_SYSCTL_FAN_DIV, VALUE(3), 0 }, + { SENSORS_MTP008_ALARMS, "alarms", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, + SENSORS_MODE_R, MTP008_SYSCTL_ALARMS, VALUE(1), 0 }, + { SENSORS_MTP008_BEEP, "beeps", SENSORS_NO_MAPPING, SENSORS_NO_MAPPING, + SENSORS_MODE_R, MTP008_SYSCTL_BEEP, VALUE(1), 0 }, + { 0 } + }; + sensors_chip_features sensors_chip_features_list[] = { { SENSORS_LM78_PREFIX, lm78_features }, @@ -1898,6 +2013,6 @@ sensors_chip_features sensors_chip_features_list[] = { SENSORS_DDCMON_PREFIX, ddcmon_features }, { SENSORS_EEPROM_PREFIX, eeprom_features }, { SENSORS_LM87_PREFIX, lm87_features }, + { SENSORS_MTP008_PREFIX, mtp008_features }, { 0 } }; - diff --git a/lib/chips.h b/lib/chips.h index a1afc8db..365fe3e7 100644 --- a/lib/chips.h +++ b/lib/chips.h @@ -854,4 +854,51 @@ #define SENSORS_LM87_ALARMS 81 /* R */ #define SENSORS_LM87_ANALOG_OUT 82 /* RW */ +/* Myson MTP008 chips */ + +#define SENSORS_MTP008_PREFIX "mtp008" + +#define SENSORS_MTP008_IN0 1 /* R */ +#define SENSORS_MTP008_IN1 2 /* R */ +#define SENSORS_MTP008_IN2 3 /* R */ +#define SENSORS_MTP008_IN3 4 /* R */ +#define SENSORS_MTP008_IN4 5 /* R */ +#define SENSORS_MTP008_IN5 6 /* R */ +#define SENSORS_MTP008_IN6 7 /* R */ +#define SENSORS_MTP008_IN0_MIN 11 /* RW */ +#define SENSORS_MTP008_IN1_MIN 12 /* RW */ +#define SENSORS_MTP008_IN2_MIN 13 /* RW */ +#define SENSORS_MTP008_IN3_MIN 14 /* RW */ +#define SENSORS_MTP008_IN4_MIN 15 /* RW */ +#define SENSORS_MTP008_IN5_MIN 16 /* RW */ +#define SENSORS_MTP008_IN6_MIN 17 /* RW */ +#define SENSORS_MTP008_IN0_MAX 21 /* RW */ +#define SENSORS_MTP008_IN1_MAX 22 /* RW */ +#define SENSORS_MTP008_IN2_MAX 23 /* RW */ +#define SENSORS_MTP008_IN3_MAX 24 /* RW */ +#define SENSORS_MTP008_IN4_MAX 25 /* RW */ +#define SENSORS_MTP008_IN5_MAX 26 /* RW */ +#define SENSORS_MTP008_IN6_MAX 27 /* RW */ +#define SENSORS_MTP008_FAN1 31 /* R */ +#define SENSORS_MTP008_FAN2 32 /* R */ +#define SENSORS_MTP008_FAN3 33 /* R */ +#define SENSORS_MTP008_FAN1_MIN 41 /* RW */ +#define SENSORS_MTP008_FAN2_MIN 42 /* RW */ +#define SENSORS_MTP008_FAN3_MIN 43 /* RW */ +#define SENSORS_MTP008_TEMP1 51 /* R */ +#define SENSORS_MTP008_TEMP2 52 /* R */ +#define SENSORS_MTP008_TEMP3 53 /* R */ +#define SENSORS_MTP008_TEMP1_OVER 54 /* RW */ +#define SENSORS_MTP008_TEMP1_HYST 55 /* RW */ +#define SENSORS_MTP008_TEMP2_OVER 56 /* RW */ +#define SENSORS_MTP008_TEMP2_HYST 57 /* RW */ +#define SENSORS_MTP008_TEMP3_OVER 58 /* RW */ +#define SENSORS_MTP008_TEMP3_HYST 59 /* RW */ +#define SENSORS_MTP008_VID 61 /* R */ +#define SENSORS_MTP008_FAN1_DIV 71 /* RW */ +#define SENSORS_MTP008_FAN2_DIV 72 /* RW */ +#define SENSORS_MTP008_FAN3_DIV 73 /* RW */ +#define SENSORS_MTP008_ALARMS 81 /* R */ +#define SENSORS_MTP008_BEEP 82 /* RW */ + #endif /* def LIB_SENSORS_CHIPS_H */ diff --git a/prog/detect/sensors-detect b/prog/detect/sensors-detect index c38aab2a..b5e1dcb3 100755 --- a/prog/detect/sensors-detect +++ b/prog/detect/sensors-detect @@ -354,12 +354,13 @@ use vars qw(@pci_adapters @chip_ids @undetectable_adapters); } , ); -use subs qw(lm78_detect lm78_isa_detect lm78_alias_detect lm75_detect - lm80_detect w83781d_detect w83781d_alias_detect adm1025_detect - w83781d_isa_detect gl518sm_detect gl520sm_detect adm9240_detect - adm1021_detect sis5595_isa_detect eeprom_detect via686a_isa_detect - adm1022_detect ltc1710_detect gl525sm_detect lm87_detect - ite_detect ite_isa_detect ite_alias_detect ddcmonitor_detect); +use subs qw(mtp008_detect lm78_detect lm78_isa_detect lm78_alias_detect + lm75_detect lm80_detect w83781d_detect w83781d_alias_detect + adm1025_detect w83781d_isa_detect gl518sm_detect gl520sm_detect + adm9240_detect adm1021_detect sis5595_isa_detect eeprom_detect + via686a_isa_detect adm1022_detect ltc1710_detect gl525sm_detect + lm87_detect ite_detect ite_isa_detect ite_alias_detect + ddcmonitor_detect); # This is a list of all recognized chips. # Each entry must have the following fields: @@ -385,6 +386,12 @@ use subs qw(lm78_detect lm78_isa_detect lm78_alias_detect lm75_detect # The function should take three parameters: The ISA address, the # I2C bus number, and the I2C address. @chip_ids = ( + { + name => "Myson MTP008", + driver => "mtp008", + i2c_addrs => [0x2c..0x2e], + i2c_detect => sub { mtp008_detect @_}, + } , { name => "National Semiconductor LM78", driver => "lm78", @@ -1452,6 +1459,18 @@ sub scan_isa_bus # any of these devices. +# $_[0]: A reference to the file descriptor to access this chip. +# We may assume an i2c_set_slave_addr was already done. +# $_[1]: Address +# Returns: undef if not detected, (7) if detected. +# Registers used: 0x58 +sub mtp008_detect +{ + my ($file,$addr) = @_; + return if (i2c_smbus_read_byte_data($file,0x58)) != 0xac; + return (8); +} + # $_[0]: Chip to detect (0 = LM78, 1 = LM78-J, 2 = LM79) # $_[1]: A reference to the file descriptor to access this chip. # We may assume an i2c_set_slave_addr was already done. diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index da878af0..1634d94b 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -1175,6 +1175,191 @@ void print_lm80(const sensors_chip_name *name) free_the_label(&label); } +void print_mtp008(const sensors_chip_name *name) +{ + char *label = NULL; + double cur,min,max,fdiv; + int alarms,valid; + + if (!sensors_get_feature(*name,SENSORS_MTP008_ALARMS,&cur)) + alarms = cur + 0.5; + else { + printf("ERROR: Can't get alarm data!\n"); + alarms = 0; + } + + + if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_IN0,&label,&valid) && + !sensors_get_feature(*name,SENSORS_MTP008_IN0,&cur) && + !sensors_get_feature(*name,SENSORS_MTP008_IN0_MIN,&min) && + !sensors_get_feature(*name,SENSORS_MTP008_IN0_MAX,&max)) { + if (valid) { + print_label(label,10); + printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", + cur,min,max,alarms&MTP008_ALARM_IN0?"ALARM":""); + } + } else + printf("ERROR: Can't get IN0 data!\n"); + free_the_label(&label); + if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_IN1,&label,&valid) && + !sensors_get_feature(*name,SENSORS_MTP008_IN1,&cur) && + !sensors_get_feature(*name,SENSORS_MTP008_IN1_MIN,&min) && + !sensors_get_feature(*name,SENSORS_MTP008_IN1_MAX,&max)) { + if (valid) { + print_label(label,10); + printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", + cur,min,max,alarms&MTP008_ALARM_IN1?"ALARM":""); + } + } else + printf("ERROR: Can't get IN1 data!\n"); + free_the_label(&label); + if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_IN2,&label,&valid) && + !sensors_get_feature(*name,SENSORS_MTP008_IN2,&cur) && + !sensors_get_feature(*name,SENSORS_MTP008_IN2_MIN,&min) && + !sensors_get_feature(*name,SENSORS_MTP008_IN2_MAX,&max)) { + if (valid) { + print_label(label,10); + printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", + cur,min,max,alarms&MTP008_ALARM_IN2?"ALARM":""); + } + } else + printf("ERROR: Can't get IN2 data!\n"); + free_the_label(&label); + if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_IN3,&label,&valid) && + !sensors_get_feature(*name,SENSORS_MTP008_IN3,&cur) && + !sensors_get_feature(*name,SENSORS_MTP008_IN3_MIN,&min) && + !sensors_get_feature(*name,SENSORS_MTP008_IN3_MAX,&max)) { + if (valid) { + print_label(label,10); + printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", + cur,min,max,alarms&MTP008_ALARM_IN3?"ALARM":""); + } + } else + printf("ERROR: Can't get IN3 data!\n"); + free_the_label(&label); + if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_IN4,&label,&valid) && + !sensors_get_feature(*name,SENSORS_MTP008_IN4,&cur) && + !sensors_get_feature(*name,SENSORS_MTP008_IN4_MIN,&min) && + !sensors_get_feature(*name,SENSORS_MTP008_IN4_MAX,&max)) { + if (valid) { + print_label(label,10); + printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", + cur,min,max,alarms&MTP008_ALARM_IN4?"ALARM":""); + } + } else + printf("ERROR: Can't get IN4 data!\n"); + free_the_label(&label); + if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_IN5,&label,&valid) && + !sensors_get_feature(*name,SENSORS_MTP008_IN5,&cur) && + !sensors_get_feature(*name,SENSORS_MTP008_IN5_MIN,&min) && + !sensors_get_feature(*name,SENSORS_MTP008_IN5_MAX,&max)) { + if (valid) { + print_label(label,10); + printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", + cur,min,max,alarms&MTP008_ALARM_IN5?"ALARM":""); + } + } else + printf("ERROR: Can't get IN5 data!\n"); + free_the_label(&label); + if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_IN6,&label,&valid) && + !sensors_get_feature(*name,SENSORS_MTP008_IN6,&cur) && + !sensors_get_feature(*name,SENSORS_MTP008_IN6_MIN,&min) && + !sensors_get_feature(*name,SENSORS_MTP008_IN6_MAX,&max)) { + if (valid) { + print_label(label,10); + printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", + cur,min,max,alarms&MTP008_ALARM_IN6?"ALARM":""); + } + } else + printf("ERROR: Can't get IN6 data!\n"); + free_the_label(&label); + + if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_FAN1,&label,&valid) && + !sensors_get_feature(*name,SENSORS_MTP008_FAN1,&cur) && + !sensors_get_feature(*name,SENSORS_MTP008_FAN1_DIV,&fdiv) && + !sensors_get_feature(*name,SENSORS_MTP008_FAN1_MIN,&min)) { + if (valid) { + print_label(label,10); + printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", + cur,min,fdiv, alarms&MTP008_ALARM_FAN1?"ALARM":""); + } + } else + printf("ERROR: Can't get FAN1 data!\n"); + free_the_label(&label); + if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_FAN2,&label,&valid) && + !sensors_get_feature(*name,SENSORS_MTP008_FAN2,&cur) && + !sensors_get_feature(*name,SENSORS_MTP008_FAN2_DIV,&fdiv) && + !sensors_get_feature(*name,SENSORS_MTP008_FAN2_MIN,&min)) { + if (valid) { + print_label(label,10); + printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", + cur,min,fdiv, alarms&MTP008_ALARM_FAN2?"ALARM":""); + } + } else + printf("ERROR: Can't get FAN2 data!\n"); + free_the_label(&label); + if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_FAN3,&label,&valid) && + !sensors_get_feature(*name,SENSORS_MTP008_FAN3,&cur) && + !sensors_get_feature(*name,SENSORS_MTP008_FAN3_DIV,&fdiv) && + !sensors_get_feature(*name,SENSORS_MTP008_FAN3_MIN,&min)) { + if (valid) { + print_label(label,10); + printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", + cur,min,fdiv, alarms&MTP008_ALARM_FAN3?"ALARM":""); + } + } else + printf("ERROR: Can't get FAN3 data!\n"); + free_the_label(&label); + + if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_TEMP1,&label,&valid) && + !sensors_get_feature(*name,SENSORS_MTP008_TEMP1,&cur) && + !sensors_get_feature(*name,SENSORS_MTP008_TEMP1_HYST,&min) && + !sensors_get_feature(*name,SENSORS_MTP008_TEMP1_OVER,&max)) { + if (valid) { + print_label(label,10); + printf("%+6.0f C (limit = %+3.0f C, hysteresis = %+3.0f C) %s\n", + cur,max,min, alarms&MTP008_ALARM_TEMP1?"ALARM":""); + } + } else + printf("ERROR: Can't get TEMP1 data!\n"); + free_the_label(&label); + + if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_TEMP2,&label,&valid) && + !sensors_get_feature(*name,SENSORS_MTP008_TEMP2,&cur) && + !sensors_get_feature(*name,SENSORS_MTP008_TEMP2_HYST,&min) && + !sensors_get_feature(*name,SENSORS_MTP008_TEMP2_OVER,&max)) { + if (valid) { + print_label(label,10); + printf("%+6.0f C (limit = %+3.0f C, hysteresis = %+3.0f C) %s\n", + cur,max,min, alarms&MTP008_ALARM_TEMP2?"ALARM":""); + } + } else + printf("ERROR: Can't get TEMP2 data!\n"); + free_the_label(&label); + + if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_TEMP3,&label,&valid) && + !sensors_get_feature(*name,SENSORS_MTP008_TEMP3,&cur) && + !sensors_get_feature(*name,SENSORS_MTP008_TEMP3_HYST,&min) && + !sensors_get_feature(*name,SENSORS_MTP008_TEMP3_OVER,&max)) { + if (valid) { + print_label(label,10); + printf("%+6.0f C (limit = %+3.0f C, hysteresis = %+3.0f C) %s\n", + cur,max,min, alarms&MTP008_ALARM_TEMP3?"ALARM":""); + } + } else + printf("ERROR: Can't get TEMP3 data!\n"); + free_the_label(&label); + + if (!sensors_get_label_and_valid(*name,SENSORS_MTP008_VID,&label,&valid) && + !sensors_get_feature(*name,SENSORS_MTP008_VID,&cur)) { + if (valid) { + print_label(label,10); + printf("%+6.2f V\n",cur); + } + } + free_the_label(&label); +} + void print_w83781d(const sensors_chip_name *name) { char *label = NULL; diff --git a/prog/sensors/chips.h b/prog/sensors/chips.h index 2351dd86..5355423a 100644 --- a/prog/sensors/chips.h +++ b/prog/sensors/chips.h @@ -24,6 +24,7 @@ extern void print_unknown_chip(const sensors_chip_name *name); +extern void print_mtp008(const sensors_chip_name *name); extern void print_lm75(const sensors_chip_name *name); extern void print_adm1021(const sensors_chip_name *name); extern void print_adm1025(const sensors_chip_name *name); diff --git a/prog/sensors/main.c b/prog/sensors/main.c index d3b919c3..85c38ad3 100644 --- a/prog/sensors/main.c +++ b/prog/sensors/main.c @@ -268,6 +268,8 @@ void do_a_print(sensors_chip_name name) else if (!strcmp(name.prefix,"lm78") || !strcmp(name.prefix,"lm78-j") || !strcmp(name.prefix,"lm79")) print_lm78(&name); + else if (!strcmp(name.prefix,"mtp008")) + print_mtp008(&name); else if (!strcmp(name.prefix,"sis5595")) print_sis5595(&name); else if (!strcmp(name.prefix,"via686a"))