On Tue, Dec 15, 2015 at 08:11:32AM +0100, Christophe Ricard wrote:
> When a gpio is used as an interrupt in acpi, the irq_type was not
> available for device driver.
> 
> Make available polarity and triggering information in acpi_find_gpio by
> renaming acpi_gpio_info field active_low  to polarity and adding triggering
> field (edge/level).
> For sanity, in gpiolib.c replace info.active_low by
> "info.polarity == GPIO_ACTIVE_LOW".
> 
> Set the irq_type if necessary in acpi_dev_gpio_irq_get.
> 
> Signed-off-by: Christophe Ricard <[email protected]>
> ---
>  drivers/gpio/gpiolib-acpi.c | 30 ++++++++++++++++++++++++------
>  drivers/gpio/gpiolib.c      |  4 ++--
>  drivers/gpio/gpiolib.h      |  3 ++-
>  3 files changed, 28 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/gpio/gpiolib-acpi.c b/drivers/gpio/gpiolib-acpi.c
> index 16a7b68..9f83fc6 100644
> --- a/drivers/gpio/gpiolib-acpi.c
> +++ b/drivers/gpio/gpiolib-acpi.c
> @@ -418,9 +418,11 @@ static int acpi_find_gpio(struct acpi_resource *ares, 
> void *data)
>                * GpioIo is used then the only way to set the flag is
>                * to use _DSD "gpios" property.
>                */
> -             if (lookup->info.gpioint)
> -                     lookup->info.active_low =
> -                             agpio->polarity == ACPI_ACTIVE_LOW;
> +             if (lookup->info.gpioint) {
> +                     lookup->info.polarity = agpio->polarity;

Since you are passing ACPI_ACTIVE_LOW/HIGH/BOTH here and then later on
compare that to GPIO_ACTIVE_LOW you should either put comment here
explaining that we expect the two to be equal, or alternatively convert
ACPI flags here to the corresponding Linux ones.

> +                     lookup->info.triggering = agpio->triggering;
> +             }
> +
>       }
>  
>       return 1;
--
To unsubscribe from this list: send the line "unsubscribe linux-gpio" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to