forked from Minki/linux
hwmon: (pmbus) Add a PMBUS_NO_CAPABILITY platform data flag
Some PMBus chips don't respond with valid data when reading the CAPABILITY register. Add a flag that device drivers can set so that the PMBus core driver doesn't use CAPABILITY to determine it's behavior. Signed-off-by: Eddie James <eajames@linux.ibm.com> Link: https://lore.kernel.org/r/20201222152640.27749-2-eajames@linux.ibm.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
parent
c8d0d3fa94
commit
e5befc024c
@ -2204,9 +2204,11 @@ static int pmbus_init_common(struct i2c_client *client, struct pmbus_data *data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Enable PEC if the controller supports it */
|
/* Enable PEC if the controller supports it */
|
||||||
|
if (!(data->flags & PMBUS_NO_CAPABILITY)) {
|
||||||
ret = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
|
ret = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
|
||||||
if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK))
|
if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK))
|
||||||
client->flags |= I2C_CLIENT_PEC;
|
client->flags |= I2C_CLIENT_PEC;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Check if the chip is write protected. If it is, we can not clear
|
* Check if the chip is write protected. If it is, we can not clear
|
||||||
|
@ -34,6 +34,15 @@
|
|||||||
*/
|
*/
|
||||||
#define PMBUS_WRITE_PROTECTED BIT(1)
|
#define PMBUS_WRITE_PROTECTED BIT(1)
|
||||||
|
|
||||||
|
/*
|
||||||
|
* PMBUS_NO_CAPABILITY
|
||||||
|
*
|
||||||
|
* Some PMBus chips don't respond with valid data when reading the CAPABILITY
|
||||||
|
* register. For such chips, this flag should be set so that the PMBus core
|
||||||
|
* driver doesn't use CAPABILITY to determine it's behavior.
|
||||||
|
*/
|
||||||
|
#define PMBUS_NO_CAPABILITY BIT(2)
|
||||||
|
|
||||||
struct pmbus_platform_data {
|
struct pmbus_platform_data {
|
||||||
u32 flags; /* Device specific flags */
|
u32 flags; /* Device specific flags */
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user