linux-gpio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] gpiolib: Forbid irqchip default trigger for ACPI enumerated devices
@ 2016-09-12 11:29 Mika Westerberg
  2016-11-24  1:33 ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Mika Westerberg @ 2016-09-12 11:29 UTC (permalink / raw)
  To: Linus Walleij, Alexandre Courbot
  Cc: Rafael J. Wysocki, Mika Westerberg, linux-acpi, linux-gpio

Follow DT and forbid default trigger if the GPIO irqchip device is
enumerated from ACPI. Triggering for these devices will be configured
automatically from ACPI interrupt resources provided by the BIOS.

Suggested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
---
This is on top of Marc's patch here:

  https://lkml.org/lkml/2016/9/7/121

 drivers/gpio/gpiolib.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
index 5707b5d12b28..0efb67f387ea 100644
--- a/drivers/gpio/gpiolib.c
+++ b/drivers/gpio/gpiolib.c
@@ -1618,13 +1618,18 @@ int _gpiochip_irqchip_add(struct gpio_chip *gpiochip,
 		of_node = gpiochip->of_node;
 #endif
 	/*
-	 * Specifying a default trigger is a terrible idea if DT is
+	 * Specifying a default trigger is a terrible idea if DT or ACPI is
 	 * used to configure the interrupts, as you may end-up with
 	 * conflicting triggers. Tell the user, and reset to NONE.
 	 */
 	if (WARN(of_node && type != IRQ_TYPE_NONE,
 		 "%s: Ignoring %d default trigger\n", of_node->full_name, type))
 		type = IRQ_TYPE_NONE;
+	if (has_acpi_companion(gpiochip->parent) && type != IRQ_TYPE_NONE) {
+		acpi_handle_warn(ACPI_HANDLE(gpiochip->parent),
+				 "Ignoring %d default trigger\n", type);
+		type = IRQ_TYPE_NONE;
+	}
 
 	gpiochip->irqchip = irqchip;
 	gpiochip->irq_handler = handler;
-- 
2.9.3


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpiolib: Forbid irqchip default trigger for ACPI enumerated devices
  2016-09-12 11:29 [PATCH] gpiolib: Forbid irqchip default trigger for ACPI enumerated devices Mika Westerberg
@ 2016-11-24  1:33 ` Rafael J. Wysocki
  2016-11-24  7:59   ` Mika Westerberg
  0 siblings, 1 reply; 4+ messages in thread
From: Rafael J. Wysocki @ 2016-11-24  1:33 UTC (permalink / raw)
  To: Mika Westerberg; +Cc: Linus Walleij, Alexandre Courbot, linux-acpi, linux-gpio

On Monday, September 12, 2016 02:29:51 PM Mika Westerberg wrote:
> Follow DT and forbid default trigger if the GPIO irqchip device is
> enumerated from ACPI. Triggering for these devices will be configured
> automatically from ACPI interrupt resources provided by the BIOS.
> 
> Suggested-by: Linus Walleij <linus.walleij@linaro.org>
> Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> ---
> This is on top of Marc's patch here:
> 
>   https://lkml.org/lkml/2016/9/7/121
> 
>  drivers/gpio/gpiolib.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> index 5707b5d12b28..0efb67f387ea 100644
> --- a/drivers/gpio/gpiolib.c
> +++ b/drivers/gpio/gpiolib.c
> @@ -1618,13 +1618,18 @@ int _gpiochip_irqchip_add(struct gpio_chip *gpiochip,
>  		of_node = gpiochip->of_node;
>  #endif
>  	/*
> -	 * Specifying a default trigger is a terrible idea if DT is
> +	 * Specifying a default trigger is a terrible idea if DT or ACPI is
>  	 * used to configure the interrupts, as you may end-up with
>  	 * conflicting triggers. Tell the user, and reset to NONE.
>  	 */
>  	if (WARN(of_node && type != IRQ_TYPE_NONE,
>  		 "%s: Ignoring %d default trigger\n", of_node->full_name, type))
>  		type = IRQ_TYPE_NONE;
> +	if (has_acpi_companion(gpiochip->parent) && type != IRQ_TYPE_NONE) {
> +		acpi_handle_warn(ACPI_HANDLE(gpiochip->parent),
> +				 "Ignoring %d default trigger\n", type);
> +		type = IRQ_TYPE_NONE;
> +	}
>  
>  	gpiochip->irqchip = irqchip;
>  	gpiochip->irq_handler = handler;
> 

Has this gone anywhere already?

Thanks,
Rafael


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpiolib: Forbid irqchip default trigger for ACPI enumerated devices
  2016-11-24  1:33 ` Rafael J. Wysocki
@ 2016-11-24  7:59   ` Mika Westerberg
  2016-11-24 13:45     ` Rafael J. Wysocki
  0 siblings, 1 reply; 4+ messages in thread
From: Mika Westerberg @ 2016-11-24  7:59 UTC (permalink / raw)
  To: Rafael J. Wysocki
  Cc: Linus Walleij, Alexandre Courbot, linux-acpi, linux-gpio

On Thu, Nov 24, 2016 at 02:33:55AM +0100, Rafael J. Wysocki wrote:
> On Monday, September 12, 2016 02:29:51 PM Mika Westerberg wrote:
> > Follow DT and forbid default trigger if the GPIO irqchip device is
> > enumerated from ACPI. Triggering for these devices will be configured
> > automatically from ACPI interrupt resources provided by the BIOS.
> > 
> > Suggested-by: Linus Walleij <linus.walleij@linaro.org>
> > Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
> > ---
> > This is on top of Marc's patch here:
> > 
> >   https://lkml.org/lkml/2016/9/7/121
> > 
> >  drivers/gpio/gpiolib.c | 7 ++++++-
> >  1 file changed, 6 insertions(+), 1 deletion(-)
> > 
> > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
> > index 5707b5d12b28..0efb67f387ea 100644
> > --- a/drivers/gpio/gpiolib.c
> > +++ b/drivers/gpio/gpiolib.c
> > @@ -1618,13 +1618,18 @@ int _gpiochip_irqchip_add(struct gpio_chip *gpiochip,
> >  		of_node = gpiochip->of_node;
> >  #endif
> >  	/*
> > -	 * Specifying a default trigger is a terrible idea if DT is
> > +	 * Specifying a default trigger is a terrible idea if DT or ACPI is
> >  	 * used to configure the interrupts, as you may end-up with
> >  	 * conflicting triggers. Tell the user, and reset to NONE.
> >  	 */
> >  	if (WARN(of_node && type != IRQ_TYPE_NONE,
> >  		 "%s: Ignoring %d default trigger\n", of_node->full_name, type))
> >  		type = IRQ_TYPE_NONE;
> > +	if (has_acpi_companion(gpiochip->parent) && type != IRQ_TYPE_NONE) {
> > +		acpi_handle_warn(ACPI_HANDLE(gpiochip->parent),
> > +				 "Ignoring %d default trigger\n", type);
> > +		type = IRQ_TYPE_NONE;
> > +	}
> >  
> >  	gpiochip->irqchip = irqchip;
> >  	gpiochip->irq_handler = handler;
> > 
> 
> Has this gone anywhere already?

Yes, it should be in the mainline kernel with commit id
0a1e005374910180c30247386992565b05109eac.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] gpiolib: Forbid irqchip default trigger for ACPI enumerated devices
  2016-11-24  7:59   ` Mika Westerberg
@ 2016-11-24 13:45     ` Rafael J. Wysocki
  0 siblings, 0 replies; 4+ messages in thread
From: Rafael J. Wysocki @ 2016-11-24 13:45 UTC (permalink / raw)
  To: Mika Westerberg
  Cc: Rafael J. Wysocki, Linus Walleij, Alexandre Courbot,
	ACPI Devel Maling List, linux-gpio

On Thu, Nov 24, 2016 at 8:59 AM, Mika Westerberg
<mika.westerberg@linux.intel.com> wrote:
> On Thu, Nov 24, 2016 at 02:33:55AM +0100, Rafael J. Wysocki wrote:
>> On Monday, September 12, 2016 02:29:51 PM Mika Westerberg wrote:
>> > Follow DT and forbid default trigger if the GPIO irqchip device is
>> > enumerated from ACPI. Triggering for these devices will be configured
>> > automatically from ACPI interrupt resources provided by the BIOS.
>> >
>> > Suggested-by: Linus Walleij <linus.walleij@linaro.org>
>> > Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
>> > ---
>> > This is on top of Marc's patch here:
>> >
>> >   https://lkml.org/lkml/2016/9/7/121
>> >
>> >  drivers/gpio/gpiolib.c | 7 ++++++-
>> >  1 file changed, 6 insertions(+), 1 deletion(-)
>> >
>> > diff --git a/drivers/gpio/gpiolib.c b/drivers/gpio/gpiolib.c
>> > index 5707b5d12b28..0efb67f387ea 100644
>> > --- a/drivers/gpio/gpiolib.c
>> > +++ b/drivers/gpio/gpiolib.c
>> > @@ -1618,13 +1618,18 @@ int _gpiochip_irqchip_add(struct gpio_chip *gpiochip,
>> >             of_node = gpiochip->of_node;
>> >  #endif
>> >     /*
>> > -    * Specifying a default trigger is a terrible idea if DT is
>> > +    * Specifying a default trigger is a terrible idea if DT or ACPI is
>> >      * used to configure the interrupts, as you may end-up with
>> >      * conflicting triggers. Tell the user, and reset to NONE.
>> >      */
>> >     if (WARN(of_node && type != IRQ_TYPE_NONE,
>> >              "%s: Ignoring %d default trigger\n", of_node->full_name, type))
>> >             type = IRQ_TYPE_NONE;
>> > +   if (has_acpi_companion(gpiochip->parent) && type != IRQ_TYPE_NONE) {
>> > +           acpi_handle_warn(ACPI_HANDLE(gpiochip->parent),
>> > +                            "Ignoring %d default trigger\n", type);
>> > +           type = IRQ_TYPE_NONE;
>> > +   }
>> >
>> >     gpiochip->irqchip = irqchip;
>> >     gpiochip->irq_handler = handler;
>> >
>>
>> Has this gone anywhere already?
>
> Yes, it should be in the mainline kernel with commit id
> 0a1e005374910180c30247386992565b05109eac.

OK, thanks!

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-11-24 13:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-09-12 11:29 [PATCH] gpiolib: Forbid irqchip default trigger for ACPI enumerated devices Mika Westerberg
2016-11-24  1:33 ` Rafael J. Wysocki
2016-11-24  7:59   ` Mika Westerberg
2016-11-24 13:45     ` Rafael J. Wysocki

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).