diff mbox series

[v6,2/7] dt-bindings: thermal: add YAML schema for sun8i-thermal driver bindings

Message ID 20191127052935.1719897-3-anarsoul@gmail.com (mailing list archive)
State New, archived
Delegated to: Eduardo Valentin
Headers show
Series add thermal sensor driver for A64, A83T, H3, H5, H6, R40 | expand

Commit Message

Vasily Khoruzhick Nov. 27, 2019, 5:29 a.m. UTC
From: Yangtao Li <tiny.windzz@gmail.com>

sun8i-thermal driver supports thermal sensor in wide range of Allwinner
SoCs. Add YAML schema for its bindings.

Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
---
 .../thermal/allwinner,sun8i-a83t-ths.yaml     | 103 ++++++++++++++++++
 1 file changed, 103 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml

Comments

Maxime Ripard Nov. 27, 2019, 5:44 p.m. UTC | #1
Hi,

On Tue, Nov 26, 2019 at 09:29:30PM -0800, Vasily Khoruzhick wrote:
> From: Yangtao Li <tiny.windzz@gmail.com>
>
> sun8i-thermal driver supports thermal sensor in wide range of Allwinner
> SoCs. Add YAML schema for its bindings.
>
> Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> ---
>  .../thermal/allwinner,sun8i-a83t-ths.yaml     | 103 ++++++++++++++++++
>  1 file changed, 103 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
>
> diff --git a/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml b/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
> new file mode 100644
> index 000000000000..e622f0a4be90
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
> @@ -0,0 +1,103 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Allwinner SUN8I Thermal Controller Device Tree Bindings
> +
> +maintainers:
> +  - Yangtao Li <tiny.windzz@gmail.com>
> +
> +properties:
> +  compatible:
> +    oneOf:
> +      - const: allwinner,sun8i-a83t-ths
> +      - const: allwinner,sun8i-h3-ths
> +      - const: allwinner,sun8i-r40-ths
> +      - const: allwinner,sun50i-a64-ths
> +      - const: allwinner,sun50i-h5-ths
> +      - const: allwinner,sun50i-h6-ths
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  resets:
> +    maxItems: 1
> +
> +  clocks:
> +    minItems: 1
> +    maxItems: 2
> +
> +  clock-names:
> +    anyOf:
> +      - items:
> +        - const: bus
> +        - const: mod
> +      - items:
> +        - const: bus

This can be:

clock-names:
  minItems: 1
  maxItems: 2
  items:
    - const: bus
    - const: mod

And the length should be checked based on the compatible value, with
something like

if:
  properties:
    compatible:
      contains:
        const: allwinner,sun50i-h6-ths

then:
  properties:
    clocks:
      maxItems: 1

    clock-names:
      maxItems: 1

else:
  properties:
    clocks:
      maxItems: 2

    clock-names:
      maxItems: 2

> +
> +  '#thermal-sensor-cells':
> +    enum: [ 0, 1 ]
> +    description: |
> +      Definition depends on soc version:
> +
> +      For "allwinner,sun8i-h3-ths",
> +      value must be 0.
> +      For all other compatibles
> +      value must be 1.

This should be checked using an if as well.

> +
> +  nvmem-cells:
> +    maxItems: 1
> +    items:
> +      - description: Calibration data for thermal sensors

You can drop the items and just move the description up one level,
under nvmem-cells

> +
> +  nvmem-cell-names:
> +    items:
> +      - const: calibration

Ditto for the const

> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - '#thermal-sensor-cells'

Whether clocks, clock-names and resets are thereshould be check using
an if statement as well.

> +
> +examples:
> +  - |
> +    ths_a83t: ths@1f04000 {

You don't need the label at all, and the node name should be
temperature-sensor according to the DT spec, not ths. This applies to
all you examples.

> +         compatible = "allwinner,sun8i-a83t-ths";
> +         reg = <0x01f04000 0x100>;
> +         interrupts = <0 31 0>;
> +         nvmem-cells = <&ths_calibration>;
> +         nvmem-cell-names = "calibration";
> +         #thermal-sensor-cells = <1>;
> +    };

New line.

Thanks!
Maxime
Ondřej Jirman Nov. 27, 2019, 6:07 p.m. UTC | #2
Hi,

