From ba665c528e7f18ac57692e69fff7b6767cace5b3 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Fri, 6 Jul 2007 15:44:28 +0000 Subject: [PATCH] Add user-space support for it87 fan4 and fan5. Closes half of ticket #2227. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@4565 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 2 ++ kernel/chips/it87.c | 2 ++ lib/chips.c | 10 ++++++++++ lib/chips.h | 4 ++++ prog/sensors/chips.c | 29 ++++++++++++++++++++++++++++- 5 files changed, 46 insertions(+), 1 deletion(-) diff --git a/CHANGES b/CHANGES index 66b80b7a..ab78372a 100644 --- a/CHANGES +++ b/CHANGES @@ -12,6 +12,7 @@ SVN HEAD Add w83627ehf support (for Linux 2.4) Add support for the w83627ehf VID function Add support for the w83627ehf thermal sensor types + Add support for it87 fan4 and fan5 Man page sensors.conf.5: Update the chip statement section Module i2c-nforce2: Add nForce MCP61, MCP65 support (2.6 backport) Module lm85: Fix setting the fan speed min limit to 0 @@ -41,6 +42,7 @@ SVN HEAD Add w83627ehf support (for Linux 2.4) Add support for the w83627ehf VID function Add support for the w83627ehf thermal sensor types + Add support for it87 fan4 and fan5 Program sensors-detect: Stop Super-I/O probe after first family success Fix SMSC DME1737 detection Add /usr/sbin to the PATH (#2199) diff --git a/kernel/chips/it87.c b/kernel/chips/it87.c index 01286a7e..b746b98b 100644 --- a/kernel/chips/it87.c +++ b/kernel/chips/it87.c @@ -333,6 +333,8 @@ static struct i2c_driver it87_driver = { #define IT87_ALARM_FAN1 0x0001 #define IT87_ALARM_FAN2 0x0002 #define IT87_ALARM_FAN3 0x0004 +#define IT87_ALARM_FAN4 0x0008 +#define IT87_ALARM_FAN5 0x0040 #define IT87_ALARM_TEMP1 0x00010000 #define IT87_ALARM_TEMP2 0x00020000 #define IT87_ALARM_TEMP3 0x00040000 diff --git a/lib/chips.c b/lib/chips.c index 5f7ed612..66bd0534 100644 --- a/lib/chips.c +++ b/lib/chips.c @@ -4162,6 +4162,10 @@ static sensors_chip_feature it87_features[] = IT87_SYSCTL_FAN2, VALUE(2), 0 }, { { SENSORS_IT87_FAN3, "fan3", NOMAP, NOMAP, R }, IT87_SYSCTL_FAN3, VALUE(2), 0 }, + { { SENSORS_IT87_FAN4, "fan4", NOMAP, NOMAP, R }, + NOSYSCTL, VALUE(2), 0 }, + { { SENSORS_IT87_FAN5, "fan5", NOMAP, NOMAP, R }, + NOSYSCTL, VALUE(2), 0 }, { { SENSORS_IT87_FAN1_MIN, "fan1_min", SENSORS_IT87_FAN1, SENSORS_IT87_FAN1, RW }, IT87_SYSCTL_FAN1, VALUE(1), 0 }, @@ -4171,6 +4175,12 @@ static sensors_chip_feature it87_features[] = { { SENSORS_IT87_FAN3_MIN, "fan3_min", SENSORS_IT87_FAN3, SENSORS_IT87_FAN3, RW }, IT87_SYSCTL_FAN3, VALUE(1), 0 }, + { { SENSORS_IT87_FAN4_MIN, "fan4_min", SENSORS_IT87_FAN4, SENSORS_IT87_FAN4, + RW }, + NOSYSCTL, VALUE(1), 0 }, + { { SENSORS_IT87_FAN5_MIN, "fan5_min", SENSORS_IT87_FAN5, SENSORS_IT87_FAN5, + RW }, + NOSYSCTL, VALUE(1), 0 }, { { SENSORS_IT87_TEMP1, "temp1", NOMAP, NOMAP, R }, IT87_SYSCTL_TEMP1, VALUE(3), 1 }, { { SENSORS_IT87_TEMP2, "temp2", NOMAP, NOMAP, R }, diff --git a/lib/chips.h b/lib/chips.h index 682b7282..14748f5b 100644 --- a/lib/chips.h +++ b/lib/chips.h @@ -1628,9 +1628,13 @@ #define SENSORS_IT87_FAN1 31 /* R */ #define SENSORS_IT87_FAN2 32 /* R */ #define SENSORS_IT87_FAN3 33 /* R */ +#define SENSORS_IT87_FAN4 34 /* R */ +#define SENSORS_IT87_FAN5 35 /* R */ #define SENSORS_IT87_FAN1_MIN 41 /* RW */ #define SENSORS_IT87_FAN2_MIN 42 /* RW */ #define SENSORS_IT87_FAN3_MIN 43 /* RW */ +#define SENSORS_IT87_FAN4_MIN 44 /* RW */ +#define SENSORS_IT87_FAN5_MIN 45 /* RW */ #define SENSORS_IT87_TEMP1 51 /* R */ #define SENSORS_IT87_TEMP2 52 /* R */ #define SENSORS_IT87_TEMP3 53 /* R */ diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 3b3032af..f4d407ae 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -3271,7 +3271,11 @@ void print_it87(const sensors_chip_name *name) { char *label; double cur, min, max, fdiv, sens; - int alarms, valid; + int alarms, valid, fan45; + + /* The IT8716F, IT8718F and late revisions of the IT8712F have two + additional (optional) fan inputs */ + fan45 = strcmp(name->prefix, "it87"); if (!sensors_get_feature(*name,SENSORS_IT87_ALARMS, &cur)) { alarms = cur + 0.5; @@ -3431,6 +3435,29 @@ void print_it87(const sensors_chip_name *name) } free(label); + if (fan45) { + if (!sensors_get_label_and_valid(*name, SENSORS_IT87_FAN4, &label, &valid) && + !sensors_get_feature(*name, SENSORS_IT87_FAN4, &cur) && + !sensors_get_feature(*name, SENSORS_IT87_FAN4_MIN, &min)) { + if (valid) { + print_label(label, 10); + printf("%4.0f RPM (min = %4.0f RPM) %s\n", + cur, min, alarms&IT87_ALARM_FAN4?"ALARM":""); + } + } + free(label); + if (!sensors_get_label_and_valid(*name, SENSORS_IT87_FAN5, &label, &valid) && + !sensors_get_feature(*name, SENSORS_IT87_FAN5, &cur) && + !sensors_get_feature(*name, SENSORS_IT87_FAN5_MIN, &min)) { + if (valid) { + print_label(label, 10); + printf("%4.0f RPM (min = %4.0f RPM) %s\n", + cur, min, alarms&IT87_ALARM_FAN5?"ALARM":""); + } + } + free(label); + } + if (!sensors_get_label_and_valid(*name,SENSORS_IT87_TEMP1,&label,&valid) && !sensors_get_feature(*name,SENSORS_IT87_TEMP1,&cur) && !sensors_get_feature(*name,SENSORS_IT87_TEMP1_LOW,&min) &&