diff mbox series

[v3,2/2] dt-bindings: hwmon: Add ltc2947 documentation

Message ID 20191021154115.319073-2-nuno.sa@analog.com (mailing list archive)
State Accepted
Headers show
Series [v3,1/2] hwmon: Add support for ltc2947 | expand

Commit Message

Nuno Sa Oct. 21, 2019, 3:41 p.m. UTC
Document the LTC2947 device devicetree bindings.

Signed-off-by: Nuno Sá <nuno.sa@analog.com>
---
Changes in v2:
 * Add license identifier;
 * Fix the uint32-array properties;
 * Set maximum at the same indent as allOf in adi,accumulation-deadband-microamp;
 * Set enum at the same indent as allOf in adi,gpio-out-pol;
 * Use spi instead of spi0 on the example;

Changes in v3:
 * Nothing changed.

 .../bindings/hwmon/adi,ltc2947.yaml           | 104 ++++++++++++++++++
 MAINTAINERS                                   |   1 +
 2 files changed, 105 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/adi,ltc2947.yaml

Comments

Rob Herring (Arm) Oct. 24, 2019, 10:46 p.m. UTC | #1
On Mon, 21 Oct 2019 17:41:15 +0200, =?UTF-8?q?Nuno=20S=C3=A1?= wrote:
> Document the LTC2947 device devicetree bindings.
> 
> Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> ---
> Changes in v2:
>  * Add license identifier;
>  * Fix the uint32-array properties;
>  * Set maximum at the same indent as allOf in adi,accumulation-deadband-microamp;
>  * Set enum at the same indent as allOf in adi,gpio-out-pol;
>  * Use spi instead of spi0 on the example;
> 
> Changes in v3:
>  * Nothing changed.
> 
>  .../bindings/hwmon/adi,ltc2947.yaml           | 104 ++++++++++++++++++
>  MAINTAINERS                                   |   1 +
>  2 files changed, 105 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/hwmon/adi,ltc2947.yaml
> 

Please add Acked-by/Reviewed-by tags when posting new versions. However,
there's no need to repost patches *only* to add the tags. The upstream
maintainer will do that for acks received on the version they apply.

If a tag was not added on purpose, please state why and what changed.
Nuno Sa Oct. 25, 2019, 10:32 a.m. UTC | #2
On Thu, 2019-10-24 at 17:46 -0500, Rob Herring wrote:
> 
> On Mon, 21 Oct 2019 17:41:15 +0200, =?UTF-8?q?Nuno=20S=C3=A1?= wrote:
> > Document the LTC2947 device devicetree bindings.
> > 
> > Signed-off-by: Nuno Sá <nuno.sa@analog.com>
> > ---
> > Changes in v2:
> >  * Add license identifier;
> >  * Fix the uint32-array properties;
> >  * Set maximum at the same indent as allOf in adi,accumulation-
> > deadband-microamp;
> >  * Set enum at the same indent as allOf in adi,gpio-out-pol;
> >  * Use spi instead of spi0 on the example;
> > 
> > Changes in v3:
> >  * Nothing changed.
> > 
> >  .../bindings/hwmon/adi,ltc2947.yaml           | 104
> > ++++++++++++++++++
> >  MAINTAINERS                                   |   1 +
> >  2 files changed, 105 insertions(+)
> >  create mode 100644
> > Documentation/devicetree/bindings/hwmon/adi,ltc2947.yaml
> > 
> 
> Please add Acked-by/Reviewed-by tags when posting new versions.
> However,
> there's no need to repost patches *only* to add the tags. The
> upstream
> maintainer will do that for acks received on the version they apply.
> 
> If a tag was not added on purpose, please state why and what changed.

Yes, sorry for that. Completely forgot.

Nuno Sá
Guenter Roeck Oct. 29, 2019, 12:30 p.m. UTC | #3
On Mon, Oct 21, 2019 at 05:41:15PM +0200, Nuno Sá wrote:
> Document the LTC2947 device devicetree bindings.
> 
> Signed-off-by: Nuno Sá <nuno.sa@analog.com>

Applied with Rob's Reviewed-by:.

Guenter