On Wed, Nov 27, 2019 at 06:44:34PM +0100, Maxime Ripard wrote:
> Hi,
> 
> On Tue, Nov 26, 2019 at 09:29:30PM -0800, Vasily Khoruzhick wrote:
> > From: Yangtao Li <tiny.windzz@gmail.com>
> >
> > sun8i-thermal driver supports thermal sensor in wide range of Allwinner
> > SoCs. Add YAML schema for its bindings.
> >
> > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> > Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> > ---
> >  .../thermal/allwinner,sun8i-a83t-ths.yaml     | 103 ++++++++++++++++++
> >  1 file changed, 103 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml b/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
> > new file mode 100644
> > index 000000000000..e622f0a4be90
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
> > @@ -0,0 +1,103 @@
> > +# SPDX-License-Identifier: GPL-2.0
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Allwinner SUN8I Thermal Controller Device Tree Bindings
> > +
> > +maintainers:
> > +  - Yangtao Li <tiny.windzz@gmail.com>
> > +
> > +properties:
> > +  compatible:
> > +    oneOf:
> > +      - const: allwinner,sun8i-a83t-ths
> > +      - const: allwinner,sun8i-h3-ths
> > +      - const: allwinner,sun8i-r40-ths
> > +      - const: allwinner,sun50i-a64-ths
> > +      - const: allwinner,sun50i-h5-ths
> > +      - const: allwinner,sun50i-h6-ths
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  interrupts:
> > +    maxItems: 1
> > +
> > +  resets:
> > +    maxItems: 1
> > +
> > +  clocks:
> > +    minItems: 1
> > +    maxItems: 2
> > +
> > +  clock-names:
> > +    anyOf:
> > +      - items:
> > +        - const: bus
> > +        - const: mod
> > +      - items:
> > +        - const: bus
> 
> This can be:
> 
> clock-names:
>   minItems: 1

Additionally, minItems should be 0, since A83T doesn't have bus clock/reset. And
then there should be a special case for A83T too with min/maxItems = 0 for both
resets and clocks.

regards,
	o.

>   maxItems: 2
>   items:
>     - const: bus
>     - const: mod
> 
> And the length should be checked based on the compatible value, with
> something like
> 
> if:
>   properties:
>     compatible:
>       contains:
>         const: allwinner,sun50i-h6-ths
> 
> then:
>   properties:
>     clocks:
>       maxItems: 1
> 
>     clock-names:
>       maxItems: 1
> 
> else:
>   properties:
>     clocks:
>       maxItems: 2
> 
>     clock-names:
>       maxItems: 2
> 
> > +
> > +  '#thermal-sensor-cells':
> > +    enum: [ 0, 1 ]
> > +    description: |
> > +      Definition depends on soc version:
> > +
> > +      For "allwinner,sun8i-h3-ths",
> > +      value must be 0.
> > +      For all other compatibles
> > +      value must be 1.
> 
> This should be checked using an if as well.
> 
> > +
> > +  nvmem-cells:
> > +    maxItems: 1
> > +    items:
> > +      - description: Calibration data for thermal sensors
> 
> You can drop the items and just move the description up one level,
> under nvmem-cells
> 
> > +
> > +  nvmem-cell-names:
> > +    items:
> > +      - const: calibration
> 
> Ditto for the const
> 
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +  - interrupts
> > +  - '#thermal-sensor-cells'
> 
> Whether clocks, clock-names and resets are thereshould be check using
> an if statement as well.
> 
> > +
> > +examples:
> > +  - |
> > +    ths_a83t: ths@1f04000 {
> 
> You don't need the label at all, and the node name should be
> temperature-sensor according to the DT spec, not ths. This applies to
> all you examples.
> 
> > +         compatible = "allwinner,sun8i-a83t-ths";
> > +         reg = <0x01f04000 0x100>;
> > +         interrupts = <0 31 0>;
> > +         nvmem-cells = <&ths_calibration>;
> > +         nvmem-cell-names = "calibration";
> > +         #thermal-sensor-cells = <1>;
> > +    };
> 
> New line.
> 
> Thanks!
> Maxime
Vasily Khoruzhick Nov. 27, 2019, 6:52 p.m. UTC | #3
On Wed, Nov 27, 2019 at 10:07 AM Ondřej Jirman <megous@megous.com> wrote:
>
> Hi,
>
> On Wed, Nov 27, 2019 at 06:44:34PM +0100, Maxime Ripard wrote:
> > Hi,
> >
> > On Tue, Nov 26, 2019 at 09:29:30PM -0800, Vasily Khoruzhick wrote:
> > > From: Yangtao Li <tiny.windzz@gmail.com>
> > >
> > > sun8i-thermal driver supports thermal sensor in wide range of Allwinner
> > > SoCs. Add YAML schema for its bindings.
> > >
> > > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> > > Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> > > ---
> > >  .../thermal/allwinner,sun8i-a83t-ths.yaml     | 103 ++++++++++++++++++
> > >  1 file changed, 103 insertions(+)
> > >  create mode 100644 Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
> > >
> > > diff --git a/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml b/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
> > > new file mode 100644
> > > index 000000000000..e622f0a4be90
> > > --- /dev/null
> > > +++ b/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
> > > @@ -0,0 +1,103 @@
> > > +# SPDX-License-Identifier: GPL-2.0
> > > +%YAML 1.2
> > > +---
> > > +$id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
> > > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > > +
> > > +title: Allwinner SUN8I Thermal Controller Device Tree Bindings
> > > +
> > > +maintainers:
> > > +  - Yangtao Li <tiny.windzz@gmail.com>
> > > +
> > > +properties:
> > > +  compatible:
> > > +    oneOf:
> > > +      - const: allwinner,sun8i-a83t-ths
> > > +      - const: allwinner,sun8i-h3-ths
> > > +      - const: allwinner,sun8i-r40-ths
> > > +      - const: allwinner,sun50i-a64-ths
> > > +      - const: allwinner,sun50i-h5-ths
> > > +      - const: allwinner,sun50i-h6-ths
> > > +
> > > +  reg:
> > > +    maxItems: 1
> > > +
> > > +  interrupts:
> > > +    maxItems: 1
> > > +
> > > +  resets:
> > > +    maxItems: 1
> > > +
> > > +  clocks:
> > > +    minItems: 1
> > > +    maxItems: 2
> > > +
> > > +  clock-names:
> > > +    anyOf:
> > > +      - items:
> > > +        - const: bus
> > > +        - const: mod
> > > +      - items:
> > > +        - const: bus
> >
> > This can be:
> >
> > clock-names:
> >   minItems: 1
>
> Additionally, minItems should be 0, since A83T doesn't have bus clock/reset. And
> then there should be a special case for A83T too with min/maxItems = 0 for both
> resets and clocks.

