gpio: omap: handle pin config bias flags
Subsystems (2)
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.
---
v2 change:
- simplify handling of -ENOTSUPP return value per Grygorii's suggestion
drivers/gpio/gpio-omap.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-)
drivers/gpio/gpio-omap.c +13 -4
@@ -896,12 +896,21 @@ 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_INPUT_DEBOUNCE ) -return -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); + } - 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
Quoted 9 lines · Drew Fustini
Modify
omap_gpio_set_config()to handle pin config bias flags by callinggpiochip_generic_config().The pin group for the gpio line must have the corresponding pinconf properties:
PIN_CONFIG_BIAS_PULL_UPrequires "pinctrl-single,bias-pullup"PIN_CONFIG_BIAS_PULL_DOWNrequires "pinctrl-single,bias-pulldown"
Quoted 6 lines
This is necessary for
pcs_pinconf_set()to find the requested bias parameter in thePIN_MAP_TYPE_CONFIGS_GROUPpinctrl map.Acked-by Tony Lindgren <[email protected]>Signed-off-by Drew Fustini <[email protected]>
This v2 version applied!
Yours,
Linus Walleij
Quoted 14 lines · Linus Walleij
Quoted 12 lines · Drew Fustini
Modify
omap_gpio_set_config()to handle pin config bias flags by callinggpiochip_generic_config().The pin group for the gpio line must have the corresponding pinconf properties:
PIN_CONFIG_BIAS_PULL_UPrequires "pinctrl-single,bias-pullup"PIN_CONFIG_BIAS_PULL_DOWNrequires "pinctrl-single,bias-pulldown"This is necessary for
pcs_pinconf_set()to find the requested bias parameter in thePIN_MAP_TYPE_CONFIGS_GROUPpinctrl map.
Quoted 8 lines
Quoted 3 lines
Acked-by Tony Lindgren <[email protected]>Signed-off-by Drew Fustini <[email protected]>This v2 version applied!
Yours,
Linus Walleij
Thanks!
I'm curious which branch should I look in to find it?
I didn't see it in any of the branches in:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/refs/
-Drew
Quoted 24 lines · Drew Fustini
Quoted 14 lines · Linus Walleij
Quoted 12 lines · Drew Fustini
Modify
omap_gpio_set_config()to handle pin config bias flags by callinggpiochip_generic_config().The pin group for the gpio line must have the corresponding pinconf properties:
PIN_CONFIG_BIAS_PULL_UPrequires "pinctrl-single,bias-pullup"PIN_CONFIG_BIAS_PULL_DOWNrequires "pinctrl-single,bias-pulldown"This is necessary for
pcs_pinconf_set()to find the requested bias parameter in thePIN_MAP_TYPE_CONFIGS_GROUPpinctrl map.Quoted 8 lines
Quoted 3 lines
Acked-by Tony Lindgren <[email protected]>Signed-off-by Drew Fustini <[email protected]>This v2 version applied!
Yours,
Linus Walleij
Quoted 8 lines
Thanks!
I'm curious which branch should I look in to find it?
I didn't see it in any of the branches in:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-gpio.git/refs/-Drew
Oh, nevermind. I found it in linux-pinctrl:
https://git.kernel.org/pub/scm/linux/kernel/git/linusw/linux-pinctrl.git/commit/?h=for-next&id=40e30d26d909af89de2dcd0b4abdd27c47ac2235
Thanks,
Drew
Quoted 12 lines · Drew Fustini
Modify
omap_gpio_set_config()to handle pin config bias flags by callinggpiochip_generic_config().The pin group for the gpio line must have the corresponding pinconf properties:
PIN_CONFIG_BIAS_PULL_UPrequires "pinctrl-single,bias-pullup"PIN_CONFIG_BIAS_PULL_DOWNrequires "pinctrl-single,bias-pulldown"This is necessary for
pcs_pinconf_set()to find the requested bias parameter in thePIN_MAP_TYPE_CONFIGS_GROUPpinctrl map.
...
drivers/gpio/gpio-omap.c static int omap_gpio_set_config(struct gpio_chip *chip, unsigned offset, · line 911
Quoted 11 lines
drivers/gpio/gpio-omap.c +11
-0+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); + }
It's a rather strange indentation of the curly braces. Don't you run checkpatch?
Signature · 2 lines
With Best Regards, Andy Shevchenko
A message that is not in the archive (sent off-list or not yet received): CAPgEAj4gJsZLWDEkjfF+THcD92y6HL8T00NWzpECLDdXQYLVfA@mail.gmail.com
Quoted 44 lines · Drew Fustini
Quoted 33 lines · On Fri, Jul 17, 2020, 17:15 Andy Shevchenko <[email protected]> wrote:
Quoted 12 lines · Drew Fustini
Modify
omap_gpio_set_config()to handle pin config bias flags by callinggpiochip_generic_config().The pin group for the gpio line must have the corresponding pinconf properties:
PIN_CONFIG_BIAS_PULL_UPrequires "pinctrl-single,bias-pullup"PIN_CONFIG_BIAS_PULL_DOWNrequires "pinctrl-single,bias-pulldown"This is necessary for
pcs_pinconf_set()to find the requested bias parameter in thePIN_MAP_TYPE_CONFIGS_GROUPpinctrl map....
Quoted 1 line
+ 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))drivers/gpio/gpio-omap.c static int omap_gpio_set_config(struct gpio_chip *chip, unsigned offset,
Quoted 4 lines
drivers/gpio/gpio-omap.c +4
-0+ { + ret =gpiochip_generic_config (chip, offset, config); + } + else if (pinconf_to_config_param(config) ==
PIN_CONFIG_INPUT_DEBOUNCE)drivers/gpio/gpio-omap.c static int omap_gpio_set_config(struct gpio_chip *chip, unsigned offset, · line 911
Quoted 4 lines
drivers/gpio/gpio-omap.c +4
-0+ { + debounce =pinconf_to_config_argument (config); + ret =omap_gpio_debounce (chip, offset, debounce); + }Quoted 7 lines
It's a rather strange indentation of the curly braces. Don't you run checkpatch?
--
With Best Regards,
Andy Shevchenko
Quoted 8 lines
Thanks for pointing that out. I should have caught that.
Linus - I submitted a v2 with the braces fixed. Please let me know if I should send a patch just for the braces on top of what is already in for-next.
Thanks,
Drew
Sorry for the noise. I failed to realize that I had already sent v2 (regarding the handling of the return value). I have now submitted v3 patch [0] to fix the braces formatting that Andy pointed out.
thanks,
drew
Quoted 3 lines · Drew Fustini
Sorry for the noise. I failed to realize that I had already sent v2 (regarding the handling of the return value). I have now submitted v3 patch [0] to fix the braces formatting that Andy pointed out.
Oh, OK I applied the v3 instead. To the GPIO tree.
Yours,
Linus Walleij