> ---
> Changes in v2:
>  * Add license identifier;
>  * Fix the uint32-array properties;
>  * Set maximum at the same indent as allOf in adi,accumulation-deadband-microamp;
>  * Set enum at the same indent as allOf in adi,gpio-out-pol;
>  * Use spi instead of spi0 on the example;
> 
> Changes in v3:
>  * Nothing changed.
> 
>  .../bindings/hwmon/adi,ltc2947.yaml           | 104 ++++++++++++++++++
>  MAINTAINERS                                   |   1 +
>  2 files changed, 105 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/hwmon/adi,ltc2947.yaml
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/adi,ltc2947.yaml b/Documentation/devicetree/bindings/hwmon/adi,ltc2947.yaml
> new file mode 100644
> index 000000000000..ae04903f34bf
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwmon/adi,ltc2947.yaml
> @@ -0,0 +1,104 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/bindings/hwmon/adi,ltc2947.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Analog Devices LTC2947 high precision power and energy monitor
> +
> +maintainers:
> +  - Nuno Sá <nuno.sa@analog.com>
> +
> +description: |
> +  Analog Devices LTC2947 high precision power and energy monitor over SPI or I2C.
> +
> +  https://www.analog.com/media/en/technical-documentation/data-sheets/LTC2947.pdf
> +
> +properties:
> +  compatible:
> +    enum:
> +      - adi,ltc2947
> +
> +  reg:
> +    maxItems: 1
> +
> +  clocks:
> +    description:
> +      The LTC2947 uses either a trimmed internal oscillator or an external clock
> +      as the time base for determining the integration period to represent time,
> +      charge and energy. When an external clock is used, this property must be
> +      set accordingly.
> +    maxItems: 1
> +
> +  adi,accumulator-ctl-pol:
> +    description:
> +      This property controls the polarity of current that is accumulated to
> +      calculate charge and energy so that, they can be only accumulated for
> +      positive current for example. Since there are two sets of registers for
> +      the accumulated values, this entry can also have two items which sets
> +      energy1/charge1 and energy2/charger2 respectively. Check table 12 of the
> +      datasheet for more information on the supported options.
> +    allOf:
> +      - $ref: /schemas/types.yaml#/definitions/uint32-array
> +      - minItems: 2
> +        maxItems: 2
> +        items:
> +          enum: [0, 1, 2, 3]
> +          default: 0
> +
> +  adi,accumulation-deadband-microamp:
> +    description:
> +      This property controls the Accumulation Dead band which allows to set the
> +      level of current below which no accumulation takes place.
> +    allOf:
> +      - $ref: /schemas/types.yaml#/definitions/uint32
> +    maximum: 255
> +    default: 0
> +
> +  adi,gpio-out-pol:
> +    description:
> +      This property controls the GPIO polarity. Setting it to one makes the GPIO
> +      active high, setting it to zero makets it active low. When this property
> +      is present, the GPIO is automatically configured as output and set to
> +      control a fan as a function of measured temperature.
> +    allOf:
> +      - $ref: /schemas/types.yaml#/definitions/uint32
> +    enum: [0, 1]
> +    default: 0
> +
> +  adi,gpio-in-accum:
> +    description:
> +      When set, this property sets the GPIO as input. It is then used to control
> +      the accumulation of charge, energy and time. This function can be
> +      enabled/configured separately for each of the two sets of accumulation
> +      registers. Check table 13 of the datasheet for more information on the
> +      supported options. This property cannot be used together with
> +      adi,gpio-out-pol.
> +    allOf:
> +      - $ref: /schemas/types.yaml#/definitions/uint32-array
> +      - minItems: 2
> +        maxItems: 2
> +        items:
> +          enum: [0, 1, 2]
> +          default: 0
> +
> +required:
> +  - compatible
> +  - reg
> +
> +
> +examples:
> +  - |
> +    spi {
> +           #address-cells = <1>;
> +           #size-cells = <0>;
> +
> +           ltc2947_spi: ltc2947@0 {
> +                   compatible = "adi,ltc2947";
> +                   reg = <0>;
> +                   /* accumulation takes place always for energ1/charge1. */
> +                   /* accumulation only on positive current for energy2/charge2. */
> +                   adi,accumulator-ctl-pol = <0 1>;
> +           };
> +    };
> +...
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 318332b6a411..e2ba1a182052 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -9638,6 +9638,7 @@ F:	drivers/hwmon/ltc2947-core.c
>  F:	drivers/hwmon/ltc2947-spi.c
>  F:	drivers/hwmon/ltc2947-i2c.c
>  F:	drivers/hwmon/ltc2947.h
> +F:	Documentation/devicetree/bindings/hwmon/adi,ltc2947.yaml
>  
>  LTC4306 I2C MULTIPLEXER DRIVER
>  M:	Michael Hennerich <michael.hennerich@analog.com>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/hwmon/adi,ltc2947.yaml b/Documentation/devicetree/bindings/hwmon/adi,ltc2947.yaml
new file mode 100644
index 000000000000..ae04903f34bf
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/adi,ltc2947.yaml
@@ -0,0 +1,104 @@ 
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/bindings/hwmon/adi,ltc2947.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices LTC2947 high precision power and energy monitor
+
+maintainers:
+  - Nuno Sá <nuno.sa@analog.com>
+
+description: |
+  Analog Devices LTC2947 high precision power and energy monitor over SPI or I2C.
+
+  https://www.analog.com/media/en/technical-documentation/data-sheets/LTC2947.pdf
+
+properties:
+  compatible:
+    enum:
+      - adi,ltc2947
+
+  reg:
+    maxItems: 1
+
+  clocks:
+    description:
+      The LTC2947 uses either a trimmed internal oscillator or an external clock
+      as the time base for determining the integration period to represent time,
+      charge and energy. When an external clock is used, this property must be
+      set accordingly.
+    maxItems: 1
+
+  adi,accumulator-ctl-pol:
+    description:
+      This property controls the polarity of current that is accumulated to
+      calculate charge and energy so that, they can be only accumulated for
+      positive current for example. Since there are two sets of registers for
+      the accumulated values, this entry can also have two items which sets
+      energy1/charge1 and energy2/charger2 respectively. Check table 12 of the
+      datasheet for more information on the supported options.
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32-array
+      - minItems: 2
+        maxItems: 2
+        items:
+          enum: [0, 1, 2, 3]
+          default: 0
+
+  adi,accumulation-deadband-microamp:
+    description:
+      This property controls the Accumulation Dead band which allows to set the
+      level of current below which no accumulation takes place.
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32
+    maximum: 255
+    default: 0
+
+  adi,gpio-out-pol:
+    description:
+      This property controls the GPIO polarity. Setting it to one makes the GPIO
+      active high, setting it to zero makets it active low. When this property
+      is present, the GPIO is automatically configured as output and set to
+      control a fan as a function of measured temperature.
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [0, 1]
+    default: 0
+
+  adi,gpio-in-accum:
+    description:
+      When set, this property sets the GPIO as input. It is then used to control
+      the accumulation of charge, energy and time. This function can be
+      enabled/configured separately for each of the two sets of accumulation
+      registers. Check table 13 of the datasheet for more information on the
+      supported options. This property cannot be used together with
+      adi,gpio-out-pol.
+    allOf:
+      - $ref: /schemas/types.yaml#/definitions/uint32-array
+      - minItems: 2
+        maxItems: 2
+        items:
+          enum: [0, 1, 2]
+          default: 0
+
+required:
+  - compatible
+  - reg
+
+
+examples:
+  - |
+    spi {
+           #address-cells = <1>;
+           #size-cells = <0>;
+
+           ltc2947_spi: ltc2947@0 {
+                   compatible = "adi,ltc2947";
+                   reg = <0>;
+                   /* accumulation takes place always for energ1/charge1. */
+                   /* accumulation only on positive current for energy2/charge2. */
+                   adi,accumulator-ctl-pol = <0 1>;
+           };
+    };
+...
diff --git a/MAINTAINERS b/MAINTAINERS
index 318332b6a411..e2ba1a182052 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -9638,6 +9638,7 @@  F:	drivers/hwmon/ltc2947-core.c
 F:	drivers/hwmon/ltc2947-spi.c
 F:	drivers/hwmon/ltc2947-i2c.c
 F:	drivers/hwmon/ltc2947.h
+F:	Documentation/devicetree/bindings/hwmon/adi,ltc2947.yaml
 
 LTC4306 I2C MULTIPLEXER DRIVER
 M:	Michael Hennerich <michael.hennerich@analog.com>