Skip to contentSkip to conversation

hwmon: (pmbus) Auto-detect temp2 and temp3

PATCH In review Guenter Roeck 2 participants 3 messages Jun 30, 2011 – Jul 3, 2011 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 4/4 hwmon: (pmbus) Auto-detect temp2 and temp3

Additional temperature attribute support is easy to detect, so do it.

---
 drivers/hwmon/pmbus.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/hwmon/pmbus.c +4 -0
index b0ea00b..931d940 100644
@@ -65,6 +65,10 @@ static void pmbus_find_sensor_groups(struct i2c_client *client,
 					      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;
 
 	/* Sensors detected on all pages */
 	for (page = 0; page < info->pages; page++) {
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 4/4
#1 lore raw

Re: [lm-sensors] [PATCH 4/4] hwmon: (pmbus) Auto-detect temp2 and

Hi Guenter,

Quoted 12 lines · Guenter Roeck

Additional temperature attribute support is easy to detect, so do it.

---
 drivers/hwmon/pmbus.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/hwmon/pmbus.c +0 -0
index b0ea00b..931d940 100644

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

Quoted 7 lines
drivers/hwmon/pmbus.c +4 -0
@@ -65,6 +65,10 @@ static void pmbus_find_sensor_groups(struct i2c_client *client,
 					      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;

Looks good, but is it not possible for a device to have temp2 (or temp3) but not temp1? If it is, then the test for PMBUS_STATUS_TEMPERATURE should be moved after the test for PMBUS_READ_TEMPERATURE_3, and should depend on any of PMBUS_HAVE_TEMP* being set. If it is not possible, then the code is fine as it is and:

Quoted 3 lines
drivers/hwmon/pmbus.c +0 -0
 	/* Sensors detected on all pages */
 	for (page = 0; page < info->pages; page++) {
Signature · 6 lines
Jean Delvare

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

Re: [lm-sensors] [PATCH 4/4] hwmon: (pmbus) Auto-detect temp2 and

In reply to Guenter Roeck

Hi Jean,

Quoted 20 lines · Jean Delvare

Hi Guenter,

Quoted 17 lines · Guenter Roeck

Additional temperature attribute support is easy to detect, so do it.

---
 drivers/hwmon/pmbus.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
drivers/hwmon/pmbus.c +2 -0
index b0ea00b..931d940 100644
@@ -65,6 +65,10 @@ static void pmbus_find_sensor_groups(struct i2c_client *client,
 					      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;
Quoted 9 lines

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

Quoted 2 lines
drivers/hwmon/pmbus.c +2 -0
+	if (pmbus_check_word_register(client, 0, PMBUS_READ_TEMPERATURE_3))
+		info->func[0] |= PMBUS_HAVE_TEMP3;

Looks good, but is it not possible for a device to have temp2 (or temp3) but not temp1? If it is, then the test for PMBUS_STATUS_TEMPERATURE should be moved after the test for PMBUS_READ_TEMPERATURE_3, and should depend on any of PMBUS_HAVE_TEMP* being set. If it is not possible, then the code is fine as it is and:

Yes, you are right, that condition can happen. I'll update the code and submit another patch for it. Not that urgent, since I am not (yet) aware of a PMBus device actually doing it, but given the inventiveness of PMBus device developers I am sure we will hit that condition at some point.

Thanks,
Guenter

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