linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] imx/gpio: Use handle_level_irq
@ 2009-10-19 20:19 Uwe Kleine-König
  2009-10-20  8:13 ` Sascha Hauer
  0 siblings, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2009-10-19 20:19 UTC (permalink / raw)
  To: linux-arm-kernel

According to Russell King handle_edge_irq is only useful for "edge-based
inputs where the controller does not remember transitions with the input
masked."

So using handle_edge_irq unconditionally for both edge and level irqs is
wrong.  Testing showed that the controller does remember transitions
while the interrupt is masked.  So use handle_level_irq unconditionally.

Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
Cc: Russell King <rmk@arm.linux.org.uk>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
---
 arch/arm/plat-mxc/gpio.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
index cfc4a8b..d65ebe3 100644
--- a/arch/arm/plat-mxc/gpio.c
+++ b/arch/arm/plat-mxc/gpio.c
@@ -282,7 +282,7 @@ int __init mxc_gpio_init(struct mxc_gpio_port *port, int cnt)
 		for (j = port[i].virtual_irq_start;
 			j < port[i].virtual_irq_start + 32; j++) {
 			set_irq_chip(j, &gpio_irq_chip);
-			set_irq_handler(j, handle_edge_irq);
+			set_irq_handler(j, handle_level_irq);
 			set_irq_flags(j, IRQF_VALID);
 		}
 
-- 
1.6.5

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

* [PATCH] imx/gpio: Use handle_level_irq
  2009-10-19 20:19 [PATCH] imx/gpio: Use handle_level_irq Uwe Kleine-König
@ 2009-10-20  8:13 ` Sascha Hauer
  2009-10-20 17:37   ` Uwe Kleine-König
  2009-11-01 20:39   ` Uwe Kleine-König
  0 siblings, 2 replies; 6+ messages in thread
From: Sascha Hauer @ 2009-10-20  8:13 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Oct 19, 2009 at 10:19:28PM +0200, Uwe Kleine-K?nig wrote:
> According to Russell King handle_edge_irq is only useful for "edge-based
> inputs where the controller does not remember transitions with the input
> masked."
> 
> So using handle_edge_irq unconditionally for both edge and level irqs is
> wrong.  Testing showed that the controller does remember transitions
> while the interrupt is masked.  So use handle_level_irq unconditionally.

As this fixes only rt kernels and we have no reports that something is
not working on non rt kernels I suggest putting this into the next merge
window.

Sascha


> 
> Signed-off-by: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> Cc: Russell King <rmk@arm.linux.org.uk>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> ---
>  arch/arm/plat-mxc/gpio.c |    2 +-
>  1 files changed, 1 insertions(+), 1 deletions(-)
> 
> diff --git a/arch/arm/plat-mxc/gpio.c b/arch/arm/plat-mxc/gpio.c
> index cfc4a8b..d65ebe3 100644
> --- a/arch/arm/plat-mxc/gpio.c
> +++ b/arch/arm/plat-mxc/gpio.c
> @@ -282,7 +282,7 @@ int __init mxc_gpio_init(struct mxc_gpio_port *port, int cnt)
>  		for (j = port[i].virtual_irq_start;
>  			j < port[i].virtual_irq_start + 32; j++) {
>  			set_irq_chip(j, &gpio_irq_chip);
> -			set_irq_handler(j, handle_edge_irq);
> +			set_irq_handler(j, handle_level_irq);
>  			set_irq_flags(j, IRQF_VALID);
>  		}
>  
> -- 
> 1.6.5
> 
> 

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

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

* [PATCH] imx/gpio: Use handle_level_irq
  2009-10-20  8:13 ` Sascha Hauer
@ 2009-10-20 17:37   ` Uwe Kleine-König
  2009-10-23 11:27     ` Richard Zhao
  2009-11-01 20:39   ` Uwe Kleine-König
  1 sibling, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2009-10-20 17:37 UTC (permalink / raw)
  To: linux-arm-kernel

Hello Sascha,

On Tue, Oct 20, 2009 at 10:13:03AM +0200, Sascha Hauer wrote:
> On Mon, Oct 19, 2009 at 10:19:28PM +0200, Uwe Kleine-K?nig wrote:
> > According to Russell King handle_edge_irq is only useful for "edge-based
> > inputs where the controller does not remember transitions with the input
> > masked."
> > 
> > So using handle_edge_irq unconditionally for both edge and level irqs is
> > wrong.  Testing showed that the controller does remember transitions
> > while the interrupt is masked.  So use handle_level_irq unconditionally.
> 
> As this fixes only rt kernels and we have no reports that something is
> not working on non rt kernels I suggest putting this into the next merge
> window.
The PMIC on pcm038 doesn't work anymore with handle_edge_irq since I
switched to using threaded irqs in the driver.  But as this won't hit
mainline before the next merge window that is fine for me, too.

Best regards
Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-K?nig            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

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