That's why I removed clocks, clock-names and resets from required
properties. If they're present min/maxItems should be 1 and 2
accordingly.

> regards,
>         o.
>
> >   maxItems: 2
> >   items:
> >     - const: bus
> >     - const: mod
> >
> > And the length should be checked based on the compatible value, with
> > something like
> >
> > if:
> >   properties:
> >     compatible:
> >       contains:
> >         const: allwinner,sun50i-h6-ths
> >
> > then:
> >   properties:
> >     clocks:
> >       maxItems: 1
> >
> >     clock-names:
> >       maxItems: 1
> >
> > else:
> >   properties:
> >     clocks:
> >       maxItems: 2
> >
> >     clock-names:
> >       maxItems: 2
> >
> > > +
> > > +  '#thermal-sensor-cells':
> > > +    enum: [ 0, 1 ]
> > > +    description: |
> > > +      Definition depends on soc version:
> > > +
> > > +      For "allwinner,sun8i-h3-ths",
> > > +      value must be 0.
> > > +      For all other compatibles
> > > +      value must be 1.
> >
> > This should be checked using an if as well.
> >
> > > +
> > > +  nvmem-cells:
> > > +    maxItems: 1
> > > +    items:
> > > +      - description: Calibration data for thermal sensors
> >
> > You can drop the items and just move the description up one level,
> > under nvmem-cells
> >
> > > +
> > > +  nvmem-cell-names:
> > > +    items:
> > > +      - const: calibration
> >
> > Ditto for the const
> >
> > > +
> > > +required:
> > > +  - compatible
> > > +  - reg
> > > +  - interrupts
> > > +  - '#thermal-sensor-cells'
> >
> > Whether clocks, clock-names and resets are thereshould be check using
> > an if statement as well.
> >
> > > +
> > > +examples:
> > > +  - |
> > > +    ths_a83t: ths@1f04000 {
> >
> > You don't need the label at all, and the node name should be
> > temperature-sensor according to the DT spec, not ths. This applies to
> > all you examples.
> >
> > > +         compatible = "allwinner,sun8i-a83t-ths";
> > > +         reg = <0x01f04000 0x100>;
> > > +         interrupts = <0 31 0>;
> > > +         nvmem-cells = <&ths_calibration>;
> > > +         nvmem-cell-names = "calibration";
> > > +         #thermal-sensor-cells = <1>;
> > > +    };
> >
> > New line.
> >
> > Thanks!
> > Maxime
>
>
Vasily Khoruzhick Nov. 27, 2019, 8:23 p.m. UTC | #4
On Wed, Nov 27, 2019 at 9:44 AM Maxime Ripard <mripard@kernel.org> wrote:
>
> Hi,
>
> On Tue, Nov 26, 2019 at 09:29:30PM -0800, Vasily Khoruzhick wrote:
> > From: Yangtao Li <tiny.windzz@gmail.com>
> >
> > sun8i-thermal driver supports thermal sensor in wide range of Allwinner
> > SoCs. Add YAML schema for its bindings.
> >
> > Signed-off-by: Yangtao Li <tiny.windzz@gmail.com>
> > Signed-off-by: Vasily Khoruzhick <anarsoul@gmail.com>
> > ---
> >  .../thermal/allwinner,sun8i-a83t-ths.yaml     | 103 ++++++++++++++++++
> >  1 file changed, 103 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml b/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
> > new file mode 100644
> > index 000000000000..e622f0a4be90
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
> > @@ -0,0 +1,103 @@
> > +# SPDX-License-Identifier: GPL-2.0
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Allwinner SUN8I Thermal Controller Device Tree Bindings
> > +
> > +maintainers:
> > +  - Yangtao Li <tiny.windzz@gmail.com>
> > +
> > +properties:
> > +  compatible:
> > +    oneOf:
> > +      - const: allwinner,sun8i-a83t-ths
> > +      - const: allwinner,sun8i-h3-ths
> > +      - const: allwinner,sun8i-r40-ths
> > +      - const: allwinner,sun50i-a64-ths
> > +      - const: allwinner,sun50i-h5-ths
> > +      - const: allwinner,sun50i-h6-ths
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  interrupts:
> > +    maxItems: 1
> > +
> > +  resets:
> > +    maxItems: 1
> > +
> > +  clocks:
> > +    minItems: 1
> > +    maxItems: 2
> > +
> > +  clock-names:
> > +    anyOf:
> > +      - items:
> > +        - const: bus
> > +        - const: mod
> > +      - items:
> > +        - const: bus
>
> This can be:
>
> clock-names:
>   minItems: 1
>   maxItems: 2
>   items:
>     - const: bus
>     - const: mod
>
> And the length should be checked based on the compatible value, with
> something like
>
> if:
>   properties:
>     compatible:
>       contains:
>         const: allwinner,sun50i-h6-ths
>
> then:
>   properties:
>     clocks:
>       maxItems: 1
>
>     clock-names:
>       maxItems: 1
>
> else:
>   properties:
>     clocks:
>       maxItems: 2
>
>     clock-names:
>       maxItems: 2

