]> git.ipfire.org Git - thirdparty/u-boot.git/commitdiff
test: gpio: add test for gpio-line-names lookup
authorRasmus Villemoes <ravi@prevas.dk>
Tue, 4 Nov 2025 17:44:58 +0000 (18:44 +0100)
committerTom Rini <trini@konsulko.com>
Tue, 11 Nov 2025 20:53:40 +0000 (14:53 -0600)
Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
Reviewed-by: Heiko Schocher <hs@nabladev.com>
arch/sandbox/dts/test.dts
test/dm/gpio.c

index a2c739a2044c728a96b5f4acbf439a42d7e12fb5..13d8e498b0339178860d1f3ea0f9650176490cd0 100644 (file)
                        #gpio-cells = <1>;
                        gpio-bank-name = "a";
                        sandbox,gpio-count = <25>;
+                       gpio-line-names = "", "eth1-reset", "rtc-irq";
                        hog_input_active_low {
                                gpio-hog;
                                input;
                        #gpio-cells = <5>;
                        gpio-bank-name = "b";
                        sandbox,gpio-count = <10>;
+                       gpio-line-names = "factory-reset";
                };
 
                gpio_c: pinmux-gpios {
index 34a5d1a974e41cc381a3a6b10e362c1db6167080..0fb05b5ca06c90ea026d131fe7948d565254d641 100644 (file)
@@ -143,6 +143,17 @@ static int dm_test_gpio(struct unit_test_state *uts)
        ut_assert(gpio_lookup_name("hog_not_exist", &dev, &offset,
                                   &gpio));
 
+       /* Check if lookup for gpio-line-names work */
+       ut_assertok(gpio_lookup_name("factory-reset", &dev, &offset, &gpio));
+       ut_asserteq_str(dev->name, "extra-gpios");
+       ut_asserteq(0, offset);
+       ut_asserteq(CONFIG_SANDBOX_GPIO_COUNT + 25 + 0, gpio);
+
+       ut_assertok(gpio_lookup_name("rtc-irq", &dev, &offset, &gpio));
+       ut_asserteq_str(dev->name, "base-gpios");
+       ut_asserteq(2, offset);
+       ut_asserteq(CONFIG_SANDBOX_GPIO_COUNT + 2, gpio);
+
        return 0;
 }
 DM_TEST(dm_test_gpio, UTF_SCAN_PDATA | UTF_SCAN_FDT);