[v7,1/2] dt-bindings: hwmon: Add TMP512/513
diff mbox series

Message ID 20191111203445.27130-2-etremblay@distech-controls.com
State Changes Requested
Headers show
Series
  • hwmon: Add driver for Texas Instruments TMP512/513 sensor chips.
Related show

Checks

Context Check Description
robh/dt-meta-schema fail build log
robh/checkpatch success

Commit Message

Eric Tremblay Nov. 11, 2019, 8:34 p.m. UTC
From: Eric Tremblay <etremblay@distech-controls.com>

Document the TMP513/512 device devicetree bindings

Signed-off-by: Eric Tremblay <etremblay@distech-controls.com>
---
 .../devicetree/bindings/hwmon/ti,tmp513.yaml  | 89 +++++++++++++++++++
 1 file changed, 89 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml

Comments

Rob Herring Nov. 12, 2019, 1:03 a.m. UTC | #1
On Mon, Nov 11, 2019 at 03:34:44PM -0500, etremblay@distech-controls.com wrote:
> From: Eric Tremblay <etremblay@distech-controls.com>
> 
> Document the TMP513/512 device devicetree bindings
> 
> Signed-off-by: Eric Tremblay <etremblay@distech-controls.com>
> ---
>  .../devicetree/bindings/hwmon/ti,tmp513.yaml  | 89 +++++++++++++++++++
>  1 file changed, 89 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml b/Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml
> new file mode 100644
> index 000000000000..de4ed3645e0f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml
> @@ -0,0 +1,89 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +
> +$id: http://devicetree.org/schemas/hwmon/ti,tmp513.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: TMP513/512 system monitor sensor
> +
> +maintainers:
> +  - Eric Tremblay <etremblay@distech-controls.com>
> +
> +description: |
> +  This driver implements support for Texas Instruments TMP512, and TMP513.
> +  The TMP512 (dual-channel) and TMP513 (triple-channel) are system monitors
> +  that include remote sensors, a local temperature sensor, and a high-side
> +  current shunt monitor. These system monitors have the capability of measuring
> +  remote temperatures, on-chip temperatures, and system voltage/power/current
> +  consumption.
> +
> +  Datasheets:
> +  http://www.ti.com/lit/gpn/tmp513
> +  http://www.ti.com/lit/gpn/tmp512
> +
> +
> +properties:
> +  compatible:
> +    enum:
> +      - ti,tmp512
> +      - ti,tmp513
> +
> +  reg:
> +    maxItems: 1
> +
> +  shunt-resistor-micro-ohms:
> +    description: |
> +      If 0, the calibration process will be skiped and the current and power
> +      measurement engine will not work. Temperature and voltage measurement
> +      will continue to work. The shunt value also need to respect:
> +      rshunt <= pga-gain * 40 * 1000 * 1000.
> +      If not, it's not possible to compute a valid calibration value.
> +    default: 1000
> +
> +  ti,pga-gain:
> +    description: |
> +      The gain value for the PGA function. This is 8, 4, 2 or 1.
> +      The PGA gain affect the shunt voltage range.
> +      The range will be equal to: pga-gain * 40mV
> +    allOf:
> +      - $ref: /schemas/types.yaml#/definitions/uint32
> +    enum: [1, 2, 4, 8]
> +    default: 8
> +
> +  ti,bus-range-microvolt:
> +    description: |
> +      This is the operating range of the bus voltage in microvolt
> +    allOf:
> +      - $ref: /schemas/types.yaml#/definitions/uint32
> +    enum: [16000000, 32000000]
> +    default: 32000000
> +
> +  ti,nfactor:
> +    description: |
> +      Array of three(TMP513) or two(TMP512) n-Factor value for each remote
> +      temperature channel.
> +      See datasheet Table 11 for n-Factor range list and value interpretation.
> +    allOf:
> +      - $ref: /schemas/types.yaml#definitions/uint8-array
> +      - minItems: 2
> +        maxItems: 3
> +        items:
> +          default: 0
> +
> +required:
> +  - compatible
> +  - reg
> +
> +examples:
> +  - |
> +    i2c {

'make dt_binding_check' fails. You need #address-cells and #size-cells 
in here:

Documentation/devicetree/bindings/hwmon/ti,tmp513.example.dts:20.17-30: Warning (reg_format): /example-0/i2c/tmp513@5c:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
Documentation/devicetree/bindings/hwmon/ti,tmp513.example.dt.yaml: Warning (pci_device_bus_num): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/hwmon/ti,tmp513.example.dts:17.5-26.11: Warning (i2c_bus_bridge): /example-0/i2c: incorrect #address-cells for I2C bus
Documentation/devicetree/bindings/hwmon/ti,tmp513.example.dts:17.5-26.11: Warning (i2c_bus_bridge): /example-0/i2c: incorrect #size-cells for I2C bus
Documentation/devicetree/bindings/hwmon/ti,tmp513.example.dt.yaml: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/hwmon/ti,tmp513.example.dt.yaml: Warning (i2c_bus_reg): Failed prerequisite 'i2c_bus_bridge'
Documentation/devicetree/bindings/hwmon/ti,tmp513.example.dt.yaml: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
Documentation/devicetree/bindings/hwmon/ti,tmp513.example.dts:18.23-25.15: 
Warning (avoid_default_addr_size): /example-0/i2c/tmp513@5c: Relying on default #address-cells value
Documentation/devicetree/bindings/hwmon/ti,tmp513.example.dts:18.23-25.15: Warning (avoid_default_addr_size): /example-0/i2c/tmp513@5c: Relying on default #size-cells value

> +        tmp513@5c {
> +            compatible = "ti,tmp513";
> +            reg = <0x5C>;
> +            shunt-resistor-micro-ohms = <330000>;
> +            ti,bus-range-microvolt = <32000000>;
> +            ti,pga-gain = <8>;
> +            ti,nfactor = [01 F3 00];
> +        };
> +    };
> -- 
> 2.17.1
>
Guenter Roeck Nov. 12, 2019, 1:45 a.m. UTC | #2
On 11/11/19 12:34 PM, etremblay@distech-controls.com wrote:
> From: Eric Tremblay <etremblay@distech-controls.com>
> 
> Document the TMP513/512 device devicetree bindings
> 
> Signed-off-by: Eric Tremblay <etremblay@distech-controls.com>
> ---
>   .../devicetree/bindings/hwmon/ti,tmp513.yaml  | 89 +++++++++++++++++++
>   1 file changed, 89 insertions(+)
>   create mode 100644 Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml b/Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml
> new file mode 100644
> index 000000000000..de4ed3645e0f
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml
> @@ -0,0 +1,89 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +
> +$id: http://devicetree.org/schemas/hwmon/ti,tmp513.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: TMP513/512 system monitor sensor
> +
> +maintainers:
> +  - Eric Tremblay <etremblay@distech-controls.com>
> +
> +description: |
> +  This driver implements support for Texas Instruments TMP512, and TMP513.

