Re: [PATCH v2] dt-bindings: mfd: Convert TI TWL6040 to DT schema

From: Dhruva G

Date: Sun Aug 16 2026 - 12:00:56 EST


Hi Eduard,

On 16-08-2026 14:58, Eduard Bostina wrote:
> Convert the Texas Instruments TWL6040 audio codecs family bindings to DT
> schema.
>
> During the conversion, the following updates were made:
> - Changed 'twl6040,audpwron-gpio' to 'ti,audpwron-gpio', which was
> misnamed in the old txt binding.
> - Made 'gpio-controller', '#gpio-cells', and 'ti,audpwron-gpio' optional
> because modern platforms do not require them.
> - Renamed the vibra 'vddvibl_uV'/'vddvibr_uV' properties to
> 'ti,vddvibl-uV'/'ti,vddvibr-uV', the names actually read by the
> twl6040-vibra driver.
>
> Signed-off-by: Eduard Bostina <egbostina@xxxxxxxxx>
> ---
> Changes in v2:
> - Renamed the vibra 'vddvibl_uV'/'vddvibr_uV' properties to
> 'ti,vddvibl-uV'/'ti,vddvibr-uV', the names actually read by the
> twl6040-vibra driver.
>
> Link to v1: https://lore.kernel.org/all/20260815083451.2147129-1-egbostina@xxxxxxxxx/
>
> .../devicetree/bindings/mfd/ti,twl6040.yaml | 142 ++++++++++++++++++
> .../devicetree/bindings/mfd/twl6040.txt | 67 ---------
> 2 files changed, 142 insertions(+), 67 deletions(-)
> create mode 100644 Documentation/devicetree/bindings/mfd/ti,twl6040.yaml
> delete mode 100644 Documentation/devicetree/bindings/mfd/twl6040.txt
>
> diff --git a/Documentation/devicetree/bindings/mfd/ti,twl6040.yaml b/Documentation/devicetree/bindings/mfd/ti,twl6040.yaml
> new file mode 100644
[..snip..]
> +
> + vddvibl-supply:
> + description: Regulator for the left vibra motor
> +
> + vddvibr-supply:
> + description: Regulator for the right vibra motor
> +
> + vibra:
> + type: object
> + additionalProperties: false
> + properties:
> + ti,vibldrv-res:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: Resistance parameter for left driver
> + ti,vibrdrv-res:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: Resistance parameter for right driver
> + ti,viblmotor-res:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: Resistance parameter for left motor
> + ti,vibrmotor-res:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: Resistance parameter for right motor
> + ti,vddvibl-uV:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: vddvibl default voltage if it needs to be changed
> + ti,vddvibr-uV:
> + $ref: /schemas/types.yaml#/definitions/uint32
> + description: vddvibr default voltage if it needs to be changed
> +
> + required:
> + - ti,vibldrv-res
> + - ti,vibrdrv-res
> + - ti,viblmotor-res
> + - ti,vibrmotor-res
> +
> +required:
> + - compatible
> + - reg
> + - interrupts
> + - "#clock-cells"
> + - vio-supply
> + - v2v1-supply

I think the vibra supplies need to be conditionally required when the vibra child is present.
twl6040_has_vibra() uses the presence of this child to instantiate twl6040-vibra, whose probe
then unconditionally gets both vddvibl and vddvibr.

Would something like this make sense?

allOf:
- if:
required:
- vibra
then:
required:
- vddvibl-supply
- vddvibr-supply

This would still allow TWL6040 users without vibra, while retaining the dependency for users which enable it.

> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/interrupt-controller/irq.h>
> +
> + i2c {
> + #address-cells = <1>;
> + #size-cells = <0>;
> +
> + audio-codec@4b {
> + compatible = "ti,twl6040";
> + reg = <0x4b>;
> + interrupts = <0 119 IRQ_TYPE_LEVEL_HIGH>;
> + interrupt-parent = <&gic>;
> + gpio-controller;
> + #gpio-cells = <1>;
> + #clock-cells = <0>;
> + ti,audpwron-gpio = <&gpio4 31 0>;
> +
> + vio-supply = <&v1v8>;
> + v2v1-supply = <&v2v1>;
> + enable-active-high;
> +
> + /* regulators for vibra motor */
> + vddvibl-supply = <&vbat>;
> + vddvibr-supply = <&vbat>;
> +
> + vibra {
> + ti,vibldrv-res = <8>;
> + ti,vibrdrv-res = <3>;
> + ti,viblmotor-res = <10>;
> + ti,vibrmotor-res = <10>;
> + };
> + };
> + };
> diff --git a/Documentation/devicetree/bindings/mfd/twl6040.txt b/Documentation/devicetree/bindings/mfd/twl6040.txt
> deleted file mode 100644

[..snip..]