Devicetree
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Esben Haabendal" <esben@geanix.com>
Cc: robh@kernel.org, conor+dt@kernel.org, devicetree@vger.kernel.org
Subject: Re: [PATCH v8 4/9] iio: accel: mma8452: Only apply trigger type when not set by firmware
Date: Mon, 07 Sep 2026 15:01:08 +0000	[thread overview]
Message-ID: <20260907150108.97F411F00ACF@smtp.kernel.org> (raw)
In-Reply-To: <20260907-mma8452-open-drain-v8-4-c17407e22118@geanix.com>

Thank you for your contribution! Sashiko AI review found 1 potential issue(s) to consider:
- [High] Hardware configuration mismatch for active-high interrupts
--

commit cc23812be1f638568d4c39e30f713017f6ba0b47
Author: Esben Haabendal <esben@geanix.com>

iio: accel: mma8452: Only apply trigger type when not set by firmware

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.

> diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
> index 6c5a8d65c8a42..05851274596e5 100644
> --- a/drivers/iio/accel/mma8452.c
> +++ b/drivers/iio/accel/mma8452.c
> @@ -1665,9 +1665,16 @@ static int mma8452_probe(struct i2c_client *client)
>  		goto trigger_cleanup;
>  
>  	if (client->irq) {
> +		unsigned long irq_flags;
> +
> +		irq_flags = irq_get_trigger_type(client->irq);
> +		if (irq_flags == IRQ_TYPE_NONE) {
> +			dev_info(dev, "invalid irq type, setting default active low\n");
> +			irq_flags = IRQF_TRIGGER_LOW;
> +		}
> +		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);

[Severity: High]
Will this cause a hardware configuration mismatch if the firmware specifies
an active-high or edge-rising interrupt?

In mma8452_probe(), when the firmware specifies an active-high interrupt
(e.g., IRQ_TYPE_LEVEL_HIGH or IRQ_TYPE_EDGE_RISING), this code passes the
active-high flag to request_threaded_irq() and configures the host
interrupt controller accordingly.

However, the MMA8452 sensor hardware defaults to an active-low output.
Without explicitly configuring the IPOL (Interrupt Polarity) bit in the
sensor's CTRL_REG3 register (0x2C) to match the requested firmware trigger
type, the sensor will continue driving an active-low signal.

This mismatch will break interrupts for systems that correctly specify an
active-high trigger.

It may also regress systems with incorrectly specified active-high device
trees that previously worked because the driver hardcoded IRQF_TRIGGER_LOW.

>  		if (ret)
>  			goto buffer_cleanup;
>  	}

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20260907-mma8452-open-drain-v8-0-c17407e22118@geanix.com?part=4

  reply	other threads:[~2026-09-07 15:01 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-07 14:50 [PATCH v8 0/9] io: accel: mma8452: Allow open drain interrupt pin configuration Esben Haabendal
2026-09-07 14:50 ` [PATCH v8 1/9] dt-bindings: iio: accel: mma8452: Add drive-open-drain Esben Haabendal
2026-09-07 14:50 ` [PATCH v8 2/9] iio: accel: mma8452: Fix use-after-free bug in error error path Esben Haabendal
2026-09-07 15:04   ` sashiko-bot
2026-09-07 15:08     ` Esben Haabendal
2026-09-07 14:50 ` [PATCH v8 3/9] iio: accel: mma8452: Optimize struct mma8452_data member orders Esben Haabendal
2026-09-07 14:50 ` [PATCH v8 4/9] iio: accel: mma8452: Only apply trigger type when not set by firmware Esben Haabendal
2026-09-07 15:01   ` sashiko-bot [this message]
2026-09-07 14:51 ` [PATCH v8 5/9] iio: accel: mma8452: Fix unintended comment indent Esben Haabendal
2026-09-07 15:04   ` Joshua Crofts
2026-09-07 14:51 ` [PATCH v8 6/9] iio: accel: mma8452: Add comment block for struct mma8452_data Esben Haabendal
2026-09-07 14:58   ` sashiko-bot
2026-09-07 15:07     ` Esben Haabendal
2026-09-07 15:14   ` Joshua Crofts
2026-09-07 16:28     ` Esben Haabendal
2026-09-08 10:36   ` Andy Shevchenko
2026-09-07 14:51 ` [PATCH v8 7/9] iio: accel: mma8452: Allow open drain interrupt pin configuration Esben Haabendal
2026-09-07 15:05   ` sashiko-bot
2026-09-07 15:09     ` Esben Haabendal
2026-09-07 14:51 ` [PATCH v8 8/9] iio: accel: mma8452: Use proper error code when missing device model Esben Haabendal
2026-09-07 14:51 ` [PATCH v8 9/9] iio: accel: mma8452: Support interrupt sharing Esben Haabendal
2026-09-07 15:08   ` sashiko-bot
2026-09-07 15:58     ` Esben Haabendal
2026-09-08  9:15       ` Esben Haabendal
2026-09-07 15:10   ` Joshua Crofts
2026-09-07 16:36     ` Esben Haabendal
2026-09-09  9:21       ` Joshua Crofts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260907150108.97F411F00ACF@smtp.kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=esben@geanix.com \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox