test: dm: led: Fix LED enumeration
The GPIO LED driver no longer considers the top level node an LED, because it is not an LED. With this bug fixed, the LED enumeration has changed. Update the test accordingly. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Patrice Chotard <patrice.chotard@foss.st.com> Cc: Patrick Delaunay <patrick.delaunay@foss.st.com> Cc: Sean Anderson <seanga2@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Steven Lawrance <steven.lawrance@softathome.com>
This commit is contained in:
parent
69245e406e
commit
876276f5de
@ -21,8 +21,7 @@ static int dm_test_led_base(struct unit_test_state *uts)
|
||||
ut_assertok(uclass_get_device(UCLASS_LED, 1, &dev));
|
||||
ut_assertok(uclass_get_device(UCLASS_LED, 2, &dev));
|
||||
ut_assertok(uclass_get_device(UCLASS_LED, 3, &dev));
|
||||
ut_assertok(uclass_get_device(UCLASS_LED, 4, &dev));
|
||||
ut_asserteq(-ENODEV, uclass_get_device(UCLASS_LED, 5, &dev));
|
||||
ut_asserteq(-ENODEV, uclass_get_device(UCLASS_LED, 4, &dev));
|
||||
|
||||
return 0;
|
||||
}
|
||||
@ -52,10 +51,10 @@ static int dm_test_led_gpio(struct unit_test_state *uts)
|
||||
struct udevice *dev, *gpio;
|
||||
|
||||
/*
|
||||
* Check that we can manipulate an LED. LED 1 is connected to GPIO
|
||||
* Check that we can manipulate an LED. LED 0 is connected to GPIO
|
||||
* bank gpio_a, offset 1.
|
||||
*/
|
||||
ut_assertok(uclass_get_device(UCLASS_LED, 1, &dev));
|
||||
ut_assertok(uclass_get_device(UCLASS_LED, 0, &dev));
|
||||
ut_assertok(uclass_get_device(UCLASS_GPIO, 1, &gpio));
|
||||
ut_asserteq(0, sandbox_gpio_get_value(gpio, offset));
|
||||
ut_assertok(led_set_state(dev, LEDST_ON));
|
||||
@ -77,10 +76,10 @@ static int dm_test_led_toggle(struct unit_test_state *uts)
|
||||
struct udevice *dev, *gpio;
|
||||
|
||||
/*
|
||||
* Check that we can manipulate an LED. LED 1 is connected to GPIO
|
||||
* Check that we can manipulate an LED. LED 0 is connected to GPIO
|
||||
* bank gpio_a, offset 1.
|
||||
*/
|
||||
ut_assertok(uclass_get_device(UCLASS_LED, 1, &dev));
|
||||
ut_assertok(uclass_get_device(UCLASS_LED, 0, &dev));
|
||||
ut_assertok(uclass_get_device(UCLASS_GPIO, 1, &gpio));
|
||||
ut_asserteq(0, sandbox_gpio_get_value(gpio, offset));
|
||||
ut_assertok(led_set_state(dev, LEDST_TOGGLE));
|
||||
@ -102,12 +101,12 @@ static int dm_test_led_label(struct unit_test_state *uts)
|
||||
|
||||
ut_assertok(led_get_by_label("sandbox:red", &dev));
|
||||
ut_asserteq(1, device_active(dev));
|
||||
ut_assertok(uclass_get_device(UCLASS_LED, 1, &cmp));
|
||||
ut_assertok(uclass_get_device(UCLASS_LED, 0, &cmp));
|
||||
ut_asserteq_ptr(dev, cmp);
|
||||
|
||||
ut_assertok(led_get_by_label("sandbox:green", &dev));
|
||||
ut_asserteq(1, device_active(dev));
|
||||
ut_assertok(uclass_get_device(UCLASS_LED, 2, &cmp));
|
||||
ut_assertok(uclass_get_device(UCLASS_LED, 1, &cmp));
|
||||
ut_asserteq_ptr(dev, cmp);
|
||||
|
||||
ut_asserteq(-ENODEV, led_get_by_label("sandbox:blue", &dev));
|
||||
@ -127,7 +126,7 @@ static int dm_test_led_blink(struct unit_test_state *uts)
|
||||
* Check that we get an error when trying to blink an LED, since it is
|
||||
* not supported by the GPIO LED driver.
|
||||
*/
|
||||
ut_assertok(uclass_get_device(UCLASS_LED, 1, &dev));
|
||||
ut_assertok(uclass_get_device(UCLASS_LED, 0, &dev));
|
||||
ut_assertok(uclass_get_device(UCLASS_GPIO, 1, &gpio));
|
||||
ut_asserteq(0, sandbox_gpio_get_value(gpio, offset));
|
||||
ut_asserteq(-ENOSYS, led_set_state(dev, LEDST_BLINK));
|
||||
|
Loading…
Reference in New Issue
Block a user