I think this needs some rewording. This is not a driver description, but
a system description.

> +  The TMP512 (dual-channel) and TMP513 (triple-channel) are system monitors
> +  that include remote sensors, a local temperature sensor, and a high-side
> +  current shunt monitor. These system monitors have the capability of measuring
> +  remote temperatures, on-chip temperatures, and system voltage/power/current
> +  consumption.
> +
> +  Datasheets:
> +  http://www.ti.com/lit/gpn/tmp513
> +  http://www.ti.com/lit/gpn/tmp512
> +
> +
> +properties:
> +  compatible:
> +    enum:
> +      - ti,tmp512
> +      - ti,tmp513
> +
> +  reg:
> +    maxItems: 1
> +
> +  shunt-resistor-micro-ohms:
> +    description: |
> +      If 0, the calibration process will be skiped and the current and power
> +      measurement engine will not work. Temperature and voltage measurement
> +      will continue to work. The shunt value also need to respect:
> +      rshunt <= pga-gain * 40 * 1000 * 1000.
> +      If not, it's not possible to compute a valid calibration value.
> +    default: 1000
> +
> +  ti,pga-gain:
> +    description: |
> +      The gain value for the PGA function. This is 8, 4, 2 or 1.
> +      The PGA gain affect the shunt voltage range.
> +      The range will be equal to: pga-gain * 40mV
> +    allOf:
> +      - $ref: /schemas/types.yaml#/definitions/uint32
> +    enum: [1, 2, 4, 8]
> +    default: 8
> +
> +  ti,bus-range-microvolt:
> +    description: |
> +      This is the operating range of the bus voltage in microvolt
> +    allOf:
> +      - $ref: /schemas/types.yaml#/definitions/uint32
> +    enum: [16000000, 32000000]
> +    default: 32000000
> +
> +  ti,nfactor:
> +    description: |
> +      Array of three(TMP513) or two(TMP512) n-Factor value for each remote
> +      temperature channel.
> +      See datasheet Table 11 for n-Factor range list and value interpretation.
> +    allOf:
> +      - $ref: /schemas/types.yaml#definitions/uint8-array
> +      - minItems: 2
> +        maxItems: 3
> +        items:
> +          default: 0
> +
> +required:
> +  - compatible
> +  - reg
> +
> +examples:
> +  - |
> +    i2c {
> +        tmp513@5c {
> +            compatible = "ti,tmp513";
> +            reg = <0x5C>;
> +            shunt-resistor-micro-ohms = <330000>;
> +            ti,bus-range-microvolt = <32000000>;
> +            ti,pga-gain = <8>;
> +            ti,nfactor = [01 F3 00];
> +        };
> +    };
>
Eric Tremblay Nov. 12, 2019, 2:40 p.m. UTC | #3
> From: Guenter Roeck <groeck7@gmail.com> On Behalf Of Guenter Roeck
> Sent: Monday, November 11, 2019 8:45 PM
> To: Tremblay, Eric <etremblay@distech-controls.com>; linux-hwmon@vger.kernel.org; devicetree@vger.kernel.org; linux-
> doc@vger.kernel.org
> Cc: jdelvare@suse.com; robh+dt@kernel.org; mark.rutland@arm.com; corbet@lwn.net
> Subject: Re: [PATCH v7 1/2] dt-bindings: hwmon: Add TMP512/513
> 
> On 11/11/19 12:34 PM, etremblay@distech-controls.com wrote:
> > From: Eric Tremblay <etremblay@distech-controls.com>
> >
> > Document the TMP513/512 device devicetree bindings
> >
> > Signed-off-by: Eric Tremblay <etremblay@distech-controls.com>
> > ---
> >   .../devicetree/bindings/hwmon/ti,tmp513.yaml  | 89 +++++++++++++++++++
> >   1 file changed, 89 insertions(+)
> >   create mode 100644
> > Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml
> > b/Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml
> > new file mode 100644
> > index 000000000000..de4ed3645e0f
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml
> > @@ -0,0 +1,89 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) %YAML 1.2
> > +---
> > +
> > +$id:
> > +https://urldefense.proofpoint.com/v2/url?u=http-3A__devicetree.org_sc
> > +hemas_hwmon_ti-2Ctmp513.yaml-23&d=DwICaQ&c=tvvHx3uC0XdtgG-ImPDjfM0Qna
> > +kIsmmGcwejQDVxD-g&r=y34zLl9_AvBy5NSrvskG6SFbiKoCzI99WW2xhKlsVV4&m=d33
> > +wBKig7BZ0kss0OOUmmNbl5HWsWnMBDtfFv5-rsXo&s=KeOmfQeqUEi1WkJCgcjnWTIIsS
> > +kzY2hiRajIVVkq-lc&e=
> > +$schema:
> > +https://urldefense.proofpoint.com/v2/url?u=http-3A__devicetree.org_me
> > +ta-2Dschemas_core.yaml-23&d=DwICaQ&c=tvvHx3uC0XdtgG-ImPDjfM0QnakIsmmG
> > +cwejQDVxD-g&r=y34zLl9_AvBy5NSrvskG6SFbiKoCzI99WW2xhKlsVV4&m=d33wBKig7
> > +BZ0kss0OOUmmNbl5HWsWnMBDtfFv5-rsXo&s=Nel6OcDfyv8xWX3hGYbELKfEo9XLEwL7
> > +lVrzLKHcB6E&e=
> > +
> > +title: TMP513/512 system monitor sensor
> > +
> > +maintainers:
> > +  - Eric Tremblay <etremblay@distech-controls.com>
> > +
> > +description: |
> > +  This driver implements support for Texas Instruments TMP512, and TMP513.
> 
> I think this needs some rewording. This is not a driver description, but a system description.

