public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Rasmus Villemoes <ravi@prevas.dk>
To: u-boot@lists.denx.de
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>,
	Tom Rini <trini@konsulko.com>, Heiko Schocher <hs@denx.de>,
	Simon Glass <sjg@chromium.org>, Rasmus Villemoes <ravi@prevas.dk>
Subject: [PATCH v3 3/3] test: gpio: add test for gpio-line-names lookup
Date: Tue,  4 Nov 2025 18:44:58 +0100	[thread overview]
Message-ID: <20251104174458.3385564-4-ravi@prevas.dk> (raw)
In-Reply-To: <20251104174458.3385564-1-ravi@prevas.dk>

Signed-off-by: Rasmus Villemoes <ravi@prevas.dk>
---
 arch/sandbox/dts/test.dts |  2 ++
 test/dm/gpio.c            | 11 +++++++++++
 2 files changed, 13 insertions(+)

diff --git a/arch/sandbox/dts/test.dts b/arch/sandbox/dts/test.dts
index a2c739a2044..13d8e498b03 100644
--- a/arch/sandbox/dts/test.dts
+++ b/arch/sandbox/dts/test.dts
@@ -823,6 +823,7 @@
 			#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;
@@ -851,6 +852,7 @@
 			#gpio-cells = <5>;
 			gpio-bank-name = "b";
 			sandbox,gpio-count = <10>;
+			gpio-line-names = "factory-reset";
 		};
 
 		gpio_c: pinmux-gpios {
diff --git a/test/dm/gpio.c b/test/dm/gpio.c
index 34a5d1a974e..0fb05b5ca06 100644
--- a/test/dm/gpio.c
+++ b/test/dm/gpio.c
@@ -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);
-- 
2.51.0


  parent reply	other threads:[~2025-11-04 17:45 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-11-04 17:44 [PATCH v3 0/3] reenable dm_gpio tests, add support for gpio-line-names lookup Rasmus Villemoes
2025-11-04 17:44 ` [PATCH v3 1/3] test: gpio: include in build, and fixup bitrot Rasmus Villemoes
2025-11-05  5:48   ` Heiko Schocher
2025-11-04 17:44 ` [PATCH v3 2/3] gpio: search gpio-line-names property in dm_gpio_lookup_name Rasmus Villemoes
2025-11-05  5:52   ` Heiko Schocher
2025-11-04 17:44 ` Rasmus Villemoes [this message]
2025-11-05  5:53   ` [PATCH v3 3/3] test: gpio: add test for gpio-line-names lookup Heiko Schocher
2025-11-05 15:20 ` [PATCH v3 0/3] reenable dm_gpio tests, add support " Tom Rini
2025-11-11 22:16 ` Tom Rini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20251104174458.3385564-4-ravi@prevas.dk \
    --to=ravi@prevas.dk \
    --cc=hs@denx.de \
    --cc=sjg@chromium.org \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox