[PATCH 2/2] dt-bindings: regulator: Add adi,lt8722-regulator.yaml

Ramon Cristopher M. Calam posted 2 patches 1 year, 1 month ago
[PATCH 2/2] dt-bindings: regulator: Add adi,lt8722-regulator.yaml
Posted by Ramon Cristopher M. Calam 1 year, 1 month ago
Add documentation for device tree bindings of LT8722.

Signed-off-by: Ramon Cristopher M. Calam <ramoncristopher.calam@analog.com>
---
 .../regulator/adi,lt8722-regulator.yaml       | 178 ++++++++++++++++++
 1 file changed, 178 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/regulator/adi,lt8722-regulator.yaml

diff --git a/Documentation/devicetree/bindings/regulator/adi,lt8722-regulator.yaml b/Documentation/devicetree/bindings/regulator/adi,lt8722-regulator.yaml
new file mode 100644
index 000000000000..3fbf788d4154
--- /dev/null
+++ b/Documentation/devicetree/bindings/regulator/adi,lt8722-regulator.yaml
@@ -0,0 +1,178 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+# Copyright (c) 2023 Analog Devices, Inc.
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/regulator/adi,lt8722-regulator.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Analog Devices LT8722 Ultracompact Full Bridge Driver
+
+maintainers:
+  - Ramon Cristopher Calam <ramoncristopher.calam@analog.com>
+
+description: |
+  The Analog Devices LT8722 is a high performance, high efficiency, 15V input,
+  4A monolithic full bridge DC/DC converter. This converter has 92.5% efficiency
+  with high power output of 54W for fine control TEC driving applications.
+
+properties:
+  compatible:
+    enum:
+      - adi,lt8722
+
+  reg:
+    maxItems: 1
+
+  enable-gpios:
+    description:
+      This pin in used together with the ENABLE_REQ bit in the SPIS_COMMAND
+      register to set the state of LT8722. When both the ENABLE_REQ bit and
+      the enable GPIO are low, LT8722 is in shutdown mode. When either the
+      ENABLE_REQ bit or the enable GPIO is high, LT8722 is active and the
+      internal VCC LDO regulator is enabled. The enable GPIO is active high.
+    maxItems: 1
+
+  switch-enable-gpios:
+    description:
+      This pin is used together with the SWEN_REG bit in the SPIS_COMMAND
+      register to set the PWM switching behavior of LT8722. When both the
+      SWEN_REG bit and the switch enable GPIO are low, LT8722 PWM switching
+      is disabled. When both the SWEN_REG bit and the switch enable GPIO are
+      high, LT8722 PWM switching is enabled. The switch enable GPIO is active
+      high.
+    maxItems: 1
+
+  spi-max-frequency:
+    maximum: 10000000
+
+  adi,uv-clamp-microvolt:
+    description: Maximum negative output voltage clamp in microvolts.
+    enum: [
+      -20000000,
+      -18750000,
+      -17500000,
+      -16250000,
+      -15000000,
+      -13750000,
+      -12500000,
+      -11250000,
+      -10000000,
+      -8750000,
+      -7500000,
+      -6250000,
+      -5000000,
+      -3750000,
+      -2500000,
+      -1250000
+    ]
+    default: -20000000
+
+  adi,ov-clamp-microvolt:
+    description: Maximum positive output voltage clamp in microvolts.
+    enum: [
+      1250000,
+      2500000,
+      3750000,
+      5000000,
+      6250000,
+      7500000,
+      8750000,
+      10000000,
+      11250000,
+      12500000,
+      13750000,
+      15000000,
+      16250000,
+      17500000,
+      18750000,
+      20000000
+    ]
+    default: 20000000
+
+  adi,ilimn-microamp:
+    description: Maximum negative output current limit in microamps.
+    minimum: -6786000
+    maximum: -637440
+    default: -6786000
+
+  adi,ilimp-microamp:
+    description: Maximum positive output current limit in microamps.
+    minimum: 637440
+    maximum: 6800000
+    default: 6800000
+
+  adi,switch-frequency-hz:
+    description: PWM switch frequency.
+    enum: [500000, 1000000, 1500000, 2000000, 2500000, 3000000]
+    default: 500000
+
+  adi,switch-frequency-adjust:
+    description: PWM switch frequency adjustment.
+    enum: [0%, 15%, -15%]
+    default: 0%
+
+  adi,duty-cycle-range:
+    description: PWM duty cycle.
+    enum: [20%-80%, 15%-85%, 10%-90%]
+    default: 20%-80%
+
+  adi,vcc-vreg-millivolt:
+    description: VCC LCO regulation voltage in millivolts.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [3100, 3400]
+    default: 3400
+
+  adi,peak-inductor-current-milliamp:
+    description: Typical peak inductor current in milliamps.
+    $ref: /schemas/types.yaml#/definitions/uint32
+    enum: [252, 594, 936, 1278, 1620, 1962, 2304, 2646]
+    default: 1620
+
+  adi,power-limit-milliwatt:
+    description: Linear power stage MOSFET power limit in milliwatts.
+    enum: [0, 2000, 3000, 3500]
+    default: 0
+
+required:
+  - compatible
+  - reg
+  - enable-gpios
+  - switch-enable-gpios
+
+allOf:
+  - $ref: regulator.yaml#
+  - $ref: /schemas/spi/spi-peripheral-props.yaml#
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        regulator@0 {
+            compatible = "adi,lt8722";
+            reg = <0>;
+            enable-gpios = <&gpio 23 GPIO_ACTIVE_HIGH>;
+            switch-enable-gpios = <&gpio 24 GPIO_ACTIVE_HIGH>;
+            spi-max-frequency = <10000000>;
+            spi-bits-per-word = <8>;
+
+            adi,uv-clamp-microvolt = <(-20000000)>;
+            adi,ov-clamp-microvolt = <20000000>;
+            adi,ilimn-microamp = <(-6786000)>;
+            adi,ilimp-microamp = <6800000>;
+            adi,switch-frequency-hz = <500000>;
+            adi,switch-frequency-adjust = "0%";
+            adi,duty-cycle-range = "20%-80%";
+            adi,vcc-vreg-millivolt = <3400>;
+            adi,peak-inductor-current-milliamp = <1620>;
+            adi,power-limit-milliwatt = <0>;
+
+            regulator-min-microvolt = <-20000000>;
+            regulator-max-microvolt = <20000000>;
+            regulator-soft-start;
+        };
+    };
-- 
2.47.0
Re: [PATCH 2/2] dt-bindings: regulator: Add adi,lt8722-regulator.yaml
Posted by Krzysztof Kozlowski 1 year, 1 month ago
On Fri, Nov 08, 2024 at 05:35:44PM +0800, Ramon Cristopher M. Calam wrote:
> Add documentation for device tree bindings of LT8722.
> 
> Signed-off-by: Ramon Cristopher M. Calam <ramoncristopher.calam@analog.com>
> ---
>  .../regulator/adi,lt8722-regulator.yaml       | 178 ++++++++++++++++++
>  1 file changed, 178 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/regulator/adi,lt8722-regulator.yaml
> 

