Skip to contentSkip to conversation

hwmon: (pmbus/ibm-cffps) Do not swap max_power_out

PATCH Superseded Brandon Wyman 3 participants 9 messages Aug 27, 2021 – Aug 31, 2021 Hardware monitoring

v1 of 2 Superseded Latest is v2 →

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon: (pmbus/ibm-cffps) Do not swap max_power_out

The bytes for max_power_out from the ibm-cffps devices do not need to be swapped.

---
 drivers/hwmon/pmbus/ibm-cffps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pmbus/ibm-cffps.c +1 -1
index df712ce4b164..29b77f192c9e 100644
@@ -171,7 +171,7 @@ static ssize_t ibm_cffps_debugfs_read(struct file *file, char __user *buf,
 		cmd = CFFPS_SN_CMD;
 		break;
 	case CFFPS_DEBUGFS_MAX_POWER_OUT:
-		rc = i2c_smbus_read_word_swapped(psu->client,
+		rc = i2c_smbus_read_word_data(psu->client,
 						 CFFPS_MAX_POWER_OUT_CMD);
 		if (rc < 0)
 			return rc;
Signature · 1 line
2.25.1
maintainer
#1 lore raw
Quoted 4 lines · Brandon Wyman

The bytes for max_power_out from the ibm-cffps devices do not need to be swapped.

Eddie, can you confirm this ?

Thanks,
Guenter

Quoted 20 lines
---
 drivers/hwmon/pmbus/ibm-cffps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pmbus/ibm-cffps.c +1 -1
index df712ce4b164..29b77f192c9e 100644
@@ -171,7 +171,7 @@ static ssize_t ibm_cffps_debugfs_read(struct file *file, char __user *buf,
 		cmd = CFFPS_SN_CMD;
 		break;
 	case CFFPS_DEBUGFS_MAX_POWER_OUT:
-		rc = i2c_smbus_read_word_swapped(psu->client,
+		rc = i2c_smbus_read_word_data(psu->client,
 						 CFFPS_MAX_POWER_OUT_CMD);
 		if (rc < 0)
 			return rc;
Signature · 1 line
2.25.1
#2 lore raw
Quoted 8 lines · Guenter Roeck
Quoted 5 lines · Brandon Wyman

The bytes for max_power_out from the ibm-cffps devices do not need to be
swapped.

Eddie, can you confirm this ?

This can't be true for all the power supplies supported by this driver, no. I think we need to check the version first. Brandon, I tested this on witherspoon (which is psu version 1) and get 3148 watts. If it's not swapped, that would be 19468 watts...

Thanks,
Eddie

Quoted 27 lines

Thanks,
Guenter

Quoted 23 lines
---
 drivers/hwmon/pmbus/ibm-cffps.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pmbus/ibm-cffps.c +1 -1
index df712ce4b164..29b77f192c9e 100644
@@ -171,7 +171,7 @@ static ssize_t ibm_cffps_debugfs_read(struct
 file *file, char __user *buf,
 		cmd = CFFPS_SN_CMD;
 		break;
 	case CFFPS_DEBUGFS_MAX_POWER_OUT:
-		rc = i2c_smbus_read_word_swapped(psu->client,
+		rc = i2c_smbus_read_word_data(psu->client,
 						 CFFPS_MAX_POWER_OUT_CM
 D);
drivers/hwmon/pmbus/ibm-cffps.c +0 -0
 		if (rc < 0)
 			return rc;
Signature · 1 line
2.25.1
maintainer
#3 lore raw
Quoted 6 lines · Eddie James
Quoted 5 lines · Guenter Roeck
Quoted 4 lines · Brandon Wyman

The bytes for max_power_out from the ibm-cffps devices do not need to be
swapped.

Quoted 9 lines
Quoted 3 lines
Quoted 1 line

Eddie, can you confirm this ?

This can't be true for all the power supplies supported by this driver, no. I think we need to check the version first. Brandon, I tested this on witherspoon (which is psu version 1) and get 3148 watts. If it's not swapped, that would be 19468 watts...

Hmm. Eddie, can you also have a look at commit 9fed8fa99334 ("hwmon:
(pmbus/ibm-cffps) Fix write bits for LED control") ?
We need to make sure that it doesn't mess up some versions of this PS.

Thanks,
Guenter

#4 lore raw
Quoted 21 lines · Guenter Roeck
Quoted 11 lines · Eddie James
Quoted 9 lines · Guenter Roeck
Quoted 6 lines · Brandon Wyman

The bytes for max_power_out from the ibm-cffps devices do not need
to be
swapped.

Eddie, can you confirm this ?

Quoted 8 lines

This can't be true for all the power supplies supported by this driver,
no. I think we need to check the version first. Brandon, I tested this
on witherspoon (which is psu version 1) and get 3148 watts. If it's not
swapped, that would be 19468 watts...

Quoted 4 lines

Hmm. Eddie, can you also have a look at commit 9fed8fa99334 ("hwmon:
(pmbus/ibm-cffps) Fix write bits for LED control") ?
We need to make sure that it doesn't mess up some versions of this PS.

That one looks correct to me. I believe older PSUs didn't enforce this so I didn't catch it, but I do see that the older specifications mention setting bit 6 to "allow write".

Thanks,
Eddie

Quoted 3 lines

Thanks,
Guenter

maintainer
#5 lore raw
Quoted 22 lines · Eddie James
Quoted 21 lines · Guenter Roeck
Quoted 19 lines · Eddie James
Quoted 9 lines · Guenter Roeck
Quoted 6 lines · Brandon Wyman

The bytes for max_power_out from the ibm-cffps devices do not need
to be
swapped.

Eddie, can you confirm this ?

This can't be true for all the power supplies supported by this driver,
no. I think we need to check the version first. Brandon, I tested this
on witherspoon (which is psu version 1) and get 3148 watts. If it's not
swapped, that would be 19468 watts...

Quoted 9 lines
Quoted 4 lines

Hmm. Eddie, can you also have a look at commit 9fed8fa99334 ("hwmon:
(pmbus/ibm-cffps) Fix write bits for LED control") ?
We need to make sure that it doesn't mess up some versions of this PS.

That one looks correct to me. I believe older PSUs didn't enforce this so I didn't catch it, but I do see that the older specifications mention setting bit 6 to "allow write".

Great, thanks a lot for checking.

Guenter

#6 lore raw
In reply to Eddie James
Quoted 7 lines · Eddie James
Quoted 6 lines · Guenter Roeck
Quoted 5 lines · Brandon Wyman

The bytes for max_power_out from the ibm-cffps devices do not need to be
swapped.

Quoted 8 lines
Quoted 1 line

Eddie, can you confirm this ?

This can't be true for all the power supplies supported by this driver, no. I think we need to check the version first. Brandon, I tested this on witherspoon (which is psu version 1) and get 3148 watts. If it's not swapped, that would be 19468 watts...

Thanks,
Eddie

I had tested this on a variety of systems with a variety of different power supplies, but I did *NOT* test this on the Witherspoon power supplies.

This apparently requires a bit more thought to figure out how to handle the other types and also not get Witherspoon wrong.

Thanks for checking Eddie.

Quoted 26 lines
Quoted 26 lines

Thanks,
Guenter

Quoted 23 lines
---
  drivers/hwmon/pmbus/ibm-cffps.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pmbus/ibm-cffps.c +1 -1
index df712ce4b164..29b77f192c9e 100644
@@ -171,7 +171,7 @@ static ssize_t ibm_cffps_debugfs_read(struct
 file *file, char __user *buf,
  		cmd = CFFPS_SN_CMD;
  		break;
  	case CFFPS_DEBUGFS_MAX_POWER_OUT:
-		rc = i2c_smbus_read_word_swapped(psu->client,
+		rc = i2c_smbus_read_word_data(psu->client,
  						 CFFPS_MAX_POWER_OUT_CM
 D);

if (rc < 0)
return rc;

Signature · 1 line
2.25.1
maintainer
#7 lore raw
Quoted 15 lines · Brandon Wyman
Quoted 13 lines · Eddie James
Quoted 7 lines · Guenter Roeck
Quoted 5 lines · Brandon Wyman

The bytes for max_power_out from the ibm-cffps devices do not need to be
swapped.

Eddie, can you confirm this ?

This can't be true for all the power supplies supported by this driver, no. I think we need to check the version first. Brandon, I tested this on witherspoon (which is psu version 1) and get 3148 watts. If it's not swapped, that would be 19468 watts...

Quoted 6 lines
Quoted 2 lines

Thanks,
Eddie

I had tested this on a variety of systems with a variety of different power supplies, but I did *NOT* test this on the Witherspoon power supplies.

This apparently requires a bit more thought to figure out how to handle the other types and also not get Witherspoon wrong.

Is the specification for those power supplies available in public ?

Thanks,
Guenter

Quoted 28 lines

Thanks for checking Eddie.

Quoted 26 lines
Quoted 26 lines

Thanks,
Guenter

Quoted 23 lines

---
  drivers/hwmon/pmbus/ibm-cffps.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pmbus/ibm-cffps.c +0 -0
index df712ce4b164..29b77f192c9e 100644
@@ -171,7 +171,7 @@ static ssize_t ibm_cffps_debugfs_read(struct
 file *file, char __user *buf,
           cmd = CFFPS_SN_CMD;
           break;

      case CFFPS_DEBUGFS_MAX_POWER_OUT:
-        rc = i2c_smbus_read_word_swapped(psu->client, +        rc = i2c_smbus_read_word_data(psu->client, CFFPS_MAX_POWER_OUT_CM D);
          if (rc < 0)
              return rc;

Signature · 1 line
2.25.1
#8 lore raw
Quoted 20 lines · Guenter Roeck
Quoted 19 lines · Brandon Wyman
Quoted 7 lines · Eddie James
Quoted 6 lines · Guenter Roeck
Quoted 5 lines · Brandon Wyman

The bytes for max_power_out from the ibm-cffps devices do not need to be
swapped.

Quoted 8 lines
Quoted 1 line

Eddie, can you confirm this ?

This can't be true for all the power supplies supported by this driver, no. I think we need to check the version first. Brandon, I tested this on witherspoon (which is psu version 1) and get 3148 watts. If it's not swapped, that would be 19468 watts...

Thanks,
Eddie

I had tested this on a variety of systems with a variety of different power supplies, but I did *NOT* test this on the Witherspoon power supplies.

Quoted 8 lines
Quoted 2 lines

This apparently requires a bit more thought to figure out how to handle the other types and also not get Witherspoon wrong.

Is the specification for those power supplies available in public ?

Thanks,
Guenter

No, unfortunately those power supply specifications are not available to the public.

Sorry,

Brandon

Quoted 29 lines
Quoted 28 lines

Thanks for checking Eddie.

Quoted 26 lines
Quoted 26 lines

Thanks,
Guenter

Quoted 23 lines

---
  drivers/hwmon/pmbus/ibm-cffps.c | 2 +-

  1 file changed, 1 insertion(+), 1 deletion(-)
drivers/hwmon/pmbus/ibm-cffps.c +0 -0
index df712ce4b164..29b77f192c9e 100644
@@ -171,7 +171,7 @@ static ssize_t ibm_cffps_debugfs_read(struct
 file *file, char __user *buf,
           cmd = CFFPS_SN_CMD;
           break;

      case CFFPS_DEBUGFS_MAX_POWER_OUT:
-        rc = i2c_smbus_read_word_swapped(psu->client, +        rc = i2c_smbus_read_word_data(psu->client, CFFPS_MAX_POWER_OUT_CM D);
          if (rc < 0)
              return rc;

Signature · 1 line
2.25.1