* [PATCH v2] gpio: omap: handle pin config bias flags
@ 2020-07-15 21:37 Drew Fustini
2020-07-16 8:29 ` Linus Walleij
2020-07-17 15:15 ` Andy Shevchenko
0 siblings, 2 replies; 9+ messages in thread
From: Drew Fustini @ 2020-07-15 21:37 UTC (permalink / raw)
To: Tony Lindgren, Haojian Zhuang, Grygorii Strashko, Linus Walleij,
linux-omap, linux-gpio, Jason Kridner, Robert Nelson
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.
Acked-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Signed-off-by: Drew Fustini <drew@beagleboard.org>
---
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(-)
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index b8e2ecc3eade..eba303cff7cb 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -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)
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
* Re: [PATCH v2] gpio: omap: handle pin config bias flags
2020-07-15 21:37 [PATCH v2] gpio: omap: handle pin config bias flags Drew Fustini
@ 2020-07-16 8:29 ` Linus Walleij
2020-07-17 12:40 ` Drew Fustini
2020-07-17 15:15 ` Andy Shevchenko
1 sibling, 1 reply; 9+ messages in thread
From: Linus Walleij @ 2020-07-16 8:29 UTC (permalink / raw)
To: Drew Fustini
Cc: Tony Lindgren, Haojian Zhuang, Grygorii Strashko, Linux-OMAP,
open list:GPIO SUBSYSTEM, Jason Kridner, Robert Nelson
On Wed, Jul 15, 2020 at 11:37 PM Drew Fustini <drew@beagleboard.org> 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.
>
> Acked-by: Grygorii Strashko <grygorii.strashko@ti.com>
> Acked-by: Tony Lindgren <tony@atomide.com>
> Signed-off-by: Drew Fustini <drew@beagleboard.org>
This v2 version applied!
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] gpio: omap: handle pin config bias flags
2020-07-16 8:29 ` Linus Walleij
@ 2020-07-17 12:40 ` Drew Fustini
2020-07-17 12:45 ` Drew Fustini
0 siblings, 1 reply; 9+ messages in thread
From: Drew Fustini @ 2020-07-17 12:40 UTC (permalink / raw)
To: Linus Walleij
Cc: Tony Lindgren, Haojian Zhuang, Grygorii Strashko, Linux-OMAP,
open list:GPIO SUBSYSTEM, Jason Kridner, Robert Nelson
On Thu, Jul 16, 2020 at 10:29:30AM +0200, Linus Walleij wrote:
> On Wed, Jul 15, 2020 at 11:37 PM Drew Fustini <drew@beagleboard.org> 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.
> >
> > Acked-by: Grygorii Strashko <grygorii.strashko@ti.com>
> > Acked-by: Tony Lindgren <tony@atomide.com>
> > Signed-off-by: Drew Fustini <drew@beagleboard.org>
>
> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] gpio: omap: handle pin config bias flags
2020-07-17 12:40 ` Drew Fustini
@ 2020-07-17 12:45 ` Drew Fustini
0 siblings, 0 replies; 9+ messages in thread
From: Drew Fustini @ 2020-07-17 12:45 UTC (permalink / raw)
To: Linus Walleij
Cc: Tony Lindgren, Haojian Zhuang, Grygorii Strashko, Linux-OMAP,
open list:GPIO SUBSYSTEM, Jason Kridner, Robert Nelson
On Fri, Jul 17, 2020 at 02:40:48PM +0200, Drew Fustini wrote:
> On Thu, Jul 16, 2020 at 10:29:30AM +0200, Linus Walleij wrote:
> > On Wed, Jul 15, 2020 at 11:37 PM Drew Fustini <drew@beagleboard.org> 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.
> > >
> > > Acked-by: Grygorii Strashko <grygorii.strashko@ti.com>
> > > Acked-by: Tony Lindgren <tony@atomide.com>
> > > Signed-off-by: Drew Fustini <drew@beagleboard.org>
> >
> > 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
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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] gpio: omap: handle pin config bias flags
2020-07-15 21:37 [PATCH v2] gpio: omap: handle pin config bias flags Drew Fustini
2020-07-16 8:29 ` Linus Walleij
@ 2020-07-17 15:15 ` Andy Shevchenko
[not found] ` <CAPgEAj4gJsZLWDEkjfF+THcD92y6HL8T00NWzpECLDdXQYLVfA@mail.gmail.com>
1 sibling, 1 reply; 9+ messages in thread
From: Andy Shevchenko @ 2020-07-17 15:15 UTC (permalink / raw)
To: Drew Fustini
Cc: Tony Lindgren, Haojian Zhuang, Grygorii Strashko, Linus Walleij,
Linux OMAP Mailing List, open list:GPIO SUBSYSTEM, Jason Kridner,
Robert Nelson
On Thu, Jul 16, 2020 at 12:38 AM Drew Fustini <drew@beagleboard.org> 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.
...
> + 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?
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] gpio: omap: handle pin config bias flags
[not found] ` <CAPgEAj4gJsZLWDEkjfF+THcD92y6HL8T00NWzpECLDdXQYLVfA@mail.gmail.com>
@ 2020-07-17 19:42 ` Drew Fustini
2020-07-20 14:05 ` Linus Walleij
0 siblings, 1 reply; 9+ messages in thread
From: Drew Fustini @ 2020-07-17 19:42 UTC (permalink / raw)
To: Andy Shevchenko
Cc: Tony Lindgren, Haojian Zhuang, Grygorii Strashko, Linus Walleij,
Linux OMAP Mailing List, open list:GPIO SUBSYSTEM, Jason Kridner,
Robert Nelson
On Fri, Jul 17, 2020 at 08:56:45PM +0200, Drew Fustini wrote:
> On Fri, Jul 17, 2020, 17:15 Andy Shevchenko <andy.shevchenko@gmail.com>
> wrote:
>
> > On Thu, Jul 16, 2020 at 12:38 AM Drew Fustini <drew@beagleboard.org>
> > 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.
> >
> > ...
> >
> > > + 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?
> >
> > --
> > With Best Regards,
> > Andy Shevchenko
> >
>
> 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
[0] https://lore.kernel.org/linux-omap/20200717194043.1774643-1-drew@beagleboard.org/
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] gpio: omap: handle pin config bias flags
2020-07-17 19:42 ` Drew Fustini
@ 2020-07-20 14:05 ` Linus Walleij
0 siblings, 0 replies; 9+ messages in thread
From: Linus Walleij @ 2020-07-20 14:05 UTC (permalink / raw)
To: Drew Fustini
Cc: Andy Shevchenko, Tony Lindgren, Haojian Zhuang,
Grygorii Strashko, Linux OMAP Mailing List,
open list:GPIO SUBSYSTEM, Jason Kridner, Robert Nelson
On Fri, Jul 17, 2020 at 9:42 PM Drew Fustini <drew@beagleboard.org> wrote:
> 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [PATCH v2] gpio: omap: handle pin config bias flags
2020-07-17 18:12 Drew Fustini
@ 2020-07-20 14:03 ` Linus Walleij
0 siblings, 0 replies; 9+ messages in thread
From: Linus Walleij @ 2020-07-20 14:03 UTC (permalink / raw)
To: Drew Fustini
Cc: Tony Lindgren, Haojian Zhuang, Linux-OMAP,
open list:GPIO SUBSYSTEM, Jason Kridner, Robert Nelson,
Grygorii Strashko
On Fri, Jul 17, 2020 at 8:12 PM Drew Fustini <drew@beagleboard.org> wrote:
> V2 changes:
> - adjust the braces to match the correct coding style
Thanks
> - 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
^ permalink raw reply [flat|nested] 9+ messages in thread
* [PATCH v2] gpio: omap: handle pin config bias flags
@ 2020-07-17 18:12 Drew Fustini
2020-07-20 14:03 ` Linus Walleij
0 siblings, 1 reply; 9+ messages in thread
From: Drew Fustini @ 2020-07-17 18:12 UTC (permalink / raw)
To: Tony Lindgren, Haojian Zhuang, Linus Walleij, linux-omap,
linux-gpio, Jason Kridner, Robert Nelson
Cc: Drew Fustini, Grygorii Strashko
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>
Acked-by: Grygorii Strashko <grygorii.strashko@ti.com>
Acked-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20200715213738.1640030-1-drew@beagleboard.org
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
---
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?
diff --git a/drivers/gpio/gpio-omap.c b/drivers/gpio/gpio-omap.c
index b8e2ecc3eade..0ccb31de0b67 100644
--- a/drivers/gpio/gpio-omap.c
+++ b/drivers/gpio/gpio-omap.c
@@ -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)
--
2.25.1
^ permalink raw reply related [flat|nested] 9+ messages in thread
end of thread, other threads:[~2020-07-20 14:05 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-15 21:37 [PATCH v2] gpio: omap: handle pin config bias flags Drew Fustini
2020-07-16 8:29 ` Linus Walleij
2020-07-17 12:40 ` Drew Fustini
2020-07-17 12:45 ` Drew Fustini
2020-07-17 15:15 ` Andy Shevchenko
[not found] ` <CAPgEAj4gJsZLWDEkjfF+THcD92y6HL8T00NWzpECLDdXQYLVfA@mail.gmail.com>
2020-07-17 19:42 ` Drew Fustini
2020-07-20 14:05 ` Linus Walleij
2020-07-17 18:12 Drew Fustini
2020-07-20 14:03 ` Linus Walleij
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).