Skip to contentSkip to conversation

hwmon: (w83627ehf) Fix documentation of

PATCH In review Jean Delvare 2 participants 4 messages Nov 1, 2011 – Nov 6, 2011

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (w83627ehf) Fix documentation of

The NCT6775F and NCT6776F have specific temperature sensor resolutions for sensors above 3.

---
Guenter, did I get it right?

 Documentation/hwmon/w83627ehf |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Documentation/hwmon/w83627ehf +3 -2
@@ -62,8 +62,9 @@ sensors. The configured source for each
 in tempX_label.
 
 Temperatures are measured in degrees Celsius and measurement resolution is 1
-degC for temp1 and and 0.5 degC for temp2 and temp3. For temp4 and higher,
-resolution is 1 degC for W83667HG-B and 0.0 degC for NCT6775F and NCT6776F.
+degC for temp1 and and 0.5 degC for temp2 and temp3. For W83667HG-B, temp4
+has resolution 1 degC. For NCT6775F and NCT6776F, temp4 to temp6 have
+resolution 0.5 degC, while temp7 to temp9 have resolution 1 degC.
 An alarm is triggered when the temperature gets higher than high limit;
 it stays on until the temperature falls below the hysteresis value.
 Alarms are only supported for temp1, temp2, and temp3.
Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
Acked-by on v1 1/1
#1 lore raw
Quoted 8 lines · Jean Delvare

The NCT6775F and NCT6776F have specific temperature sensor resolutions for sensors above 3.

---
Guenter, did I get it right?

Did I add the 0.0 degrees note ? Brr.

Anyway, it is kind of correct. temp7 to temp9 resolution is 0.5 degrees C, but the code only reads full degrees because it was too complicated to merge the lowest bit.

Thanks,
Guenter

Quoted 21 lines
 Documentation/hwmon/w83627ehf |    5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
Documentation/hwmon/w83627ehf +3 -2
@@ -62,8 +62,9 @@ sensors. The configured source for each
 in tempX_label.
 
 Temperatures are measured in degrees Celsius and measurement resolution is 1
-degC for temp1 and and 0.5 degC for temp2 and temp3. For temp4 and higher,
-resolution is 1 degC for W83667HG-B and 0.0 degC for NCT6775F and NCT6776F.
+degC for temp1 and and 0.5 degC for temp2 and temp3. For W83667HG-B, temp4
+has resolution 1 degC. For NCT6775F and NCT6776F, temp4 to temp6 have
+resolution 0.5 degC, while temp7 to temp9 have resolution 1 degC.
 An alarm is triggered when the temperature gets higher than high limit;
 it stays on until the temperature falls below the hysteresis value.
 Alarms are only supported for temp1, temp2, and temp3.
Signature · 2 lines
-- 
Jean Delvare

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

#2 lore raw
In reply to Jean Delvare
Quoted 10 lines · Guenter Roeck
Quoted 8 lines · Jean Delvare

The NCT6775F and NCT6776F have specific temperature sensor resolutions for sensors above 3.

---
Guenter, did I get it right?

Did I add the 0.0 degrees note ? Brr.

I've done worse...

Quoted 2 lines

Anyway, it is kind of correct. temp7 to temp9 resolution is 0.5 degrees C, but the code only reads full degrees because it was too complicated to merge the lowest bit.

It is indeed different from the other values but I wouldn't call it terribly complicated. My only worry is related to the integrity of the reading, i.e. how can we guarantee that the MSB and the LSB belong to the same measurement. I would hope that the chip latches the LSB when the MSB is read, but I don't see any mention of this in the datasheet. The problem isn't limited to temp7 to temp9, BTW, other 9-bit temperature inputs are affected too.

Would the following (untested) be OK with you?

---
 drivers/hwmon/w83627ehf.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/hwmon/w83627ehf.c +12 -0