This wasn't tested, so limited review follows.

Please use subject prefixes matching the subsystem. You can get them for
example with 'git log --oneline -- DIRECTORY_OR_FILE' on the directory
your patch is touching. For bindings, the preferred subjects are
explained here:
https://www.kernel.org/doc/html/latest/devicetree/bindings/submitting-patches.html#i-for-patch-submitters

> diff --git a/Documentation/devicetree/bindings/regulator/adi,lt8722-regulator.yaml b/Documentation/devicetree/bindings/regulator/adi,lt8722-regulator.yaml
> new file mode 100644
> index 000000000000..3fbf788d4154
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/regulator/adi,lt8722-regulator.yaml
> @@ -0,0 +1,178 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +# Copyright (c) 2023 Analog Devices, Inc.
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/regulator/adi,lt8722-regulator.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Analog Devices LT8722 Ultracompact Full Bridge Driver

Driver like motor driver or regulator? Or Linux driver? If the latter
then, drop. Describe the hardware please.


> +
> +maintainers:
> +  - Ramon Cristopher Calam <ramoncristopher.calam@analog.com>
> +
> +description: |

Do not need '|' unless you need to preserve formatting.

That's all folks! More review when this is tested, please.

Best regards,
Krzysztof
Re: [PATCH 2/2] dt-bindings: regulator: Add adi,lt8722-regulator.yaml
Posted by Rob Herring (Arm) 1 year, 1 month ago
On Fri, 08 Nov 2024 17:35:44 +0800, Ramon Cristopher M. Calam wrote:
> Add documentation for device tree bindings of LT8722.
> 
> Signed-off-by: Ramon Cristopher M. Calam <ramoncristopher.calam@analog.com>
> ---
>  .../regulator/adi,lt8722-regulator.yaml       | 178 ++++++++++++++++++
>  1 file changed, 178 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/regulator/adi,lt8722-regulator.yaml
> 

My bot found errors running 'make dt_binding_check' on your patch:

yamllint warnings/errors:

dtschema/dtc warnings/errors:
Error: Documentation/devicetree/bindings/regulator/adi,lt8722-regulator.example.dts:42.44-45 syntax error
FATAL ERROR: Unable to parse input tree
make[2]: *** [scripts/Makefile.dtbs:129: Documentation/devicetree/bindings/regulator/adi,lt8722-regulator.example.dtb] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [/builds/robherring/dt-review-ci/linux/Makefile:1442: dt_binding_check] Error 2
make: *** [Makefile:224: __sub-make] Error 2

doc reference errors (make refcheckdocs):

See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20241108093544.9492-3-ramoncristopher.calam@analog.com

The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.

If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:

pip3 install dtschema --upgrade

Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.