Re: [PATCH] dt-bindings: thermal: Convert i.MX8MM to json-schema

From: Amit Kucheria
Date: Thu Apr 09 2020 - 09:59:57 EST


Hi Anson,

On Thu, Apr 9, 2020 at 8:56 AM Anson Huang <Anson.Huang@xxxxxxx> wrote:
>
> Convert the i.MX8MM thermal binding to DT schema format using json-schema

Would it be possible to have a single yaml file for all i.MX thermal
sensors by playing with required and optional properties ?

> Signed-off-by: Anson Huang <Anson.Huang@xxxxxxx>
> ---
> .../devicetree/bindings/thermal/imx8mm-thermal.txt | 15 ------
> .../bindings/thermal/imx8mm-thermal.yaml | 53 ++++++++++++++++++++++
> 2 files changed, 53 insertions(+), 15 deletions(-)
> delete mode 100644 Documentation/devicetree/bindings/thermal/imx8mm-thermal.txt
> create mode 100644 Documentation/devicetree/bindings/thermal/imx8mm-thermal.yaml
>
> diff --git a/Documentation/devicetree/bindings/thermal/imx8mm-thermal.txt b/Documentation/devicetree/bindings/thermal/imx8mm-thermal.txt
> deleted file mode 100644
> index 3629d3c..0000000
> --- a/Documentation/devicetree/bindings/thermal/imx8mm-thermal.txt
> +++ /dev/null
> @@ -1,15 +0,0 @@
> -* Thermal Monitoring Unit (TMU) on Freescale i.MX8MM SoC
> -
> -Required properties:
> -- compatible : Must be "fsl,imx8mm-tmu" or "fsl,imx8mp-tmu".
> -- reg : Address range of TMU registers.
> -- clocks : TMU's clock source.
> -- #thermal-sensor-cells : Should be 0 or 1. See ./thermal.txt for a description.
> -
> -Example:
> -tmu: tmu@30260000 {
> - compatible = "fsl,imx8mm-tmu";
> - reg = <0x30260000 0x10000>;
> - clocks = <&clk IMX8MM_CLK_TMU_ROOT>;
> - #thermal-sensor-cells = <0>;
> -};
> diff --git a/Documentation/devicetree/bindings/thermal/imx8mm-thermal.yaml b/Documentation/devicetree/bindings/thermal/imx8mm-thermal.yaml
> new file mode 100644
> index 0000000..53a42b3
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/thermal/imx8mm-thermal.yaml
> @@ -0,0 +1,53 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/thermal/imx8mm-thermal.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: NXP i.MX8M Mini Thermal Binding
> +
> +maintainers:
> + - Anson Huang <Anson.Huang@xxxxxxx>
> +
> +properties:
> + compatible:
> + oneOf:
> + - items:
> + - enum:
> + - fsl,imx8mm-tmu
> + - fsl,imx8mp-tmu
> + reg:
> + description: |
> + Address range of TMU registers.
> + maxItems: 1
> + clocks:
> + description: |
> + TMU's clock source.
> + maxItems: 1
> +
> + # See ./thermal.txt for details

Don't point to thermal.txt anymore. thermal.txt will be replaced by
thermal-*.yaml files at some point soon.

> + "#thermal-sensor-cells":
> + enum:
> + - 0

Don't you have multiple sensors connected to this controller? In that
case, 0 won't be a valid value.

> + - 1
> +
> +required:
> + - compatible
> + - reg
> + - clocks
> + - '#thermal-sensor-cells'
> +
> +additionalProperties: false
> +
> +examples:
> + - |
> + #include <dt-bindings/clock/imx8mm-clock.h>
> +
> + tmu: tmu@30260000 {
> + compatible = "fsl,imx8mm-tmu";
> + reg = <0x30260000 0x10000>;
> + clocks = <&clk IMX8MM_CLK_TMU_ROOT>;
> + #thermal-sensor-cells = <0>;
> + };
> +
> +...
> --
> 2.7.4
>