Skip to content

Commit

Permalink
misc/led: LED state is set opposite of what is expected
Browse files Browse the repository at this point in the history
Testing of the LED state showed that when the LED polarity was
set to GPIO_POLARITY_ACTIVE_LOW and a low logic value was set on
the input GPIO of the LED, the LED was being turn off when it was
expected to be turned on.

Fixes: ddb67f6 ("hw/misc/led: Allow connecting from GPIO output")
Signed-off-by: Glenn Miles <milesg@linux.vnet.ibm.com>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Andrew Jeffery <andrew@codeconstruct.com.au>
Message-id: 20231024191945.4135036-1-milesg@linux.vnet.ibm.com
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
(cherry picked from commit 6f83dc6)
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
  • Loading branch information
milesg-github authored and Michael Tokarev committed Oct 31, 2023
1 parent cec02bc commit d241c15
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion hw/misc/led.c
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ static void led_set_state_gpio_handler(void *opaque, int line, int new_state)
LEDState *s = LED(opaque);

assert(line == 0);
led_set_state(s, !!new_state != s->gpio_active_high);
led_set_state(s, !!new_state == s->gpio_active_high);
}

static void led_reset(DeviceState *dev)
Expand Down

0 comments on commit d241c15

Please sign in to comment.