aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/hwmon
diff options
context:
space:
mode:
authorGuenter Roeck <guenter.roeck@ericsson.com>2011-03-06 15:28:24 -0500
committerGuenter Roeck <guenter.roeck@ericsson.com>2011-03-15 01:39:10 -0400
commit8677011a5d8e0358ce5ae26d82dfcddcad073c47 (patch)
treedf4bb5324105b5e818f77307eecea1e21732133e /drivers/hwmon
parentb49547a5df96bc755d6f96abb8503678af49d91c (diff)
hwmon: (pmbus) Continuously update temperature limit registers
PMBus only has one set of limit registers for up to three temperature sensors. Thus, changing a limit for one of the temperature sensors affects limits for other temperature sensors in the same page (and potentially multiple pages depending on the chip implementation). To handle this situation, re-read all temperature limit registers when updating sensor data. This way, all affected temperature limits are updated whenever the limit for a single sensor is changed. Signed-off-by: Guenter Roeck <guenter.roeck@ericsson.com>
Diffstat (limited to 'drivers/hwmon')
-rw-r--r--drivers/hwmon/pmbus_core.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/drivers/hwmon/pmbus_core.c b/drivers/hwmon/pmbus_core.c
index e9dda58a5b90..92540c9cd34e 100644
--- a/drivers/hwmon/pmbus_core.c
+++ b/drivers/hwmon/pmbus_core.c
@@ -1308,13 +1308,19 @@ static void pmbus_find_attributes(struct i2c_client *client,
1308 * Always compare current temperature against the limit 1308 * Always compare current temperature against the limit
1309 * registers to determine alarm conditions for a 1309 * registers to determine alarm conditions for a
1310 * specific sensor. 1310 * specific sensor.
1311 *
1312 * Since there is only one set of limit registers for
1313 * up to three temperature sensors, we need to update
1314 * all limit registers after the limit was changed for
1315 * one of the sensors. This ensures that correct limits
1316 * are reported for all temperature sensors.
1311 */ 1317 */
1312 if (pmbus_check_word_register 1318 if (pmbus_check_word_register
1313 (client, page, PMBUS_UT_WARN_LIMIT)) { 1319 (client, page, PMBUS_UT_WARN_LIMIT)) {
1314 i1 = data->num_sensors; 1320 i1 = data->num_sensors;
1315 pmbus_add_sensor(data, "temp", "min", in_index, 1321 pmbus_add_sensor(data, "temp", "min", in_index,
1316 page, PMBUS_UT_WARN_LIMIT, 1322 page, PMBUS_UT_WARN_LIMIT,
1317 PSC_TEMPERATURE, false); 1323 PSC_TEMPERATURE, true);
1318 if (info->func[page] & PMBUS_HAVE_STATUS_TEMP) { 1324 if (info->func[page] & PMBUS_HAVE_STATUS_TEMP) {
1319 pmbus_add_boolean_cmp(data, "temp", 1325 pmbus_add_boolean_cmp(data, "temp",
1320 "min_alarm", in_index, i1, i0, 1326 "min_alarm", in_index, i1, i0,
@@ -1329,7 +1335,7 @@ static void pmbus_find_attributes(struct i2c_client *client,
1329 pmbus_add_sensor(data, "temp", "lcrit", 1335 pmbus_add_sensor(data, "temp", "lcrit",
1330 in_index, page, 1336 in_index, page,
1331 PMBUS_UT_FAULT_LIMIT, 1337 PMBUS_UT_FAULT_LIMIT,
1332 PSC_TEMPERATURE, false); 1338 PSC_TEMPERATURE, true);
1333 if (info->func[page] & PMBUS_HAVE_STATUS_TEMP) { 1339 if (info->func[page] & PMBUS_HAVE_STATUS_TEMP) {
1334 pmbus_add_boolean_cmp(data, "temp", 1340 pmbus_add_boolean_cmp(data, "temp",
1335 "lcrit_alarm", in_index, i1, i0, 1341 "lcrit_alarm", in_index, i1, i0,
@@ -1343,7 +1349,7 @@ static void pmbus_find_attributes(struct i2c_client *client,
1343 i1 = data->num_sensors; 1349 i1 = data->num_sensors;
1344 pmbus_add_sensor(data, "temp", "max", in_index, 1350 pmbus_add_sensor(data, "temp", "max", in_index,
1345 page, PMBUS_OT_WARN_LIMIT, 1351 page, PMBUS_OT_WARN_LIMIT,
1346 PSC_TEMPERATURE, false); 1352 PSC_TEMPERATURE, true);
1347 if (info->func[page] & PMBUS_HAVE_STATUS_TEMP) { 1353 if (info->func[page] & PMBUS_HAVE_STATUS_TEMP) {
1348 pmbus_add_boolean_cmp(data, "temp", 1354 pmbus_add_boolean_cmp(data, "temp",
1349 "max_alarm", in_index, i0, i1, 1355 "max_alarm", in_index, i0, i1,
@@ -1357,7 +1363,7 @@ static void pmbus_find_attributes(struct i2c_client *client,
1357 i1 = data->num_sensors; 1363 i1 = data->num_sensors;
1358 pmbus_add_sensor(data, "temp", "crit", in_index, 1364 pmbus_add_sensor(data, "temp", "crit", in_index,
1359 page, PMBUS_OT_FAULT_LIMIT, 1365 page, PMBUS_OT_FAULT_LIMIT,
1360 PSC_TEMPERATURE, false); 1366 PSC_TEMPERATURE, true);
1361 if (info->func[page] & PMBUS_HAVE_STATUS_TEMP) { 1367 if (info->func[page] & PMBUS_HAVE_STATUS_TEMP) {
1362 pmbus_add_boolean_cmp(data, "temp", 1368 pmbus_add_boolean_cmp(data, "temp",
1363 "crit_alarm", in_index, i0, i1, 1369 "crit_alarm", in_index, i0, i1,