Skip to content

Commit b1fbe67

Browse files
Eddie Jamesgroeck
authored andcommitted
hwmon: (pmbus/ibm-cffps) Add another PSU CCIN to version detection
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. Signed-off-by: Eddie James <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 02fc3c7 commit b1fbe67

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

drivers/hwmon/pmbus/ibm-cffps.c

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,12 @@
3333
#define CFFPS_INPUT_HISTORY_CMD 0xD6
3434
#define CFFPS_INPUT_HISTORY_SIZE 100
3535

36+
#define CFFPS_CCIN_REVISION GENMASK(7, 0)
37+
#define CFFPS_CCIN_REVISION_LEGACY 0xde
3638
#define CFFPS_CCIN_VERSION GENMASK(15, 8)
3739
#define CFFPS_CCIN_VERSION_1 0x2b
3840
#define CFFPS_CCIN_VERSION_2 0x2e
41+
#define CFFPS_CCIN_VERSION_3 0x51
3942

4043
/* STATUS_MFR_SPECIFIC bits */
4144
#define CFFPS_MFR_FAN_FAULT BIT(0)
@@ -486,11 +489,14 @@ static int ibm_cffps_probe(struct i2c_client *client,
486489
vs = (enum versions)id->driver_data;
487490

488491
if (vs == cffps_unknown) {
492+
u16 ccin_revision = 0;
489493
u16 ccin_version = CFFPS_CCIN_VERSION_1;
490494
int ccin = i2c_smbus_read_word_swapped(client, CFFPS_CCIN_CMD);
491495

492-
if (ccin > 0)
496+
if (ccin > 0) {
497+
ccin_revision = FIELD_GET(CFFPS_CCIN_REVISION, ccin);
493498
ccin_version = FIELD_GET(CFFPS_CCIN_VERSION, ccin);
499+
}
494500

495501
switch (ccin_version) {
496502
default:
@@ -500,6 +506,12 @@ static int ibm_cffps_probe(struct i2c_client *client,
500506
case CFFPS_CCIN_VERSION_2:
501507
vs = cffps2;
502508
break;
509+
case CFFPS_CCIN_VERSION_3:
510+
if (ccin_revision == CFFPS_CCIN_REVISION_LEGACY)
511+
vs = cffps1;
512+
else
513+
vs = cffps2;
514+
break;
503515
}
504516

505517
/* Set the client name to include the version number. */

0 commit comments

Comments
 (0)