summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authormario.six@gdsys.cc <mario.six@gdsys.cc>2016-05-25 15:15:23 +0200
committerYork Sun <york.sun@nxp.com>2016-06-03 22:14:20 -0700
commit743268f5146e3fd93abb8b6142ef6a259a0656c5 (patch)
treed28611bc6504378b0316582e62bf8f7f3132c219 /test
parent51781783c59ad0080621d777579eb8acd14aa0ed (diff)
downloadu-boot-743268f5146e3fd93abb8b6142ef6a259a0656c5.tar.gz
u-boot-743268f5146e3fd93abb8b6142ef6a259a0656c5.tar.xz
u-boot-743268f5146e3fd93abb8b6142ef6a259a0656c5.zip
dm: test: Add GPIO open drain tests
Add some tests for the new open drain setting feature of the GPIO uclass, and extend the capabilities of the sandbox GPIO driver accordingly. Signed-off-by: Mario Six <mario.six@gdsys.cc> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: York Sun <york.sun@nxp.com>
Diffstat (limited to 'test')
-rw-r--r--test/dm/gpio.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/test/dm/gpio.c b/test/dm/gpio.c
index 727db18690..b99452340d 100644
--- a/test/dm/gpio.c
+++ b/test/dm/gpio.c
@@ -75,6 +75,13 @@ static int dm_test_gpio(struct unit_test_state *uts)
ut_assertok(ops->set_value(dev, offset, 1));
ut_asserteq(1, ops->get_value(dev, offset));
+ /* Make it an open drain output, and reset it */
+ ut_asserteq(0, sandbox_gpio_get_open_drain(dev, offset));
+ ut_assertok(ops->set_open_drain(dev, offset, 1));
+ ut_asserteq(1, sandbox_gpio_get_open_drain(dev, offset));
+ ut_assertok(ops->set_open_drain(dev, offset, 0));
+ ut_asserteq(0, sandbox_gpio_get_open_drain(dev, offset));
+
/* Make it an input */
ut_assertok(ops->direction_input(dev, offset));
ut_assertok(gpio_get_status(dev, offset, buf, sizeof(buf)));