(Phil) Fixed temperature reporting of LM80 (I hope).

git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@543 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
Philip Edelbrock committed 1999-08-30 04:15:55 +00:00
1 parent cb4b34a2ab
commit 2a2a3f35fe
1 file changed
+13 -12
+13 -12
View File
@@ -99,13 +99,14 @@ FAN_TO_REG (unsigned rpm, unsigned div)
extern inline long TEMP_FROM_REG(u16 temp)
{
long res;
res = ((temp & 0xff00) >> 8) * 10000 + ((temp & 0x10) >> 4) * 5000 +
((temp & 0x20) >> 5) * 2500 + ((temp & 0x40) >> 6) * 1250 +
((temp & 0x80) >> 7) * 625;
temp /= 100;
if (temp >= 0x80 * 100)
temp = - (0x100 * 100 - temp);
return temp;
temp= temp >> 4;
if (temp < 0x0800) {
res = (625 * (long)temp);
} else {
res = ((long)temp - 0x01000) * 625;
}
return res;
}
#define TEMP_LIMIT_FROM_REG(val) (((val)>0x80?(val)-0x100:(val))*100)
@@ -602,13 +603,13 @@ void lm80_temp(struct i2c_client *client, int operation, int ctl_name,
{
struct lm80_data *data = client->data;
if (operation == SENSORS_PROC_REAL_INFO)
*nrels_mag = 1;
*nrels_mag = 4;
else if (operation == SENSORS_PROC_REAL_READ) {
lm80_update_client(client);
results[0] = TEMP_LIMIT_FROM_REG(data->temp_hot_max);
results[1] = TEMP_LIMIT_FROM_REG(data->temp_hot_hyst);
results[2] = TEMP_LIMIT_FROM_REG(data->temp_os_max);
results[3] = TEMP_LIMIT_FROM_REG(data->temp_os_hyst);
results[0] = TEMP_LIMIT_FROM_REG(data->temp_hot_max) * 10000;
results[1] = TEMP_LIMIT_FROM_REG(data->temp_hot_hyst) * 10000;
results[2] = TEMP_LIMIT_FROM_REG(data->temp_os_max) * 10000;
results[3] = TEMP_LIMIT_FROM_REG(data->temp_os_hyst) * 10000;
results[4] = TEMP_FROM_REG(data->temp);
*nrels_mag = 5;
} else if (operation == SENSORS_PROC_REAL_WRITE) {