Message ID | 20210225163320.71267-2-andriy.shevchenko@linux.intel.com |
---|---|
State | Accepted |
Commit | 62d5247d239d4b48762192a251c647d7c997616a |
Headers | show |
Series | gpio: pca953x: Better quirk for Intel Galileo Gen 2 | expand |
On Thu, Feb 25, 2021 at 5:33 PM Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > On some systems the ACPI tables has wrong pin number and instead of > having a relative one it provides an absolute one in the global GPIO > number space. > > Add ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER quirk to cope with such cases. > > Fixes: ba8c90c61847 ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2") > Depends-on: 0ea683931adb ("gpio: dwapb: Convert driver to using the GPIO-lib-based IRQ-chip") > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> OH THE HORROR! However, we discussed it before. It is as it is. It's the right place to fix the problem, so: Acked-by: Linus Walleij <linus.walleij@linaro.org> Yours, Linus Walleij
On Tue, Mar 02, 2021 at 03:48:43PM +0100, Linus Walleij wrote: > On Thu, Feb 25, 2021 at 5:33 PM Andy Shevchenko > <andriy.shevchenko@linux.intel.com> wrote: > > > On some systems the ACPI tables has wrong pin number and instead of > > having a relative one it provides an absolute one in the global GPIO > > number space. > > > > Add ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER quirk to cope with such cases. > > > > Fixes: ba8c90c61847 ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2") > > Depends-on: 0ea683931adb ("gpio: dwapb: Convert driver to using the GPIO-lib-based IRQ-chip") > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > OH THE HORROR! > However, we discussed it before. It is as it is. Unfortunately :-( (And recently it seems MS does something really "creative" on ARM ACPI platform) > It's the right place to fix the problem, so: > Acked-by: Linus Walleij <linus.walleij@linaro.org> I am waiting for Mika, but if he keeps silent let's say to the end of the day, I will submit it as is to the v5.12-rcX fixes. Thanks!
On Tue, Mar 02, 2021 at 05:09:24PM +0200, Andy Shevchenko wrote: > On Tue, Mar 02, 2021 at 03:48:43PM +0100, Linus Walleij wrote: > > On Thu, Feb 25, 2021 at 5:33 PM Andy Shevchenko > > <andriy.shevchenko@linux.intel.com> wrote: > > > > > On some systems the ACPI tables has wrong pin number and instead of > > > having a relative one it provides an absolute one in the global GPIO > > > number space. > > > > > > Add ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER quirk to cope with such cases. > > > > > > Fixes: ba8c90c61847 ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2") > > > Depends-on: 0ea683931adb ("gpio: dwapb: Convert driver to using the GPIO-lib-based IRQ-chip") > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > > > OH THE HORROR! > > However, we discussed it before. It is as it is. > > Unfortunately :-( (And recently it seems MS does something really "creative" on > ARM ACPI platform) > > > It's the right place to fix the problem, so: > > Acked-by: Linus Walleij <linus.walleij@linaro.org> > > I am waiting for Mika, but if he keeps silent let's say to the end of the day, > I will submit it as is to the v5.12-rcX fixes. Sorry for the delay - I somehow missed this. Feel free to add my ACK too.
On Tue, Mar 02, 2021 at 05:14:30PM +0200, Mika Westerberg wrote: > On Tue, Mar 02, 2021 at 05:09:24PM +0200, Andy Shevchenko wrote: > > On Tue, Mar 02, 2021 at 03:48:43PM +0100, Linus Walleij wrote: > > > On Thu, Feb 25, 2021 at 5:33 PM Andy Shevchenko > > > <andriy.shevchenko@linux.intel.com> wrote: > > > > > > > On some systems the ACPI tables has wrong pin number and instead of > > > > having a relative one it provides an absolute one in the global GPIO > > > > number space. > > > > > > > > Add ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER quirk to cope with such cases. > > > > > > > > Fixes: ba8c90c61847 ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2") > > > > Depends-on: 0ea683931adb ("gpio: dwapb: Convert driver to using the GPIO-lib-based IRQ-chip") > > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > > > > > OH THE HORROR! > > > However, we discussed it before. It is as it is. > > > > Unfortunately :-( (And recently it seems MS does something really "creative" on > > ARM ACPI platform) > > > > > It's the right place to fix the problem, so: > > > Acked-by: Linus Walleij <linus.walleij@linaro.org> > > > > I am waiting for Mika, but if he keeps silent let's say to the end of the day, > > I will submit it as is to the v5.12-rcX fixes. > > Sorry for the delay - I somehow missed this. Feel free to add my ACK too. Thanks, Mika!
On Tue, Mar 2, 2021 at 4:21 PM Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote: > > On Tue, Mar 02, 2021 at 05:14:30PM +0200, Mika Westerberg wrote: > > On Tue, Mar 02, 2021 at 05:09:24PM +0200, Andy Shevchenko wrote: > > > On Tue, Mar 02, 2021 at 03:48:43PM +0100, Linus Walleij wrote: > > > > On Thu, Feb 25, 2021 at 5:33 PM Andy Shevchenko > > > > <andriy.shevchenko@linux.intel.com> wrote: > > > > > > > > > On some systems the ACPI tables has wrong pin number and instead of > > > > > having a relative one it provides an absolute one in the global GPIO > > > > > number space. > > > > > > > > > > Add ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER quirk to cope with such cases. > > > > > > > > > > Fixes: ba8c90c61847 ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2") > > > > > Depends-on: 0ea683931adb ("gpio: dwapb: Convert driver to using the GPIO-lib-based IRQ-chip") > > > > > Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> > > > > > > > > OH THE HORROR! > > > > However, we discussed it before. It is as it is. > > > > > > Unfortunately :-( (And recently it seems MS does something really "creative" on > > > ARM ACPI platform) > > > > > > > It's the right place to fix the problem, so: > > > > Acked-by: Linus Walleij <linus.walleij@linaro.org> > > > > > > I am waiting for Mika, but if he keeps silent let's say to the end of the day, > > > I will submit it as is to the v5.12-rcX fixes. > > > > Sorry for the delay - I somehow missed this. Feel free to add my ACK too. > > Thanks, Mika! > > > -- > With Best Regards, > Andy Shevchenko > > Hi Andy, Do you want me to take these, or will you include them in your PR? Bart
On Tue, Mar 02, 2021 at 05:07:55PM +0100, Bartosz Golaszewski wrote: > On Tue, Mar 2, 2021 at 4:21 PM Andy Shevchenko > <andriy.shevchenko@linux.intel.com> wrote: > Do you want me to take these, or will you include them in your PR? I'll send PR. I'm waiting for vger to process the queue (it has some lags).
diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c index e37a57d0a2f0..026ef258d4b9 100644 --- a/drivers/gpio/gpiolib-acpi.c +++ b/drivers/gpio/gpiolib-acpi.c @@ -677,6 +677,7 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data) if (!lookup->desc) { const struct acpi_resource_gpio *agpio = &ares->data.gpio; bool gpioint = agpio->connection_type == ACPI_RESOURCE_GPIO_TYPE_INT; + struct gpio_desc *desc; u16 pin_index; if (lookup->info.quirks & ACPI_GPIO_QUIRK_ONLY_GPIOIO && gpioint) @@ -689,8 +690,12 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data) if (pin_index >= agpio->pin_table_length) return 1; - lookup->desc = acpi_get_gpiod(agpio->resource_source.string_ptr, + if (lookup->info.quirks & ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER) + desc = gpio_to_desc(agpio->pin_table[pin_index]); + else + desc = acpi_get_gpiod(agpio->resource_source.string_ptr, agpio->pin_table[pin_index]); + lookup->desc = desc; lookup->info.pin_config = agpio->pin_config; lookup->info.debounce = agpio->debounce_timeout; lookup->info.gpioint = gpioint; diff --git a/include/linux/gpio/consumer.h b/include/linux/gpio/consumer.h index ef49307611d2..c73b25bc9213 100644 --- a/include/linux/gpio/consumer.h +++ b/include/linux/gpio/consumer.h @@ -674,6 +674,8 @@ struct acpi_gpio_mapping { * get GpioIo type explicitly, this quirk may be used. */ #define ACPI_GPIO_QUIRK_ONLY_GPIOIO BIT(1) +/* Use given pin as an absolute GPIO number in the system */ +#define ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER BIT(2) unsigned int quirks; };
On some systems the ACPI tables has wrong pin number and instead of having a relative one it provides an absolute one in the global GPIO number space. Add ACPI_GPIO_QUIRK_ABSOLUTE_NUMBER quirk to cope with such cases. Fixes: ba8c90c61847 ("gpio: pca953x: Override IRQ for one of the expanders on Galileo Gen 2") Depends-on: 0ea683931adb ("gpio: dwapb: Convert driver to using the GPIO-lib-based IRQ-chip") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> --- drivers/gpio/gpiolib-acpi.c | 7 ++++++- include/linux/gpio/consumer.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-)