Skip to contentSkip to conversation

dt-bindings: iio: accel: bma255: Fix interrupt type / merge bma180

PATCH In review Stephan Gerhold 4 participants 13 messages Jun 14, 2021 – Jul 18, 2021 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover dt-bindings: iio: accel: bma255: Fix interrupt type / merge bma180

This patch series first fixes the interrupt type in the bosch,bma255.yaml schema and then combines it with the bosch,bma180.yaml schema since they are pretty much identical.

Stephan Gerhold (3):
dt-bindings: iio: accel: bma255: Fix interrupt type
dt-bindings: iio: accel: bma255: Sort compatibles
dt-bindings: iio: accel: bma255: Merge bosch,bma180 schema

 .../bindings/iio/accel/bosch,bma180.yaml      | 61 -------------------
 .../bindings/iio/accel/bosch,bma255.yaml      | 23 ++++---
 2 files changed, 16 insertions(+), 68 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/iio/accel/bosch,bma180.yaml
Signature · 1 line
2.32.0
#1 lore raw

PATCH 1/3 dt-bindings: iio: accel: bma255: Fix interrupt type

Bosch accelerometers similar to BMA255 are initially configured to emit an active-high interrupt signal. This is currently not re-configured in the bmc150-accel driver so the interrupt should most certainly be IRQ_TYPE_EDGE_RISING (or potentially IRQ_TYPE_LEVEL_HIGH). (Unless there is some kind of inverter installed on the board...)

At the moment the bmc150-accel driver forcefully requests the IRQ using IRQF_TRIGGER_RISING, which means that the IRQ type is currently ignored in all existing device trees.

Fixes 6259551 ("iio: accel: bmc150-accel: Add DT bindings")
Cc Linus Walleij <[email protected]>

---
It's probably better to let the bmc150-accel driver rely on the IRQ type provided by the device tree in case of inverters or something.

However:
1. We need to fix up several broken device trees first (I found IRQ_TYPE_LEVEL_LOW in some device trees).
2. Similarly, I'm not sure if this might break some ACPI devices in case they have the wrong IRQ type listed?

As a first step this patch just fixes the documentation.

---
 Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml +2 -2
index e830d5295b92..b37ba902e4a2 100644
@@ -38,7 +38,7 @@ properties:
     description: |
       The first interrupt listed must be the one connected to the INT1 pin,
       the second (optional) interrupt listed must be the one connected to the
-      INT2 pin (if available).
+      INT2 pin (if available). The type should be IRQ_TYPE_EDGE_RISING.
 
   mount-matrix:
     description: an optional 3x3 mounting rotation matrix.
@@ -63,7 +63,7 @@ examples:
             reg = <0x08>;
             vddio-supply = <&vddio>;
             vdd-supply = <&vdd>;
-            interrupts = <57 IRQ_TYPE_EDGE_FALLING>;
+            interrupts = <57 IRQ_TYPE_EDGE_RISING>;
         };
     };
   - |
Signature · 1 line
2.32.0
Reviewed-by on v1 1/3
#2 lore raw

Re: [PATCH 1/3] dt-bindings: iio: accel: bma255: Fix interrupt type

Quoted 6 lines · Stephan Gerhold

Bosch accelerometers similar to BMA255 are initially configured to emit an active-high interrupt signal. This is currently not re-configured in the bmc150-accel driver so the interrupt should most certainly be IRQ_TYPE_EDGE_RISING (or potentially IRQ_TYPE_LEVEL_HIGH). (Unless there is some kind of inverter installed on the board...)

Quoted 7 lines

At the moment the bmc150-accel driver forcefully requests the IRQ using IRQF_TRIGGER_RISING, which means that the IRQ type is currently ignored in all existing device trees.

Fixes 6259551 ("iio: accel: bmc150-accel: Add DT bindings")
Cc Linus Walleij <[email protected]>
Quoted 3 lines

However:
1. We need to fix up several broken device trees first (I found IRQ_TYPE_LEVEL_LOW in some device trees).

Oh this situation... Some are mine I bet (I can fix those, just poke me with something sharp.)

Quoted 2 lines

