From 64eeab4ffa24939163c080e2dd7534699b0cbbc5 Mon Sep 17 00:00:00 2001 From: Jean Delvare Date: Sun, 23 Jan 2005 09:10:34 +0000 Subject: [PATCH] Use standard LSB (0.5 degree C) for AS99127F temp2 and temp3. git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@2865 7894878c-1315-0410-8ee3-d5d059ff63e0 --- etc/sensors.conf.eg | 26 +++++++++++++------------- kernel/chips/w83781d.c | 39 +++++++-------------------------------- 2 files changed, 20 insertions(+), 45 deletions(-) diff --git a/etc/sensors.conf.eg b/etc/sensors.conf.eg index 85054da3..10acec60 100644 --- a/etc/sensors.conf.eg +++ b/etc/sensors.conf.eg @@ -750,24 +750,24 @@ chip "as99127f-*" # compute in5 (5.14 * @) - 14.91 , (@ + 14.91) / 5.14 # compute in6 (3.14 * @) - 7.71 , (@ + 7.71) / 3.14 -# Depending on your motherboard, you have to choose between three formulae -# for temp2. Quoting Artur Gawryszczak: -# "I guess, that the formula "temp2 (@*30/43)+25, (@-25)*43/30" is correct +# Depending on your motherboard, you may have to use any of two formulae +# for temp2. Quoting Artur Gawryszczak (edited to reflect subsequent fixes +# to the driver): +# "I guess, that the formula "(@*15/43)+25, (@-25)*43/15" is correct # for those Asus motherboards, which get CPU temperature from internal -# thermal diode (Pentium Coppermine, and above), and "temp2 @*2.0, @/2.0" -# is correct for Athlon/Duron boards, which use a thermistor in the -# socket." -# The third formula was found and reported by Victor G. Marimon. -# Asus CUV4X, Asus A7V8X -# compute temp2 (@*30/43)+25, (@-25)*43/30 +# thermal diode (Pentium Coppermine, and above), while no formula is needed +# for Athlon/Duron boards, which use a thermistor in the socket." +# An alternative formula was then found and reported by Victor G. Marimon. + # Asus A7V133, Asus A7M266 - compute temp2 @*2.0, @/2.0 +# No compute line is needed +# Asus CUV4X, Asus A7V8X +# compute temp2 (@*15/43)+25, (@-25)*43/15 # Asus CUSL2, Asus CUV266-DLS -# compute temp2 (@*60/43)+25, (@-25)*43/60 +# compute temp2 (@*30/43)+25, (@-25)*43/30 # See comments above if temp3 looks bad. What works for temp2 is likely -# to work for temp3. - compute temp3 @*2.0, @/2.0 +# to work for temp3 for dual-CPU boards. # Most Asus boards have temperatures settled like that: label temp1 "M/B Temp" diff --git a/kernel/chips/w83781d.c b/kernel/chips/w83781d.c index 6c020e1d..9c44c2ee 100644 --- a/kernel/chips/w83781d.c +++ b/kernel/chips/w83781d.c @@ -200,10 +200,6 @@ static inline u8 FAN_TO_REG(long rpm, int div) ((val)+5)/10),0,255)) #define TEMP_FROM_REG(val) (((val)>0x80?(val)-0x100:(val))*10) -#define AS99127_TEMP_ADD_TO_REG(val) (SENSORS_LIMIT((((((val) + 2)*4)/10) \ - << 7),0,0xffff)) -#define AS99127_TEMP_ADD_FROM_REG(val) ((((val) >> 7) * 10) / 4) - #define ALARMS_FROM_REG(val) (val) #define PWM_FROM_REG(val) (val) #define PWM_TO_REG(val) (SENSORS_LIMIT((val),0,255)) @@ -1588,43 +1584,22 @@ void w83781d_temp_add(struct i2c_client *client, int operation, *nrels_mag = 1; else if (operation == SENSORS_PROC_REAL_READ) { w83781d_update_client(client); - if (data->type == as99127f) { - results[0] = - AS99127_TEMP_ADD_FROM_REG(data-> - temp_add_over[nr]); - results[1] = - AS99127_TEMP_ADD_FROM_REG(data-> - temp_add_hyst[nr]); - results[2] = - AS99127_TEMP_ADD_FROM_REG(data->temp_add[nr]); - } else { - results[0] = - LM75_TEMP_FROM_REG(data->temp_add_over[nr]); - results[1] = - LM75_TEMP_FROM_REG(data->temp_add_hyst[nr]); - results[2] = LM75_TEMP_FROM_REG(data->temp_add[nr]); - } + results[0] = LM75_TEMP_FROM_REG(data->temp_add_over[nr]); + results[1] = LM75_TEMP_FROM_REG(data->temp_add_hyst[nr]); + results[2] = LM75_TEMP_FROM_REG(data->temp_add[nr]); *nrels_mag = 3; } else if (operation == SENSORS_PROC_REAL_WRITE) { if (*nrels_mag >= 1) { - if (data->type == as99127f) - data->temp_add_over[nr] = - AS99127_TEMP_ADD_TO_REG(results[0]); - else - data->temp_add_over[nr] = - LM75_TEMP_TO_REG(results[0]); + data->temp_add_over[nr] = + LM75_TEMP_TO_REG(results[0]); w83781d_write_value(client, nr ? W83781D_REG_TEMP3_OVER : W83781D_REG_TEMP2_OVER, data->temp_add_over[nr]); } if (*nrels_mag >= 2) { - if (data->type == as99127f) - data->temp_add_hyst[nr] = - AS99127_TEMP_ADD_TO_REG(results[1]); - else - data->temp_add_hyst[nr] = - LM75_TEMP_TO_REG(results[1]); + data->temp_add_hyst[nr] = + LM75_TEMP_TO_REG(results[1]); w83781d_write_value(client, nr ? W83781D_REG_TEMP3_HYST : W83781D_REG_TEMP2_HYST,