summaryrefslogtreecommitdiffstats
path: root/drivers/gpio/gpiolib.c
diff options
context:
space:
mode:
authorLinus Walleij <linus.walleij@linaro.org>2019-12-13 14:24:41 +0100
committerLinus Walleij <linus.walleij@linaro.org>2019-12-13 14:24:41 +0100
commit279b1fed09eaa921379c6f1e3347e4161ef5f76a (patch)
treef6e50b037ffb0d265f58f4f9347fc750eedbd52e /drivers/gpio/gpiolib.c
parentd935bd50dd14a7714cbdba9a76435dbb56edb1ae (diff)
parent2688302bf1924ebccab2a3b298dd50b4f744d48d (diff)
downloadlinux-279b1fed09eaa921379c6f1e3347e4161ef5f76a.tar.gz
linux-279b1fed09eaa921379c6f1e3347e4161ef5f76a.tar.bz2
linux-279b1fed09eaa921379c6f1e3347e4161ef5f76a.zip
Merge tag 'gpio-v5.5-rc2-fixes-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/brgl/linux into fixes
gpio fixes for v5.5-rc2 - fix gpio-xtensa build failure - fix a regression in gpio-mockup - fix a gcc warning in gpio-aspeed - fix a section mismatch problem in xgs-iproc - fix a problem with emulated open-drain outputs in gpiolib core - switch to bitops in gpio-pca953x after converting the driver to using bitmap - add a missed file to MAINTAINERS entry
Diffstat (limited to 'drivers/gpio/gpiolib.c')
-rw-r--r--drivers/gpio/gpiolib.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index dce0b31f4125..78a16e42f222 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -220,6 +220,14 @@ int gpiod_get_direction(struct gpio_desc *desc)
chip = gpiod_to_chip(desc);
offset = gpio_chip_hwgpio(desc);
+ /*
+ * Open drain emulation using input mode may incorrectly report
+ * input here, fix that up.
+ */
+ if (test_bit(FLAG_OPEN_DRAIN, &desc->flags) &&
+ test_bit(FLAG_IS_OUT, &desc->flags))
+ return 0;
+
if (!chip->get_direction)
return -ENOTSUPP;