diff options
author | Mark D. Studebaker <mdsxyz123@yahoo.com> | 2002-06-29 02:46:51 +0000 |
---|---|---|
committer | Mark D. Studebaker <mdsxyz123@yahoo.com> | 2002-06-29 02:46:51 +0000 |
commit | 927aae8b81f65fb1bd45b150b2b6b0b2b9e27a09 (patch) | |
tree | f7852040cb48ca03d6b07863fbe1332646bcd1c6 | |
parent | 1c990e4d359103635ad0a0c8305996f4cfb82457 (diff) | |
download | lm-sensors-git-927aae8b81f65fb1bd45b150b2b6b0b2b9e27a09.tar.gz |
Initialize temp1-3 to "comparator" mode so that the ALARM
indication will always be valid; it won't be cleared forever by
reading the register. Do this by setting temp1_hyst to 127
and programming register 4C which sets it for temps 2 and 3.
Don't print hyst. value for temp1 in 'sensors' if == 127.
git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@1407 7894878c-1315-0410-8ee3-d5d059ff63e0
-rw-r--r-- | CHANGES | 2 | ||||
-rw-r--r-- | doc/chips/w83781d | 5 | ||||
-rw-r--r-- | kernel/chips/w83781d.c | 10 | ||||
-rw-r--r-- | prog/sensors/chips.c | 17 |
4 files changed, 26 insertions, 8 deletions
@@ -36,7 +36,7 @@ ask CVS about it: Module smbus-arp: new Module smsc47m1: new Module via686a: Add support for VT8231 sensors - Module w83781d: Add multiple VID version support + Module w83781d: Add multiple VID version support; fix temp alarms Program eeprom: new Program i2cdump: Add smbus block command specification Program mkpatch: Install new sensors_vid.h diff --git a/doc/chips/w83781d b/doc/chips/w83781d index 4dd8bb02..6563b11c 100644 --- a/doc/chips/w83781d +++ b/doc/chips/w83781d @@ -106,7 +106,10 @@ Overtemperature Shutdown limit is crossed; it is triggered again as soon as it drops below the Hysteresis value. A more useful behaviour can be found by setting the Hysteresis value to +127 degrees Celcius; in this case, alarms are issued during all the time when the actual temperature -is above the Overtemperature Shutdown value. For the other sensor(s), an +is above the Overtemperature Shutdown value. The driver sets the +hysteresis value for temp1 to 127 at initialization. + +For the other temperature sensor(s), an alarm is triggered when the temperature gets higher then the Overtemperature Shutdown value; it stays on until the temperature falls below the Hysteresis value. But on the W83781D, there is only one alarm that functions for both diff --git a/kernel/chips/w83781d.c b/kernel/chips/w83781d.c index d4884296..3f275c75 100644 --- a/kernel/chips/w83781d.c +++ b/kernel/chips/w83781d.c @@ -115,6 +115,7 @@ MODULE_PARM_DESC(init, "Set to zero to bypass chip initialization"); #define W83781D_REG_ALARM2 0x42 #define W83781D_REG_ALARM3 0x450 /* not on W83781D */ +#define W83781D_REG_IRQ 0x4C #define W83781D_REG_BEEP_CONFIG 0x4D #define W83781D_REG_BEEP_INTS1 0x56 #define W83781D_REG_BEEP_INTS2 0x57 @@ -306,7 +307,7 @@ extern inline u8 DIV_TO_REG(long val, enum chips type) #define W83781D_INIT_FAN_MIN_3 3000 #define W83781D_INIT_TEMP_OVER 600 -#define W83781D_INIT_TEMP_HYST 500 +#define W83781D_INIT_TEMP_HYST 1270 /* must be 127 for ALARM to work */ #define W83781D_INIT_TEMP2_OVER 600 #define W83781D_INIT_TEMP2_HYST 500 #define W83781D_INIT_TEMP3_OVER 600 @@ -1455,10 +1456,13 @@ void w83781d_init_client(struct i2c_client *client) w83781d_write_value(client, W83781D_REG_TEMP3_CONFIG, 0x00); } - /* enable PWM2 control (can't hurt since PWM reg should have - been reset to 0xff) */ if (type != w83781d) { + /* enable PWM2 control (can't hurt since PWM reg + should have been reset to 0xff) */ w83781d_write_value(client, W83781D_REG_PWMCLK12, 0x19); + /* enable comparator mode for temp2 and temp3 so + alarm indication will work correctly */ + w83781d_write_value(client, W83781D_REG_IRQ, 0x41); } } diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index 6a456d98..0a424cca 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -51,7 +51,8 @@ inline float deg_ctof( float cel ) #define HYST 0 #define MINMAX 1 -/* minmax = 0 for limit/hysteresis, 1 for max/min; +#define MAXONLY 2 +/* minmax = 0 for limit/hysteresis, 1 for max/min, 2 for max only; curprec and limitprec are # of digits after decimal point for the current temp and the limits */ void print_temp_info(float n_cur, float n_over, float n_hyst, @@ -74,6 +75,10 @@ void print_temp_info(float n_cur, float n_over, float n_hyst, curprec, n_cur, degv, limitprec + 4, limitprec, n_hyst, degv, limitprec + 4, limitprec, n_over, degv); + else if(minmax == MAXONLY) + printf( "%+6.*f%s (limit = %+*.*f%s) ", + curprec, n_cur, degv, + limitprec + 4, limitprec, n_over, degv); else /* HYST */ printf( "%+6.*f%s (limit = %+*.*f%s, hysteresis = %+*.*f%s)", curprec, n_cur, degv, @@ -2027,13 +2032,19 @@ void print_w83781d(const sensors_chip_name *name) if (valid) { if((!is82d) && (!is83s) && (!is697hf)) { print_label(label,10); - print_temp_info( cur, max, min, HYST, 0, 0); + if(min == 127) + print_temp_info( cur, max, 0, MAXONLY, 0, 0); + else + print_temp_info( cur, max, min, HYST, 0, 0); printf(" %s %s\n", alarms&W83781D_ALARM_TEMP1 ?"ALARM":" ", beeps&W83781D_ALARM_TEMP1?"(beep)":""); } else { if(!sensors_get_feature(*name,SENSORS_W83781D_SENS1,&sens)) { print_label(label,10); - print_temp_info( cur, max, min, HYST, 0, 0); + if(min == 127) + print_temp_info( cur, max, 0, MAXONLY, 0, 0); + else + print_temp_info( cur, max, min, HYST, 0, 0); printf( " sensor = %s %s %s\n", (((int)sens)==1)?"PII/Celeron diode":(((int)sens)==2)? "3904 transistor":"thermistor", |