test: dm: led: Fix LED enumeration
PATCH 1/2 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.
--- test/dm/led.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-)
test/dm/led.c +8 -9
@@ -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 ));
Signature · 1 line
2.35.1
PATCH 2/2 test: dm: pinmux: Get LED2 udevice in the pinmux test
The UT reinitializes the pin controller state, get LED2 udevice to trigger its probe and configure the pin controller pin state as it is expected by the test.
--- test/cmd/pinmux.c | 5 +++++ 1 file changed, 5 insertions(+)
test/cmd/pinmux.c +5 -0
@@ -7,12 +7,17 @@#include <common.h> #include <command.h> +#include <dm.h> #include <dm/test.h> #include <test/test.h> #include <test/ut.h> static int dm_test_cmd_pinmux_status_pinname (struct unit_test_state *uts) { +struct udevice *dev; + +ut_assertok (uclass_get_device (UCLASS_LED ,2 , &dev)); +/* Test that 'pinmux status <pinname>' displays the selected pin. */ console_record_reset ();run_command ("pinmux status a5" ,0 );
Signature · 1 line
2.35.1
Re: [PATCH 2/2] test: dm: pinmux: Get LED2 udevice in the pinmux test
Quoted 10 lines · Marek Vasut
The UT reinitializes the pin controller state, get LED2 udevice to trigger its probe and configure the pin controller pin state as it is expected by the test.
Signed-off-by Marek Vasut <[email protected]>Cc Patrice Chotard <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Sean Anderson <[email protected]>Cc Simon Glass <[email protected]>Cc Steven Lawrance <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom
Quoted 10 lines · Marek Vasut
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 <[email protected]>Cc Patrice Chotard <[email protected]>Cc Patrick Delaunay <[email protected]>Cc Sean Anderson <[email protected]>Cc Simon Glass <[email protected]>Cc Steven Lawrance <[email protected]>
Applied to u-boot/master, thanks!
Signature · 1 line
Tom