Skip to contentSkip to conversation

hwmon: (pmbus) Add the PMBUS_NO_CAPABILITY flag

PATCH Applied Eddie James 2 participants 5 messages Dec 22, 2020 – Dec 23, 2020 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

v2 cover hwmon: (pmbus) Add the PMBUS_NO_CAPABILITY flag

Some PMBus chips, like some power supplies supported by the cffps driver, don't respond with valid data when reading the CAPABILITY register. Add a platform data flag that device drivers can set to tell the PMBus core driver that it shouldn't use the CAPABILITY register. The second patch sets this flag for the cffps driver.

Changes since v1:
- Rename the flag to PMBUS_NO_CAPABILITY and adjust the associated comment accordingly.

Eddie James (2):
hwmon: (pmbus) Add a PMBUS_NO_CAPABILITY platform data flag
hwmon: (pmbus/ibm-cffps) Set the PMBUS_NO_CAPABILITY flag

 drivers/hwmon/pmbus/ibm-cffps.c  | 2 +-
 drivers/hwmon/pmbus/pmbus_core.c | 8 +++++---
 include/linux/pmbus.h            | 9 +++++++++
 3 files changed, 15 insertions(+), 4 deletions(-)
Signature · 1 line
2.27.0
#1 lore raw

PATCH v2 1/2 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.

---
 drivers/hwmon/pmbus/pmbus_core.c | 8 +++++---
 include/linux/pmbus.h            | 9 +++++++++
 2 files changed, 14 insertions(+), 3 deletions(-)
drivers/hwmon/pmbus/pmbus_core.c +5 -3
index 192442b3b7a2..906c9fec9cce 100644
@@ -2204,9 +2204,11 @@ 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);
-	if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK))
-		client->flags |= I2C_CLIENT_PEC;
+	if (!(data->flags & PMBUS_NO_CAPABILITY)) {
+		ret = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
+		if (ret >= 0 && (ret & PB_CAPABILITY_ERROR_CHECK))
+			client->flags |= I2C_CLIENT_PEC;
+	}
 
 	/*
 	 * Check if the chip is write protected. If it is, we can not clear
include/linux/pmbus.h +9 -0
index 1ea5bae708a1..12cbbf305969 100644
@@ -34,6 +34,15 @@
  */
 #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 {
 	u32 flags;		/* Device specific flags */
 
Signature · 1 line
2.27.0
maintainer Applied
#2 lore raw

Re: [PATCH v2 1/2] hwmon: (pmbus) Add a PMBUS_NO_CAPABILITY platform data flag

Quoted 6 lines · Eddie James

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.

Applied.

Thanks,
Guenter

#3 lore raw

PATCH v2 2/2 hwmon: (pmbus/ibm-cffps) Set the PMBUS_NO_CAPABILITY flag

In reply to Eddie James

Several power supplies supported by the IBM CFFPS driver don't report valid data in the CAPABILITY register. This results in PEC being enabled when it's not supported by the device, and since the automatic version detection might fail, disable use of the CAPABILITY register across the board for this driver.

---
 drivers/hwmon/pmbus/ibm-cffps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pmbus/ibm-cffps.c +1 -1
index d6bbbb223871..ffde5aaa5036 100644
@@ -472,7 +472,7 @@ static struct pmbus_driver_info ibm_cffps_info[] = {
 };
 
 static struct pmbus_platform_data ibm_cffps_pdata = {
-	.flags = PMBUS_SKIP_STATUS_CHECK,
+	.flags = PMBUS_SKIP_STATUS_CHECK | PMBUS_NO_CAPABILITY,
 };
 
 static int ibm_cffps_probe(struct i2c_client *client)
Signature · 1 line
2.27.0
maintainer Applied
#4 lore raw

Re: [PATCH v2 2/2] hwmon: (pmbus/ibm-cffps) Set the PMBUS_NO_CAPABILITY flag

Quoted 7 lines · Eddie James

Several power supplies supported by the IBM CFFPS driver don't report valid data in the CAPABILITY register. This results in PEC being enabled when it's not supported by the device, and since the automatic version detection might fail, disable use of the CAPABILITY register across the board for this driver.

Applied.

Thanks,
Guenter