Commit 8677011a authored by Guenter Roeck's avatar Guenter Roeck

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: default avatarGuenter Roeck <guenter.roeck@ericsson.com>
parent b49547a5
...@@ -1308,13 +1308,19 @@ static void pmbus_find_attributes(struct i2c_client *client, ...@@ -1308,13 +1308,19 @@ static void pmbus_find_attributes(struct i2c_client *client,
* Always compare current temperature against the limit * Always compare current temperature against the limit
* registers to determine alarm conditions for a * registers to determine alarm conditions for a
* specific sensor. * specific sensor.
*
* Since there is only one set of limit registers for
* up to three temperature sensors, we need to update
* all limit registers after the limit was changed for
* one of the sensors. This ensures that correct limits
* are reported for all temperature sensors.
*/ */
if (pmbus_check_word_register if (pmbus_check_word_register
(client, page, PMBUS_UT_WARN_LIMIT)) { (client, page, PMBUS_UT_WARN_LIMIT)) {
i1 = data->num_sensors; i1 = data->num_sensors;
pmbus_add_sensor(data, "temp", "min", in_index, pmbus_add_sensor(data, "temp", "min", in_index,
page, PMBUS_UT_WARN_LIMIT, page, PMBUS_UT_WARN_LIMIT,
PSC_TEMPERATURE, false); PSC_TEMPERATURE, true);
if (info->func[page] & PMBUS_HAVE_STATUS_TEMP) { if (info->func[page] & PMBUS_HAVE_STATUS_TEMP) {
pmbus_add_boolean_cmp(data, "temp", pmbus_add_boolean_cmp(data, "temp",
"min_alarm", in_index, i1, i0, "min_alarm", in_index, i1, i0,
...@@ -1329,7 +1335,7 @@ static void pmbus_find_attributes(struct i2c_client *client, ...@@ -1329,7 +1335,7 @@ static void pmbus_find_attributes(struct i2c_client *client,
pmbus_add_sensor(data, "temp", "lcrit", pmbus_add_sensor(data, "temp", "lcrit",
in_index, page, in_index, page,
PMBUS_UT_FAULT_LIMIT, PMBUS_UT_FAULT_LIMIT,
PSC_TEMPERATURE, false); PSC_TEMPERATURE, true);
if (info->func[page] & PMBUS_HAVE_STATUS_TEMP) { if (info->func[page] & PMBUS_HAVE_STATUS_TEMP) {
pmbus_add_boolean_cmp(data, "temp", pmbus_add_boolean_cmp(data, "temp",
"lcrit_alarm", in_index, i1, i0, "lcrit_alarm", in_index, i1, i0,
...@@ -1343,7 +1349,7 @@ static void pmbus_find_attributes(struct i2c_client *client, ...@@ -1343,7 +1349,7 @@ static void pmbus_find_attributes(struct i2c_client *client,
i1 = data->num_sensors; i1 = data->num_sensors;
pmbus_add_sensor(data, "temp", "max", in_index, pmbus_add_sensor(data, "temp", "max", in_index,
page, PMBUS_OT_WARN_LIMIT, page, PMBUS_OT_WARN_LIMIT,
PSC_TEMPERATURE, false); PSC_TEMPERATURE, true);
if (info->func[page] & PMBUS_HAVE_STATUS_TEMP) { if (info->func[page] & PMBUS_HAVE_STATUS_TEMP) {
pmbus_add_boolean_cmp(data, "temp", pmbus_add_boolean_cmp(data, "temp",
"max_alarm", in_index, i0, i1, "max_alarm", in_index, i0, i1,
...@@ -1357,7 +1363,7 @@ static void pmbus_find_attributes(struct i2c_client *client, ...@@ -1357,7 +1363,7 @@ static void pmbus_find_attributes(struct i2c_client *client,
i1 = data->num_sensors; i1 = data->num_sensors;
pmbus_add_sensor(data, "temp", "crit", in_index, pmbus_add_sensor(data, "temp", "crit", in_index,
page, PMBUS_OT_FAULT_LIMIT, page, PMBUS_OT_FAULT_LIMIT,
PSC_TEMPERATURE, false); PSC_TEMPERATURE, true);
if (info->func[page] & PMBUS_HAVE_STATUS_TEMP) { if (info->func[page] & PMBUS_HAVE_STATUS_TEMP) {
pmbus_add_boolean_cmp(data, "temp", pmbus_add_boolean_cmp(data, "temp",
"crit_alarm", in_index, i0, i1, "crit_alarm", in_index, i0, i1,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment