Skip to contentSkip to conversation

adt7470: Temperatures should be signed

PATCH In review Darrick J. Wong 2 participants 3 messages Jul 16, 2007 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 adt7470: Temperatures should be signed

Quoted 1 line · Philip Pokorny

The values 0x81 and 0x7f are *signed* 8 bit quantities. 0x81 whould be considered -127

Ah yes, excellent point. Here's a patch to correct that.

---
adt7470: Temperature sensors are signed quantities

Philip Pokorny points out that the temperature sensors are signed quantities, hence the anomalous looking readings reported by Vadim Zeitlin.

---

 drivers/hwmon/adt7470.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
drivers/hwmon/adt7470.c +4 -4
index 33a66ac..75aee3b 100644
@@ -125,9 +125,9 @@ struct adt7470_data {
 	char			valid;
 	unsigned long		last_updated;	/* In jiffies */
 
-	u8			temp[ADT7470_TEMP_COUNT];
-	u8			temp_min[ADT7470_TEMP_COUNT];
-	u8			temp_max[ADT7470_TEMP_COUNT];
+	s8			temp[ADT7470_TEMP_COUNT];
+	s8			temp_min[ADT7470_TEMP_COUNT];
+	s8			temp_max[ADT7470_TEMP_COUNT];
 	u16			fan[ADT7470_FAN_COUNT];
 	u16			fan_min[ADT7470_FAN_COUNT];
 	u16			fan_max[ADT7470_FAN_COUNT];
@@ -137,7 +137,7 @@ struct adt7470_data {
 	u8			pwm_max[ADT7470_PWM_COUNT];
 	u8			pwm_automatic[ADT7470_PWM_COUNT];
 	u8			pwm_min[ADT7470_PWM_COUNT];
-	u8			pwm_tmin[ADT7470_PWM_COUNT];
+	s8			pwm_tmin[ADT7470_PWM_COUNT];
 	u8			pwm_auto_temp[ADT7470_PWM_COUNT];
 };
 

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#1 lore raw

On Mon, 16 Jul 2007 16:07:24 -0700 "Darrick J. Wong" <[email protected]> wrote:

DJW> On Mon, Jul 16, 2007 at 03:19:04PM -0700, Philip Pokorny wrote:
DJW> > The values 0x81 and 0x7f are signed 8 bit quantities. 0x81 whould be considered -127 DJW>
DJW> Ah yes, excellent point. Here's a patch to correct that.
DJW>
DJW> ---
DJW> adt7470: Temperature sensors are signed quantities
DJW>
DJW> Philip Pokorny points out that the temperature sensors are signed
DJW> quantities, hence the anomalous looking readings reported by Vadim
DJW> Zeitlin.
DJW>
DJW> Signed-off-by: Darrick J. Wong <[email protected]>
DJW> ---
DJW>
DJW> drivers/hwmon/adt7470.c | 8 ++++----
DJW> 1 files changed, 4 insertions(+), 4 deletions(-)

Thanks, this does fix the shown values of low/high values. Some of the
temperature values (2, 5, 6) themselves are still strange though:

% sensors3 -c /dev/null
adt7470-i2c-0-2e

Adapter: SMBus I801 adapter at 18c0
fan1:       2001 RPM  (min =    0 RPM)
fan2:          0 RPM  (min =    0 RPM)
fan3:       1717 RPM  (min =    0 RPM)
fan4:       1539 RPM  (min =    0 RPM)
temp1:        +1.0 C  (low  = -127.0 C, high = +127.0 C)
temp2:       -30.0 C  (low  = -127.0 C, high = +127.0 C)
temp3:       +56.0 C  (low  = -127.0 C, high = +127.0 C)
temp4:       +52.0 C  (low  = -127.0 C, high = +127.0 C)
temp5:       -33.0 C  (low  = -127.0 C, high = +127.0 C)
temp6:       -31.0 C  (low  = -127.0 C, high = +127.0 C)
temp7:       +57.0 C  (low  = -127.0 C, high = +127.0 C)
temp8:       +53.0 C  (low  = -127.0 C, high = +127.0 C)
temp9:       +47.0 C  (low  = -127.0 C, high = +127.0 C)
temp10:      +49.0 C  (low  = -127.0 C, high = +127.0 C)

Normally I'd just say that the corresponding sensors are not connected but
these values do change slightly (+/-1 degree) from time to time so I'm not sure if this is indeed the case or they are connected but should be interpreted differently somehow.

Thanks,
VZ

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors

#2 lore raw
In reply to Darrick J. Wong
Quoted 4 lines · Vadim Zeitlin

Normally I'd just say that the corresponding sensors are not connected but
these values do change slightly (+/-1 degree) from time to time so I'm not sure if this is indeed the case or they are connected but should be interpreted differently somehow.

Maybe the pins for those temperature inputs aren't connected and are floating around? <shrug> Idle speculation on my part, however.

If you have a copy of i2cdump, take a look at registers 0x21, 0x24 and 0x25 a few seconds after reading the sensors via sysfs; if the values that i2cdump shows you match what you're seeing, then there's nothing the driver can do. If, however, temp2,5,6 go normal after a few seconds of waiting, then we need to increase the wait time during the temperature sensor read a bit.

--D

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors