Skip to contentSkip to conversation

hwmon: (pmbus/ibm-cffps) Add another CCIN to version detection and fix LEDs

PATCH In review Eddie James 3 participants 6 messages Apr 1, 2020 – Apr 2, 2020 Hardware monitoring

lore
Share & tools
lore
#1 lore raw

PATCH 1/2 hwmon: (pmbus/ibm-cffps) Add another PSU CCIN to version detection

In reply to Eddie James

There is an additional CCIN for the IBM CFFPS that may be classifed as either version one or version two, based upon the rest of the bits of the CCIN. Add support for it in the version detection.

---
 drivers/hwmon/pmbus/ibm-cffps.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/hwmon/pmbus/ibm-cffps.c +13 -1
index 27593b723d74..7d3720665ad4 100644
@@ -33,9 +33,12 @@
 #define CFFPS_INPUT_HISTORY_CMD			0xD6
 #define CFFPS_INPUT_HISTORY_SIZE		100
 
+#define CFFPS_CCIN_REVISION			GENMASK(7, 0)
+#define  CFFPS_CCIN_REVISION_LEGACY		 0xde
 #define CFFPS_CCIN_VERSION			GENMASK(15, 8)
 #define CFFPS_CCIN_VERSION_1			 0x2b
 #define CFFPS_CCIN_VERSION_2			 0x2e
+#define CFFPS_CCIN_VERSION_3			 0x51
 
 /* STATUS_MFR_SPECIFIC bits */
 #define CFFPS_MFR_FAN_FAULT			BIT(0)