Ok, I will only keep the chip description.
> 
> > +  The TMP512 (dual-channel) and TMP513 (triple-channel) are system
> > + monitors  that include remote sensors, a local temperature sensor,
> > + and a high-side  current shunt monitor. These system monitors have
> > + the capability of measuring  remote temperatures, on-chip
> > + temperatures, and system voltage/power/current  consumption.
> > +
> > +  Datasheets:
> > +
> > + https://urldefense.proofpoint.com/v2/url?u=http-3A__www.ti.com_lit_g
> > + pn_tmp513&d=DwICaQ&c=tvvHx3uC0XdtgG-ImPDjfM0QnakIsmmGcwejQDVxD-g&r=y
> > + 34zLl9_AvBy5NSrvskG6SFbiKoCzI99WW2xhKlsVV4&m=d33wBKig7BZ0kss0OOUmmNb
> > + l5HWsWnMBDtfFv5-rsXo&s=7QkDr8n0JXPVmCGRf6jhQPK9h4ECRFMfZJrqttVxWG8&e
> > + =
> > + https://urldefense.proofpoint.com/v2/url?u=http-3A__www.ti.com_lit_g
> > + pn_tmp512&d=DwICaQ&c=tvvHx3uC0XdtgG-ImPDjfM0QnakIsmmGcwejQDVxD-g&r=y
> > + 34zLl9_AvBy5NSrvskG6SFbiKoCzI99WW2xhKlsVV4&m=d33wBKig7BZ0kss0OOUmmNb
> > + l5HWsWnMBDtfFv5-rsXo&s=2c47z9hddR3vxWAytRxK08SO939Tsi12ePH1uGK_oII&e
> > + =
> > +
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - ti,tmp512
> > +      - ti,tmp513
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  shunt-resistor-micro-ohms:
> > +    description: |
> > +      If 0, the calibration process will be skiped and the current and power
> > +      measurement engine will not work. Temperature and voltage measurement
> > +      will continue to work. The shunt value also need to respect:
> > +      rshunt <= pga-gain * 40 * 1000 * 1000.
> > +      If not, it's not possible to compute a valid calibration value.
> > +    default: 1000
> > +
> > +  ti,pga-gain:
> > +    description: |
> > +      The gain value for the PGA function. This is 8, 4, 2 or 1.
> > +      The PGA gain affect the shunt voltage range.
> > +      The range will be equal to: pga-gain * 40mV
> > +    allOf:
> > +      - $ref: /schemas/types.yaml#/definitions/uint32
> > +    enum: [1, 2, 4, 8]
> > +    default: 8
> > +
> > +  ti,bus-range-microvolt:
> > +    description: |
> > +      This is the operating range of the bus voltage in microvolt
> > +    allOf:
> > +      - $ref: /schemas/types.yaml#/definitions/uint32
> > +    enum: [16000000, 32000000]
> > +    default: 32000000
> > +
> > +  ti,nfactor:
> > +    description: |
> > +      Array of three(TMP513) or two(TMP512) n-Factor value for each remote
> > +      temperature channel.
> > +      See datasheet Table 11 for n-Factor range list and value interpretation.
> > +    allOf:
> > +      - $ref: /schemas/types.yaml#definitions/uint8-array
> > +      - minItems: 2
> > +        maxItems: 3
> > +        items:
> > +          default: 0
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +
> > +examples:
> > +  - |
> > +    i2c {
> > +        tmp513@5c {
> > +            compatible = "ti,tmp513";
> > +            reg = <0x5C>;
> > +            shunt-resistor-micro-ohms = <330000>;
> > +            ti,bus-range-microvolt = <32000000>;
> > +            ti,pga-gain = <8>;
> > +            ti,nfactor = [01 F3 00];
> > +        };
> > +    };
> >
Eric Tremblay Nov. 12, 2019, 3:01 p.m. UTC | #4
> From: Rob Herring <robh@kernel.org>
> Sent: Monday, November 11, 2019 8:04 PM
> To: Tremblay, Eric <etremblay@distech-controls.com>
> Cc: linux@roeck-us.net; linux-hwmon@vger.kernel.org; devicetree@vger.kernel.org; linux-doc@vger.kernel.org;
> jdelvare@suse.com; mark.rutland@arm.com; corbet@lwn.net
> Subject: Re: [PATCH v7 1/2] dt-bindings: hwmon: Add TMP512/513
> 
> On Mon, Nov 11, 2019 at 03:34:44PM -0500, etremblay@distech-controls.com wrote:
> > From: Eric Tremblay <etremblay@distech-controls.com>
> >
> > Document the TMP513/512 device devicetree bindings
> >
> > Signed-off-by: Eric Tremblay <etremblay@distech-controls.com>
> > ---
> >  .../devicetree/bindings/hwmon/ti,tmp513.yaml  | 89
> > +++++++++++++++++++
> >  1 file changed, 89 insertions(+)
> >  create mode 100644
> > Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml
> > b/Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml
> > new file mode 100644
> > index 000000000000..de4ed3645e0f
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml
> > @@ -0,0 +1,89 @@
> > +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) %YAML 1.2
> > +---
> > +
> > +$id:
> > +https://urldefense.proofpoint.com/v2/url?u=http-3A__devicetree.org_sc
> > +hemas_hwmon_ti-2Ctmp513.yaml-23&d=DwIBAg&c=tvvHx3uC0XdtgG-ImPDjfM0Qna
> > +kIsmmGcwejQDVxD-g&r=y34zLl9_AvBy5NSrvskG6SFbiKoCzI99WW2xhKlsVV4&m=sqT
> > +mLsfhqAI5ubkZyE2FvNS0zZ42lJ4Xsiyf12MKPbI&s=cqxgi-ff4mlqg1dH-w0rmoWT9T
> > +G9UEzI4jP4boAzSTQ&e=
> > +$schema:
> > +https://urldefense.proofpoint.com/v2/url?u=http-3A__devicetree.org_me
> > +ta-2Dschemas_core.yaml-23&d=DwIBAg&c=tvvHx3uC0XdtgG-ImPDjfM0QnakIsmmG
> > +cwejQDVxD-g&r=y34zLl9_AvBy5NSrvskG6SFbiKoCzI99WW2xhKlsVV4&m=sqTmLsfhq
> > +AI5ubkZyE2FvNS0zZ42lJ4Xsiyf12MKPbI&s=MFdE05g19en41dOAGudb8oQzrSKdBS_5
> > +uhKXoz3xbfM&e=
> > +
> > +title: TMP513/512 system monitor sensor
> > +
> > +maintainers:
> > +  - Eric Tremblay <etremblay@distech-controls.com>
> > +
> > +description: |
> > +  This driver implements support for Texas Instruments TMP512, and TMP513.
> > +  The TMP512 (dual-channel) and TMP513 (triple-channel) are system
> > +monitors
> > +  that include remote sensors, a local temperature sensor, and a
> > +high-side
> > +  current shunt monitor. These system monitors have the capability of
> > +measuring
> > +  remote temperatures, on-chip temperatures, and system
> > +voltage/power/current
> > +  consumption.
> > +
> > +  Datasheets:
> > +
> > + https://urldefense.proofpoint.com/v2/url?u=http-3A__www.ti.com_lit_g
> > + pn_tmp513&d=DwIBAg&c=tvvHx3uC0XdtgG-ImPDjfM0QnakIsmmGcwejQDVxD-g&r=y
> > + 34zLl9_AvBy5NSrvskG6SFbiKoCzI99WW2xhKlsVV4&m=sqTmLsfhqAI5ubkZyE2FvNS
> > + 0zZ42lJ4Xsiyf12MKPbI&s=aRuMhzI-UQfQORXhmK3OaA7UZ_6segIbgQ4k5SoKF0E&e
> > + =
> > + https://urldefense.proofpoint.com/v2/url?u=http-3A__www.ti.com_lit_g
> > + pn_tmp512&d=DwIBAg&c=tvvHx3uC0XdtgG-ImPDjfM0QnakIsmmGcwejQDVxD-g&r=y
> > + 34zLl9_AvBy5NSrvskG6SFbiKoCzI99WW2xhKlsVV4&m=sqTmLsfhqAI5ubkZyE2FvNS
> > + 0zZ42lJ4Xsiyf12MKPbI&s=mMNKG3dkkscHl5e73jC-ESFBdu05NhcCuJ-Pfpwls7E&e
> > + =
> > +
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - ti,tmp512
> > +      - ti,tmp513
> > +
> > +  reg:
> > +    maxItems: 1
> > +
> > +  shunt-resistor-micro-ohms:
> > +    description: |
> > +      If 0, the calibration process will be skiped and the current and power
> > +      measurement engine will not work. Temperature and voltage measurement
> > +      will continue to work. The shunt value also need to respect:
> > +      rshunt <= pga-gain * 40 * 1000 * 1000.
> > +      If not, it's not possible to compute a valid calibration value.
> > +    default: 1000
> > +
> > +  ti,pga-gain:
> > +    description: |
> > +      The gain value for the PGA function. This is 8, 4, 2 or 1.
> > +      The PGA gain affect the shunt voltage range.
> > +      The range will be equal to: pga-gain * 40mV
> > +    allOf:
> > +      - $ref: /schemas/types.yaml#/definitions/uint32
> > +    enum: [1, 2, 4, 8]
> > +    default: 8
> > +
> > +  ti,bus-range-microvolt:
> > +    description: |
> > +      This is the operating range of the bus voltage in microvolt
> > +    allOf:
> > +      - $ref: /schemas/types.yaml#/definitions/uint32
> > +    enum: [16000000, 32000000]
> > +    default: 32000000
> > +
> > +  ti,nfactor:
> > +    description: |
> > +      Array of three(TMP513) or two(TMP512) n-Factor value for each remote
> > +      temperature channel.
> > +      See datasheet Table 11 for n-Factor range list and value interpretation.
> > +    allOf:
> > +      - $ref: /schemas/types.yaml#definitions/uint8-array
> > +      - minItems: 2
> > +        maxItems: 3
> > +        items:
> > +          default: 0
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +
> > +examples:
> > +  - |
> > +    i2c {
> 
> 'make dt_binding_check' fails. You need #address-cells and #size-cells in here:
> 
> Documentation/devicetree/bindings/hwmon/ti,tmp513.example.dts:20.17-30: Warning (reg_format): /example-
> 0/i2c/tmp513@5c:reg: property has invalid length (4 bytes) (#address-cells == 2, #size-cells == 1)
> Documentation/devicetree/bindings/hwmon/ti,tmp513.example.dt.yaml: Warning (pci_device_bus_num): Failed prerequisite
> 'reg_format'
> Documentation/devicetree/bindings/hwmon/ti,tmp513.example.dts:17.5-26.11: Warning (i2c_bus_bridge): /example-0/i2c: incorrect
> #address-cells for I2C bus
> Documentation/devicetree/bindings/hwmon/ti,tmp513.example.dts:17.5-26.11: Warning (i2c_bus_bridge): /example-0/i2c: incorrect
> #size-cells for I2C bus
> Documentation/devicetree/bindings/hwmon/ti,tmp513.example.dt.yaml: Warning (i2c_bus_reg): Failed prerequisite 'reg_format'
> Documentation/devicetree/bindings/hwmon/ti,tmp513.example.dt.yaml: Warning (i2c_bus_reg): Failed prerequisite 'i2c_bus_bridge'
> Documentation/devicetree/bindings/hwmon/ti,tmp513.example.dt.yaml: Warning (spi_bus_reg): Failed prerequisite 'reg_format'
> Documentation/devicetree/bindings/hwmon/ti,tmp513.example.dts:18.23-25.15:
> Warning (avoid_default_addr_size): /example-0/i2c/tmp513@5c: Relying on default #address-cells value
> Documentation/devicetree/bindings/hwmon/ti,tmp513.example.dts:18.23-25.15: Warning (avoid_default_addr_size): /example-
> 0/i2c/tmp513@5c: Relying on default #size-cells value

Sorry I was confused a little by the documentation. I did not saw that I could run `make dt_binding_check' on a single file.

I ran it on my tree and it gives me a warning on another file. I wrongly assume that it ran all over the tree.

I`ll fix those issue.

Thanks
> 
> > +        tmp513@5c {
> > +            compatible = "ti,tmp513";
> > +            reg = <0x5C>;
> > +            shunt-resistor-micro-ohms = <330000>;
> > +            ti,bus-range-microvolt = <32000000>;
> > +            ti,pga-gain = <8>;
> > +            ti,nfactor = [01 F3 00];
> > +        };
> > +    };
> > --
> > 2.17.1
> >

Patch
diff mbox series

diff --git a/Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml b/Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml
new file mode 100644
index 000000000000..de4ed3645e0f
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/ti,tmp513.yaml
@@ -0,0 +1,89 @@ 
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+
+$id: http://devicetree.org/schemas/hwmon/ti,tmp513.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: TMP513/512 system monitor sensor
+
+maintainers:
+  - Eric Tremblay <etremblay@distech-controls.com>
+
+description: |
+  This driver implements support for Texas Instruments TMP512, and TMP513.
+  The TMP512 (dual-channel) and TMP513 (triple-channel) are system monitors
+  that include remote sensors, a local temperature sensor, and a high-side
+  current shunt monitor. These system monitors have the capability of measuring
+  remote temperatures, on-chip temperatures, and system voltage/power/current
+  consumption.
+
+  Datasheets:
+  http://www.ti.com/lit/gpn/tmp513
+  http://www.ti.com/lit/gpn/tmp512
+
+
+properties:
+  compatible:
+    enum:
+      - ti,tmp512
+      - ti,tmp513
+
+  reg:
+    maxItems: 1
+
+  shunt-resistor-micro-ohms:
+    description: |
+      If 0, the calibration process will be skiped and the current and power
+      measurement engine will not work. Temperature and voltage measurement
+      will continue to work. The shunt value also need to respect:
+      rshunt <= pga-gain * 40 * 1000 * 1000.
+      If not, it's not possible to compute a valid calibration value.
+    default: 1000
+
+  ti,pga-gain:
+    description: |
+      The gain value for the PGA function. This is 8, 4, 2 or 1.
+      The PGA gain affect the shunt voltage range.
+      The range will be equal to: pga-gain * 40mV
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [1, 2, 4, 8]
+    default: 8
+
+  ti,bus-range-microvolt:
+    description: |
+      This is the operating range of the bus voltage in microvolt
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [16000000, 32000000]
+    default: 32000000
+
+  ti,nfactor:
+    description: |
+      Array of three(TMP513) or two(TMP512) n-Factor value for each remote
+      temperature channel.
+      See datasheet Table 11 for n-Factor range list and value interpretation.
+    allOf:
+      - $ref: /schemas/types.yaml#definitions/uint8-array
+      - minItems: 2
+        maxItems: 3
+        items:
+          default: 0
+
+required:
+  - compatible
+  - reg
+
+examples:
+  - |
+    i2c {
+        tmp513@5c {
+            compatible = "ti,tmp513";
+            reg = <0x5C>;
+            shunt-resistor-micro-ohms = <330000>;
+            ti,bus-range-microvolt = <32000000>;
+            ti,pga-gain = <8>;
+            ti,nfactor = [01 F3 00];
+        };
+    };