2. Similarly, I'm not sure if this might break some ACPI devices in case they have the wrong IRQ type listed?

I never figured this out but Andy and maybe Bastien Nocera knows more about this.

Quoted 1 line

As a first step this patch just fixes the documentation.

Fair enough, it makes things better.

Yours,
Linus Walleij

A message that is not in the archive (sent off-list or not yet received): 20210616133328.56106589@jic23-huawei

#4 lore raw

Re: [PATCH 1/3] dt-bindings: iio: accel: bma255: Fix interrupt type

Quoted 6 lines · Jonathan Cameron

Be a little bit careful. There is always the possibility someone has a board doing cheap level conversion via an inverter (I have one of those, though not with this device).
We could in theory represent that explicitly, but I think this is still mostly done by just flipping the sense in DT and pretending the inverter doesn't exist.

This is what we do, the DT is not a 100% map of the actual system, and we have no inverter driver, so that flag is used to indicate "some electronics" that flip the polarity.

We should document that better though.

Quoted 3 lines

So whilst it might superficially make sense to change it for all cases, make sure we get someone familiar with the board to sanity check them.

Was just thinking of those that I can test :)

Yours,
Linus Walleij

maintainer Acked-by on v1 1/3
#5 lore raw

Re: [PATCH 1/3] dt-bindings: iio: accel: bma255: Fix interrupt type

In reply to Stephan Gerhold
Quoted 23 lines · Stephan Gerhold

Bosch accelerometers similar to BMA255 are initially configured to emit an active-high interrupt signal. This is currently not re-configured in the bmc150-accel driver so the interrupt should most certainly be IRQ_TYPE_EDGE_RISING (or potentially IRQ_TYPE_LEVEL_HIGH). (Unless there is some kind of inverter installed on the board...)

At the moment the bmc150-accel driver forcefully requests the IRQ using IRQF_TRIGGER_RISING, which means that the IRQ type is currently ignored in all existing device trees.

Fixes 6259551 ("iio: accel: bmc150-accel: Add DT bindings")
Cc Linus Walleij <[email protected]>

---
It's probably better to let the bmc150-accel driver rely on the IRQ type provided by the device tree in case of inverters or something.

However:
1. We need to fix up several broken device trees first (I found IRQ_TYPE_LEVEL_LOW in some device trees).
2. Similarly, I'm not sure if this might break some ACPI devices in case they have the wrong IRQ type listed?

Quoted 5 lines

As a first step this patch just fixes the documentation.

---
 Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
#6 lore raw

PATCH 2/3 dt-bindings: iio: accel: bma255: Sort compatibles

In reply to Stephan Gerhold

Similar to recent rework in the bmc150-accel driver, sort the compatible list in the DT schema so there is a consistent order.

---
 .../devicetree/bindings/iio/accel/bosch,bma255.yaml    | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml +5 -5
index b37ba902e4a2..f35c57b8105f 100644
@@ -16,15 +16,15 @@ description:
 properties:
   compatible:
     enum:
-      - bosch,bmc150_accel
-      - bosch,bmi055_accel
+      - bosch,bma222
+      - bosch,bma222e
+      - bosch,bma250e
       - bosch,bma253
       - bosch,bma254
       - bosch,bma255
-      - bosch,bma250e
-      - bosch,bma222
-      - bosch,bma222e
       - bosch,bma280
+      - bosch,bmc150_accel
+      - bosch,bmi055_accel
 
   reg:
     maxItems: 1
Signature · 1 line
2.32.0
maintainer Acked-by on v1 2/3
#8 lore raw

Re: [PATCH 2/3] dt-bindings: iio: accel: bma255: Sort compatibles

In reply to Stephan Gerhold
Quoted 8 lines · Stephan Gerhold

Similar to recent rework in the bmc150-accel driver, sort the compatible list in the DT schema so there is a consistent order.

---
 .../devicetree/bindings/iio/accel/bosch,bma255.yaml    | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
#9 lore raw

PATCH 3/3 dt-bindings: iio: accel: bma255: Merge bosch,bma180 schema

In reply to Stephan Gerhold

