Commit ce3cf7c8 authored by Torben Nielsen's avatar Torben Nielsen Committed by Guenter Roeck
Browse files

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.

Signed-off-by: default avatarTorben Nielsen <t8927095@gmail.com>
Link: https://lore.kernel.org/r/20250718093644.356085-2-t8927095@gmail.com


Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
parent 3e8e93cb
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -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;