From: Baolin Wang <baolin.wang7@gmail.com>
To: Chunyan Zhang <zhang.lyra@gmail.com>
Cc: Linus Walleij <linus.walleij@linaro.org>,
Bartosz Golaszewski <bgolaszewski@baylibre.com>,
linux-gpio@vger.kernel.org, LKML <linux-kernel@vger.kernel.org>,
Orson Zhai <orsonzhai@gmail.com>,
Chunyan Zhang <chunyan.zhang@unisoc.com>,
Taiping Lai <taiping.lai@unisoc.com>
Subject: Re: [PATCH] gpio: sprd: Clear interrupt when setting the type as edge
Date: Sat, 1 Aug 2020 07:58:56 +0800 [thread overview]
Message-ID: <CADBw62p=aB3EZYkMm44Zx4Krww21SS9vCsMnPOq0pn2DgA8VkQ@mail.gmail.com> (raw)
In-Reply-To: <20200729093450.28585-1-zhang.lyra@gmail.com>
On Wed, Jul 29, 2020 at 5:35 PM Chunyan Zhang <zhang.lyra@gmail.com> wrote:
>
> From: Taiping Lai <taiping.lai@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.lai@unisoc.com>
> Signed-off-by: Chunyan Zhang <chunyan.zhang@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
next prev parent reply other threads:[~2020-07-31 23:59 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-29 9:34 [PATCH] gpio: sprd: Clear interrupt when setting the type as edge Chunyan Zhang
2020-07-31 23:58 ` Baolin Wang [this message]
2020-08-19 11:35 ` Chunyan Zhang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADBw62p=aB3EZYkMm44Zx4Krww21SS9vCsMnPOq0pn2DgA8VkQ@mail.gmail.com' \
--to=baolin.wang7@gmail.com \
--cc=bgolaszewski@baylibre.com \
--cc=chunyan.zhang@unisoc.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=orsonzhai@gmail.com \
--cc=taiping.lai@unisoc.com \
--cc=zhang.lyra@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).