Re: [PATCH v2] leds: pca9532: Fix inverted GPIO output polarity

From: Bartosz Golaszewski

Date: Fri Jul 03 2026 - 04:13:48 EST


On Fri, 3 Jul 2026 03:42:01 +0200, Cosmo Chou <chou.cosmo@xxxxxxxxx> said:
> The pca9532_gpio_set_value() function incorrectly mapped the requested
> value to PCA9532_ON and PCA9532_OFF, inverting the GPIO output polarity.
> A requested logical high (val=1) incorrectly enabled the LED output
> driver, which on this open-drain device pulls the pin low, while a
> requested logical low (val=0) released the pin.
>
> Correct the mapping so that val=1 yields PCA9532_OFF (pin released /
> high-impedance) and val=0 yields PCA9532_ON (pin driven low).
>
> pca9532_gpio_direction_input() is also updated to pass val=1 to
> pca9532_gpio_set_value() to align with the corrected polarity mapping,
> ensuring the pin remains not driven when configured as an input.
>
> Fixes: 3c1ab50d0a31 ("drivers/leds/leds-pca9532.c: add gpio capability")
> Signed-off-by: Cosmo Chou <chou.cosmo@xxxxxxxxx>
> ---

Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxxxxxxxx>