Skip to contentSkip to conversation

hwmon: (pmbus) Improve auto-detection of

PATCH In review Guenter Roeck 2 participants 3 messages Jul 5, 2011 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (pmbus) Improve auto-detection of

It is possible that a PMBus device supports the READ_TEMPERATURE2 and/or READ_TEMPERATURE3 registers but does not support READ_TEMPERATURE1. Improve temperature status register detection to address this condition.

---
 drivers/hwmon/pmbus.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
drivers/hwmon/pmbus.c +12 -5
index 931d940..4a1f217 100644
@@ -59,16 +59,17 @@ static void pmbus_find_sensor_groups(struct i2c_client *client,
 		if (pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_34))
 			info->func[0] |= PMBUS_HAVE_STATUS_FAN34;
 	}
-	if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_1)) {
+	if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_1))
 		info->func[0] |= PMBUS_HAVE_TEMP;
-		if (pmbus_check_byte_register(client, 0,
-					      PMBUS_STATUS_TEMPERATURE))
-			info->func[0] |= PMBUS_HAVE_STATUS_TEMP;
-	}
 	if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_2))
 		info->func[0] |= PMBUS_HAVE_TEMP2;
 	if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_3))
 		info->func[0] |= PMBUS_HAVE_TEMP3;
+	if (info->func[0] & (PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2
+			     | PMBUS_HAVE_TEMP3)
+	    && pmbus_check_byte_register(client, 0,
+					 PMBUS_STATUS_TEMPERATURE))
+			info->func[0] |= PMBUS_HAVE_STATUS_TEMP;
 
 	/* Sensors detected on all pages */
 	for (page = 0; page < info->pages; page++) {
@@ -177,6 +178,12 @@ static const struct i2c_device_id pmbus_id[] = {
 	{"bmr454", 1},
 	{"ltc2978", 8},
 	{"pmbus", 0},
+	{"zl2004", 1},
+	{"zl2006", 1},
+	{"zl2008", 1},
+	{"zl2106", 1},
+	{"zl6100", 1},
+	{"zl6105", 1},
 	{}
 };
 
Signature · 7 lines
1.7.3.1


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

Hi Guenter,

Quoted 27 lines · Guenter Roeck

It is possible that a PMBus device supports the READ_TEMPERATURE2 and/or READ_TEMPERATURE3 registers but does not support READ_TEMPERATURE1. Improve temperature status register detection to address this condition.

---
 drivers/hwmon/pmbus.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
drivers/hwmon/pmbus.c +1 -5
index 931d940..4a1f217 100644
@@ -59,16 +59,17 @@ static void pmbus_find_sensor_groups(struct i2c_client *client,
 		if (pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_34))
 			info->func[0] |= PMBUS_HAVE_STATUS_FAN34;
 	}
-	if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_1)) {
+	if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_1))
 		info->func[0] |= PMBUS_HAVE_TEMP;
-		if (pmbus_check_byte_register(client, 0,
-					      PMBUS_STATUS_TEMPERATURE))
-			info->func[0] |= PMBUS_HAVE_STATUS_TEMP;
-	}
 	if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_2))
 		info->func[0] |= PMBUS_HAVE_TEMP2;

drivers/hwmon/pmbus.c static void pmbus_find_sensor_groups(struct i2c_client *client, · line 75

Quoted 10 lines
drivers/hwmon/pmbus.c +5 -0
 	if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_3))
 		info->func[0] |= PMBUS_HAVE_TEMP3;
+	if (info->func[0] & (PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2
+			     | PMBUS_HAVE_TEMP3)
+	    && pmbus_check_byte_register(client, 0,
+					 PMBUS_STATUS_TEMPERATURE))
+			info->func[0] |= PMBUS_HAVE_STATUS_TEMP;
 
 	/* Sensors detected on all pages */
 	for (page = 0; page < info->pages; page++) {

So far so good, and

drivers/hwmon/pmbus.c static const struct i2c_device_id pmbus_id[] = { · line 189

Quoted 13 lines
drivers/hwmon/pmbus.c +6 -0
@@ -177,6 +178,12 @@ static const struct i2c_device_id pmbus_id[] = {
 	{"bmr454", 1},
 	{"ltc2978", 8},
 	{"pmbus", 0},
+	{"zl2004", 1},
+	{"zl2006", 1},
+	{"zl2008", 1},
+	{"zl2106", 1},
+	{"zl6100", 1},
+	{"zl6105", 1},
 	{}
 };
 

OTOH I very much doubt that this change was supposed to be included in that patch.

Signature · 6 lines
Jean Delvare

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

Hi Guenter,

Quoted 27 lines · Guenter Roeck

It is possible that a PMBus device supports the READ_TEMPERATURE2 and/or READ_TEMPERATURE3 registers but does not support READ_TEMPERATURE1. Improve temperature status register detection to address this condition.

---
 drivers/hwmon/pmbus.c |   17 ++++++++++++-----
 1 files changed, 12 insertions(+), 5 deletions(-)
drivers/hwmon/pmbus.c +1 -5
index 931d940..4a1f217 100644
@@ -59,16 +59,17 @@ static void pmbus_find_sensor_groups(struct i2c_client *client,
 		if (pmbus_check_byte_register(client, 0, PMBUS_STATUS_FAN_34))
 			info->func[0] |= PMBUS_HAVE_STATUS_FAN34;
 	}
-	if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_1)) {
+	if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_1))
 		info->func[0] |= PMBUS_HAVE_TEMP;
-		if (pmbus_check_byte_register(client, 0,
-					      PMBUS_STATUS_TEMPERATURE))
-			info->func[0] |= PMBUS_HAVE_STATUS_TEMP;
-	}
 	if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_2))
 		info->func[0] |= PMBUS_HAVE_TEMP2;

drivers/hwmon/pmbus.c static void pmbus_find_sensor_groups(struct i2c_client *client, · line 75

Quoted 10 lines
drivers/hwmon/pmbus.c +5 -0
 	if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_3))
 		info->func[0] |= PMBUS_HAVE_TEMP3;
+	if (info->func[0] & (PMBUS_HAVE_TEMP | PMBUS_HAVE_TEMP2
+			     | PMBUS_HAVE_TEMP3)
+	    && pmbus_check_byte_register(client, 0,
+					 PMBUS_STATUS_TEMPERATURE))
+			info->func[0] |= PMBUS_HAVE_STATUS_TEMP;
 
 	/* Sensors detected on all pages */
 	for (page = 0; page < info->pages; page++) {

So far so good, and

Quoted 17 lines

drivers/hwmon/pmbus.c static const struct i2c_device_id pmbus_id[] = { · line 189

Quoted 13 lines
drivers/hwmon/pmbus.c +6 -0
@@ -177,6 +178,12 @@ static const struct i2c_device_id pmbus_id[] = {
 	{"bmr454", 1},
 	{"ltc2978", 8},
 	{"pmbus", 0},
+	{"zl2004", 1},
+	{"zl2006", 1},
+	{"zl2008", 1},
+	{"zl2106", 1},
+	{"zl6100", 1},
+	{"zl6105", 1},
 	{}
 };
 

OTOH I very much doubt that this change was supposed to be included in that patch.

Oops ... definitely not ... thanks, I'll take it out.

Guenter

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