diff options
author | Simon Glass <sjg@chromium.org> | 2017-04-10 11:34:55 -0600 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2017-04-14 19:38:57 -0600 |
commit | 8f4b612333ee0381eedf767c1c005a830886df27 (patch) | |
tree | c687de5e960d0bb4c1de07f1b322119e46859349 /test/dm | |
parent | ddae9fcddc48d1e624c941148d0df5a4fc7d7d5c (diff) |
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>
Diffstat (limited to 'test/dm')
-rw-r--r-- | test/dm/led.c | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/test/dm/led.c b/test/dm/led.c index ebb9b46584..68aa39bd4d 100644 --- a/test/dm/led.c +++ b/test/dm/led.c @@ -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; } |