Skip to contentSkip to conversation

gpio: omap: handle pin config bias flags

PATCH Superseded Drew Fustini 2 participants 2 messages Jul 17, 2020 – Jul 20, 2020

Subsystems (2)

v2 of 3 Superseded Latest is v3 →

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 gpio: omap: handle pin config bias flags

Modify omap_gpio_set_config() to handle pin config bias flags by calling gpiochip_generic_config().

The pin group for the gpio line must have the corresponding pinconf properties:

PIN_CONFIG_BIAS_PULL_UP requires "pinctrl-single,bias-pullup" PIN_CONFIG_BIAS_PULL_DOWN requires "pinctrl-single,bias-pulldown"

This is necessary for pcs_pinconf_set() to find the requested bias parameter in the PIN_MAP_TYPE_CONFIGS_GROUP pinctrl map.

---
 drivers/gpio/gpio-omap.c | 16 +++++++++++-----
 1 file changed, 11 insertions(+), 5 deletions(-)

V2 changes:
- adjust the braces to match the correct coding style
- Linus: should I be creating a patch that is just the delta for the braces?

drivers/gpio/gpio-omap.c +11 -5
index b8e2ecc3eade..0ccb31de0b67 100644
@@ -896,12 +896,18 @@ static int omap_gpio_set_config(struct gpio_chip *chip, unsigned offset,
 				unsigned long config)
 {
 	u32 debounce;
+	int ret = -ENOTSUPP;
+
+	if ((pinconf_to_config_param(config) == PIN_CONFIG_BIAS_DISABLE) ||
+	    (pinconf_to_config_param(config) == PIN_CONFIG_BIAS_PULL_UP) ||
+	    (pinconf_to_config_param(config) == PIN_CONFIG_BIAS_PULL_DOWN)) {
+		ret = gpiochip_generic_config(chip, offset, config);
+	} else if (pinconf_to_config_param(config) == PIN_CONFIG_INPUT_DEBOUNCE) {
+		debounce = pinconf_to_config_argument(config);
+		ret = omap_gpio_debounce(chip, offset, debounce);
+	}
 
-	if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE)
-		return -ENOTSUPP;
-
-	debounce = pinconf_to_config_argument(config);
-	return omap_gpio_debounce(chip, offset, debounce);
+	return ret;
 }
 
 static void omap_gpio_set(struct gpio_chip *chip, unsigned offset, int value)
Signature · 1 line
2.25.1
#1 lore raw
Quoted 2 lines · Drew Fustini

V2 changes:
- adjust the braces to match the correct coding style

Thanks

Quoted 2 lines

- Linus: should I be creating a patch that is just the delta for the braces?

No, I noticed I mistakenly applied it to the pinctrl tree instead of GPIO so I had to revert it there anyway. I applied this version to the GPIO tree instead.

Yours,
Linus Walleij