[PATCH 1/2] dt-bindings: hwmon: add ltc4296-1 support

Antoniu Miclaus posted 2 patches 1 month ago
[PATCH 1/2] dt-bindings: hwmon: add ltc4296-1 support
Posted by Antoniu Miclaus 1 month ago
Add devicetree bindings for the ltc4296-1 device.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
---
 .../bindings/hwmon/adi,ltc4296-1.yaml         | 105 ++++++++++++++++++
 1 file changed, 105 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/adi,ltc4296-1.yaml

diff --git a/Documentation/devicetree/bindings/hwmon/adi,ltc4296-1.yaml b/Documentation/devicetree/bindings/hwmon/adi,ltc4296-1.yaml
new file mode 100644
index 000000000000..be73d59a7d65
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/adi,ltc4296-1.yaml
@@ -0,0 +1,105 @@
+# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
+%YAML 1.2
+---
+
+$id: http://devicetree.org/schemas/hwmon/adi,ltc4296-1.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: LTC4296-1 5-Port SPoE PSE Controller
+
+maintainers:
+  - Antoniu Miclaus <antoniu.miclaus@analog.com>
+
+description: |
+  The LTC4296-1 is an IEEE 802.3cg-compliant, five port, single-pair
+  power over Ethernet (SPoE), power sourcing equipment (PSE)
+  controller. SPoE simplifies system design and installation with
+  standardized power and Ethernet data over a single-pair cable.
+
+  Datasheet:
+    https://www.analog.com/en/products/ltc4296-1.html
+
+$ref: /schemas/spi/spi-peripheral-props.yaml#
+
+properties:
+  compatible:
+    const: adi,ltc4296-1
+
+  reg:
+    maxItems: 1
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+  vin-supply: true
+
+patternProperties:
+  "^channel@[0-3]$":
+    type: object
+    description:
+      Represents the current monitoring channels.
+
+    properties:
+      reg:
+        description:
+          The channel number. ltc4296-1 can monitor 5 currents.
+        items:
+          minimum: 0
+          maximum: 4
+
+      shunt-resistor-micro-ohms:
+        description:
+          The value of curent sense resistor in micro ohms.
+
+    required:
+      - reg
+
+    additionalProperties: false
+
+required:
+  - compatible
+  - reg
+  - vin-supply
+
+additionalProperties: false
+
+examples:
+  - |
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        hwmon@0 {
+            compatible = "adi,ltc4296-1";
+            reg = <0x0>;
+            vin-supply = <&vcc>;
+        };
+    };
+  - |
+    spi {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        hwmon@0 {
+            #address-cells = <1>;
+            #size-cells = <0>;
+
+            compatible = "adi,ltc4296-1";
+            reg = <0x0>;
+            vin-supply = <&vin>;
+
+            channel@0 {
+                    reg = <0x0>;
+                    shunt-resistor-micro-ohms = <100000>;
+            };
+
+            channel@1 {
+                    reg = <0x1>;
+                    shunt-resistor-micro-ohms = <100000>;
+            };
+        };
+    };
+...
-- 
2.46.2
Re: [PATCH 1/2] dt-bindings: hwmon: add ltc4296-1 support
Posted by Krzysztof Kozlowski 4 weeks ago
On Fri, Oct 25, 2024 at 02:56:10PM +0300, Antoniu Miclaus wrote:
> Add devicetree bindings for the ltc4296-1 device.
> 
> Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
> ---
>  .../bindings/hwmon/adi,ltc4296-1.yaml         | 105 ++++++++++++++++++
>  1 file changed, 105 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/hwmon/adi,ltc4296-1.yaml
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/adi,ltc4296-1.yaml b/Documentation/devicetree/bindings/hwmon/adi,ltc4296-1.yaml
> new file mode 100644
> index 000000000000..be73d59a7d65
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwmon/adi,ltc4296-1.yaml
> @@ -0,0 +1,105 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +

If there is going to be new posting: drop blank line.

> +$id: http://devicetree.org/schemas/hwmon/adi,ltc4296-1.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: LTC4296-1 5-Port SPoE PSE Controller
> +
> +maintainers:
> +  - Antoniu Miclaus <antoniu.miclaus@analog.com>
> +
> +description: |
> +  The LTC4296-1 is an IEEE 802.3cg-compliant, five port, single-pair
> +  power over Ethernet (SPoE), power sourcing equipment (PSE)
> +  controller. SPoE simplifies system design and installation with
> +  standardized power and Ethernet data over a single-pair cable.
> +
> +  Datasheet:
> +    https://www.analog.com/en/products/ltc4296-1.html
> +
> +$ref: /schemas/spi/spi-peripheral-props.yaml#
> +
> +properties:
> +  compatible:
> +    const: adi,ltc4296-1
> +
> +  reg:
> +    maxItems: 1
> +
> +  '#address-cells'

If there is going to be new posting: use consistent quotes, either ' or
".

> +    const: 1
> +
> +  '#size-cells':
> +    const: 0
> +
> +  vin-supply: true
> +
> +patternProperties:
> +  "^channel@[0-3]$":
> +    type: object
> +    description:
> +      Represents the current monitoring channels.
> +
> +    properties:
> +      reg:
> +        description:
> +          The channel number. ltc4296-1 can monitor 5 currents.
> +        items:
> +          minimum: 0
> +          maximum: 4

maximum is 3, right?

> +
> +      shunt-resistor-micro-ohms:
> +        description:
> +          The value of curent sense resistor in micro ohms.
> +
> +    required:
> +      - reg
> +
> +    additionalProperties: false
> +
> +required:
> +  - compatible
> +  - reg
> +  - vin-supply
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    spi {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        hwmon@0 {
> +            compatible = "adi,ltc4296-1";
> +            reg = <0x0>;
> +            vin-supply = <&vcc>;

Why no channels here? What's the point of such node if you do not
monitor any channels?

> +        };
> +    };
> +  - |
> +    spi {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        hwmon@0 {
> +            #address-cells = <1>;
> +            #size-cells = <0>;
> +
> +            compatible = "adi,ltc4296-1";
> +            reg = <0x0>;
> +            vin-supply = <&vin>;
> +
> +            channel@0 {
> +                    reg = <0x0>;

Use 4 spaces for example indentation.

Best regards,
Krzysztof