Skip to contentSkip to conversation

drivers (pmbus): ir35221: Set PMBUS_PAGE before reading id and model

PATCH Applied Eddie James 2 participants 2 messages Oct 19, 2017 – Oct 20, 2017 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drivers (pmbus): ir35221: Set PMBUS_PAGE before reading id and model

From: "Edward A. James" <[email protected]>

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.

---
 drivers/hwmon/pmbus/ir35221.c | 6 ++++++
 1 file changed, 6 insertions(+)
drivers/hwmon/pmbus/ir35221.c +6 -0
index cc7b3b5..9aae633 100644
@@ -243,6 +243,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");
Signature · 1 line
1.8.3.1
#1 lore raw
Quoted 8 lines · Eddie James

From: "Edward A. James" <[email protected]>

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.

Thanks, applied to dev-4.10.

Andrew

Quoted 21 lines

---
 drivers/hwmon/pmbus/ir35221.c | 6 ++++++

 1 file changed, 6 insertions(+)

drivers/hwmon/pmbus/ir35221.c +0 -0
index cc7b3b5..9aae633 100644
@@ -243,6 +243,12 @@ static int ir35221_probe(struct i2c_client *client,
  				| I2C_FUNC_SMBUS_READ_BLOCK_DATA))
  		return -ENODEV;

drivers/hwmon/pmbus/ir35221.c +6 -0
+	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");