Skip to contentSkip to conversation

hwmon:pmbus:ucd9000: Fix error in ucd9000_gpio_set

PATCH Applied Torben Nielsen 2 participants 2 messages Jul 18, 2025 Hardware monitoring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 hwmon:pmbus:ucd9000: Fix error in ucd9000_gpio_set

The GPIO output functionality does not work as intended.

The ucd9000_gpio_set function should set UCD9000_GPIO_CONFIG_OUT_VALUE (bit 2) in order to change the output value of the selected GPIO. Instead UCD9000_GPIO_CONFIG_STATUS (bit 3) is set, but this is a read-only value. This patch fixes the mistake and provides the intended functionality of the GPIOs.

See UCD90xxx Sequencer and System Health Controller PMBus Command SLVU352C section 10.43 for reference.

---
Reworded commit message as per suggestion by Guenter Roeck.

 drivers/hwmon/pmbus/ucd9000.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/hwmon/pmbus/ucd9000.c +4 -4
index 2bc8cccb01fd..52d4000902d5 100644
@@ -226,15 +226,15 @@ static int ucd9000_gpio_set(struct gpio_chip *gc, unsigned int offset,
 	}
 
 	if (value) {
-		if (ret & UCD9000_GPIO_CONFIG_STATUS)
+		if (ret & UCD9000_GPIO_CONFIG_OUT_VALUE)
 			return 0;
 
-		ret |= UCD9000_GPIO_CONFIG_STATUS;
+		ret |= UCD9000_GPIO_CONFIG_OUT_VALUE;
 	} else {
-		if (!(ret & UCD9000_GPIO_CONFIG_STATUS))
+		if (!(ret & UCD9000_GPIO_CONFIG_OUT_VALUE))
 			return 0;
 
-		ret &= ~UCD9000_GPIO_CONFIG_STATUS;
+		ret &= ~UCD9000_GPIO_CONFIG_OUT_VALUE;
 	}
 
 	ret |= UCD9000_GPIO_CONFIG_ENABLE;

base-commit: e2291551827fe5d2d3758c435c191d32b6d1350e

Signature · 1 line
2.43.0
maintainer Applied
#1 lore raw
Quoted 8 lines · Torben Nielsen

The GPIO output functionality does not work as intended.

The ucd9000_gpio_set function should set UCD9000_GPIO_CONFIG_OUT_VALUE (bit 2) in order to change the output value of the selected GPIO. Instead UCD9000_GPIO_CONFIG_STATUS (bit 3) is set, but this is a read-only value. This patch fixes the mistake and provides the intended functionality of the GPIOs.

Quoted 4 lines

See UCD90xxx Sequencer and System Health Controller PMBus Command SLVU352C section 10.43 for reference.

Applied.

Thanks,
Guenter

Quoted 33 lines

---
Reworded commit message as per suggestion by Guenter Roeck.

 drivers/hwmon/pmbus/ucd9000.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

base-commit: e2291551827fe5d2d3758c435c191d32b6d1350e

drivers/hwmon/pmbus/ucd9000.c +4 -4
index 2bc8cccb01fd..52d4000902d5 100644
@@ -226,15 +226,15 @@ static int ucd9000_gpio_set(struct gpio_chip *gc, unsigned int offset,
 	}
 
 	if (value) {
-		if (ret & UCD9000_GPIO_CONFIG_STATUS)
+		if (ret & UCD9000_GPIO_CONFIG_OUT_VALUE)
 			return 0;
 
-		ret |= UCD9000_GPIO_CONFIG_STATUS;
+		ret |= UCD9000_GPIO_CONFIG_OUT_VALUE;
 	} else {
-		if (!(ret & UCD9000_GPIO_CONFIG_STATUS))
+		if (!(ret & UCD9000_GPIO_CONFIG_OUT_VALUE))
 			return 0;
 
-		ret &= ~UCD9000_GPIO_CONFIG_STATUS;
+		ret &= ~UCD9000_GPIO_CONFIG_OUT_VALUE;
 	}
 
 	ret |= UCD9000_GPIO_CONFIG_ENABLE;