Skip to content

Commit 75dec56

Browse files
pdp7linusw
authored andcommitted
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. Signed-off-by: Drew Fustini <[email protected]> Signed-off-by: Linus Walleij <[email protected]> Acked-by: Grygorii Strashko <[email protected]> Acked-by: Tony Lindgren <[email protected]> Link: https://lore.kernel.org/r/[email protected] Link: https://lore.kernel.org/r/[email protected]
1 parent 50787be commit 75dec56

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

drivers/gpio/gpio-omap.c

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -897,12 +897,18 @@ static int omap_gpio_set_config(struct gpio_chip *chip, unsigned offset,
897897
unsigned long config)
898898
{
899899
u32 debounce;
900+
int ret = -ENOTSUPP;
901+
902+
if ((pinconf_to_config_param(config) == PIN_CONFIG_BIAS_DISABLE) ||
903+
(pinconf_to_config_param(config) == PIN_CONFIG_BIAS_PULL_UP) ||
904+
(pinconf_to_config_param(config) == PIN_CONFIG_BIAS_PULL_DOWN)) {
905+
ret = gpiochip_generic_config(chip, offset, config);
906+
} else if (pinconf_to_config_param(config) == PIN_CONFIG_INPUT_DEBOUNCE) {
907+
debounce = pinconf_to_config_argument(config);
908+
ret = omap_gpio_debounce(chip, offset, debounce);
909+
}
900910

901-
if (pinconf_to_config_param(config) != PIN_CONFIG_INPUT_DEBOUNCE)
902-
return -ENOTSUPP;
903-
904-
debounce = pinconf_to_config_argument(config);
905-
return omap_gpio_debounce(chip, offset, debounce);
911+
return ret;
906912
}
907913

908914
static void omap_gpio_set(struct gpio_chip *chip, unsigned offset, int value)

0 commit comments

Comments
 (0)