summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2021-02-04 21:21:59 -0700
committerTom Rini <trini@konsulko.com>2021-03-03 15:38:58 -0500
commita03a0aa7e833ab6af62728d6c0591b7772ffa9a8 (patch)
tree9854b3341a735242646f32e3fce740d3e68827d9 /test
parentc0c1e62c6e47ffccca953c57df4624d685493584 (diff)
downloadu-boot-a03a0aa7e833ab6af62728d6c0591b7772ffa9a8.tar.gz
u-boot-a03a0aa7e833ab6af62728d6c0591b7772ffa9a8.tar.xz
u-boot-a03a0aa7e833ab6af62728d6c0591b7772ffa9a8.zip
gpio: sandbox: Rename GPIO dir_flags to flags
Adjust the terminology in this driver to reflect that fact that all flags are handled, not just direction flags. Create a new access function to get the full GPIO state, not just the direction flags. Drop the static invalid_dir_flags since we can rely on a segfault if something is wrong. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
Diffstat (limited to 'test')
-rw-r--r--test/dm/gpio.c18
1 files changed, 9 insertions, 9 deletions
diff --git a/test/dm/gpio.c b/test/dm/gpio.c
index c583d2b344..dfbb634bf7 100644
--- a/test/dm/gpio.c
+++ b/test/dm/gpio.c
@@ -80,15 +80,15 @@ static int dm_test_gpio(struct unit_test_state *uts)
/* Make it an open drain output, and reset it */
ut_asserteq(GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE,
- sandbox_gpio_get_dir_flags(dev, offset));
+ sandbox_gpio_get_flags(dev, offset));
ut_assertok(ops->set_flags(dev, offset,
GPIOD_IS_OUT | GPIOD_OPEN_DRAIN));
ut_asserteq(GPIOD_IS_OUT | GPIOD_OPEN_DRAIN,
- sandbox_gpio_get_dir_flags(dev, offset));
+ sandbox_gpio_get_flags(dev, offset));
ut_assertok(ops->set_flags(dev, offset,
GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE));
ut_asserteq(GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE,
- sandbox_gpio_get_dir_flags(dev, offset));
+ sandbox_gpio_get_flags(dev, offset));
/* Make it an input */
ut_assertok(ops->direction_input(dev, offset));
@@ -176,7 +176,7 @@ static int dm_test_gpio_opendrain_opensource(struct unit_test_state *uts)
/* GPIO 0 is (GPIO_OUT|GPIO_OPEN_DRAIN) */
ut_asserteq(GPIOD_IS_OUT | GPIOD_OPEN_DRAIN,
- sandbox_gpio_get_dir_flags(gpio_c, 0));
+ sandbox_gpio_get_flags(gpio_c, 0));
/* Set it as output high, should become an input */
ut_assertok(dm_gpio_set_value(&desc_list[0], 1));
@@ -190,7 +190,7 @@ static int dm_test_gpio_opendrain_opensource(struct unit_test_state *uts)
/* GPIO 1 is (GPIO_OUT|GPIO_OPEN_SOURCE) */
ut_asserteq(GPIOD_IS_OUT | GPIOD_OPEN_SOURCE,
- sandbox_gpio_get_dir_flags(gpio_c, 1));
+ sandbox_gpio_get_flags(gpio_c, 1));
/* Set it as output high, should become output high */
ut_assertok(dm_gpio_set_value(&desc_list[1], 1));
@@ -204,7 +204,7 @@ static int dm_test_gpio_opendrain_opensource(struct unit_test_state *uts)
/* GPIO 6 is (GPIO_ACTIVE_LOW|GPIO_OUT|GPIO_OPEN_DRAIN) */
ut_asserteq(GPIOD_ACTIVE_LOW | GPIOD_IS_OUT | GPIOD_OPEN_DRAIN,
- sandbox_gpio_get_dir_flags(gpio_c, 6));
+ sandbox_gpio_get_flags(gpio_c, 6));
/* Set it as output high, should become output low */
ut_assertok(dm_gpio_set_value(&desc_list[6], 1));
@@ -218,7 +218,7 @@ static int dm_test_gpio_opendrain_opensource(struct unit_test_state *uts)
/* GPIO 7 is (GPIO_ACTIVE_LOW|GPIO_OUT|GPIO_OPEN_SOURCE) */
ut_asserteq(GPIOD_ACTIVE_LOW | GPIOD_IS_OUT | GPIOD_OPEN_SOURCE,
- sandbox_gpio_get_dir_flags(gpio_c, 7));
+ sandbox_gpio_get_flags(gpio_c, 7));
/* Set it as output high, should become an input */
ut_assertok(dm_gpio_set_value(&desc_list[7], 1));
@@ -363,12 +363,12 @@ static int dm_test_gpio_phandles(struct unit_test_state *uts)
ut_assertok(gpio_free_list(dev, desc_list, 3));
ut_asserteq(GPIOD_IS_OUT | GPIOD_IS_OUT_ACTIVE,
- sandbox_gpio_get_dir_flags(gpio_a, 1));
+ sandbox_gpio_get_flags(gpio_a, 1));
ut_asserteq(6, gpio_request_list_by_name(dev, "test2-gpios", desc_list,
ARRAY_SIZE(desc_list), 0));
/* This was set to output previously but flags resetted to 0 = INPUT */
- ut_asserteq(0, sandbox_gpio_get_dir_flags(gpio_a, 1));
+ ut_asserteq(0, sandbox_gpio_get_flags(gpio_a, 1));
ut_asserteq(GPIOF_INPUT, gpio_get_function(gpio_a, 1, NULL));
/* Active low should invert the input value */