OK, will do

> > +
> > +  '#thermal-sensor-cells':
> > +    enum: [ 0, 1 ]
> > +    description: |
> > +      Definition depends on soc version:
> > +
> > +      For "allwinner,sun8i-h3-ths",
> > +      value must be 0.
> > +      For all other compatibles
> > +      value must be 1.
>
> This should be checked using an if as well.

Will do.

> > +
> > +  nvmem-cells:
> > +    maxItems: 1
> > +    items:
> > +      - description: Calibration data for thermal sensors
>
> You can drop the items and just move the description up one level,
> under nvmem-cells

Will do.

> > +
> > +  nvmem-cell-names:
> > +    items:
> > +      - const: calibration
>
> Ditto for the const

Sorry, I don't quite get it. What exactly do you want me to do with
this one? nvmem-cell-names must be "calibration"

> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +  - interrupts
> > +  - '#thermal-sensor-cells'
>
> Whether clocks, clock-names and resets are thereshould be check using
> an if statement as well.

Will do

> > +
> > +examples:
> > +  - |
> > +    ths_a83t: ths@1f04000 {
>
> You don't need the label at all, and the node name should be
> temperature-sensor according to the DT spec, not ths. This applies to
> all you examples.

OK

> > +         compatible = "allwinner,sun8i-a83t-ths";
> > +         reg = <0x01f04000 0x100>;
> > +         interrupts = <0 31 0>;
> > +         nvmem-cells = <&ths_calibration>;
> > +         nvmem-cell-names = "calibration";
> > +         #thermal-sensor-cells = <1>;
> > +    };
>
> New line.

