summaryrefslogtreecommitdiff
path: root/drivers/gpio/sandbox.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2020-10-14 13:35:05 -0400
committerTom Rini <trini@konsulko.com>2020-10-14 13:35:05 -0400
commit6731c5a5ef30e1581e3042b11893627f42949cd7 (patch)
treea5c3fe0db688a28be279cac93174389863747d23 /drivers/gpio/sandbox.c
parent55fca74a5ba9bb0a101b247f421e81322b945a7b (diff)
parent40a3008632abd8bb393eefc212547456f2a5cb25 (diff)
Merge branch '2020-10-14-assorted-changes'
- Add support for Linux "pstore" dumps. - Button command fixup. - gd cleanup and documentation. - Assorted other cleanups.
Diffstat (limited to 'drivers/gpio/sandbox.c')
-rw-r--r--drivers/gpio/sandbox.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/drivers/gpio/sandbox.c b/drivers/gpio/sandbox.c
index c2f80472b83..eb2600de311 100644
--- a/drivers/gpio/sandbox.c
+++ b/drivers/gpio/sandbox.c
@@ -185,7 +185,15 @@ static int sb_gpio_set_dir_flags(struct udevice *dev, unsigned int offset,
dir_flags = get_gpio_dir_flags(dev, offset);
- *dir_flags = flags;
+ /*
+ * For testing purposes keep the output value when switching to input.
+ * This allows us to manipulate the input value via the gpio command.
+ */
+ if (flags & GPIOD_IS_IN)
+ *dir_flags = (flags & ~GPIOD_IS_OUT_ACTIVE) |
+ (*dir_flags & GPIOD_IS_OUT_ACTIVE);
+ else
+ *dir_flags = flags;
return 0;
}