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

Esben Haabendal <[email protected]>
Newsgroups org.kernel.vger.linux-iio,org.kernel.vger.linux-devicetree,org.kernel.vger.linux-kernel
Message-ID <[email protected]>
"Andy Shevchenko" <[email protected]> writes:

> 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.

I agree. That seems like a nice improvement. I will add that for v4.

>> +		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);

/Esben
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.