linux-hwmon.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ruslan Babayev <fib@cisco.com>
To: Guenter Roeck <linux@roeck-us.net>
Cc: Ruslan Babayev <ruslan@babayev.com>,
	xe-linux-external@cisco.com, Jean Delvare <jdelvare@suse.com>,
	linux-hwmon@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 2/4] hwmon: (pmbus) mark registers READ_VIN and READ_IIN as paged
Date: Tue, 16 Apr 2019 11:45:44 -0700	[thread overview]
Message-ID: <20190416184547.40128-2-fib@cisco.com> (raw)

From: Ruslan Babayev <ruslan@babayev.com>

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.

Cc: xe-linux-external@cisco.com
Signed-off-by: Ruslan Babayev <ruslan@babayev.com>
---
 drivers/hwmon/pmbus/pmbus_core.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index f35b239961e3..fac966967816 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -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,
-- 
2.17.1


             reply	other threads:[~2019-04-16 19:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-16 18:45 Ruslan Babayev [this message]
  -- strict thread matches above, loose matches on Subject: below --
2019-04-16 18:36 [PATCH 2/4] hwmon: (pmbus) mark registers READ_VIN and READ_IIN as paged Ruslan Babayev
2019-04-16 19:40 ` Guenter Roeck
2019-04-16 21:30   ` Guenter Roeck

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20190416184547.40128-2-fib@cisco.com \
    --to=fib@cisco.com \
    --cc=jdelvare@suse.com \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=ruslan@babayev.com \
    --cc=xe-linux-external@cisco.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).