diff mbox series

[3/4] gpiolib: acpi: support bias pull disable

Message ID 20220713131421.1527179-4-nuno.sa@analog.com
State New
Headers show
Series add support for bias pull-disable | expand

Commit Message

Nuno Sa July 13, 2022, 1:14 p.m. UTC
On top of looking at PULL_UP and PULL_DOWN flags, also look at
PULL_DISABLE and set the appropriate GPIO flag. The GPIO core will then
pass down this to controllers that support it.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
---
 drivers/gpio/gpiolib-acpi.c | 3 +++
 1 file changed, 3 insertions(+)

Comments

Linus Walleij July 18, 2022, 10:32 a.m. UTC | #1
On Wed, Jul 13, 2022 at 3:13 PM Nuno Sá <nuno.sa@analog.com> wrote:

> On top of looking at PULL_UP and PULL_DOWN flags, also look at
> PULL_DISABLE and set the appropriate GPIO flag. The GPIO core will then
> pass down this to controllers that support it.
>
> Signed-off-by: Nuno Sá <nuno.sa@analog.com>

Do we have a semantic check that PULLDOWN and PULLUP
is not used in combination with NOPULL here?

(We should also be checking that PULLDOWN and PULLUP
are not used simultaneously but that is an unrelated thing.)

Yours,
Linus Walleij
Nuno Sá July 18, 2022, 10:49 a.m. UTC | #2
On Mon, 2022-07-18 at 12:32 +0200, Linus Walleij wrote:
> On Wed, Jul 13, 2022 at 3:13 PM Nuno Sá <nuno.sa@analog.com> wrote:
> 
> > On top of looking at PULL_UP and PULL_DOWN flags, also look at
> > PULL_DISABLE and set the appropriate GPIO flag. The GPIO core will
> > then
> > pass down this to controllers that support it.
> > 
> > Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> 
> Do we have a semantic check that PULLDOWN and PULLUP
> is not used in combination with NOPULL here?
> 
> (We should also be checking that PULLDOWN and PULLUP
> are not used simultaneously but that is an unrelated thing.)

I did extended this check:

https://elixir.bootlin.com/linux/v5.19-rc7/source/drivers/gpio/gpiolib.c#L3948

on patch 1 to make sure that PULLDOWN and PULLUP are not used with
NOPULL. Is this what you have in mind or is it something else?

- Nuno Sá
Linus Walleij July 18, 2022, 1:49 p.m. UTC | #3
On Mon, Jul 18, 2022 at 12:48 PM Nuno Sá <noname.nuno@gmail.com> wrote:
> On Mon, 2022-07-18 at 12:32 +0200, Linus Walleij wrote:
> > On Wed, Jul 13, 2022 at 3:13 PM Nuno Sá <nuno.sa@analog.com> wrote:
> >
> > > On top of looking at PULL_UP and PULL_DOWN flags, also look at
> > > PULL_DISABLE and set the appropriate GPIO flag. The GPIO core will
> > > then
> > > pass down this to controllers that support it.
> > >
> > > Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> >
> > Do we have a semantic check that PULLDOWN and PULLUP
> > is not used in combination with NOPULL here?
> >
> > (We should also be checking that PULLDOWN and PULLUP
> > are not used simultaneously but that is an unrelated thing.)
>
> I did extended this check:
>
> https://elixir.bootlin.com/linux/v5.19-rc7/source/drivers/gpio/gpiolib.c#L3948
>
> on patch 1 to make sure that PULLDOWN and PULLUP are not used with
> NOPULL. Is this what you have in mind or is it something else?

Excellent, thanks! That is exactly what we need, sorry for not being
able to keep all floating patches in my head :D

Yours,
Linus Walleij
Andy Shevchenko July 18, 2022, 6:25 p.m. UTC | #4
On Wed, Jul 13, 2022 at 03:14:20PM +0200, Nuno Sá wrote:
> On top of looking at PULL_UP and PULL_DOWN flags, also look at
> PULL_DISABLE and set the appropriate GPIO flag. The GPIO core will then
> pass down this to controllers that support it.

In case this patch will be in v2,
Acked-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

P.S. I will be on vacation till mid-August.
diff mbox series

Patch

diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
index c2523ac26fac..9be1376f9a62 100644
--- a/drivers/gpio/gpiolib-acpi.c
+++ b/drivers/gpio/gpiolib-acpi.c
@@ -687,6 +687,9 @@  int acpi_gpio_update_gpiod_lookup_flags(unsigned long *lookupflags,
 	case ACPI_PIN_CONFIG_PULLDOWN:
 		*lookupflags |= GPIO_PULL_DOWN;
 		break;
+	case ACPI_PIN_CONFIG_NOPULL:
+		*lookupflags |= GPIO_PULL_DISABLE;
+		break;
 	default:
 		break;
 	}