gpio: dwapb: fix missing first irq for edgeboth irq type
Hi, Guys
Any comments for this change?
Thanks
Xiaoguang
2017-06-02 7:27 GMT+08:00 <[email protected]>:
Quoted 33 lines
From: Xiaoguang Chen <[email protected]>
dwapb_irq_set_typeoverwrites polarity register value forIRQ_TYPE_EDGE_BOTHcase. If the polarity of one gpio is 0 by default, then it will set falling edge irq trigger. and the gpio may requires rising edge irq for the first time, and it will be missed.Do not overwrite polarity register for
IRQ_TYPE_EDGE_BOTHcase can solve this issue.Signed-off-by Xiaoguang Chen <[email protected]>--- drivers/gpio/gpio-dwapb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpio/gpio-dwapb.c +2
-2@@ -288,7 +288,8 @@ static int dwapb_irq_set_type(struct irq_data *d, u32 type)irq_setup_alt_chip (d, type);dwapb_write (gpio,GPIO_INTTYPE_LEVEL , level); -dwapb_write (gpio,GPIO_INT_POLARITY , polarity); + if (type != IRQ_TYPE_EDGE_BOTH) +dwapb_write (gpio,GPIO_INT_POLARITY , polarity);spin_unlock_irqrestore (&gc->bgpio_lock, flags);return 0 ; --2.8.4 (Apple Git-73)
Adding driver authors to the To: Line and top posting to get some review.
Yours,
Linus Walleij
Quoted 33 lines · On Fri, Jun 2, 2017 at 1:27 AM, <[email protected]> wrote:
From: Xiaoguang Chen <[email protected]>
dwapb_irq_set_typeoverwrites polarity register value forIRQ_TYPE_EDGE_BOTHcase. If the polarity of one gpio is 0 by default, then it will set falling edge irq trigger. and the gpio may requires rising edge irq for the first time, and it will be missed.Do not overwrite polarity register for
IRQ_TYPE_EDGE_BOTHcase can solve this issue.Signed-off-by Xiaoguang Chen <[email protected]>--- drivers/gpio/gpio-dwapb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpio/gpio-dwapb.c +2
-2@@ -288,7 +288,8 @@ static int dwapb_irq_set_type(struct irq_data *d, u32 type)irq_setup_alt_chip (d, type);dwapb_write (gpio,GPIO_INTTYPE_LEVEL , level); -dwapb_write (gpio,GPIO_INT_POLARITY , polarity); + if (type != IRQ_TYPE_EDGE_BOTH) +dwapb_write (gpio,GPIO_INT_POLARITY , polarity);spin_unlock_irqrestore (&gc->bgpio_lock, flags);return 0 ; --2.8.4 (Apple Git-73)
Jisheng Zhang
Tested-byQuoted 4 lines · On Fri, 9 Jun 2017 11:26:19 +0200 Linus Walleij wrote:
Quoted 2 lines · On Fri, Jun 2, 2017 at 1:27 AM, <[email protected]> wrote:
From: Xiaoguang Chen <[email protected]>
Quoted 8 lines
Quoted 8 lines
dwapb_irq_set_typeoverwrites polarity register value forIRQ_TYPE_EDGE_BOTHcase. If the polarity of one gpio is 0 by default, then it will set falling edge irq trigger. and the gpio may requires rising edge irq for the first time, and it will be missed.Do not overwrite polarity register for
IRQ_TYPE_EDGE_BOTHcase can solve this issue.
I think this is a correct fix.
Quoted 2 lines
Quoted 2 lines
Signed-off-by Xiaoguang Chen <[email protected]>
Quoted 21 lines
Quoted 21 lines
--- drivers/gpio/gpio-dwapb.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)drivers/gpio/gpio-dwapb.c +2
-2@@ -288,7 +288,8 @@ static int dwapb_irq_set_type(struct irq_data *d, u32 type)irq_setup_alt_chip (d, type);dwapb_write (gpio,GPIO_INTTYPE_LEVEL , level); -dwapb_write (gpio,GPIO_INT_POLARITY , polarity); + if (type != IRQ_TYPE_EDGE_BOTH) +dwapb_write (gpio,GPIO_INT_POLARITY , polarity);spin_unlock_irqrestore (&gc->bgpio_lock, flags);return 0 ; --2.8.4 (Apple Git-73)
Quoted 15 lines · On Mon, 12 Jun 2017 13:05:30 +0800 Jisheng Zhang wrote:
Quoted 4 lines · On Fri, 9 Jun 2017 11:26:19 +0200 Linus Walleij wrote:
Quoted 2 lines · On Fri, Jun 2, 2017 at 1:27 AM, <[email protected]> wrote:
From: Xiaoguang Chen <[email protected]>
Quoted 8 lines
Quoted 8 lines
dwapb_irq_set_typeoverwrites polarity register value forIRQ_TYPE_EDGE_BOTHcase. If the polarity of one gpio is 0 by default, then it will set falling edge irq trigger. and the gpio may requires rising edge irq for the first time, and it will be missed.Do not overwrite polarity register for
IRQ_TYPE_EDGE_BOTHcase can solve this issue.
Quoted 6 lines
I think this is a correct fix.
Quoted 2 lines
Quoted 2 lines
Signed-off-by Xiaoguang Chen <[email protected]>Tested-by Jisheng Zhang <[email protected]>
Per my test, this patch fixes the following bug:
make use of CD-GPIO mechanism. Cold boot with sdcard inserted, hot-unplug the sdcard, sometimes, kernel won't get the remove interrupt.
Thanks
Quoted 8 lines · On Fri, Jun 2, 2017 at 1:27 AM, <[email protected]> wrote:
From: Xiaoguang Chen <[email protected]>
dwapb_irq_set_typeoverwrites polarity register value forIRQ_TYPE_EDGE_BOTHcase. If the polarity of one gpio is 0 by default, then it will set falling edge irq trigger. and the gpio may requires rising edge irq for the first time, and it will be missed.
Quoted 4 lines
Do not overwrite polarity register for
IRQ_TYPE_EDGE_BOTHcase can solve this issue.Signed-off-by Xiaoguang Chen <[email protected]>
Patch applied with Jisheng's tested tag.
Yours,
Linus Walleij