Skip to content

Commit ce3cf7c

Browse files
Torben Nielsengroeck
authored andcommitted
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: Torben Nielsen <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Guenter Roeck <[email protected]>
1 parent 3e8e93c commit ce3cf7c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

drivers/hwmon/pmbus/ucd9000.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -226,15 +226,15 @@ static int ucd9000_gpio_set(struct gpio_chip *gc, unsigned int offset,
226226
}
227227

228228
if (value) {
229-
if (ret & UCD9000_GPIO_CONFIG_STATUS)
229+
if (ret & UCD9000_GPIO_CONFIG_OUT_VALUE)
230230
return 0;
231231

232-
ret |= UCD9000_GPIO_CONFIG_STATUS;
232+
ret |= UCD9000_GPIO_CONFIG_OUT_VALUE;
233233
} else {
234-
if (!(ret & UCD9000_GPIO_CONFIG_STATUS))
234+
if (!(ret & UCD9000_GPIO_CONFIG_OUT_VALUE))
235235
return 0;
236236

237-
ret &= ~UCD9000_GPIO_CONFIG_STATUS;
237+
ret &= ~UCD9000_GPIO_CONFIG_OUT_VALUE;
238238
}
239239

240240
ret |= UCD9000_GPIO_CONFIG_ENABLE;

0 commit comments

Comments
 (0)