Re: [PATCH v3 3/4] iio: accel: mma8452: Only apply trigger type when not set by firmware

Andy Shevchenko <[email protected]>
Newsgroups org.kernel.vger.linux-iio,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Organization Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo
Message-ID <[email protected]>
On Wed, Aug 05, 2026 at 09:21:37AM +0200, Esben Haabendal wrote:
> Instead of unconditionally overriding the trigger type, it is better to
> only apply a default when no trigger type is set by firmware. This should
> be reasonably backward compatible, and should only potentially cause
> problems if systems exist where firmware specifies an incorrect trigger
> type. With a bit of luck, there are no such systems.

Reviewed-by: Andy Shevchenko <[email protected]>

...

>  	if (client->irq) {
> +		unsigned long irq_flags;
> +
> +		irq_flags = irq_get_trigger_type(client->irq);
> +		if (irq_flags == IRQ_TYPE_NONE)
> +			irq_flags = IRQF_TRIGGER_LOW;

I would even add info message or so that FW lacks of the proper IRQ type.
But it's up to you, most of the code that I saw and does something similar
does not print anything in this case.

> +		irq_flags |= IRQF_ONESHOT;
>  		ret = request_threaded_irq(client->irq, NULL, mma8452_interrupt,
> -					   IRQF_TRIGGER_LOW | IRQF_ONESHOT,
> -					   client->name, indio_dev);
> +					   irq_flags, client->name, indio_dev);

-- 
With Best Regards,
Andy Shevchenko
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.