In Linux the bma180 and bmc150-accel driver cover fairly similar chips from Bosch (just with minor register differences). For the DT schema, this does not make any difference: They both represent I2C/SPI devices, have one or two interrupts plus a vdd/vddio-supply.

This means there is no need to duplicate the schema, we can just document the compatibles for both drivers in a single DT schema.

---
Some additional notes:
- The datasheet links in bma180 sadly seem all broken for me so I just dropped them.
- I separated the bma180/bmc150-accel compatibles using a comment. This is just for clarity, it has no influence on the schema.
- I added myself as second maintainer for the bma255 binding since Jonathan seemed to be happy to get unlisted for bma180. :)

In the future we could consider combining even more schemas. In particular bosch,bma400.yaml and bosch,bmi088.yaml are also almost identical, although they currently specify different interrupt types. I think in general the situation for those Bosch sensors is exactly the same: The sensors can be configured to either active-high or active-low level. However, at the moment neither bma400 or bmi088 actually implement interrupt support. For now I kept those schemas as-is, I think this is better left up for follow-up patches.

---
 .../bindings/iio/accel/bosch,bma180.yaml      | 61 -------------------
 .../bindings/iio/accel/bosch,bma255.yaml      |  9 +++
 2 files changed, 9 insertions(+), 61 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/iio/accel/bosch,bma180.yaml
Documentation/devicetree/bindings/iio/accel/bosch,bma180.yaml deleted +0 -61
deleted file mode 100644
index a7e84089cc3d..000000000000
@@ -1,61 +0,0 @@
-# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
-%YAML 1.2
----
-$id: http://devicetree.org/schemas/iio/accel/bosch,bma180.yaml#
-$schema: http://devicetree.org/meta-schemas/core.yaml#
-
-title: Bosch BMA023 / BMA150/ BMA180 / BMA250 / SMB380 triaxial accelerometers
-
-maintainers:
-  - Jonathan Cameron <[email protected]>
-
-description: |
-  https://media.digikey.com/pdf/Data%20Sheets/Bosch/BMA150.pdf
-  http://omapworld.com/BMA180_111_1002839.pdf
-  http://ae-bst.resource.bosch.com/media/products/dokumente/bma250/bst-bma250-ds002-05.pdf
-
-properties:
-  compatible:
-    enum:
-      - bosch,bma023
-      - bosch,bma150
-      - bosch,bma180
-      - bosch,bma250
-      - bosch,smb380
-
-  reg:
-    maxItems: 1
-
-  vdd-supply: true
-
-  vddio-supply: true
-
-  interrupts:
-    minItems: 1
-    maxItems: 2
-    description: |
-      Type should be either IRQ_TYPE_LEVEL_HIGH or IRQ_TYPE_EDGE_RISING.
-      For the bma250 the first interrupt listed must be the one
-      connected to the INT1 pin, the second (optional) interrupt
-      listed must be the one connected to the INT2 pin.
-
-required:
-  - compatible
-  - reg
-
-additionalProperties: false
-
-examples:
-  - |
-    #include <dt-bindings/interrupt-controller/irq.h>
-    i2c {
-        #address-cells = <1>;
-        #size-cells = <0>;
-        accel@40 {
-            compatible = "bosch,bma180";
-            reg = <0x40>;
-            interrupt-parent = <&gpio6>;
-            interrupts = <18 (IRQ_TYPE_LEVEL_HIGH | IRQ_TYPE_EDGE_RISING)>;
-        };
-    };
-...
Documentation/devicetree/bindings/iio/accel/bosch,bma255.yaml +9 -0
index f35c57b8105f..5b35856b1942 100644
@@ -8,6 +8,7 @@ title: Bosch BMA255 and Similar Accelerometers
 
 maintainers:
   - Linus Walleij <[email protected]>
+  - Stephan Gerhold <[email protected]>
 
 description:
   3 axis accelerometers with varying range and I2C or SPI
@@ -16,6 +17,7 @@ description:
 properties:
   compatible:
     enum:
+      # bmc150-accel driver in Linux
       - bosch,bma222
       - bosch,bma222e
       - bosch,bma250e
