Skip to contentSkip to conversation

hwmon: (pmbus) allow to use a custom read_byte_data function for PMBUS_CAPABILITY

PATCH In review Adam Wujek 2 participants 3 messages Apr 19, 2022 Hardware monitoring

lore
Share & tools
lore

Adam Wujek

author
#0 lore raw

PATCH 1/1 hwmon: (pmbus) allow to use a custom read_byte_data function for PMBUS_CAPABILITY

Some devices returns a wrong value in PMBUS_CAPABILITY register. Allow the use of read_byte_data function defined in a driver for a specific device.

---
 drivers/hwmon/pmbus/pmbus_core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pmbus/pmbus_core.c +1 -1
index f8ca36759b0a..ef9989be8f89 100644
@@ -2011,7 +2011,7 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
 	}
 
 	/* Enable PEC if the controller supports it */
-	ret = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
+	ret = _pmbus_read_byte_data(client, -1, PMBUS_CAPABILITY);
 	if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK))
 		client->flags |= I2C_CLIENT_PEC;
 	else

--
2.17.1

maintainer
#1 lore raw
Quoted 3 lines · Adam Wujek

Some devices returns a wrong value in PMBUS_CAPABILITY register. Allow the use of read_byte_data function defined in a driver for a specific device.

Those devices should set PMBUS_NO_CAPABILITY.

Guenter

Quoted 23 lines
---
  drivers/hwmon/pmbus/pmbus_core.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pmbus/pmbus_core.c +1 -2
index f8ca36759b0a..ef9989be8f89 100644
@@ -2011,7 +2011,7 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
  	}
 
  	/* Enable PEC if the controller supports it */
-	ret = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
+	ret = _pmbus_read_byte_data(client, -1, PMBUS_CAPABILITY);
  	if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK))
  		client->flags |= I2C_CLIENT_PEC;
  	else
--

2.17.1

author
#2 lore raw

------- Original Message -------

Quoted 4 lines · Guenter Roeck

On 4/19/22 14:52, Adam Wujek wrote:

Quoted 8 lines
Quoted 3 lines

Some devices returns a wrong value in PMBUS_CAPABILITY register. Allow the use of read_byte_data function defined in a driver for a specific device.

Those devices should set PMBUS_NO_CAPABILITY.

Guenter

Yes, you're correct. I was working with the older kernel. Please ignore this patch.

Adam

Quoted 21 lines
Quoted 21 lines

---
drivers/hwmon/pmbus/pmbus_core.c | 2 +-

1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pmbus/pmbus_core.c +1 -1
index f8ca36759b0a..ef9989be8f89 100644
@@ -2011,7 +2011,7 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
 }
 
 /* Enable PEC if the controller supports it */
- ret = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
+ ret = _pmbus_read_byte_data(client, -1, PMBUS_CAPABILITY);
 if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK))
 client->flags |= I2C_CLIENT_PEC;

else
--
2.17.1