@@ -489,11 +492,14 @@ static int ibm_cffps_probe(struct i2c_client *client,
 		vs = (enum versions)id->driver_data;
 
 	if (vs == cffps_unknown) {
+		u16 ccin_revision = 0;
 		u16 ccin_version = CFFPS_CCIN_VERSION_1;
 		int ccin = i2c_smbus_read_word_swapped(client, CFFPS_CCIN_CMD);
 
-		if (ccin > 0)
+		if (ccin > 0) {
+			ccin_revision = FIELD_GET(CFFPS_CCIN_REVISION, ccin);
 			ccin_version = FIELD_GET(CFFPS_CCIN_VERSION, ccin);
+		}
 
 		switch (ccin_version) {
 		default:
@@ -503,6 +509,12 @@ static int ibm_cffps_probe(struct i2c_client *client,
 		case CFFPS_CCIN_VERSION_2:
 			vs = cffps2;
 			break;
+		case CFFPS_CCIN_VERSION_3:
+			if (ccin_revision == CFFPS_CCIN_REVISION_LEGACY)
+				vs = cffps1;
+			else
+				vs = cffps2;
+			break;
 		}
 
 		/* Set the client name to include the version number. */
Signature · 1 line
2.24.0
maintainer
#2 lore raw

Re: [PATCH linux dev-5.4 1/2] hwmon: (pmbus/ibm-cffps) Add another PSU CCIN to version detection

Quoted 7 lines · Eddie James

There is an additional CCIN for the IBM CFFPS that may be classifed as either version one or version two, based upon the rest of the bits of the CCIN. Add support for it in the version detection.

Those e-mails are confusing. Can you drop me from cc:, please ?

Guenter

Quoted 51 lines
---
 drivers/hwmon/pmbus/ibm-cffps.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)
drivers/hwmon/pmbus/ibm-cffps.c +13 -1
index 27593b723d74..7d3720665ad4 100644
@@ -33,9 +33,12 @@
 #define CFFPS_INPUT_HISTORY_CMD			0xD6
 #define CFFPS_INPUT_HISTORY_SIZE		100
 
+#define CFFPS_CCIN_REVISION			GENMASK(7, 0)
+#define  CFFPS_CCIN_REVISION_LEGACY		 0xde
 #define CFFPS_CCIN_VERSION			GENMASK(15, 8)
 #define CFFPS_CCIN_VERSION_1			 0x2b
 #define CFFPS_CCIN_VERSION_2			 0x2e
+#define CFFPS_CCIN_VERSION_3			 0x51
 
 /* STATUS_MFR_SPECIFIC bits */
 #define CFFPS_MFR_FAN_FAULT			BIT(0)
@@ -489,11 +492,14 @@ static int ibm_cffps_probe(struct i2c_client *client,
 		vs = (enum versions)id->driver_data;
 
 	if (vs == cffps_unknown) {
+		u16 ccin_revision = 0;
 		u16 ccin_version = CFFPS_CCIN_VERSION_1;
 		int ccin = i2c_smbus_read_word_swapped(client, CFFPS_CCIN_CMD);
 
-		if (ccin > 0)
+		if (ccin > 0) {
+			ccin_revision = FIELD_GET(CFFPS_CCIN_REVISION, ccin);
 			ccin_version = FIELD_GET(CFFPS_CCIN_VERSION, ccin);
+		}
 
 		switch (ccin_version) {
 		default:
@@ -503,6 +509,12 @@ static int ibm_cffps_probe(struct i2c_client *client,
 		case CFFPS_CCIN_VERSION_2:
 			vs = cffps2;
 			break;
+		case CFFPS_CCIN_VERSION_3:
+			if (ccin_revision == CFFPS_CCIN_REVISION_LEGACY)
+				vs = cffps1;
+			else
+				vs = cffps2;
+			break;
 		}
 
 		/* Set the client name to include the version number. */
#3 lore raw

Re: [PATCH linux dev-5.4 1/2] hwmon: (pmbus/ibm-cffps) Add another PSU CCIN to version detection

Quoted 11 lines · Guenter Roeck
Quoted 7 lines · Eddie James

There is an additional CCIN for the IBM CFFPS that may be classifed as either version one or version two, based upon the rest of the bits of the CCIN. Add support for it in the version detection.

Those e-mails are confusing. Can you drop me from cc:, please ?

I think Eddie forgot to --suppress-cc=body when he git send-email'd

Sorry for the noise Guenter.

Cheers,

Joel

#0 lore raw

cover hwmon: (pmbus/ibm-cffps) Add another CCIN to version detection and fix LEDs

These commits bring the driver into the same state as -next.

Eddie James (2):
hwmon: (pmbus/ibm-cffps) Add another PSU CCIN to version detection
hwmon: (pmbus/ibm-cffps) Fix LED behavior again

 drivers/hwmon/pmbus/ibm-cffps.c | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)
Signature · 1 line
2.24.0
#5 lore raw

PATCH 2/2 hwmon: (pmbus/ibm-cffps) Fix LED behavior again

Get the driver into the same state as -next. The driver should not relinquish control of the LEDs to the PSU firmware.

---
 drivers/hwmon/pmbus/ibm-cffps.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)
drivers/hwmon/pmbus/ibm-cffps.c +1 -5
index 7d3720665ad4..7cf4cc5824ab 100644
@@ -50,13 +50,9 @@
 #define CFFPS_MFR_VAUX_FAULT			BIT(6)
 #define CFFPS_MFR_CURRENT_SHARE_WARNING		BIT(7)
 
-/*
- * LED off state actually relinquishes LED control to PSU firmware, so it can
- * turn on the LED for faults.
- */
-#define CFFPS_LED_OFF				0
 #define CFFPS_LED_BLINK				BIT(0)
 #define CFFPS_LED_ON				BIT(1)
+#define CFFPS_LED_OFF				BIT(2)
 #define CFFPS_BLINK_RATE_MS			250
 
 enum {
Signature · 1 line
2.24.0
#4 lore raw

Re: [PATCH linux dev-5.4 1/2] hwmon: (pmbus/ibm-cffps) Add another PSU CCIN to version detection

In reply to Joel Stanley
Quoted 6 lines · Joel Stanley
Quoted 5 lines · Guenter Roeck
Quoted 4 lines · Eddie James

There is an additional CCIN for the IBM CFFPS that may be classifed as either version one or version two, based upon the rest of the bits of the CCIN. Add support for it in the version detection.

Quoted 7 lines
Quoted 4 lines
Quoted 3 lines

Those e-mails are confusing. Can you drop me from cc:, please ?

I think Eddie forgot to --suppress-cc=body when he git send-email'd

Sorry for the noise Guenter.

Indeed, my apologies.

Thanks,

Eddie

Quoted 4 lines

Cheers,

Joel