dm: gpio: Return error when pull up/down is requested but set_flags ops is not implme...
authorZixun LI <admin@hifiphile.com>
Mon, 21 Oct 2024 15:04:51 +0000 (17:04 +0200)
committerTom Rini <trini@konsulko.com>
Wed, 4 Dec 2024 20:11:43 +0000 (14:11 -0600)
Currently in _dm_gpio_set_flags() when set_flags ops is not implemented
direction_output()/_input() is used, but pull up/down is not supported by
these ops.

Signed-off-by: Zixun LI <admin@hifiphile.com>
drivers/gpio/gpio-uclass.c

index 0213271..da929c3 100644 (file)
@@ -705,6 +705,9 @@ static int _dm_gpio_set_flags(struct gpio_desc *desc, ulong flags)
        if (ops->set_flags) {
                ret = ops->set_flags(dev, desc->offset, flags);
        } else {
+               if (flags & GPIOD_MASK_PULL)
+                       return -EINVAL;
+
                if (flags & GPIOD_IS_OUT) {
                        bool value = flags & GPIOD_IS_OUT_ACTIVE;