* [PATCH v4 0/2] iio: imu: inv_icm42600: switch to use generic name irq get
@ 2025-04-10 15:39 Jean-Baptiste Maneyrol via B4 Relay
2025-04-10 15:39 ` [PATCH v4 1/2] dt-bindings: iio: imu: icm42600: add interrupt naming support Jean-Baptiste Maneyrol via B4 Relay
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Jean-Baptiste Maneyrol via B4 Relay @ 2025-04-10 15:39 UTC (permalink / raw)
To: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, David Lechner, Nuno Sá,
Andy Shevchenko
Cc: linux-iio, devicetree, linux-kernel, Jean-Baptiste Maneyrol
The purpose of this series is to switch to fwnode_irq_get_by_name()
in the core module instead of using irq from the bus parsing.
Add in dt binding interrupt naming and up to 2 interrupts support.
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
---
Changes in v4:
- Change dt-binding commit message to be more explicit about interrupt
support.
- Simplify fwnode usage, NULL checking is already done automatically.
- Link to v3: https://lore.kernel.org/r/20250409-iio-imu-inv-icm42600-rework-interrupt-using-names-v3-0-dab85a0a7c2b@tdk.com
Changes in v3:
- Update dt-binding to report support of the 2 interrupts and delete
remark about driver feature support.
- Link to v2: https://lore.kernel.org/r/20250407-iio-imu-inv-icm42600-rework-interrupt-using-names-v2-0-c278acf587b2@tdk.com
Changes in v2:
- Add INT2 in interrupt-names enum and fix enum
- Add fallback to first interrupt if naming is not here to ensure
backward compatibility
- Link to v1: https://lore.kernel.org/r/20250404-iio-imu-inv-icm42600-rework-interrupt-using-names-v1-0-72ed5100da14@tdk.com
---
Jean-Baptiste Maneyrol (2):
dt-bindings: iio: imu: icm42600: add interrupt naming support
iio: imu: inv_icm42600: switch to use generic name irq get
.../devicetree/bindings/iio/imu/invensense,icm42600.yaml | 13 ++++++++++++-
drivers/iio/imu/inv_icm42600/inv_icm42600.h | 2 +-
drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 14 ++++++++++++--
drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c | 2 +-
drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c | 2 +-
5 files changed, 27 insertions(+), 6 deletions(-)
---
base-commit: 1c2409fe38d5c19015d69851d15ba543d1911932
change-id: 20250325-iio-imu-inv-icm42600-rework-interrupt-using-names-b397ced72835
Best regards,
--
Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v4 1/2] dt-bindings: iio: imu: icm42600: add interrupt naming support
2025-04-10 15:39 [PATCH v4 0/2] iio: imu: inv_icm42600: switch to use generic name irq get Jean-Baptiste Maneyrol via B4 Relay
@ 2025-04-10 15:39 ` Jean-Baptiste Maneyrol via B4 Relay
2025-04-11 16:24 ` Conor Dooley
2025-04-10 15:39 ` [PATCH v4 2/2] iio: imu: inv_icm42600: switch to use generic name irq get Jean-Baptiste Maneyrol via B4 Relay
2025-04-12 12:50 ` [PATCH v4 0/2] " Jonathan Cameron
2 siblings, 1 reply; 7+ messages in thread
From: Jean-Baptiste Maneyrol via B4 Relay @ 2025-04-10 15:39 UTC (permalink / raw)
To: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, David Lechner, Nuno Sá,
Andy Shevchenko
Cc: linux-iio, devicetree, linux-kernel, Jean-Baptiste Maneyrol
From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Add interrupt-names field for specifying interrupt pin configured.
Chips are supporting up to 2 interrupt pins with configurable interrupt
sources. Change interrupt to support 1 or 2 entries.
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
---
.../devicetree/bindings/iio/imu/invensense,icm42600.yaml | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml b/Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml
index 7e4492bbd0278a336587dc5ac04da7153453da29..d4d4e5c3d8562523872a737864610c26c8fccd82 100644
--- a/Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml
+++ b/Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml
@@ -39,7 +39,16 @@ properties:
maxItems: 1
interrupts:
- maxItems: 1
+ minItems: 1
+ maxItems: 2
+
+ interrupt-names:
+ minItems: 1
+ maxItems: 2
+ items:
+ enum:
+ - INT1
+ - INT2
drive-open-drain:
type: boolean
@@ -76,6 +85,7 @@ examples:
reg = <0x68>;
interrupt-parent = <&gpio2>;
interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
+ interrupt-names = "INT1";
vdd-supply = <&vdd>;
vddio-supply = <&vddio>;
};
@@ -95,6 +105,7 @@ examples:
spi-cpol;
interrupt-parent = <&gpio1>;
interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
+ interrupt-names = "INT1";
vdd-supply = <&vdd>;
vddio-supply = <&vddio>;
};
--
2.49.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH v4 2/2] iio: imu: inv_icm42600: switch to use generic name irq get
2025-04-10 15:39 [PATCH v4 0/2] iio: imu: inv_icm42600: switch to use generic name irq get Jean-Baptiste Maneyrol via B4 Relay
2025-04-10 15:39 ` [PATCH v4 1/2] dt-bindings: iio: imu: icm42600: add interrupt naming support Jean-Baptiste Maneyrol via B4 Relay
@ 2025-04-10 15:39 ` Jean-Baptiste Maneyrol via B4 Relay
2025-04-14 8:14 ` Andy Shevchenko
2025-04-12 12:50 ` [PATCH v4 0/2] " Jonathan Cameron
2 siblings, 1 reply; 7+ messages in thread
From: Jean-Baptiste Maneyrol via B4 Relay @ 2025-04-10 15:39 UTC (permalink / raw)
To: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, David Lechner, Nuno Sá,
Andy Shevchenko
Cc: linux-iio, devicetree, linux-kernel, Jean-Baptiste Maneyrol
From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Use generic fwnode_irq_get_byname() for getting interrupt pin using
interrupt name. Only INT1 is supported by the driver currently.
If not found fallback to first defined interrupt to keep compatibility.
Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
---
drivers/iio/imu/inv_icm42600/inv_icm42600.h | 2 +-
drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 14 ++++++++++++--
drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c | 2 +-
drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c | 2 +-
4 files changed, 15 insertions(+), 5 deletions(-)
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600.h b/drivers/iio/imu/inv_icm42600/inv_icm42600.h
index 18787a43477b89db12caee597ab040af5c8f52d5..f893dbe6996506a33eb5d3be47e6765a923665c9 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600.h
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600.h
@@ -426,7 +426,7 @@ int inv_icm42600_set_temp_conf(struct inv_icm42600_state *st, bool enable,
int inv_icm42600_debugfs_reg(struct iio_dev *indio_dev, unsigned int reg,
unsigned int writeval, unsigned int *readval);
-int inv_icm42600_core_probe(struct regmap *regmap, int chip, int irq,
+int inv_icm42600_core_probe(struct regmap *regmap, int chip,
inv_icm42600_bus_setup bus_setup);
struct iio_dev *inv_icm42600_gyro_init(struct inv_icm42600_state *st);
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
index ef9875d3b79db116f9fb4f6d881a7979292c1792..63d46619ebfaa1372171129fca96381ef4606b2e 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_core.c
@@ -683,12 +683,13 @@ static void inv_icm42600_disable_pm(void *_data)
pm_runtime_disable(dev);
}
-int inv_icm42600_core_probe(struct regmap *regmap, int chip, int irq,
+int inv_icm42600_core_probe(struct regmap *regmap, int chip,
inv_icm42600_bus_setup bus_setup)
{
struct device *dev = regmap_get_device(regmap);
+ struct fwnode_handle *fwnode = dev_fwnode(dev);
struct inv_icm42600_state *st;
- int irq_type;
+ int irq, irq_type;
bool open_drain;
int ret;
@@ -697,6 +698,15 @@ int inv_icm42600_core_probe(struct regmap *regmap, int chip, int irq,
return -ENODEV;
}
+ /* get INT1 only supported interrupt or fallback to first interrupt */
+ irq = fwnode_irq_get_byname(fwnode, "INT1");
+ if (irq < 0 && irq != -EPROBE_DEFER) {
+ dev_info(dev, "no INT1 interrupt defined, fallback to first interrupt\n");
+ irq = fwnode_irq_get(fwnode, 0);
+ }
+ if (irq < 0)
+ return dev_err_probe(dev, irq, "error missing INT1 interrupt\n");
+
irq_type = irq_get_trigger_type(irq);
if (!irq_type)
irq_type = IRQF_TRIGGER_FALLING;
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
index 04e440fe023aa3869529b0f0be003ea0544bfb8d..38cc0d7834fcb96dabc401f29d613cf9fc75b8f5 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c
@@ -67,7 +67,7 @@ static int inv_icm42600_probe(struct i2c_client *client)
if (IS_ERR(regmap))
return PTR_ERR(regmap);
- return inv_icm42600_core_probe(regmap, chip, client->irq,
+ return inv_icm42600_core_probe(regmap, chip,
inv_icm42600_i2c_bus_setup);
}
diff --git a/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c b/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c
index 2bd2c4c8e50c3fe081e882aca6c64736510b474c..f40a09c4cbfc673e76922d13d61a3634785300ec 100644
--- a/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c
+++ b/drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c
@@ -64,7 +64,7 @@ static int inv_icm42600_probe(struct spi_device *spi)
if (IS_ERR(regmap))
return PTR_ERR(regmap);
- return inv_icm42600_core_probe(regmap, chip, spi->irq,
+ return inv_icm42600_core_probe(regmap, chip,
inv_icm42600_spi_bus_setup);
}
--
2.49.0
^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v4 1/2] dt-bindings: iio: imu: icm42600: add interrupt naming support
2025-04-10 15:39 ` [PATCH v4 1/2] dt-bindings: iio: imu: icm42600: add interrupt naming support Jean-Baptiste Maneyrol via B4 Relay
@ 2025-04-11 16:24 ` Conor Dooley
0 siblings, 0 replies; 7+ messages in thread
From: Conor Dooley @ 2025-04-11 16:24 UTC (permalink / raw)
To: jean-baptiste.maneyrol
Cc: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, devicetree, linux-kernel
[-- Attachment #1: Type: text/plain, Size: 1989 bytes --]
On Thu, Apr 10, 2025 at 05:39:40PM +0200, Jean-Baptiste Maneyrol via B4 Relay wrote:
> From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
>
> Add interrupt-names field for specifying interrupt pin configured.
>
> Chips are supporting up to 2 interrupt pins with configurable interrupt
> sources. Change interrupt to support 1 or 2 entries.
>
> Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
> ---
> .../devicetree/bindings/iio/imu/invensense,icm42600.yaml | 13 ++++++++++++-
> 1 file changed, 12 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml b/Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml
> index 7e4492bbd0278a336587dc5ac04da7153453da29..d4d4e5c3d8562523872a737864610c26c8fccd82 100644
> --- a/Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml
> +++ b/Documentation/devicetree/bindings/iio/imu/invensense,icm42600.yaml
> @@ -39,7 +39,16 @@ properties:
> maxItems: 1
>
> interrupts:
> - maxItems: 1
> + minItems: 1
> + maxItems: 2
> +
> + interrupt-names:
> + minItems: 1
> + maxItems: 2
> + items:
> + enum:
> + - INT1
> + - INT2
>
> drive-open-drain:
> type: boolean
> @@ -76,6 +85,7 @@ examples:
> reg = <0x68>;
> interrupt-parent = <&gpio2>;
> interrupts = <7 IRQ_TYPE_EDGE_FALLING>;
> + interrupt-names = "INT1";
> vdd-supply = <&vdd>;
> vddio-supply = <&vddio>;
> };
> @@ -95,6 +105,7 @@ examples:
> spi-cpol;
> interrupt-parent = <&gpio1>;
> interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
> + interrupt-names = "INT1";
> vdd-supply = <&vdd>;
> vddio-supply = <&vddio>;
> };
>
> --
> 2.49.0
>
>
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 228 bytes --]
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 0/2] iio: imu: inv_icm42600: switch to use generic name irq get
2025-04-10 15:39 [PATCH v4 0/2] iio: imu: inv_icm42600: switch to use generic name irq get Jean-Baptiste Maneyrol via B4 Relay
2025-04-10 15:39 ` [PATCH v4 1/2] dt-bindings: iio: imu: icm42600: add interrupt naming support Jean-Baptiste Maneyrol via B4 Relay
2025-04-10 15:39 ` [PATCH v4 2/2] iio: imu: inv_icm42600: switch to use generic name irq get Jean-Baptiste Maneyrol via B4 Relay
@ 2025-04-12 12:50 ` Jonathan Cameron
2 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2025-04-12 12:50 UTC (permalink / raw)
To: Jean-Baptiste Maneyrol via B4 Relay
Cc: jean-baptiste.maneyrol, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, David Lechner, Nuno Sá,
Andy Shevchenko, linux-iio, devicetree, linux-kernel
On Thu, 10 Apr 2025 17:39:39 +0200
Jean-Baptiste Maneyrol via B4 Relay <devnull+jean-baptiste.maneyrol.tdk.com@kernel.org> wrote:
> The purpose of this series is to switch to fwnode_irq_get_by_name()
> in the core module instead of using irq from the bus parsing.
>
> Add in dt binding interrupt naming and up to 2 interrupts support.
>
> Signed-off-by: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
Applied to the togreg branch of iio.git. Initially pushing that out as
testing for 0-day to poke at it.
Thanks,
Jonathan
> ---
> Changes in v4:
> - Change dt-binding commit message to be more explicit about interrupt
> support.
> - Simplify fwnode usage, NULL checking is already done automatically.
> - Link to v3: https://lore.kernel.org/r/20250409-iio-imu-inv-icm42600-rework-interrupt-using-names-v3-0-dab85a0a7c2b@tdk.com
>
> Changes in v3:
> - Update dt-binding to report support of the 2 interrupts and delete
> remark about driver feature support.
> - Link to v2: https://lore.kernel.org/r/20250407-iio-imu-inv-icm42600-rework-interrupt-using-names-v2-0-c278acf587b2@tdk.com
>
> Changes in v2:
> - Add INT2 in interrupt-names enum and fix enum
> - Add fallback to first interrupt if naming is not here to ensure
> backward compatibility
> - Link to v1: https://lore.kernel.org/r/20250404-iio-imu-inv-icm42600-rework-interrupt-using-names-v1-0-72ed5100da14@tdk.com
>
> ---
> Jean-Baptiste Maneyrol (2):
> dt-bindings: iio: imu: icm42600: add interrupt naming support
> iio: imu: inv_icm42600: switch to use generic name irq get
>
> .../devicetree/bindings/iio/imu/invensense,icm42600.yaml | 13 ++++++++++++-
> drivers/iio/imu/inv_icm42600/inv_icm42600.h | 2 +-
> drivers/iio/imu/inv_icm42600/inv_icm42600_core.c | 14 ++++++++++++--
> drivers/iio/imu/inv_icm42600/inv_icm42600_i2c.c | 2 +-
> drivers/iio/imu/inv_icm42600/inv_icm42600_spi.c | 2 +-
> 5 files changed, 27 insertions(+), 6 deletions(-)
> ---
> base-commit: 1c2409fe38d5c19015d69851d15ba543d1911932
> change-id: 20250325-iio-imu-inv-icm42600-rework-interrupt-using-names-b397ced72835
>
> Best regards,
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 2/2] iio: imu: inv_icm42600: switch to use generic name irq get
2025-04-10 15:39 ` [PATCH v4 2/2] iio: imu: inv_icm42600: switch to use generic name irq get Jean-Baptiste Maneyrol via B4 Relay
@ 2025-04-14 8:14 ` Andy Shevchenko
2025-04-14 18:45 ` Jonathan Cameron
0 siblings, 1 reply; 7+ messages in thread
From: Andy Shevchenko @ 2025-04-14 8:14 UTC (permalink / raw)
To: jean-baptiste.maneyrol
Cc: Jonathan Cameron, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, David Lechner, Nuno Sá,
linux-iio, devicetree, linux-kernel
On Thu, Apr 10, 2025 at 05:39:41PM +0200, Jean-Baptiste Maneyrol via B4 Relay wrote:
> From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
>
> Use generic fwnode_irq_get_byname() for getting interrupt pin using
> interrupt name. Only INT1 is supported by the driver currently.
>
> If not found fallback to first defined interrupt to keep compatibility.
...
> - return inv_icm42600_core_probe(regmap, chip, client->irq,
> + return inv_icm42600_core_probe(regmap, chip,
> inv_icm42600_i2c_bus_setup);
It's only 81 character, I doubt it will be a problem to have it on one line.
...
> - return inv_icm42600_core_probe(regmap, chip, spi->irq,
> + return inv_icm42600_core_probe(regmap, chip,
> inv_icm42600_spi_bus_setup);
Ditto.
--
With Best Regards,
Andy Shevchenko
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v4 2/2] iio: imu: inv_icm42600: switch to use generic name irq get
2025-04-14 8:14 ` Andy Shevchenko
@ 2025-04-14 18:45 ` Jonathan Cameron
0 siblings, 0 replies; 7+ messages in thread
From: Jonathan Cameron @ 2025-04-14 18:45 UTC (permalink / raw)
To: Andy Shevchenko
Cc: jean-baptiste.maneyrol, Lars-Peter Clausen, Rob Herring,
Krzysztof Kozlowski, Conor Dooley, David Lechner, Nuno Sá,
linux-iio, devicetree, linux-kernel
On Mon, 14 Apr 2025 11:14:10 +0300
Andy Shevchenko <andy@kernel.org> wrote:
> On Thu, Apr 10, 2025 at 05:39:41PM +0200, Jean-Baptiste Maneyrol via B4 Relay wrote:
> > From: Jean-Baptiste Maneyrol <jean-baptiste.maneyrol@tdk.com>
> >
> > Use generic fwnode_irq_get_byname() for getting interrupt pin using
> > interrupt name. Only INT1 is supported by the driver currently.
> >
> > If not found fallback to first defined interrupt to keep compatibility.
>
> ...
>
> > - return inv_icm42600_core_probe(regmap, chip, client->irq,
> > + return inv_icm42600_core_probe(regmap, chip,
> > inv_icm42600_i2c_bus_setup);
>
> It's only 81 character, I doubt it will be a problem to have it on one line.
>
> ...
>
> > - return inv_icm42600_core_probe(regmap, chip, spi->irq,
> > + return inv_icm42600_core_probe(regmap, chip,
> > inv_icm42600_spi_bus_setup);
>
> Ditto.
>
tweaked and pushed out.
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2025-04-14 18:45 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-10 15:39 [PATCH v4 0/2] iio: imu: inv_icm42600: switch to use generic name irq get Jean-Baptiste Maneyrol via B4 Relay
2025-04-10 15:39 ` [PATCH v4 1/2] dt-bindings: iio: imu: icm42600: add interrupt naming support Jean-Baptiste Maneyrol via B4 Relay
2025-04-11 16:24 ` Conor Dooley
2025-04-10 15:39 ` [PATCH v4 2/2] iio: imu: inv_icm42600: switch to use generic name irq get Jean-Baptiste Maneyrol via B4 Relay
2025-04-14 8:14 ` Andy Shevchenko
2025-04-14 18:45 ` Jonathan Cameron
2025-04-12 12:50 ` [PATCH v4 0/2] " Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).