Re: [PATCH 2/4] dt-bindings: iio: magnetometer: Add DT binding for Voltafield AF8133J

From: Jonathan Cameron
Date: Mon Feb 12 2024 - 06:47:50 EST


On Sun, 11 Feb 2024 21:51:58 +0100
Ondřej Jirman <megi@xxxxxx> wrote:

> From: Icenowy Zheng <icenowy@xxxxxxx>

Title doesn't need to mention binding (it's implicit from the dt-bindings bit
dt-bindings: iio: magnetometer: Add Voltafield AF8133J

>
> Voltafield AF8133J is a simple magnetometer sensor produced by Voltafield
> Technology Corp, with dual power supplies (one for core and one for I/O)
> and active-low reset pin.
>
> The sensor has configurable range 1.2 - 2.2 mT and a software controlled
> standby mode.
>
> Add a device tree binding for it.
>
> Signed-off-by: Icenowy Zheng <icenowy@xxxxxxx>
> Signed-off-by: Ondřej Jirman <megi@xxxxxx>

Hi Ondřej

A few quick comments.


> ---
> .../iio/magnetometer/voltafield,af8133j.yaml | 58 +++++++++++++++++++
> 1 file changed, 58 insertions(+)
> create mode 100644 Documentation/devicetree/bindings/iio/magnetometer/voltafield,af8133j.yaml
>
> diff --git a/Documentation/devicetree/bindings/iio/magnetometer/voltafield,af8133j.yaml b/Documentation/devicetree/bindings/iio/magnetometer/voltafield,af8133j.yaml
> new file mode 100644
> index 000000000000..ab56c0f798ad
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/magnetometer/voltafield,af8133j.yaml
> @@ -0,0 +1,58 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/magnetometer/voltafield,af8133j.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Voltafield AF8133J magnetometer sensor
> +
> +maintainers:
> + - Ondřej Jirman <megi@xxxxxx>
> +
> +properties:
> + compatible:
> + - voltafield,af8133j
Test your bindings (as described in the bot message).
const: voltafield,af8133j

> +
> + reg:
> + maxItems: 1
> +
> + reset-gpios:
> + description: |
No need for the | as the formatting doesn't need to be preserved.

> + an pin needed for AF8133J to set the reset state. This should be usually

A pin

> + active low.
> +
> + avdd-supply:
> + description: |
> + an optional regulator that needs to be on to provide AVDD power (Working

An optional (if it were optional, A regulator if not)

> + power, usually 3.3V) to the sensor.
Seems unlikely the power supply is optional (though specifying it in DT might be -
however see below).

> +
> + dvdd-supply:
> + description: |
> + an optional regulator that needs to be on to provide DVDD power (Digital
> + IO power, 1.8V~AVDD) to the sensor.
> +
> + mount-matrix:
> + description: an optional 3x3 mounting rotation matrix.
> +
> +required:
> + - compatible
> + - reg

Any power supply that is required for operation should be listed here (even though
we can rely on the stub supplies if it isn't in the DT).
I used to think this wasn't necessary, so lots of bindings upstream don't yet
have it.

> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/interrupt-controller/irq.h>
> + #include <dt-bindings/gpio/gpio.h>
> + i2c {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + magnetometer@1c {
> + compatible = "voltafield,af8133j";
> + reg = <0x1c>;
> + avdd-supply = <&reg_dldo1>;
> + dvdd-supply = <&reg_dldo1>;
> + reset-gpios = <&pio 1 1 GPIO_ACTIVE_LOW>;
> + };
> + };