* [PATCH] imx/gpio: Use handle_level_irq
  2009-10-20 17:37   ` Uwe Kleine-König
@ 2009-10-23 11:27     ` Richard Zhao
  2009-10-23 11:58       ` Uwe Kleine-König
  0 siblings, 1 reply; 6+ messages in thread
From: Richard Zhao @ 2009-10-23 11:27 UTC (permalink / raw)
  To: linux-arm-kernel

2009/10/21 Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>:
> Hello Sascha,
>
> On Tue, Oct 20, 2009 at 10:13:03AM +0200, Sascha Hauer wrote:
>> On Mon, Oct 19, 2009 at 10:19:28PM +0200, Uwe Kleine-K?nig wrote:
>> > According to Russell King handle_edge_irq is only useful for "edge-based
>> > inputs where the controller does not remember transitions with the input
>> > masked."
>> >
>> > So using handle_edge_irq unconditionally for both edge and level irqs is
>> > wrong. ?Testing showed that the controller does remember transitions
>> > while the interrupt is masked. ?So use handle_level_irq unconditionally.
>>
>> As this fixes only rt kernels and we have no reports that something is
>> not working on non rt kernels I suggest putting this into the next merge
>> window.
> The PMIC on pcm038 doesn't work anymore with handle_edge_irq since I
> switched to using threaded irqs in the driver. ?But as this won't hit
> mainline before the next merge window that is fine for me, too.
>
> Best regards
> Uwe
>
> --
> Pengutronix e.K. ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?| Uwe Kleine-K?nig ? ? ? ? ? ?|
> Industrial Linux Solutions ? ? ? ? ? ? ? ? ? ?| http://www.pengutronix.de/ ?|
>
> _______________________________________________
> linux-arm-kernel mailing list
> linux-arm-kernel at lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
>

handle_level_irq may lost edge irq request. The controller won't
change ISR when irq's masked.
Why not decide to use handle_level_irq or handle_edge_irq in gpio_set_irq_type?

Thanks
Richard

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

* [PATCH] imx/gpio: Use handle_level_irq
  2009-10-23 11:27     ` Richard Zhao
@ 2009-10-23 11:58       ` Uwe Kleine-König
  0 siblings, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2009-10-23 11:58 UTC (permalink / raw)
  To: linux-arm-kernel

Hello,

On Fri, Oct 23, 2009 at 07:27:08PM +0800, Richard Zhao wrote:
> 2009/10/21 Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>:
> > Hello Sascha,
> >
> > On Tue, Oct 20, 2009 at 10:13:03AM +0200, Sascha Hauer wrote:
> >> On Mon, Oct 19, 2009 at 10:19:28PM +0200, Uwe Kleine-K?nig wrote:
> >> > According to Russell King handle_edge_irq is only useful for "edge-based
> >> > inputs where the controller does not remember transitions with the input
> >> > masked."
> >> >
> >> > So using handle_edge_irq unconditionally for both edge and level irqs is
> >> > wrong. ?Testing showed that the controller does remember transitions
> >> > while the interrupt is masked. ?So use handle_level_irq unconditionally.
> >>
> >> As this fixes only rt kernels and we have no reports that something is
> >> not working on non rt kernels I suggest putting this into the next merge
> >> window.
> > The PMIC on pcm038 doesn't work anymore with handle_edge_irq since I
> > switched to using threaded irqs in the driver. ?But as this won't hit
> > mainline before the next merge window that is fine for me, too.
> 
> handle_level_irq may lost edge irq request. The controller won't
> change ISR when irq's masked.
> Why not decide to use handle_level_irq or handle_edge_irq in gpio_set_irq_type?
Have you read the commit log?  If yes, do you know a test case where
handle_level_irq fails to detect an edge irq when masked?

I did on a Phytec pcm038:

	set_irq_type(TRIGGER_RISING)
	mask(irq=119)
	provoke a rising edge on gpio55
	unmask(irq=119)

and after that the irq handler was entered.

Best regards
Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-K?nig            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

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

* [PATCH] imx/gpio: Use handle_level_irq
  2009-10-20  8:13 ` Sascha Hauer
  2009-10-20 17:37   ` Uwe Kleine-König
@ 2009-11-01 20:39   ` Uwe Kleine-König
  1 sibling, 0 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2009-11-01 20:39 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Oct 20, 2009 at 10:13:03AM +0200, Sascha Hauer wrote:
> On Mon, Oct 19, 2009 at 10:19:28PM +0200, Uwe Kleine-K?nig wrote:
> > According to Russell King handle_edge_irq is only useful for "edge-based
> > inputs where the controller does not remember transitions with the input
> > masked."
> > 
> > So using handle_edge_irq unconditionally for both edge and level irqs is
> > wrong.  Testing showed that the controller does remember transitions
> > while the interrupt is masked.  So use handle_level_irq unconditionally.
> 
> As this fixes only rt kernels and we have no reports that something is
> not working on non rt kernels I suggest putting this into the next merge
> window.
I didn't find my patch in your imx tree.  Assuming I don't have
overlooked it, what is stopping you?

Best regards
Uwe

-- 
Pengutronix e.K.                              | Uwe Kleine-K?nig            |
Industrial Linux Solutions                    | http://www.pengutronix.de/  |

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

end of thread, other threads:[~2009-11-01 20:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-10-19 20:19 [PATCH] imx/gpio: Use handle_level_irq Uwe Kleine-König
2009-10-20  8:13 ` Sascha Hauer
2009-10-20 17:37   ` Uwe Kleine-König
2009-10-23 11:27     ` Richard Zhao
2009-10-23 11:58       ` Uwe Kleine-König
2009-11-01 20:39   ` Uwe Kleine-König

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).