* [PATCH] gpio: omap: handle pin config bias flags
@ 2020-07-09 22:34 Drew Fustini
2020-07-13 18:07 ` Tony Lindgren
2020-07-15 10:09 ` Grygorii Strashko
0 siblings, 2 replies; 4+ messages in thread
From: Drew Fustini @ 2020-07-09 22:34 UTC (permalink / raw)
To: Tony Lindgren, Linus Walleij, Bartosz Golaszewski,
Grygorii Strashko, Santosh Shilimkar, Kevin Hilman, linux-omap,
linux-gpio, linux-kernel
Cc: Drew Fustini
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 <drew@beagleboard.org>
---
drivers/gpio/gpio-omap.c | 21 +++++++++++++++++----
1 file changed, 17 insertions(+), 4 deletions(-)
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index b8e2ecc3eade..a471a152f318 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -896,12 +896,25 @@ static int omap_gpio_set_config(struct gpio_chip *chip, unsigned offset,
unsigned long config)
{
u32 debounce;
+ int ret;
- 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);
+ }
+ else
+ {
+ ret = -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)
--
2.25.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio: omap: handle pin config bias flags
2020-07-09 22:34 [PATCH] gpio: omap: handle pin config bias flags Drew Fustini
@ 2020-07-13 18:07 ` Tony Lindgren
2020-07-15 10:09 ` Grygorii Strashko
1 sibling, 0 replies; 4+ messages in thread
From: Tony Lindgren @ 2020-07-13 18:07 UTC (permalink / raw)
To: Drew Fustini
Cc: Linus Walleij, Bartosz Golaszewski, Grygorii Strashko,
Santosh Shilimkar, Kevin Hilman, linux-omap, linux-gpio,
linux-kernel
* Drew Fustini <drew@beagleboard.org> [200709 22:35]:
> 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.
Looks good to me:
Acked-by: Tony Lindgren <tony@atomide.com>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio: omap: handle pin config bias flags
2020-07-09 22:34 [PATCH] gpio: omap: handle pin config bias flags Drew Fustini
2020-07-13 18:07 ` Tony Lindgren
@ 2020-07-15 10:09 ` Grygorii Strashko
2020-07-15 21:32 ` Drew Fustini
1 sibling, 1 reply; 4+ messages in thread
From: Grygorii Strashko @ 2020-07-15 10:09 UTC (permalink / raw)
To: Drew Fustini, Tony Lindgren, Linus Walleij, Bartosz Golaszewski,
Santosh Shilimkar, Kevin Hilman, linux-omap, linux-gpio,
linux-kernel
On 10/07/2020 01:34, Drew Fustini wrote:
> 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 <drew@beagleboard.org>
> ---
> drivers/gpio/gpio-omap.c | 21 +++++++++++++++++----
> 1 file changed, 17 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> index b8e2ecc3eade..a471a152f318 100644
> --- a/drivers/gpio/gpio-omap.c
> +++ b/drivers/gpio/gpio-omap.c
> @@ -896,12 +896,25 @@ static int omap_gpio_set_config(struct gpio_chip *chip, unsigned offset,
> unsigned long config)
> {
> u32 debounce;
> + int ret;
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);
> + }
> + else
> + {
> + ret = -ENOTSUPP;
> + }
drop above "else"?
>
> - 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)
>
Minor comment, Otherwise:
Acked-by: Grygorii Strashko <grygorii.strashko@ti.com>
--
Best regards,
grygorii
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] gpio: omap: handle pin config bias flags
2020-07-15 10:09 ` Grygorii Strashko
@ 2020-07-15 21:32 ` Drew Fustini
0 siblings, 0 replies; 4+ messages in thread
From: Drew Fustini @ 2020-07-15 21:32 UTC (permalink / raw)
To: Grygorii Strashko
Cc: Tony Lindgren, Linus Walleij, Bartosz Golaszewski,
Santosh Shilimkar, Kevin Hilman, linux-omap, linux-gpio,
linux-kernel
On Wed, Jul 15, 2020 at 01:09:12PM +0300, Grygorii Strashko wrote:
>
>
> On 10/07/2020 01:34, Drew Fustini wrote:
> > 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 <drew@beagleboard.org>
> > ---
> > drivers/gpio/gpio-omap.c | 21 +++++++++++++++++----
> > 1 file changed, 17 insertions(+), 4 deletions(-)
> >
> > diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
> > index b8e2ecc3eade..a471a152f318 100644
> > --- a/drivers/gpio/gpio-omap.c
> > +++ b/drivers/gpio/gpio-omap.c
> > @@ -896,12 +896,25 @@ static int omap_gpio_set_config(struct gpio_chip *chip, unsigned offset,
> > unsigned long config)
> > {
> > u32 debounce;
> > + int ret;
>
> 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);
> > + }
> > + else
> > + {
> > + ret = -ENOTSUPP;
> > + }
>
> drop above "else"?
>
> > - 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)
> >
>
> Minor comment, Otherwise:
> Acked-by: Grygorii Strashko <grygorii.strashko@ti.com>
>
> --
> Best regards,
> grygorii
Thanks for reviewing. I'll post a new version with the return value
improvement per your suggestion.
-Drew
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2020-07-15 21:32 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-09 22:34 [PATCH] gpio: omap: handle pin config bias flags Drew Fustini
2020-07-13 18:07 ` Tony Lindgren
2020-07-15 10:09 ` Grygorii Strashko
2020-07-15 21:32 ` Drew Fustini
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).