Re: [PATCH v1] hwmon: (lm90) Use edge-triggered interrupt

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jun 16, 2021 at 10:07:08PM +0300, Dmitry Osipenko wrote:
> The LM90 driver uses level-based interrupt triggering. The interrupt
> handler prints a warning message about the breached temperature and
> quits. There is no way to stop interrupt from re-triggering since it's
> level-based, thus thousands of warning messages are printed per second
> once interrupt is triggered. Use edge-triggered interrupt in order to
> fix this trouble.
> 
> Fixes: 109b1283fb532 ("hwmon: (lm90) Add support to handle IRQ")
> Signed-off-by: Dmitry Osipenko <digetx@xxxxxxxxx>
> ---
>  drivers/hwmon/lm90.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/hwmon/lm90.c b/drivers/hwmon/lm90.c
> index ebbfd5f352c0..ce8ebe60fcdc 100644
> --- a/drivers/hwmon/lm90.c
> +++ b/drivers/hwmon/lm90.c
> @@ -1908,7 +1908,7 @@ static int lm90_probe(struct i2c_client *client)
>  		dev_dbg(dev, "IRQ: %d\n", client->irq);
>  		err = devm_request_threaded_irq(dev, client->irq,
>  						NULL, lm90_irq_thread,
> -						IRQF_TRIGGER_LOW | IRQF_ONESHOT,
> +						IRQF_TRIGGER_FALLING | IRQF_ONESHOT,
>  						"lm90", client);

We can't do that. Problem is that many of the devices supported by this driver
behave differently when it comes to interrupts. Specifically, the interrupt
handler is supposed to reset the interrupt condition (ie reading the status
register should reset it). If that is the not the case for a specific chip,
we'll have to update the code to address the problem for that specific chip.
The above code would probably just generate a single interrupt while never
resetting the interrupt condition, which is obviously not what we want to
happen.

Guenter

>  		if (err < 0) {
>  			dev_err(dev, "cannot request IRQ %d\n", client->irq);
> -- 
> 2.30.2
> 



[Index of Archives]     [LM Sensors]     [Linux Sound]     [ALSA Users]     [ALSA Devel]     [Linux Audio Users]     [Linux Media]     [Kernel]     [Gimp]     [Yosemite News]     [Linux Media]

  Powered by Linux