* [PATCH v5 0/6] io: accel: mma8452: Allow open drain interrupt pin configuration
@ 2026-08-17 17:20 Esben Haabendal
2026-08-17 17:20 ` [PATCH v5 1/6] dt-bindings: iio: accel: mma8452: Add drive-open-drain Esben Haabendal
` (3 more replies)
0 siblings, 4 replies; 6+ messages in thread
From: Esben Haabendal @ 2026-08-17 17:20 UTC (permalink / raw)
To: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Martin Kepplinger,
Sean Nyekjaer, David Lechner, Nuno Sá, Andy Shevchenko,
Martin Kepplinger
Cc: Esben Haabendal, linux-iio, devicetree, linux-kernel,
Joshua Crofts, Andy Shevchenko
Extend the mma8452 driver with support for configuration of the
interrupt line in open-drain mode, which is needed for hardware designs
where the interrupt line is shared with other chips.
Adding drive-open-drain property to mma8452 device-tree node for such
designs to enable switching pin configuration to open-drain mode.
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
Changes in v5:
- Squashed dev_err_probe() call to one line.
- Fixed typo in patch 2 title.
- Added synchronization between runtime suspend and interrupt handler.
- Link to v4: https://patch.msgid.link/20260812-mma8452-open-drain-v4-0-bfca15d02b59@geanix.com
Changes in v4:
- Fixed interrupt handler to check runtime PM status before trying to
access the chip.
- Split open-drain support and interrupt sharing into separate patches.
- Added new patch to reuse existing struct device * through mma8452_probe()
function.
- Print warning message when irq type is not set by firmware.
- Link to v3: https://patch.msgid.link/20260805-mma8452-open-drain-v3-0-6149f406a409@geanix.com
Changes in v3:
- Reordered patches, swapping #2 and #3.
- Always add IRQF_SHARED flag.
- New patch to change it so IQRF_TRIGGER_LOW flag is only added when no
trigger type is set by firmware.
- Link to v2: https://patch.msgid.link/20260715-mma8452-open-drain-v2-0-95be9f5f4795@geanix.com
Changes in v2:
- Commit message of patch 2 updated.
- Operator precedence bug fixed in flags argument to
request_threaded_irq().
- Always check return value of mma8452_set_interrupt_pin_mode(), and just
check for non-zero value.
- Added new patch with optimization of struct mma8452_data ordering.
- Link to v1: https://patch.msgid.link/20260715-mma8452-open-drain-v1-0-b1dd2a440c60@geanix.com
To: Jonathan Cameron <jic23@kernel.org>
To: Lars-Peter Clausen <lars@metafoo.de>
To: Rob Herring <robh@kernel.org>
To: Krzysztof Kozlowski <krzk+dt@kernel.org>
To: Conor Dooley <conor+dt@kernel.org>
To: Martin Kepplinger <martink@posteo.de>
To: Sean Nyekjaer <sean@geanix.com>
To: David Lechner <dlechner@baylibre.com>
To: Nuno Sá <nuno.sa@analog.com>
To: Andy Shevchenko <andy@kernel.org>
To: Martin Kepplinger <martin.kepplinger@theobroma-systems.com>
Cc: linux-iio@vger.kernel.org
Cc: devicetree@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
---
Esben Haabendal (6):
dt-bindings: iio: accel: mma8452: Add drive-open-drain
iio: accel: mma8452: Optimize struct mma8452_data member orders
iio: accel: mma8452: Only apply trigger type when not set by firmware
iio: accel: mma8452: Support interrupt sharing
iio: accel: mma8452: Allow open drain interrupt pin configuration
iio: accel: mma8452: Reuse existing dev pointer in mma8452_probe()
.../devicetree/bindings/iio/accel/fsl,mma8452.yaml | 6 ++
drivers/iio/accel/mma8452.c | 98 ++++++++++++++++------
2 files changed, 80 insertions(+), 24 deletions(-)
---
base-commit: db2ddb87143519e20a95aa36c60b36107b736a58
change-id: 20250401-mma8452-open-drain-81577c41375c
Best regards,
--
Esben Haabendal <esben@geanix.com>
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v5 1/6] dt-bindings: iio: accel: mma8452: Add drive-open-drain
2026-08-17 17:20 [PATCH v5 0/6] io: accel: mma8452: Allow open drain interrupt pin configuration Esben Haabendal
@ 2026-08-17 17:20 ` Esben Haabendal
2026-08-17 17:20 ` [PATCH v5 2/6] iio: accel: mma8452: Optimize struct mma8452_data member orders Esben Haabendal
` (2 subsequent siblings)
3 siblings, 0 replies; 6+ messages in thread
From: Esben Haabendal @ 2026-08-17 17:20 UTC (permalink / raw)
To: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Martin Kepplinger,
Sean Nyekjaer, David Lechner, Nuno Sá, Andy Shevchenko,
Martin Kepplinger
Cc: Esben Haabendal, linux-iio, devicetree, linux-kernel
Add new boolean to configure selected interrupt pin to open drain instead
of the default push-pull mode.
Acked-by: Rob Herring (Arm) <robh@kernel.org>
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
Documentation/devicetree/bindings/iio/accel/fsl,mma8452.yaml | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/Documentation/devicetree/bindings/iio/accel/fsl,mma8452.yaml b/Documentation/devicetree/bindings/iio/accel/fsl,mma8452.yaml
index b0dd2b4e116a..20701aa725d0 100644
--- a/Documentation/devicetree/bindings/iio/accel/fsl,mma8452.yaml
+++ b/Documentation/devicetree/bindings/iio/accel/fsl,mma8452.yaml
@@ -39,6 +39,12 @@ properties:
minItems: 1
maxItems: 2
+ drive-open-drain:
+ $ref: /schemas/types.yaml#/definitions/flag
+ description: the interrupt line will be configured as open drain, which is
+ useful if several sensors share the same interrupt line. (This binding is
+ taken from pinctrl.)
+
vdd-supply: true
vddio-supply: true
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v5 2/6] iio: accel: mma8452: Optimize struct mma8452_data member orders
2026-08-17 17:20 [PATCH v5 0/6] io: accel: mma8452: Allow open drain interrupt pin configuration Esben Haabendal
2026-08-17 17:20 ` [PATCH v5 1/6] dt-bindings: iio: accel: mma8452: Add drive-open-drain Esben Haabendal
@ 2026-08-17 17:20 ` Esben Haabendal
2026-08-17 17:20 ` [PATCH v5 3/6] iio: accel: mma8452: Only apply trigger type when not set by firmware Esben Haabendal
2026-08-19 1:36 ` [PATCH v5 0/6] io: accel: mma8452: Allow open drain interrupt pin configuration Jonathan Cameron
3 siblings, 0 replies; 6+ messages in thread
From: Esben Haabendal @ 2026-08-17 17:20 UTC (permalink / raw)
To: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Martin Kepplinger,
Sean Nyekjaer, David Lechner, Nuno Sá, Andy Shevchenko,
Martin Kepplinger
Cc: Esben Haabendal, linux-iio, devicetree, linux-kernel,
Joshua Crofts, Andy Shevchenko
Reorder struct mma8452_data members to avoid holes.
Reviewed-by: Joshua Crofts <joshua.crofts1@gmail.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/iio/accel/mma8452.c | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
index 7d683686dd9d..f645a5c6fd1c 100644
--- a/drivers/iio/accel/mma8452.c
+++ b/drivers/iio/accel/mma8452.c
@@ -106,10 +106,7 @@ struct mma8452_data {
struct i2c_client *client;
struct mutex lock;
struct iio_mount_matrix orientation;
- u8 ctrl_reg1;
- u8 data_cfg;
const struct mma_chip_info *chip_info;
- int sleep_val;
struct regulator *vdd_reg;
struct regulator *vddio_reg;
@@ -118,6 +115,10 @@ struct mma8452_data {
__be16 channels[3];
aligned_s64 ts;
} buffer;
+
+ int sleep_val;
+ u8 ctrl_reg1;
+ u8 data_cfg;
};
/**
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* [PATCH v5 3/6] iio: accel: mma8452: Only apply trigger type when not set by firmware
2026-08-17 17:20 [PATCH v5 0/6] io: accel: mma8452: Allow open drain interrupt pin configuration Esben Haabendal
2026-08-17 17:20 ` [PATCH v5 1/6] dt-bindings: iio: accel: mma8452: Add drive-open-drain Esben Haabendal
2026-08-17 17:20 ` [PATCH v5 2/6] iio: accel: mma8452: Optimize struct mma8452_data member orders Esben Haabendal
@ 2026-08-17 17:20 ` Esben Haabendal
2026-08-19 1:36 ` [PATCH v5 0/6] io: accel: mma8452: Allow open drain interrupt pin configuration Jonathan Cameron
3 siblings, 0 replies; 6+ messages in thread
From: Esben Haabendal @ 2026-08-17 17:20 UTC (permalink / raw)
To: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, Martin Kepplinger,
Sean Nyekjaer, David Lechner, Nuno Sá, Andy Shevchenko,
Martin Kepplinger
Cc: Esben Haabendal, linux-iio, devicetree, linux-kernel,
Andy Shevchenko
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 <andriy.shevchenko@intel.com>
Signed-off-by: Esben Haabendal <esben@geanix.com>
---
drivers/iio/accel/mma8452.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/drivers/iio/accel/mma8452.c b/drivers/iio/accel/mma8452.c
index f645a5c6fd1c..1fb43c5b0b72 100644
--- a/drivers/iio/accel/mma8452.c
+++ b/drivers/iio/accel/mma8452.c
@@ -1683,9 +1683,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);
if (ret)
goto buffer_cleanup;
}
--
2.55.0
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH v5 0/6] io: accel: mma8452: Allow open drain interrupt pin configuration
2026-08-17 17:20 [PATCH v5 0/6] io: accel: mma8452: Allow open drain interrupt pin configuration Esben Haabendal
` (2 preceding siblings ...)
2026-08-17 17:20 ` [PATCH v5 3/6] iio: accel: mma8452: Only apply trigger type when not set by firmware Esben Haabendal
@ 2026-08-19 1:36 ` Jonathan Cameron
2026-08-19 8:20 ` Esben Haabendal
3 siblings, 1 reply; 6+ messages in thread
From: Jonathan Cameron @ 2026-08-19 1:36 UTC (permalink / raw)
To: Esben Haabendal
Cc: Lars-Peter Clausen, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Martin Kepplinger, Sean Nyekjaer, David Lechner,
Nuno Sá, Andy Shevchenko, Martin Kepplinger, linux-iio,
devicetree, linux-kernel, Joshua Crofts, Andy Shevchenko
On Mon, 17 Aug 2026 19:20:22 +0200
Esben Haabendal <esben@geanix.com> wrote:
> Extend the mma8452 driver with support for configuration of the
> interrupt line in open-drain mode, which is needed for hardware designs
> where the interrupt line is shared with other chips.
>
> Adding drive-open-drain property to mma8452 device-tree node for such
> designs to enable switching pin configuration to open-drain mode.
>
> Signed-off-by: Esben Haabendal <esben@geanix.com>
Hi Esben,
Seems something throttled your mail. Only 0-3 made it to the list.
Please resend and mark it [RESEND PATCH ...
with a brief statement of why in the cover letter.
Thanks
Jonathan
> ---
> Changes in v5:
> - Squashed dev_err_probe() call to one line.
> - Fixed typo in patch 2 title.
> - Added synchronization between runtime suspend and interrupt handler.
> - Link to v4: https://patch.msgid.link/20260812-mma8452-open-drain-v4-0-bfca15d02b59@geanix.com
>
> Changes in v4:
> - Fixed interrupt handler to check runtime PM status before trying to
> access the chip.
> - Split open-drain support and interrupt sharing into separate patches.
> - Added new patch to reuse existing struct device * through mma8452_probe()
> function.
> - Print warning message when irq type is not set by firmware.
> - Link to v3: https://patch.msgid.link/20260805-mma8452-open-drain-v3-0-6149f406a409@geanix.com
>
> Changes in v3:
> - Reordered patches, swapping #2 and #3.
> - Always add IRQF_SHARED flag.
> - New patch to change it so IQRF_TRIGGER_LOW flag is only added when no
> trigger type is set by firmware.
> - Link to v2: https://patch.msgid.link/20260715-mma8452-open-drain-v2-0-95be9f5f4795@geanix.com
>
> Changes in v2:
> - Commit message of patch 2 updated.
> - Operator precedence bug fixed in flags argument to
> request_threaded_irq().
> - Always check return value of mma8452_set_interrupt_pin_mode(), and just
> check for non-zero value.
> - Added new patch with optimization of struct mma8452_data ordering.
> - Link to v1: https://patch.msgid.link/20260715-mma8452-open-drain-v1-0-b1dd2a440c60@geanix.com
>
> To: Jonathan Cameron <jic23@kernel.org>
> To: Lars-Peter Clausen <lars@metafoo.de>
> To: Rob Herring <robh@kernel.org>
> To: Krzysztof Kozlowski <krzk+dt@kernel.org>
> To: Conor Dooley <conor+dt@kernel.org>
> To: Martin Kepplinger <martink@posteo.de>
> To: Sean Nyekjaer <sean@geanix.com>
> To: David Lechner <dlechner@baylibre.com>
> To: Nuno Sá <nuno.sa@analog.com>
> To: Andy Shevchenko <andy@kernel.org>
> To: Martin Kepplinger <martin.kepplinger@theobroma-systems.com>
> Cc: linux-iio@vger.kernel.org
> Cc: devicetree@vger.kernel.org
> Cc: linux-kernel@vger.kernel.org
>
> ---
> Esben Haabendal (6):
> dt-bindings: iio: accel: mma8452: Add drive-open-drain
> iio: accel: mma8452: Optimize struct mma8452_data member orders
> iio: accel: mma8452: Only apply trigger type when not set by firmware
> iio: accel: mma8452: Support interrupt sharing
> iio: accel: mma8452: Allow open drain interrupt pin configuration
> iio: accel: mma8452: Reuse existing dev pointer in mma8452_probe()
>
> .../devicetree/bindings/iio/accel/fsl,mma8452.yaml | 6 ++
> drivers/iio/accel/mma8452.c | 98 ++++++++++++++++------
> 2 files changed, 80 insertions(+), 24 deletions(-)
> ---
> base-commit: db2ddb87143519e20a95aa36c60b36107b736a58
> change-id: 20250401-mma8452-open-drain-81577c41375c
>
> Best regards,
> --
> Esben Haabendal <esben@geanix.com>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v5 0/6] io: accel: mma8452: Allow open drain interrupt pin configuration
2026-08-19 1:36 ` [PATCH v5 0/6] io: accel: mma8452: Allow open drain interrupt pin configuration Jonathan Cameron
@ 2026-08-19 8:20 ` Esben Haabendal
0 siblings, 0 replies; 6+ messages in thread
From: Esben Haabendal @ 2026-08-19 8:20 UTC (permalink / raw)
To: Jonathan Cameron
Cc: Lars-Peter Clausen, Rob Herring, Krzysztof Kozlowski,
Conor Dooley, Martin Kepplinger, Sean Nyekjaer, David Lechner,
Nuno Sá, Andy Shevchenko, Martin Kepplinger, linux-iio,
devicetree, linux-kernel, Joshua Crofts, Andy Shevchenko
On Wednesday, 19 August 2026 at 03:36, Jonathan Cameron <jic23@kernel.org> wrote:
> On Mon, 17 Aug 2026 19:20:22 +0200
> Esben Haabendal <esben@geanix.com> wrote:
>
> > Extend the mma8452 driver with support for configuration of the
> > interrupt line in open-drain mode, which is needed for hardware designs
> > where the interrupt line is shared with other chips.
> >
> > Adding drive-open-drain property to mma8452 device-tree node for such
> > designs to enable switching pin configuration to open-drain mode.
> >
> > Signed-off-by: Esben Haabendal <esben@geanix.com>
>
> Hi Esben,
>
> Seems something throttled your mail. Only 0-3 made it to the list.
> Please resend and mark it [RESEND PATCH ...
> with a brief statement of why in the cover letter.
Done. And it looks like they all appeared on at least lore.kernel.org this time.
I don't know what happened the first time. It looks like b4 was interrupted without me noticing.
/Esben
>
> Thanks
>
> Jonathan
>
> > ---
> > Changes in v5:
> > - Squashed dev_err_probe() call to one line.
> > - Fixed typo in patch 2 title.
> > - Added synchronization between runtime suspend and interrupt handler.
> > - Link to v4: https://patch.msgid.link/20260812-mma8452-open-drain-v4-0-bfca15d02b59@geanix.com
> >
> > Changes in v4:
> > - Fixed interrupt handler to check runtime PM status before trying to
> > access the chip.
> > - Split open-drain support and interrupt sharing into separate patches.
> > - Added new patch to reuse existing struct device * through mma8452_probe()
> > function.
> > - Print warning message when irq type is not set by firmware.
> > - Link to v3: https://patch.msgid.link/20260805-mma8452-open-drain-v3-0-6149f406a409@geanix.com
> >
> > Changes in v3:
> > - Reordered patches, swapping #2 and #3.
> > - Always add IRQF_SHARED flag.
> > - New patch to change it so IQRF_TRIGGER_LOW flag is only added when no
> > trigger type is set by firmware.
> > - Link to v2: https://patch.msgid.link/20260715-mma8452-open-drain-v2-0-95be9f5f4795@geanix.com
> >
> > Changes in v2:
> > - Commit message of patch 2 updated.
> > - Operator precedence bug fixed in flags argument to
> > request_threaded_irq().
> > - Always check return value of mma8452_set_interrupt_pin_mode(), and just
> > check for non-zero value.
> > - Added new patch with optimization of struct mma8452_data ordering.
> > - Link to v1: https://patch.msgid.link/20260715-mma8452-open-drain-v1-0-b1dd2a440c60@geanix.com
> >
> > To: Jonathan Cameron <jic23@kernel.org>
> > To: Lars-Peter Clausen <lars@metafoo.de>
> > To: Rob Herring <robh@kernel.org>
> > To: Krzysztof Kozlowski <krzk+dt@kernel.org>
> > To: Conor Dooley <conor+dt@kernel.org>
> > To: Martin Kepplinger <martink@posteo.de>
> > To: Sean Nyekjaer <sean@geanix.com>
> > To: David Lechner <dlechner@baylibre.com>
> > To: Nuno Sá <nuno.sa@analog.com>
> > To: Andy Shevchenko <andy@kernel.org>
> > To: Martin Kepplinger <martin.kepplinger@theobroma-systems.com>
> > Cc: linux-iio@vger.kernel.org
> > Cc: devicetree@vger.kernel.org
> > Cc: linux-kernel@vger.kernel.org
> >
> > ---
> > Esben Haabendal (6):
> > dt-bindings: iio: accel: mma8452: Add drive-open-drain
> > iio: accel: mma8452: Optimize struct mma8452_data member orders
> > iio: accel: mma8452: Only apply trigger type when not set by firmware
> > iio: accel: mma8452: Support interrupt sharing
> > iio: accel: mma8452: Allow open drain interrupt pin configuration
> > iio: accel: mma8452: Reuse existing dev pointer in mma8452_probe()
> >
> > .../devicetree/bindings/iio/accel/fsl,mma8452.yaml | 6 ++
> > drivers/iio/accel/mma8452.c | 98 ++++++++++++++++------
> > 2 files changed, 80 insertions(+), 24 deletions(-)
> > ---
> > base-commit: db2ddb87143519e20a95aa36c60b36107b736a58
> > change-id: 20250401-mma8452-open-drain-81577c41375c
> >
> > Best regards,
> > --
> > Esben Haabendal <esben@geanix.com>
> >
>
>
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2026-08-19 8:21 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-17 17:20 [PATCH v5 0/6] io: accel: mma8452: Allow open drain interrupt pin configuration Esben Haabendal
2026-08-17 17:20 ` [PATCH v5 1/6] dt-bindings: iio: accel: mma8452: Add drive-open-drain Esben Haabendal
2026-08-17 17:20 ` [PATCH v5 2/6] iio: accel: mma8452: Optimize struct mma8452_data member orders Esben Haabendal
2026-08-17 17:20 ` [PATCH v5 3/6] iio: accel: mma8452: Only apply trigger type when not set by firmware Esben Haabendal
2026-08-19 1:36 ` [PATCH v5 0/6] io: accel: mma8452: Allow open drain interrupt pin configuration Jonathan Cameron
2026-08-19 8:20 ` Esben Haabendal
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox