2023-08-08 17:00:38

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH 3/3] gpio: sprd: Add clear interrupt

On Tue, Aug 08, 2023 at 11:31:44AM +0800, Wenhua Lin wrote:
> Clear interrupt after set the interrupt type.

Why?

Can't it be done in the ->init_hw() callback of GPIO IRQ chip?

--
With Best Regards,
Andy Shevchenko




2023-08-10 09:05:52

by wenhua lin

[permalink] [raw]
Subject: Re: [PATCH 3/3] gpio: sprd: Add clear interrupt

On Tue, Aug 8, 2023 at 9:25 PM Andy Shevchenko <[email protected]> wrote:
>
> On Tue, Aug 08, 2023 at 11:31:44AM +0800, Wenhua Lin wrote:
> > Clear interrupt after set the interrupt type.
>
> Why?
>
> Can't it be done in the ->init_hw() callback of GPIO IRQ chip?

Hi Andy:
The initialization state of EIC is high-level trigger. If the external
level is high and the interrupt condition is met,
EIC has a latch function. If the module registers the eic interrupt,
an interrupt will be generated immediately
as soon as the eic interrupt is enabled. To solve this problem, our
processing method is to clear the interrupt
once when setting the interrupt trigger type, in order to avoid that
this interrupt is the last interrupt.

Thanks
Wenhua.Lin

>
> --
> With Best Regards,
> Andy Shevchenko
>
>

2023-08-10 11:21:41

by Andy Shevchenko

[permalink] [raw]
Subject: Re: [PATCH 3/3] gpio: sprd: Add clear interrupt

On Thu, Aug 10, 2023 at 10:27 AM wenhua lin <[email protected]> wrote:
> On Tue, Aug 8, 2023 at 9:25 PM Andy Shevchenko <[email protected]> wrote:
> > On Tue, Aug 08, 2023 at 11:31:44AM +0800, Wenhua Lin wrote:
> > > Clear interrupt after set the interrupt type.
> >
> > Why?
> >
> > Can't it be done in the ->init_hw() callback of GPIO IRQ chip?
>
> Hi Andy:
> The initialization state of EIC is high-level trigger. If the external
> level is high and the interrupt condition is met,
> EIC has a latch function. If the module registers the eic interrupt,
> an interrupt will be generated immediately
> as soon as the eic interrupt is enabled. To solve this problem, our
> processing method is to clear the interrupt
> once when setting the interrupt trigger type, in order to avoid that
> this interrupt is the last interrupt.

Obvious question, isn't this needed to be added to ->init_hw() as well?

--
With Best Regards,
Andy Shevchenko

2023-08-11 09:04:07

by wenhua lin

[permalink] [raw]
Subject: Re: [PATCH 3/3] gpio: sprd: Add clear interrupt

On Thu, Aug 10, 2023 at 5:57 PM Andy Shevchenko
<[email protected]> wrote:
>
> On Thu, Aug 10, 2023 at 10:27 AM wenhua lin <[email protected]> wrote:
> > On Tue, Aug 8, 2023 at 9:25 PM Andy Shevchenko <[email protected]> wrote:
> > > On Tue, Aug 08, 2023 at 11:31:44AM +0800, Wenhua Lin wrote:
> > > > Clear interrupt after set the interrupt type.
> > >
> > > Why?
> > >
> > > Can't it be done in the ->init_hw() callback of GPIO IRQ chip?
> >
> > Hi Andy:
> > The initialization state of EIC is high-level trigger. If the external
> > level is high and the interrupt condition is met,
> > EIC has a latch function. If the module registers the eic interrupt,
> > an interrupt will be generated immediately
> > as soon as the eic interrupt is enabled. To solve this problem, our
> > processing method is to clear the interrupt
> > once when setting the interrupt trigger type, in order to avoid that
> > this interrupt is the last interrupt.
>
> Obvious question, isn't this needed to be added to ->init_hw() as well?

In the ->init_hw() function, the sprd_gpio_irq_ack interface will be called
to clear the interrupt, and there is no need to add it repeatedly

>
> --
> With Best Regards,
> Andy Shevchenko