@@ -26,6 +28,13 @@ properties:
       - bosch,bmc150_accel
       - bosch,bmi055_accel
 
+      # bma180 driver in Linux
+      - bosch,bma023
+      - bosch,bma150
+      - bosch,bma180
+      - bosch,bma250
+      - bosch,smb380
+
   reg:
     maxItems: 1
 
Signature · 1 line
2.32.0
Reviewed-by on v1 3/3
#10 lore raw

Re: [PATCH 3/3] dt-bindings: iio: accel: bma255: Merge bosch,bma180 schema

Quoted 10 lines · Stephan Gerhold

In Linux the bma180 and bmc150-accel driver cover fairly similar chips from Bosch (just with minor register differences). For the DT schema, this does not make any difference: They both represent I2C/SPI devices, have one or two interrupts plus a vdd/vddio-supply.

This means there is no need to duplicate the schema, we can just document the compatibles for both drivers in a single DT schema.

Quoted 3 lines

Some additional notes:
- The datasheet links in bma180 sadly seem all broken for me so I just dropped them.

Fair enough, but some people would be able to obtain them using the Wayback machine.

Quoted 2 lines

- I separated the bma180/bmc150-accel compatibles using a comment. This is just for clarity, it has no influence on the schema.

Some DT binding maintainers may be allergic to any mention of Linux particulars in binding documents but I am not so fine by me.

Quoted 2 lines

- I added myself as second maintainer for the bma255 binding since Jonathan seemed to be happy to get unlisted for bma180. :)

Thanks!

Quoted 8 lines

In the future we could consider combining even more schemas. In particular bosch,bma400.yaml and bosch,bmi088.yaml are also almost identical, although they currently specify different interrupt types. I think in general the situation for those Bosch sensors is exactly the same: The sensors can be configured to either active-high or active-low level. However, at the moment neither bma400 or bmi088 actually implement interrupt support. For now I kept those schemas as-is, I think this is better left up for follow-up patches.

The situation is caused by Bosch sensortec
division not being particularly involved with the maintenance of these drivers in the Linux kernel. (They did send a few initial patches some years back, but since have not been heard from.)

It would be great to get the attention of someone in charge @bosch-sensortec.com.

Their own drivers seem to target stuff like Arduino but more generally on the "OS independence shim"-paradigm:
https://github.com/BoschSensortec

They have their own community here:
https://community.bosch-sensortec.com/t5/Bosch-Sensortec-Community/ct-p/bst_community
Their users ask questions about Linux sensor support all the time. Their stance seem to be to work directly with companies making products through FAE:s (field application engineers). It's a bit like a guild.

I tried to find a real mail address to them but failed.

Yours,
Linus Walleij

#11 lore raw

Re: [PATCH 3/3] dt-bindings: iio: accel: bma255: Merge bosch,bma180 schema

Quoted 13 lines · Linus Walleij
Quoted 10 lines · Stephan Gerhold

In Linux the bma180 and bmc150-accel driver cover fairly similar chips from Bosch (just with minor register differences). For the DT schema, this does not make any difference: They both represent I2C/SPI devices, have one or two interrupts plus a vdd/vddio-supply.

This means there is no need to duplicate the schema, we can just document the compatibles for both drivers in a single DT schema.

Quoted 9 lines
Quoted 3 lines

Some additional notes:
- The datasheet links in bma180 sadly seem all broken for me so I just dropped them.

Fair enough, but some people would be able to obtain them using the Wayback machine.

Good point, perhaps we should add some links directly to the Wayback Machine if it still has some of the datasheets. Those links should be more stable. :)

Quoted 6 lines
Quoted 2 lines

- I separated the bma180/bmc150-accel compatibles using a comment. This is just for clarity, it has no influence on the schema.

Some DT binding maintainers may be allergic to any mention of Linux particulars in binding documents but I am not so fine by me.

Yeah, I kind of expected this to be honest. I don't mind removing those comments, just thought it would be a bit less confusing for people who read the bindings (so they know which driver covers which compatibles). And for those using the bindings outside Linux, the comments can just be ignored since they do not have any semantic meaning.

Quoted 22 lines
Quoted 9 lines

