diff options
| author | Zixun LI <admin@hifiphile.com> | 2024-10-21 17:04:51 +0200 | 
|---|---|---|
| committer | Tom Rini <trini@konsulko.com> | 2024-12-04 14:11:43 -0600 | 
| commit | 3c69a95b9a84f629cb6e5215158f9332a731aae9 (patch) | |
| tree | 9b2e16ef8dffca7dc271e2202c559067d4181de9 | |
| parent | 15299fa5dd8985759b705c7b06d7430924ba2407 (diff) | |
dm: gpio: Return error when pull up/down is requested but set_flags ops is not implmentated
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>
| -rw-r--r-- | drivers/gpio/gpio-uclass.c | 3 | 
1 files changed, 3 insertions, 0 deletions
| diff --git a/drivers/gpio/gpio-uclass.c b/drivers/gpio/gpio-uclass.c index 0213271e3a6..da929c33447 100644 --- a/drivers/gpio/gpio-uclass.c +++ b/drivers/gpio/gpio-uclass.c @@ -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; | 
