Skip to contentSkip to conversation

dt-bindings: iio: magnetometer: qst: Add QMC5883L device tree binding

PATCH In review Brajesh Patil 3 participants 3 messages May 8, 2025 – May 11, 2025

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

PATCH v2 2/5 dt-bindings: iio: magnetometer: qst: Add QMC5883L device tree binding

---
 .../iio/magnetometer/qst,qmc5883l.yaml        | 52 +++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/magnetometer/qst,qmc5883l.yaml
Documentation/devicetree/bindings/iio/magnetometer/qst,qmc5883l.yaml new file +52 -0
new file mode 100644
index 000000000000..a2e6982a177d
@@ -0,0 +1,52 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/iio/magnetometer/qst,qmc5883l.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: QST QMC5883L 3-Axis Magnetometer
+
+maintainers:
+  - Brajesh Patil <[email protected]>
+
+description: |
+  The QMC5883L is a 3-axis magnetic sensor with I2C interface. It provides
+  measurements of magnetic field strength along X, Y and Z axes, as well as
+  temperature readings.
+
+properties:
+  compatible:
+    const: qst,qmc5883l
+
+  reg:
+    maxItems: 1
+    description: I2C slave address (0x0d)
+
+  mount-matrix:
+    description: |
+      A 3x3 rotation matrix describing how the magnetometer is mounted
+      on the device. This is used to orient the sensor measurements
+      to match the device's coordinate system.
+
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        magnetometer@0d {
+            compatible = "qst,qmc5883l";
+            reg = <0x0d>;
+            mount-matrix = "1", "0", "0",
+                           "0", "1", "0",
+                           "0", "0", "1";
+        };
+    };
+...
+

--
2.39.5

#1 lore raw
Quoted 1 line · Brajesh Patil

Please run scripts/checkpatch.pl on the patches and fix reported warnings. After that, run also 'scripts/checkpatch.pl --strict' on the patches and (probably) fix more warnings. Some warnings can be ignored, especially from --strict run, but the code here looks like it needs a fix. Feel free to get in touch if the warning is not clear.

...

Documentation/devicetree/bindings/iio/magnetometer/qst,qmc5883l.yaml line 29

Quoted 6 lines
Documentation/devicetree/bindings/iio/magnetometer/qst,qmc5883l.yaml new file +6 -0
+
+  mount-matrix:
+    description: |
+      A 3x3 rotation matrix describing how the magnetometer is mounted
+      on the device. This is used to orient the sensor measurements
+      to match the device's coordinate system.

No supplies?

Best regards,
Krzysztof

maintainer
#2 lore raw
In reply to Brajesh Patil

On Thu, 8 May 2025 13:08:46 +0100
Brajesh Patil <[email protected]> wrote:

Needs description. Give us a clue what the device is in a few lines.

Quoted 14 lines
---
 .../iio/magnetometer/qst,qmc5883l.yaml        | 52 +++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/iio/magnetometer/qst,qmc5883l.yaml
Documentation/devicetree/bindings/iio/magnetometer/qst,qmc5883l.yaml new file +2 -0
new file mode 100644
index 000000000000..a2e6982a177d
@@ -0,0 +1,52 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2

Documentation/devicetree/bindings/iio/magnetometer/qst,qmc5883l.yaml line 12

Quoted 10 lines
Documentation/devicetree/bindings/iio/magnetometer/qst,qmc5883l.yaml new file +10 -0
+---
+$id: http://devicetree.org/schemas/iio/magnetometer/qst,qmc5883l.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: QST QMC5883L 3-Axis Magnetometer
+
+maintainers:
+  - Brajesh Patil <[email protected]>
+
+description: |

No need for | as paragraph that follows doesn't need any specific formatting.

Documentation/devicetree/bindings/iio/magnetometer/qst,qmc5883l.yaml line 15

Quoted 3 lines
Documentation/devicetree/bindings/iio/magnetometer/qst,qmc5883l.yaml new file +3 -0
+  The QMC5883L is a 3-axis magnetic sensor with I2C interface. It provides
+  measurements of magnetic field strength along X, Y and Z axes, as well as
+  temperature readings.

There are two supplies that should be listed here and in the required list (note that doesn't mean we can't reply on the regulator framework supplying
stub regulators if the power is always on - it just documents that the device requires power to work!)

There is also a drdy pin so I'd expect an optional interrupt.

Note that bindings should be as complete as possible, even if the driver doesn't make use of a particular feature yet.

Documentation/devicetree/bindings/iio/magnetometer/qst,qmc5883l.yaml line 26

Quoted 11 lines
Documentation/devicetree/bindings/iio/magnetometer/qst,qmc5883l.yaml new file +11 -0
+
+properties:
+  compatible:
+    const: qst,qmc5883l
+
+  reg:
+    maxItems: 1
+    description: I2C slave address (0x0d)
+
+  mount-matrix:
+    description: |

As above.

Quoted 29 lines
Documentation/devicetree/bindings/iio/magnetometer/qst,qmc5883l.yaml new file +26 -1
+      A 3x3 rotation matrix describing how the magnetometer is mounted
+      on the device. This is used to orient the sensor measurements
+      to match the device's coordinate system.
+
+additionalProperties: false
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        magnetometer@0d {
+            compatible = "qst,qmc5883l";
+            reg = <0x0d>;
+            mount-matrix = "1", "0", "0",
+                           "0", "1", "0",
+                           "0", "0", "1";
+        };
+    };
+...
+
--

2.39.5