dm: led: Add support for getting the state of an LED
It is useful to be able to read the LED as well as write it. Add this to the uclass and update the GPIO driver. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Ziping Chen <techping.chan@gmail.com>
This commit is contained in:
@@ -43,9 +43,11 @@ static int dm_test_led_gpio(struct unit_test_state *uts)
|
||||
ut_asserteq(0, sandbox_gpio_get_value(gpio, offset));
|
||||
ut_assertok(led_set_state(dev, LEDST_ON));
|
||||
ut_asserteq(1, sandbox_gpio_get_value(gpio, offset));
|
||||
ut_asserteq(LEDST_ON, led_get_state(dev));
|
||||
|
||||
ut_assertok(led_set_state(dev, LEDST_OFF));
|
||||
ut_asserteq(0, sandbox_gpio_get_value(gpio, offset));
|
||||
ut_asserteq(LEDST_OFF, led_get_state(dev));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user