Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

gpio: dwapb: fix missing first irq for edgeboth irq type

dwapb_irq_set_type overwrites polarity register value for
IRQ_TYPE_EDGE_BOTH case. 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_BOTH case
can solve this issue.

Signed-off-by: Xiaoguang Chen <xgchenshy@gmail.com>
Tested-by: Jisheng Zhang <jszhang@marvell.com>
[Fix some really weird text encoding problem]
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>

authored by

Xiaoguang Chen and committed by
Linus Walleij
edadced2 eb2ec49b

+2 -1
+2 -1
drivers/gpio/gpio-dwapb.c
··· 288 288 irq_setup_alt_chip(d, type); 289 289 290 290 dwapb_write(gpio, GPIO_INTTYPE_LEVEL, level); 291 - dwapb_write(gpio, GPIO_INT_POLARITY, polarity); 291 + if (type != IRQ_TYPE_EDGE_BOTH) 292 + dwapb_write(gpio, GPIO_INT_POLARITY, polarity); 292 293 spin_unlock_irqrestore(&gc->bgpio_lock, flags); 293 294 294 295 return 0;