@@ -260,6 +260,7 @@ static const u16 NCT6775_REG_TEMP_OVER[]
 	= { 0x39, 0x155, 0x255, 0, 0, 0, 0x672, 0x677, 0x67C };
 static const u16 NCT6775_REG_TEMP_SOURCE[]
 	= { 0x621, 0x622, 0x623, 0x100, 0x200, 0x300, 0x624, 0x625, 0x626 };
+#define NCT6775_REG_TEMP_LSB		0x62E
 
 static const char *const w83667hg_b_temp_label[] = {
 	"SYSTIN",
@@ -888,6 +889,17 @@ static struct w83627ehf_data *w83627ehf_
 				  = w83627ehf_read_temp(data,
 						data->reg_temp_hyst[i]);
 		}
+		/* LSB of temp7-9 are stored in the same register */
+		if (data->have_temp & (0x7 << 6)) {
+			u8 reg = w83627ehf_read_value(data,
+						      NCT6775_REG_TEMP_LSB);
+
+			for (i = 0; i < 3; i++) {
+				if (data->have_temp & (1 << (6 + i)))
+					data->temp[6 + i]
+					  |= (reg << (7 - i)) & 0x80;
+			}
+		}
 
 		data->alarms = w83627ehf_read_value(data,
 					W83627EHF_REG_ALARM1) |
Quoted 1 line

Thanks.

Signature · 6 lines
Jean Delvare

_______________________________________________
lm-sensors mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/lm-sensors
#3 lore raw
In reply to Jean Delvare
Quoted 50 lines · Jean Delvare
Quoted 10 lines · Guenter Roeck
Quoted 8 lines · Jean Delvare

The NCT6775F and NCT6776F have specific temperature sensor resolutions for sensors above 3.

---
Guenter, did I get it right?

Did I add the 0.0 degrees note ? Brr.

I've done worse...

Quoted 2 lines

Anyway, it is kind of correct. temp7 to temp9 resolution is 0.5 degrees C, but the code only reads full degrees because it was too complicated to merge the lowest bit.

It is indeed different from the other values but I wouldn't call it terribly complicated. My only worry is related to the integrity of the reading, i.e. how can we guarantee that the MSB and the LSB belong to the same measurement. I would hope that the chip latches the LSB when the MSB is read, but I don't see any mention of this in the datasheet. The problem isn't limited to temp7 to temp9, BTW, other 9-bit temperature inputs are affected too.

Would the following (untested) be OK with you?

---
 drivers/hwmon/w83627ehf.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)
drivers/hwmon/w83627ehf.c +5 -0
@@ -260,6 +260,7 @@ static const u16 NCT6775_REG_TEMP_OVER[]
 	= { 0x39, 0x155, 0x255, 0, 0, 0, 0x672, 0x677, 0x67C };
 static const u16 NCT6775_REG_TEMP_SOURCE[]
 	= { 0x621, 0x622, 0x623, 0x100, 0x200, 0x300, 0x624, 0x625, 0x626 };
+#define NCT6775_REG_TEMP_LSB		0x62E
 
 static const char *const w83667hg_b_temp_label[] = {
 	"SYSTIN",
@@ -888,6 +889,17 @@ static struct w83627ehf_data *w83627ehf_
 				  = w83627ehf_read_temp(data,
 						data->reg_temp_hyst[i]);
 		}
+		/* LSB of temp7-9 are stored in the same register */
+		if (data->have_temp & (0x7 << 6)) {
+			u8 reg = w83627ehf_read_value(data,
+						      NCT6775_REG_TEMP_LSB);

drivers/hwmon/w83627ehf.c static struct w83627ehf_data *w83627ehf_ · line 905

Quoted 10 lines
drivers/hwmon/w83627ehf.c +7 -0
+
+			for (i = 0; i < 3; i++) {
+				if (data->have_temp & (1 << (6 + i)))
+					data->temp[6 + i]
+					  |= (reg << (7 - i)) & 0x80;
+			}
+		}
 
 		data->alarms = w83627ehf_read_value(data,
 					W83627EHF_REG_ALARM1) |

Looks good to me. I'll test it on my system to be sure, and let you know.

Thanks,
Guenter

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