In the future we could consider combining even more schemas. In particular bosch,bma400.yaml and bosch,bmi088.yaml are also almost identical, although they currently specify different interrupt types. I think in general the situation for those Bosch sensors is exactly the same: The sensors can be configured to either active-high or active-low level. However, at the moment neither bma400 or bmi088 actually implement interrupt support. For now I kept those schemas as-is, I think this is better left up for follow-up patches.

The situation is caused by Bosch sensortec
division not being particularly involved with the maintenance of these drivers in the Linux kernel. (They did send a few initial patches some years back, but since have not been heard from.)

It would be great to get the attention of someone in charge @bosch-sensortec.com.

Their own drivers seem to target stuff like Arduino but more generally on the "OS independence shim"-paradigm:
https://github.com/BoschSensortec

Quoted 9 lines

They have their own community here:
https://community.bosch-sensortec.com/t5/Bosch-Sensortec-Community/ct-p/bst_community
Their users ask questions about Linux sensor support all the time. Their stance seem to be to work directly with companies making products through FAE:s (field application engineers). It's a bit like a guild.

I tried to find a real mail address to them but failed.

Yeah it would be nice if they would become a bit more involved. But from my experience with various other vendors I'm not really expecting much here sadly. However, I would be very happy to be proven otherwise. :)

Thanks!
Stephan

maintainer Reviewed-by on v1 3/3
#12 lore raw

Re: [PATCH 3/3] dt-bindings: iio: accel: bma255: Merge bosch,bma180 schema

In reply to Stephan Gerhold
Quoted 27 lines · Stephan Gerhold

In Linux the bma180 and bmc150-accel driver cover fairly similar chips from Bosch (just with minor register differences). For the DT schema, this does not make any difference: They both represent I2C/SPI devices, have one or two interrupts plus a vdd/vddio-supply.

This means there is no need to duplicate the schema, we can just document the compatibles for both drivers in a single DT schema.

---
Some additional notes:
- The datasheet links in bma180 sadly seem all broken for me so I just dropped them.
- I separated the bma180/bmc150-accel compatibles using a comment. This is just for clarity, it has no influence on the schema.
- I added myself as second maintainer for the bma255 binding since Jonathan seemed to be happy to get unlisted for bma180. :)

In the future we could consider combining even more schemas. In particular bosch,bma400.yaml and bosch,bmi088.yaml are also almost identical, although they currently specify different interrupt types. I think in general the situation for those Bosch sensors is exactly the same: The sensors can be configured to either active-high or active-low level. However, at the moment neither bma400 or bmi088 actually implement interrupt support. For now I kept those schemas as-is, I think this is better left up for follow-up patches.

Quoted 6 lines
---
 .../bindings/iio/accel/bosch,bma180.yaml      | 61 -------------------
 .../bindings/iio/accel/bosch,bma255.yaml      |  9 +++
 2 files changed, 9 insertions(+), 61 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/iio/accel/bosch,bma180.yaml
maintainer
#13 lore raw
In reply to Stephan Gerhold
Quoted 9 lines · On Mon, 14 Jun 2021 18:31:47 +0200 Stephan Gerhold <[email protected]> wrote:

This patch series first fixes the interrupt type in the bosch,bma255.yaml schema and then combines it with the bosch,bma180.yaml schema since they are pretty much identical.

Stephan Gerhold (3):
dt-bindings: iio: accel: bma255: Fix interrupt type
dt-bindings: iio: accel: bma255: Sort compatibles
dt-bindings: iio: accel: bma255: Merge bosch,bma180 schema

Quoted 5 lines
 .../bindings/iio/accel/bosch,bma180.yaml      | 61 -------------------
 .../bindings/iio/accel/bosch,bma255.yaml      | 23 ++++---
 2 files changed, 16 insertions(+), 68 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/iio/accel/bosch,bma180.yaml

Series applied to the togreg branch of iio.git and pushed out as testing to let 0-day have a shot at them.

I 'think' the outstanding discussion was all about potential follow up patches rather than anything here, but if I've missed a reason we should hold off on these then shout.

Thanks,

Jonathan