OK

>
> Thanks!
> Maxime
Maxime Ripard Nov. 28, 2019, 7:43 a.m. UTC | #5
On Wed, Nov 27, 2019 at 12:23:53PM -0800, Vasily Khoruzhick wrote:
> On Wed, Nov 27, 2019 at 9:44 AM Maxime Ripard <mripard@kernel.org> wrote:
> > > +
> > > +  nvmem-cell-names:
> > > +    items:
> > > +      - const: calibration
> >
> > Ditto for the const
>
> Sorry, I don't quite get it. What exactly do you want me to do with
> this one? nvmem-cell-names must be "calibration"

You don't need the items here either, this can be

nvmem-cell-names:
  const: calibration

Maxime
Yangtao Li Nov. 28, 2019, 2:35 p.m. UTC | #6
Hi,

How about this?

Best regards,
Yangtao
Yangtao Li Nov. 28, 2019, 2:45 p.m. UTC | #7
diff --git a/Documentation/devicetree/bindings/thermal/sun8i-thermal.yaml
b/Documentation/devicetree/bindings/thermal/sun8i-thermal.yaml
new file mode 100644
index 000000000000..1be32f09fcc8
--- /dev/null
+++ b/Documentation/devicetree/bindings/thermal/sun8i-thermal.yaml
@@ -0,0 +1,160 @@
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/thermal/sun8i-thermal.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Allwinner SUN8I Thermal Controller Device Tree Bindings
+
+maintainers:
+  - Yangtao Li <tiny.windzz@gmail.com>
+
+description: |-
+  This describes the device tree binding for the Allwinner thermal
+  controller which measures the on-SoC temperatures.
+
+properties:
+  compatible:
+    enum:
+      - allwinner,sun8i-a83t-ths
+      - allwinner,sun8i-h3-ths
+      - allwinner,sun8i-r40-ths
+      - allwinner,sun50i-a64-ths
+      - allwinner,sun50i-h5-ths
+      - allwinner,sun50i-h6-ths
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  clocks:
+    minItems: 1
+    maxItems: 2
+    items:
+      - description: ths bus clock
+      - description: ths mod clock
+
+  clock-names:
+    minItems: 1
+    maxItems: 2
+    items:
+      - const: bus
+      - const: mod
+
+  "#thermal-sensor-cells":
+    enum: [ 0, 1 ]
+
+  nvmem-cells:
+    description: ths calibrate data
+
+  nvmem-cell-names:
+    const: calibration
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - "#thermal-sensor-cells"
+
+allOf:
+  - if:
+      properties:
+        compatible:
+          contains:
+            enum:
+              - allwinner,sun8i-h3-ths
+              - allwinner,sun8i-r40-ths
+              - allwinner,sun50i-a64-ths
+              - allwinner,sun50i-h5-ths
+              - allwinner,sun50i-h6-ths
+
+    then:
+      properties:
+        resets:
+          minItems: 1
+          maxItems: 1
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: allwinner,sun50i-h6-ths
+
+    then:
+      properties:
+        clocks:
+          minItems: 1
+          maxItems: 1
+
+        clock-names:
+          minItems: 1
+          maxItems: 1
+
+    else:
+      if:
+        properties:
+          compatible:
+            contains:
+              enum:
+                - allwinner,sun8i-h3-ths
+                - allwinner,sun8i-r40-ths
+                - allwinner,sun50i-a64-ths
+                - allwinner,sun50i-h5-ths
+
+      then:
+        properties:
+          clocks:
+            minItems: 2
+            maxItems: 2
+
+          clock-names:
+            minItems: 2
+            maxItems: 2
+
+  - if:
+      properties:
+        compatible:
+          contains:
+            const: allwinner,sun8i-h3-ths
+
+    then:
+      properties:
+        "#thermal-sensor-cells":
+          const: 0
+
+    else:
+      properties:
+        "#thermal-sensor-cells":
+          const: 1
+
+additionalProperties: false
+
+examples:
+  - |
+    ths: ths@5070400 {
+        compatible = "allwinner,sun50i-h6-ths";
+        reg = <0x05070400 0x100>;
+        clocks = <&ccu 89>;
+        clock-names = "bus";
+        resets = <&ccu 36>;
+        interrupts = <0 15 4>;
+        nvmem-cells = <&tsen_calib>;
+        nvmem-cell-names = "calibration";
+        #thermal-sensor-cells = <1>;
+    };
+
+    sid: sid@3006000 {
+        compatible = "allwinner,sun50i-h6-sid";
+        reg = <0x03006000 0x400>;
+        #address-cells = <1>;
+        #size-cells = <1>;
+        tsen_calib: calib@14 {
+                reg = <0x14 6>;
+        };
+    };
+...

