From 6afe8168b01c12da745e8e50deec45cbb269ce11 Mon Sep 17 00:00:00 2001 From: Philip Edelbrock Date: Sun, 7 Jan 2001 22:13:59 +0000 Subject: [PATCH] (Phil) Documentation, further testing/debugging for the lm87 and osb4. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@974 7894878c-1315-0410-8ee3-d5d059ff63e0 --- CHANGES | 4 +- doc/chips/lm87 | 151 +++++++++++++++++++++++++++++++++++++++++++ kernel/chips/lm87.c | 11 ++-- prog/sensors/chips.c | 24 +++---- 4 files changed, 166 insertions(+), 24 deletions(-) create mode 100644 doc/chips/lm87 diff --git a/CHANGES b/CHANGES index 0bd25ff3..753b8de6 100644 --- a/CHANGES +++ b/CHANGES @@ -17,7 +17,7 @@ ask CVS about it: ----------------------------------------------------------------------------- -2.5.5 (2000????) +2.5.5 (2001????) NOTE: i2c 2.5.5 MUST BE be compiled and installed first. Chip modules (all): Update mutex definition (works now for new 2.2 kernels) File sensors.conf.eg: Add mtp008 entries, adm1025 entries @@ -41,7 +41,7 @@ ask CVS about it: Program sensors: Add ds1621, mtp008 support; add -f (Fahrenheit) option; add adm1025 temp2; report temp limits correctly as min/max or limit/hysteresis; print message if no - sensors are found. + sensors are found. Removed false errors from lm87 reads. Program sensors-detect: Add ds1621, mtp008 detection; add ServerWorks detection diff --git a/doc/chips/lm87 b/doc/chips/lm87 new file mode 100644 index 00000000..568d6daa --- /dev/null +++ b/doc/chips/lm87 @@ -0,0 +1,151 @@ +Kernel driver `lm87.o' +====================== + +Status: Complete and somewhat tested + +Supported chips: + * National Semiconductors LM87 + Prefix `lm87' + Addresses scanned: I2C 0x2c - 0x2f (inclusive) + +Authors: Frodo Looijaard , + Philip Edelbrock , + Mark Studebaker , + and Stephen Rousset + + +Module Parameters +----------------- + +* force: short array (min = 1, max = 48) + List of adapter,address pairs to boldly assume to be present +* force_lm87: short array (min = 1, max = 48) + List of adapter,address pairs which are unquestionably assumed to contain + a `lm87' chip +* ignore: short array (min = 1, max = 48) + List of adapter,address pairs not to scan +* ignore_range: short array (min = 1, max = 48) + List of adapter,start-addr,end-addr triples not to scan +* probe: short array (min = 1, max = 48) + List of adapter,address pairs to scan additionally +* probe_range: short array (min = 1, max = 48) + List of adapter,start-addr,end-addr triples to scan additionally + + +Description +----------- + +This driver implements support for the National Semiconductors LM87. + +The LM87 implements up to three temperature sensors, up to two FAN +rotation speed sensors, up to seven voltage sensors, alarms, and some +miscellaneous stuff. + +Temperatures are measured in degrees Celcius. Each input has a high +and low alarm settings. A high limit produces an alarm when the value +goes above it, and an alarm is also produced when the value goes below +the low limit. + +FAN rotation speeds are reported in RPM (rotations per minute). An alarm is +triggered if the rotation speed has dropped below a programmable limit. FAN +readings can be divided by a programmable divider (1, 2, 4 or 8) to give +the readings more range or accuracy. This is important because some FANs +report only one 'tick' each rotation, while others report two - making +all readings twice as high. Not all RPM values can accurately be represented, +so some rounding is done. With a divider of 2, the lowest representable +value is around 2600 RPM. + +Voltage sensors (also known as IN sensors) report their values in +volts. An alarm is triggered if the voltage has crossed a programmable +minimum or maximum limit. Note that minimum in this case always means +'closest to zero'; this is important for negative voltage +measurements. + +If an alarm triggers, it will remain triggered until the hardware register +is read at least once. This means that the cause for the alarm may +already have disappeared! Note that in the current implementation, all +hardware registers are read whenever any data is read (unless it is less +than 2.0 seconds since the last update). This means that you can easily +miss once-only alarms. + +The LM87 only updates its values each 1.0 seconds; reading it more +often will do no harm, but will return 'old' values. + + +Hardware Configurations +----------------------- + +The LM87 has four pins which can serve one of two possible functions, +depending on the hardware configuration. These pins are: + +Vccp2/D2- (pin 17) ++2.5V(IN0)/D2+ (pin 18) +FAN1/AIN1 (pin 5) +FAN2/AIN2 (pin 6) + +The most common configuration is to use the values shown here on the +left (Vccp2, 2.5V, FAN1, and FAN2). However, for a third temperature +sensor, it is possible to do away with Vccp2 and 2.5V (IN0) for the +second external temp doide inputs. Ironicly, it seems that you can +monitor the core voltage of the second processor or it's temperature, +but never both at the same time. Also, either/both FAN1 and FAN2 +inputs can be substituted for aux analog inputs AIN1 and/or AIN2, +respectively. + +To adjust the driver for a hardware configuration other than the +default, simply uncomment the appropriate #defines in the +kernel/chips/lm87.c driver header, and then recompile/reinstall. +Here is a copy (as of this writing) of the header: + + +--snip-- +/* Chip configuration settings. These should be set to reflect the +HARDWARE configuration of your chip. By default (read: when all of +these are left commented out), this driver assumes that the +configuration is the same as National's defaults for the Channel Mode +register. + + Set to '1' the appropriate defines, as nessesary: + + - External temp sensors 2 (possible second CPU temp) + This will disable the 2.5V and Vccp2 readings. + Ironicly, National decided that you can read the + temperature of a second CPU or it's core voltage, + but not both! Comment out if FAULT is reported. */ + +/* #define LM87_EXT2 1 */ + +/* Aux analog input. When enabled, the Fan 1 reading + will be disabled */ + +/* #define LM87_AIN1 1 */ + +/* Aux analog input 2. When enabled, the Fan 2 reading + will be disabled */ + +/* #define LM87_AIN2 1 */ + +/* Internal Vcc is 5V instead of 3.3V */ + +/* #define LM87_5V_VCC 1 */ + +/* That's the end of the hardware config defines. I would have made + them insmod params, but it would be too much work. ;') */ +--snip-- + +Please note: Only adjust the #defines to reflect your HARDWARE +configuration. Otherwise some, if not all, the readings will be +wrong. Simply enabling different driver configurations does not +provide the desired readings. You must make hardware changes (which +is hard) if you really wish to get a different set of readings!! + +If you may suspect that your configuration may be different than the +default, try enabling the different #defines. If you get a 'FAULT' +when using D2, it is most likely that you don't have a second external +diode, so recomment-out the #define. If you get strange readings for +some/all of the other values when enabling a AIN, then recomment-out +that #define. + +Unfortunately, it's tough to 'detect' all hardware config's +automaticly. And, I needed to resort to using #defines instead of +insmod params to make life easier on myself. diff --git a/kernel/chips/lm87.c b/kernel/chips/lm87.c index cbf70a8f..b87a3a25 100644 --- a/kernel/chips/lm87.c +++ b/kernel/chips/lm87.c @@ -38,10 +38,11 @@ #include -/* Chip configuration settings. These should be set to reflect -the HARDWARE configuration of your chip. By default (read: when all -of these are left zero), this driver assumes that the configuration -is the same as National's defaults for the Channel Mode register. +/* Chip configuration settings. These should be set to reflect the +HARDWARE configuration of your chip. By default (read: when all of +these are left commented out), this driver assumes that the +configuration is the same as National's defaults for the Channel Mode +register. Set to '1' the appropriate defines, as nessesary: @@ -821,12 +822,10 @@ void LM87_ain(struct i2c_client *client, int operation, int ctl_name, } } - void LM87_fan(struct i2c_client *client, int operation, int ctl_name, int *nrels_mag, long *results) { struct LM87_data *data = client->data; - int nr = ctl_name - LM87_SYSCTL_FAN1; if (operation == SENSORS_PROC_REAL_INFO) *nrels_mag = 0; diff --git a/prog/sensors/chips.c b/prog/sensors/chips.c index b531c96a..5bf09388 100644 --- a/prog/sensors/chips.c +++ b/prog/sensors/chips.c @@ -1299,8 +1299,7 @@ void print_lm87(const sensors_chip_name *name) printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", cur,min,max,alarms&LM87_ALARM_IN0?"ALARM":""); } - } else - printf("ERROR: Can't get IN0 data!\n"); + } free_the_label(&label); if (!sensors_get_label_and_valid(*name,SENSORS_LM87_IN1,&label,&valid) && !sensors_get_feature(*name,SENSORS_LM87_IN1,&cur) && @@ -1323,8 +1322,7 @@ void print_lm87(const sensors_chip_name *name) printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", cur,min,max,alarms&LM87_ALARM_IN2?"ALARM":""); } - } else - printf("ERROR: Can't get IN2 data!\n"); + } free_the_label(&label); if (!sensors_get_label_and_valid(*name,SENSORS_LM87_IN3,&label,&valid) && !sensors_get_feature(*name,SENSORS_LM87_IN3,&cur) && @@ -1359,8 +1357,7 @@ void print_lm87(const sensors_chip_name *name) printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", cur,min,max,alarms&LM87_ALARM_IN5?"ALARM":""); } - } else - printf("ERROR: Can't get IN5 data!\n"); + } free_the_label(&label); if (!sensors_get_label_and_valid(*name,SENSORS_LM87_AIN1,&label,&valid) && !sensors_get_feature(*name,SENSORS_LM87_AIN1,&cur) && @@ -1371,8 +1368,7 @@ void print_lm87(const sensors_chip_name *name) printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", cur,min,max,alarms&LM87_ALARM_FAN1?"ALARM":""); } - } else - printf("ERROR: Can't get AIN1 data!\n"); + } free_the_label(&label); if (!sensors_get_label_and_valid(*name,SENSORS_LM87_AIN2,&label,&valid) && !sensors_get_feature(*name,SENSORS_LM87_AIN2,&cur) && @@ -1383,8 +1379,7 @@ void print_lm87(const sensors_chip_name *name) printf("%+6.2f V (min = %+6.2f V, max = %+6.2f V) %s\n", cur,min,max,alarms&LM87_ALARM_FAN2?"ALARM":""); } - } else - printf("ERROR: Can't get AIN2 data!\n"); + } free_the_label(&label); if (!sensors_get_label_and_valid(*name,SENSORS_LM87_FAN1,&label,&valid) && @@ -1396,8 +1391,7 @@ void print_lm87(const sensors_chip_name *name) printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", cur,min,fdiv, alarms&LM87_ALARM_FAN1?"ALARM":""); } - } else - printf("ERROR: Can't get FAN1 data!\n"); + } free_the_label(&label); if (!sensors_get_label_and_valid(*name,SENSORS_LM87_FAN2,&label,&valid) && !sensors_get_feature(*name,SENSORS_LM87_FAN2,&cur) && @@ -1408,8 +1402,7 @@ void print_lm87(const sensors_chip_name *name) printf("%4.0f RPM (min = %4.0f RPM, div = %1.0f) %s\n", cur,min,fdiv, alarms&LM87_ALARM_FAN2 ?"ALARM":""); } - } else - printf("ERROR: Can't get FAN2 data!\n"); + } free_the_label(&label); if (!sensors_get_label_and_valid(*name,SENSORS_LM87_TEMP1,&label,&valid) && @@ -1450,8 +1443,7 @@ void print_lm87(const sensors_chip_name *name) printf(" %s%s\n", alarms&LM87_ALARM_TEMP3?"ALARM":"", alarms&LM87_ALARM_TEMP3_FAULT?" FAULT":""); } - } else - printf("ERROR: Can't get TEMP3 data!\n"); + } free_the_label(&label); if (!sensors_get_label_and_valid(*name,SENSORS_LM87_VID,&label,&valid) &&