Re: [PATCH v1 2/2] iio: adc: Add StarFive SAR-ADC driver

From: Jonathan Cameron

Date: Fri May 22 2026 - 07:00:45 EST


On Fri, 22 May 2026 02:20:53 +0000
Xingyu Wu <xingyu.wu@xxxxxxxxxxxxxxxx> wrote:

> On 2026/5/21 19:37, Jonathan Cameron wrote:
> >
> > >
> > > >
> > > > > +
> > > > > + starfive_saradc_ch_monitor_stop(priv, ch);
> > > >
> > > > Why stop it? Add a comment. We aren't interested in future events?
> > >
> > > If we do not stop it and the input voltage remains constant, the ADC could
> > continuously monitor the voltage and continuously trigger interrupts for the
> > bound.
> > > As a result, the CPU utilization rate will be high.
> >
> > Can you use an edge interrupt instead of a level one?
>
> No, it is a level interrupt in hardware.

Just to check. That's a restriction of the interrupt controller IP in that
it doesn't support edge interrupts on this particularly line?
Seems unfortunate given the block on the other end is providing something
that seems like an edge :( Ah well - hardly the first time we've hit that.
Add some comments to the code when you add the timer approach to
re enabling.

>
> >
> > If not, then a common solution is to disable for a period (maybe a second or so)
> > then reenable. There are various more refined ways of doing this.
>
> This is good idea. How about using timer to disable it?

yes, there are examples in tree doing that.

J

>
> >
> > Basically we don't want to be in a situation where a momentary blip disables the
> > event and we miss a later condition that must be handled.
> >
>
> Noted.
>
> Best regards,
> Xingyu Wu