On Wed, Jul 29, 2020 at 5:35 PM Chunyan Zhang <zhang.l...@gmail.com> wrote: > > From: Taiping Lai <taiping....@unisoc.com> > > 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. > > Fixes: 9a3821c2bb47 ("gpio: Add GPIO driver for Spreadtrum SC9860 platform") > Signed-off-by: Taiping Lai <taiping....@unisoc.com> > Signed-off-by: Chunyan Zhang <chunyan.zh...@unisoc.com> > --- > drivers/gpio/gpio-sprd.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpio/gpio-sprd.c b/drivers/gpio/gpio-sprd.c > index d7314d39ab65..36ea8a3bd451 100644 > --- a/drivers/gpio/gpio-sprd.c > +++ b/drivers/gpio/gpio-sprd.c > @@ -149,17 +149,20 @@ static int sprd_gpio_irq_set_type(struct irq_data *data, > sprd_gpio_update(chip, offset, SPRD_GPIO_IS, 0); > sprd_gpio_update(chip, offset, SPRD_GPIO_IBE, 0); > sprd_gpio_update(chip, offset, SPRD_GPIO_IEV, 1); > + sprd_gpio_update(chip, offset, SPRD_GPIO_IC, 1);
I think you should move this abonormal interrupt clearing operation to sprd_gpio_request(), when users request a GPIO. > irq_set_handler_locked(data, handle_edge_irq); > break; > case IRQ_TYPE_EDGE_FALLING: > sprd_gpio_update(chip, offset, SPRD_GPIO_IS, 0); > sprd_gpio_update(chip, offset, SPRD_GPIO_IBE, 0); > sprd_gpio_update(chip, offset, SPRD_GPIO_IEV, 0); > + sprd_gpio_update(chip, offset, SPRD_GPIO_IC, 1); > irq_set_handler_locked(data, handle_edge_irq); > break; > case IRQ_TYPE_EDGE_BOTH: > sprd_gpio_update(chip, offset, SPRD_GPIO_IS, 0); > sprd_gpio_update(chip, offset, SPRD_GPIO_IBE, 1); > + sprd_gpio_update(chip, offset, SPRD_GPIO_IC, 1); > irq_set_handler_locked(data, handle_edge_irq); > break; > case IRQ_TYPE_LEVEL_HIGH: > -- > 2.20.1 > -- Baolin Wang