gpiolib: acpi: Introduce ACPI_GPIO_QUIRK_ONLY_GPIOIO
PATCH v3 1/1 gpiolib: acpi: Introduce ACPI_GPIO_QUIRK_ONLY_GPIOIO
New quirk enforces search for GPIO based on its type, i.e. iterate over GpioIo resources only.
--- drivers/gpio/gpiolib-acpi.c | 15 ++++-- include/linux/acpi.h | 7 +++ sound/soc/intel/boards/bytcr_rt5651.c | 74 ++++----------------------- 3 files changed, 27 insertions(+), 69 deletions(-)
drivers/gpio/gpiolib-acpi.c +11 -4
@@ -533,17 +533,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 +7 -0
@@ -1014,6 +1014,13 @@ struct acpi_gpio_mapping {/* Ignore IoRestriction field */ #define ACPI_GPIO_QUIRK_NO_IO_RESTRICTION BIT(0) +/* +* When ACPI GPIO mapping table is in use the index parameter inside it +* refers to the GPIO resource in _CRS method. That index has no +* distinction of actual type of the resource. When consumer wants to +* get GpioIo type explicitly, this quirk may be used. +*/ +#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.20.1
Quoted 7 lines · Andy Shevchenko
New quirk enforces search for GPIO based on its type, i.e. iterate over GpioIo resources only.
Signed-off-by Andy Shevchenko <[email protected]>Acked-by Mika Westerberg <[email protected]>Acked-by Linus Walleij <[email protected]>Tested-by Hans de Goede <[email protected]>
I suppose I ACKed that because it needed to be applied in some other tree (sorry for short teflon-type memory...)
If I should just apply it, tell me!
Yours,
Linus Walleij
Quoted 6 lines · Linus Walleij
Quoted 3 lines · Andy Shevchenko
New quirk enforces search for GPIO based on its type, i.e. iterate over GpioIo resources only.
Quoted 7 lines
Quoted 4 lines
Signed-off-by Andy Shevchenko <[email protected]>Acked-by Mika Westerberg <[email protected]>Acked-by Linus Walleij <[email protected]>Tested-by Hans de Goede <[email protected]>I suppose I ACKed that because it needed to be applied in some other tree (sorry for short teflon-type memory...)
I still hope Mark will apply to ASoC tree.
Mark?
Signature · 2 lines
With Best Regards, Andy Shevchenko
Mark Brown
maintainerQuoted 2 lines · Andy Shevchenko
I still hope Mark will apply to ASoC tree.
Mark?
I'd be a lot more likely to apply it if there's something in the mail after the --- saying something about that...