Skip to contentSkip to conversation

hwmon: (pmbus) mark registers READ_VIN and READ_IIN as paged

PATCH New Ruslan Babayev 1 participant 1 message Apr 16, 2019 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 2/4 hwmon: (pmbus) mark registers READ_VIN and READ_IIN as paged

From: Ruslan Babayev <[email protected]>

On some devices (like IR35215) READ_VIN and READ_IIN registers are paged.

For devices where these registers are not paged the extra check ensures we expose only the registers that are actually present.

---
 drivers/hwmon/pmbus/pmbus_core.c | 5 +++++
 1 file changed, 5 insertions(+)
drivers/hwmon/pmbus/pmbus_core.c +5 -0
index f35b239961e3..fac966967816 100644
@@ -1379,6 +1379,9 @@ static int pmbus_add_sensor_attrs(struct i2c_client *client,
 		for (page = 0; page < pages; page++) {
 			if (!(info->func[page] & attrs->func))
 				continue;
+			if (!pmbus_check_word_register(client, page,
+						       attrs->reg))
+				continue;
 			ret = pmbus_add_sensor_attrs_one(client, data, info,
 							 name, index, page,
 							 attrs);
@@ -1498,6 +1501,7 @@ static const struct pmbus_sensor_attr voltage_attributes[] = {
 		.reg = PMBUS_READ_VIN,
 		.class = PSC_VOLTAGE_IN,
 		.label = "vin",
+		.paged = true,
 		.func = PMBUS_HAVE_VIN,
 		.sfunc = PMBUS_HAVE_STATUS_INPUT,
 		.sbase = PB_STATUS_INPUT_BASE,
@@ -1602,6 +1606,7 @@ static const struct pmbus_sensor_attr current_attributes[] = {
 		.reg = PMBUS_READ_IIN,
 		.class = PSC_CURRENT_IN,
 		.label = "iin",
+		.paged = true,
 		.func = PMBUS_HAVE_IIN,
 		.sfunc = PMBUS_HAVE_STATUS_INPUT,
 		.sbase = PB_STATUS_INPUT_BASE,
Signature · 1 line
2.17.1