On Thu, Nov 28, 2019 at 10:35 PM Frank Lee <tiny.windzz@gmail.com> wrote:
>
> Hi,
>
> How about this?
>
> Best regards,
> Yangtao
Vasily Khoruzhick Nov. 28, 2019, 4:24 p.m. UTC | #8
On Thu, Nov 28, 2019 at 6:45 AM Frank Lee <tiny.windzz@gmail.com> wrote:

Hey Yangtao,

I've already addressed all the comments and fixed patchset is sitting
in https://github.com/anarsoul/linux-2.6/tree/ths-5.4

I'll rebase and submit new version after merge window is closed (in ~1.5 weeks?)

Regards,
Vasily

> diff --git a/Documentation/devicetree/bindings/thermal/sun8i-thermal.yaml
> b/Documentation/devicetree/bindings/thermal/sun8i-thermal.yaml
> new file mode 100644
> index 000000000000..1be32f09fcc8
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/thermal/sun8i-thermal.yaml
> @@ -0,0 +1,160 @@
> +# SPDX-License-Identifier: GPL-2.0
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/thermal/sun8i-thermal.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Allwinner SUN8I Thermal Controller Device Tree Bindings
> +
> +maintainers:
> +  - Yangtao Li <tiny.windzz@gmail.com>
> +
> +description: |-
> +  This describes the device tree binding for the Allwinner thermal
> +  controller which measures the on-SoC temperatures.
> +
> +properties:
> +  compatible:
> +    enum:
> +      - allwinner,sun8i-a83t-ths
> +      - allwinner,sun8i-h3-ths
> +      - allwinner,sun8i-r40-ths
> +      - allwinner,sun50i-a64-ths
> +      - allwinner,sun50i-h5-ths
> +      - allwinner,sun50i-h6-ths
> +
> +  reg:
> +    maxItems: 1
> +
> +  interrupts:
> +    maxItems: 1
> +
> +  resets:
> +    maxItems: 1
> +
> +  clocks:
> +    minItems: 1
> +    maxItems: 2
> +    items:
> +      - description: ths bus clock
> +      - description: ths mod clock
> +
> +  clock-names:
> +    minItems: 1
> +    maxItems: 2
> +    items:
> +      - const: bus
> +      - const: mod
> +
> +  "#thermal-sensor-cells":
> +    enum: [ 0, 1 ]
> +
> +  nvmem-cells:
> +    description: ths calibrate data
> +
> +  nvmem-cell-names:
> +    const: calibration
> +
> +required:
> +  - compatible
> +  - reg
> +  - interrupts
> +  - "#thermal-sensor-cells"
> +
> +allOf:
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            enum:
> +              - allwinner,sun8i-h3-ths
> +              - allwinner,sun8i-r40-ths
> +              - allwinner,sun50i-a64-ths
> +              - allwinner,sun50i-h5-ths
> +              - allwinner,sun50i-h6-ths
> +
> +    then:
> +      properties:
> +        resets:
> +          minItems: 1
> +          maxItems: 1
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: allwinner,sun50i-h6-ths
> +
> +    then:
> +      properties:
> +        clocks:
> +          minItems: 1
> +          maxItems: 1
> +
> +        clock-names:
> +          minItems: 1
> +          maxItems: 1
> +
> +    else:
> +      if:
> +        properties:
> +          compatible:
> +            contains:
> +              enum:
> +                - allwinner,sun8i-h3-ths
> +                - allwinner,sun8i-r40-ths
> +                - allwinner,sun50i-a64-ths
> +                - allwinner,sun50i-h5-ths
> +
> +      then:
> +        properties:
> +          clocks:
> +            minItems: 2
> +            maxItems: 2
> +
> +          clock-names:
> +            minItems: 2
> +            maxItems: 2
> +
> +  - if:
> +      properties:
> +        compatible:
> +          contains:
> +            const: allwinner,sun8i-h3-ths
> +
> +    then:
> +      properties:
> +        "#thermal-sensor-cells":
> +          const: 0
> +
> +    else:
> +      properties:
> +        "#thermal-sensor-cells":
> +          const: 1
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    ths: ths@5070400 {
> +        compatible = "allwinner,sun50i-h6-ths";
> +        reg = <0x05070400 0x100>;
> +        clocks = <&ccu 89>;
> +        clock-names = "bus";
> +        resets = <&ccu 36>;
> +        interrupts = <0 15 4>;
> +        nvmem-cells = <&tsen_calib>;
> +        nvmem-cell-names = "calibration";
> +        #thermal-sensor-cells = <1>;
> +    };
> +
> +    sid: sid@3006000 {
> +        compatible = "allwinner,sun50i-h6-sid";
> +        reg = <0x03006000 0x400>;
> +        #address-cells = <1>;
> +        #size-cells = <1>;
> +        tsen_calib: calib@14 {
> +                reg = <0x14 6>;
> +        };
> +    };
> +...
>
> On Thu, Nov 28, 2019 at 10:35 PM Frank Lee <tiny.windzz@gmail.com> wrote:
> >
> > Hi,
> >
> > How about this?
> >
> > Best regards,
> > Yangtao
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml b/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
new file mode 100644
index 000000000000..e622f0a4be90
--- /dev/null
+++ b/Documentation/devicetree/bindings/thermal/allwinner,sun8i-a83t-ths.yaml
@@ -0,0 +1,103 @@ 
+# SPDX-License-Identifier: GPL-2.0
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/thermal/allwinner,sun8i-a83t-ths.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Allwinner SUN8I Thermal Controller Device Tree Bindings
+
+maintainers:
+  - Yangtao Li <tiny.windzz@gmail.com>
+
+properties:
+  compatible:
+    oneOf:
+      - const: allwinner,sun8i-a83t-ths
+      - const: allwinner,sun8i-h3-ths
+      - const: allwinner,sun8i-r40-ths
+      - const: allwinner,sun50i-a64-ths
+      - const: allwinner,sun50i-h5-ths
+      - const: allwinner,sun50i-h6-ths
+
+  reg:
+    maxItems: 1
+
+  interrupts:
+    maxItems: 1
+
+  resets:
+    maxItems: 1
+
+  clocks:
+    minItems: 1
+    maxItems: 2
+
+  clock-names:
+    anyOf:
+      - items:
+        - const: bus
+        - const: mod
+      - items:
+        - const: bus
+
+  '#thermal-sensor-cells':
+    enum: [ 0, 1 ]
+    description: |
+      Definition depends on soc version:
+
+      For "allwinner,sun8i-h3-ths",
+      value must be 0.
+      For all other compatibles
+      value must be 1.
+
+  nvmem-cells:
+    maxItems: 1
+    items:
+      - description: Calibration data for thermal sensors
+
+  nvmem-cell-names:
+    items:
+      - const: calibration
+
+required:
+  - compatible
+  - reg
+  - interrupts
+  - '#thermal-sensor-cells'
+
+examples:
+  - |
+    ths_a83t: ths@1f04000 {
+         compatible = "allwinner,sun8i-a83t-ths";
+         reg = <0x01f04000 0x100>;
+         interrupts = <0 31 0>;
+         nvmem-cells = <&ths_calibration>;
+         nvmem-cell-names = "calibration";
+         #thermal-sensor-cells = <1>;
+    };
+  - |
+    ths_h3: ths@1c25000 {
+         compatible = "allwinner,sun8i-h3-ths";
+         reg = <0x01c25000 0x400>;
+         clocks = <&ccu 0>, <&ccu 1>;
+         clock-names = "bus", "mod";
+         resets = <&ccu 2>;
+         interrupts = <0 31 0>;
+         nvmem-cells = <&ths_calibration>;
+         nvmem-cell-names = "calibration";
+         #thermal-sensor-cells = <0>;
+    };
+  - |
+    ths_h6: ths@5070400 {
+         compatible = "allwinner,sun50i-h6-ths";
+         reg = <0x05070400 0x100>;
+         clocks = <&ccu 0>;
+         clock-names = "bus";
+         resets = <&ccu 2>;
+         interrupts = <0 15 0>;
+         nvmem-cells = <&ths_calibration>;
+         nvmem-cell-names = "calibration";
+         #thermal-sensor-cells = <1>;
+    };
+
+...