public inbox for linux-hwmon@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drivers (pmbus): ir35221: Set PMBUS_PAGE before reading id and model
@ 2017-10-19 20:57 Eddie James
  2017-10-21 16:10 ` Guenter Roeck
  0 siblings, 1 reply; 5+ messages in thread
From: Eddie James @ 2017-10-19 20:57 UTC (permalink / raw)
  To: linux; +Cc: jdelvare, linux-hwmon, linux-kernel, andrew, eajames,
	Edward A. James

From: "Edward A. James" <eajames@us.ibm.com>

The MFR_ID and MFR_MODEL, which are manually read before probing the
pmbus core,  are only valid for the two pages that the ir35221 has
available. Since we don't know the state of the device when we start
probing, set the page number first before reading id and model.

Signed-off-by: Edward A. James <eajames@us.ibm.com>
---
 drivers/hwmon/pmbus/ir35221.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/drivers/hwmon/pmbus/ir35221.c b/drivers/hwmon/pmbus/ir35221.c
index 8b906b4..9a53930 100644
--- a/drivers/hwmon/pmbus/ir35221.c
+++ b/drivers/hwmon/pmbus/ir35221.c
@@ -267,6 +267,12 @@ static int ir35221_probe(struct i2c_client *client,
 				| I2C_FUNC_SMBUS_READ_BLOCK_DATA))
 		return -ENODEV;
 
+	ret = i2c_smbus_write_byte_data(client, PMBUS_PAGE, 0);
+	if (ret < 0) {
+		dev_err(&client->dev, "Failed to set PMBUS_PAGE\n");
+		return ret;
+	}
+
 	ret = i2c_smbus_read_block_data(client, PMBUS_MFR_ID, buf);
 	if (ret < 0) {
 		dev_err(&client->dev, "Failed to read PMBUS_MFR_ID\n");
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2017-10-25 19:54 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-10-19 20:57 [PATCH] drivers (pmbus): ir35221: Set PMBUS_PAGE before reading id and model Eddie James
2017-10-21 16:10 ` Guenter Roeck
2017-10-23 15:23   ` Eddie James
2017-10-23 22:12     ` Guenter Roeck
2017-10-25 19:54       ` Eddie James

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox