Re: [PATCH 2/2] dt-bindings: iio: magnetometer: document Infineon TLV493D 3D Magnetic sensor

David Lechner
2025-07-26T20:43:58Z

On 7/26/25 4:37 AM, Dixit Parmar wrote:
> Document the bindings for Infineon TLV493D Low-Power 3D Magnetic Sensor
> controlled by I2C interface. Main applications includes joysticks, control
> elements (white goods, multifunction knops), or electric meters (anti
> tampering).
>
> The device can be configured in to different operating modes by optional
> device-tree "mode" property. Also, the temperature sensing part requires
> raw offset captured at 25°C and that can be specified by "temp-offset"
> optional device-tree property.
>
> Datasheet: https://www.infineon.com/assets/row/public/documents/24/49/infineon-tlv493d-a1b6-datasheet-en.pdf
>
> Signed-off-by: Dixit Parmar <dixitparmar19@gmail.com>
> ---
> .../iio/magnetometer/infineon,tlv493d.yaml | 57 ++++++++++++++++++++++
> 1 file changed, 57 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/iio/magnetometer/infineon,tlv493d.yaml b/Documentation/devicetree/bindings/iio/magnetometer/infineon,tlv493d.yaml
> new file mode 100644
> index 000000000000..0442cf41503b
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/iio/magnetometer/infineon,tlv493d.yaml
> @@ -0,0 +1,57 @@
> +# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/iio/magnetometer/infineon,tlv493d.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Infineon Technologies TLV493D Low-Power 3D Magnetic Sensor
> +
> +maintainers:
> + - Dixit Parmar <dixitparmar19@gmail.com>
> +
> +properties:
> + $nodename:
> + pattern: '^magnetometer@[0-9a-f]+$'
> +
> + compatible:
> + const: infineon,tlv493d-a1b6
> +
> + reg:
> + maxItems: 1
> +
> + vdd-supply:
> + description: 2.8V to 3.5V supply

The SDA pin can also be a /INT signal, so we need to have an
optional interrupts property as well.

> +
> + mode:
> + description: Sensor operating mode. Must be one of the defined enum values.
> + $ref: /schemas/types.yaml#/definitions/uint32
> + enum:
> + - 0 # Power Down Mode. No measurement.
> + - 1 # Fast Mode
> + - 2 # Low-Power Mode
> + - 3 # Ultra Low-Power Mode
> + - 4 # Master Controlled Mode
> + default: 4

This is not the sort of thing that really belongs in a devicetree.
We should be describing here how the chip is wired up, and only
control how it works based on that.

If there are any wiring conditions that could affect this setting,
they could go here. For example, if the power supply doesn't have
enough current, then we can only operate in one of the low power
modes. Otherwise generally we just stick to the best performing
mode. And specifying the power down mode here really doesn't make
sense - you could never use the sensor!

> +
> + temp-offset:
> + description: Raw temperature offset at 25°C to apply before applying scale and correction.
> + $ref: /schemas/types.yaml#/definitions/uint32
> + default: 340

This is another one that likely doesn't belong in the devicetree.
There is a standard *_calibbias attribute that can be used for
such a calibration if needed.

> +
> +required:
> + - compatible
> + - reg

Power supplies are usually required.

> +
> +additionalProperties: false
> +
> +example:
> + - |
> + i2c {
> + #address-cells = <1>;
> + #size-cells = <0>;
> + magnetometer@5e {
> + compatible = "infineon,tlv493d-a1b6";
> + reg = <0x5e>;
> + vdd = <&hall_vcc>;
> + };
> + };
>