]> git.baikalelectronics.ru Git - kernel.git/commit
gpio: sprd: Clear interrupt when setting the type as edge
authorTaiping Lai <taiping.lai@unisoc.com>
Mon, 31 Aug 2020 09:09:47 +0000 (17:09 +0800)
committerBartosz Golaszewski <bgolaszewski@baylibre.com>
Mon, 31 Aug 2020 16:06:28 +0000 (18:06 +0200)
commita7a1f4d4a34f6245ac4204f9978859bc7f00605e
tree626084bc139ebd5e7e88215fc46d170175f04110
parentbd83d2d0be3578bd23d07bb1029dfe8af0ac7fdb
gpio: sprd: Clear interrupt when setting the type as edge

The raw interrupt status of GPIO maybe set before the interrupt is enabled,
which would trigger the interrupt event once enabled it from user side.
This is the case for edge interrupts only. Adding a clear operation when
setting interrupt type can avoid that.

There're a few considerations for the solution:
1) This issue is for edge interrupt only; The interrupts requested by users
   are IRQ_TYPE_LEVEL_HIGH as default, so clearing interrupt when request
   is useless.
2) The interrupt type can be set to edge when request and following up
   with clearing it though, but the problem is still there once users set
   the interrupt type to level trggier.
3) We can add a clear operation after each time of setting interrupt
   enable bit, but it is redundant for level trigger interrupt.

Therefore, the solution is this patch seems the best for now.

Fixes: 42522f1f7129 ("gpio: Add GPIO driver for Spreadtrum SC9860 platform")
Signed-off-by: Taiping Lai <taiping.lai@unisoc.com>
Signed-off-by: Chunyan Zhang <chunyan.zhang@unisoc.com>
Reviewed-by: Baolin Wang <baolin.wang7@gmail.com>
Signed-off-by: Bartosz Golaszewski <bgolaszewski@baylibre.com>
drivers/gpio/gpio-sprd.c