summaryrefslogtreecommitdiff
path: root/test/dm
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2022-04-25 18:33:50 +0200
committerTom Rini <trini@konsulko.com>2022-04-28 09:26:44 -0400
commit876276f5de92cbaa4a55706606451354650cc730 (patch)
tree8ca757f314abfa3826c92d2d8c14cb4658daf6ab /test/dm
parent69245e406e919012d45d40f045f9b7369086ce17 (diff)
downloadu-boot-876276f5de92cbaa4a55706606451354650cc730.tar.gz
u-boot-876276f5de92cbaa4a55706606451354650cc730.tar.bz2
u-boot-876276f5de92cbaa4a55706606451354650cc730.zip
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>
Diffstat (limited to 'test/dm')
-rw-r--r--test/dm/led.c17
1 files changed, 8 insertions, 9 deletions
diff --git a/test/dm/led.c b/test/dm/led.c
index 5bbe04648a..eed3f4654c 100644
--- a/test/dm/led.c
+++ b/test/dm/led.c
@@ -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));