gpiolib: acpi: Introduce ACPI_GPIO_QUIRK_ONLY_GPIOIO
PATCH 1/1 gpiolib: acpi: Introduce ACPI_GPIO_QUIRK_ONLY_GPIOIO
New quirk enforces search for GPIO based on its type. Note, supplied index in the mapping table must be 0.
---
- it was sent few weeks ago to Hans for testing, but better to re-test
- it's supposed to go via ASoC subsystem due to recent changes made for sound driver
drivers/gpio/gpiolib-acpi.c | 15 ++++-- include/linux/acpi.h | 2 + sound/soc/intel/boards/bytcr_rt5651.c | 74 ++++----------------------- 3 files changed, 22 insertions(+), 69 deletions(-)
drivers/gpio/gpiolib-acpi.c +11 -4
@@ -530,17 +530,24 @@ static int acpi_populate_gpio_lookup(struct acpi_resource *ares, void *data)if (ares->type !=ACPI_RESOURCE_TYPE_GPIO )return 1 ; -if (lookup->n++ == lookup->index && !lookup->desc) { +if (!lookup->desc) {const struct acpi_resource_gpio *agpio = &ares->data.gpio; -int pin_index = lookup->pin_index; +bool gpioint = agpio->connection_type ==ACPI_RESOURCE_GPIO_TYPE_INT ; +int pin_index; +if (lookup->info.quirks &ACPI_GPIO_QUIRK_ONLY_GPIOIO && gpioint) + lookup->index++; + +if (lookup->n++ != lookup->index) +return 1 ; + + pin_index = lookup->pin_index;if (pin_index >= agpio->pin_table_length)return 1 ; lookup->desc =acpi_get_gpiod (agpio->resource_source.string_ptr, agpio->pin_table[pin_index]); - lookup->info.gpioint = - agpio->connection_type ==ACPI_RESOURCE_GPIO_TYPE_INT ; + lookup->info.gpioint = gpioint;/* * Polarity and triggering are only specified for GpioInt
include/linux/acpi.h +2 -0
@@ -1020,6 +1020,8 @@ struct acpi_gpio_mapping {/* Ignore IoRestriction field */ #define ACPI_GPIO_QUIRK_NO_IO_RESTRICTION BIT(0) +/* Choose one of GpioIo() type */ +#define ACPI_GPIO_QUIRK_ONLY_GPIOIO BIT(1)unsigned int quirks; };
sound/soc/intel/boards/bytcr_rt5651.c +9 -65
90 lines not on this page · raw message
Signature · 1 line
2.19.2
Quoted 2 lines · Andy Shevchenko
New quirk enforces search for GPIO based on its type. Note, supplied index in the mapping table must be 0.
Can you document this where you define the new flag so new users do not need go through git history?
Otherwise looks good. :)
Quoted 4 lines · Andy Shevchenko
New quirk enforces search for GPIO based on its type. Note, supplied index in the mapping table must be 0.
Signed-off-by Andy Shevchenko <[email protected]>
(...)
Quoted 1 line
sound/soc/intel/boards/bytcr_rt5651.c | 74 ++++-----------------------
Do we have an ACK from the maintainer of this file? It's Hans I think. Ideally also from Mark Brown.
Yours,
Linus Walleij
Quoted 6 lines · Linus Walleij
Quoted 3 lines · Andy Shevchenko
New quirk enforces search for GPIO based on its type. Note, supplied index in the mapping table must be 0.
Quoted 8 lines
Quoted 1 line
Signed-off-by Andy Shevchenko <[email protected]>(...)
Quoted 1 line
sound/soc/intel/boards/bytcr_rt5651.c | 74 ++++-----------------------Do we have an ACK from the maintainer of this file? It's Hans I think. Ideally also from Mark Brown.
I hope to get Hans' Tested-by on this.
Signature · 2 lines
With Best Regards, Andy Shevchenko
Quoted 3 lines · Andy Shevchenko
On Fri, Jan 11, 2019 at 03:21:39PM +0100, Linus Walleij wrote:
I hope to get Hans' Tested-by on this.
Btw there is v2 of it with Mika's Ack (not enough, I know).
Signature · 2 lines
With Best Regards, Andy Shevchenko
Hi,
Quoted 9 lines · Andy Shevchenko
Quoted 8 lines · Linus Walleij
Quoted 4 lines · Andy Shevchenko
New quirk enforces search for GPIO based on its type. Note, supplied index in the mapping table must be 0.
Signed-off-by Andy Shevchenko <[email protected]>
Quoted 8 lines
Quoted 6 lines
(...)
Quoted 1 line
sound/soc/intel/boards/bytcr_rt5651.c | 74 ++++-----------------------Do we have an ACK from the maintainer of this file? It's Hans I think. Ideally also from Mark Brown.
I hope to get Hans' Tested-by on this.
Yes I've testing this on my TODO.
Regards,
Hans