diff options
| author | Rasmus Villemoes <[email protected]> | 2025-11-04 18:44:58 +0100 |
|---|---|---|
| committer | Tom Rini <[email protected]> | 2025-11-11 14:53:40 -0600 |
| commit | e5e4b60c55e448e6a9a6bf6f7e9cfd01fe3103e1 (patch) | |
| tree | 765145e53882c21f929fe4df97f7d20bc4a77c5a | |
| parent | c92c3768b61aa84dd6adc214308d69814a8c0af0 (diff) | |
test: gpio: add test for gpio-line-names lookup
Signed-off-by: Rasmus Villemoes <[email protected]>
Reviewed-by: Heiko Schocher <[email protected]>
| -rw-r--r-- | arch/sandbox/dts/test.dts | 2 | ||||
| -rw-r--r-- | test/dm/gpio.c | 11 |
2 files changed, 13 insertions, 0 deletions
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); |
