[PATCH 2/3] dt-bindings: hwmon: Add Microchip EMC2101 support

Álvaro Fernández Rojas posted 3 patches 3 months, 2 weeks ago
There is a newer version of this series
[PATCH 2/3] dt-bindings: hwmon: Add Microchip EMC2101 support
Posted by Álvaro Fernández Rojas 3 months, 2 weeks ago
Introduce yaml schema for Microchip emc2101 pwm fan controller with
temperature monitoring.

Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
---
 .../bindings/hwmon/microchip,emc2101.yaml     | 52 +++++++++++++++++++
 1 file changed, 52 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml

diff --git a/Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml b/Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml
new file mode 100644
index 000000000000..e73f1f9d43f4
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml
@@ -0,0 +1,52 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/hwmon/microchip,emc2101.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Microchip EMC2101 SMBus compliant PWM fan controller
+
+maintainers:
+  - Álvaro Fernández Rojas <noltari@gmail.com>
+
+description:
+  Microchip EMC2101 pwm controller which supports up to 1 fan, 1 internal
+  temperature sensor, 1 external temperature sensor and an 8 entry look
+  up table to create a programmable temperature response.
+
+properties:
+  compatible:
+    enum:
+      - microchip,emc2101
+      - microchip,emc2101-r
+
+  reg:
+    maxItems: 1
+
+  '#address-cells':
+    const: 1
+
+  '#size-cells':
+    const: 0
+
+required:
+  - compatible
+  - reg
+
+additionalProperties: false
+
+examples:
+  - |
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        fan_controller: fan-controller@4c {
+            compatible = "microchip,emc2101";
+            reg = <0x4c>;
+
+            #address-cells = <1>;
+            #size-cells = <0>;
+        };
+    };
+...
-- 
2.39.5

Re: [PATCH 2/3] dt-bindings: hwmon: Add Microchip EMC2101 support
Posted by Rob Herring 3 months, 1 week ago
On Thu, Jun 26, 2025 at 01:33:50PM +0200, Álvaro Fernández Rojas wrote:
> Introduce yaml schema for Microchip emc2101 pwm fan controller with
> temperature monitoring.
> 
> Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
> ---
>  .../bindings/hwmon/microchip,emc2101.yaml     | 52 +++++++++++++++++++
>  1 file changed, 52 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml
> 
> diff --git a/Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml b/Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml
> new file mode 100644
> index 000000000000..e73f1f9d43f4
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml
> @@ -0,0 +1,52 @@
> +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: http://devicetree.org/schemas/hwmon/microchip,emc2101.yaml#
> +$schema: http://devicetree.org/meta-schemas/core.yaml#
> +
> +title: Microchip EMC2101 SMBus compliant PWM fan controller
> +
> +maintainers:
> +  - Álvaro Fernández Rojas <noltari@gmail.com>
> +
> +description:
> +  Microchip EMC2101 pwm controller which supports up to 1 fan, 1 internal
> +  temperature sensor, 1 external temperature sensor and an 8 entry look
> +  up table to create a programmable temperature response.
> +
> +properties:
> +  compatible:
> +    enum:
> +      - microchip,emc2101
> +      - microchip,emc2101-r
> +
> +  reg:
> +    maxItems: 1
> +

> +  '#address-cells':
> +    const: 1
> +
> +  '#size-cells':
> +    const: 0

What are these for? You don't have any child nodes.

> +
> +required:
> +  - compatible
> +  - reg
> +
> +additionalProperties: false
> +
> +examples:
> +  - |
> +    i2c {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +
> +        fan_controller: fan-controller@4c {
> +            compatible = "microchip,emc2101";
> +            reg = <0x4c>;
> +
> +            #address-cells = <1>;
> +            #size-cells = <0>;
> +        };
> +    };
> +...
> -- 
> 2.39.5
> 
Re: [PATCH 2/3] dt-bindings: hwmon: Add Microchip EMC2101 support
Posted by Álvaro Fernández Rojas 3 months, 1 week ago
Hi Rob,

El vie, 27 jun 2025 a las 23:34, Rob Herring (<robh@kernel.org>) escribió:
>
> On Thu, Jun 26, 2025 at 01:33:50PM +0200, Álvaro Fernández Rojas wrote:
> > Introduce yaml schema for Microchip emc2101 pwm fan controller with
> > temperature monitoring.
> >
> > Signed-off-by: Álvaro Fernández Rojas <noltari@gmail.com>
> > ---
> >  .../bindings/hwmon/microchip,emc2101.yaml     | 52 +++++++++++++++++++
> >  1 file changed, 52 insertions(+)
> >  create mode 100644 Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml
> >
> > diff --git a/Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml b/Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml
> > new file mode 100644
> > index 000000000000..e73f1f9d43f4
> > --- /dev/null
> > +++ b/Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml
> > @@ -0,0 +1,52 @@
> > +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
> > +%YAML 1.2
> > +---
> > +$id: http://devicetree.org/schemas/hwmon/microchip,emc2101.yaml#
> > +$schema: http://devicetree.org/meta-schemas/core.yaml#
> > +
> > +title: Microchip EMC2101 SMBus compliant PWM fan controller
> > +
> > +maintainers:
> > +  - Álvaro Fernández Rojas <noltari@gmail.com>
> > +
> > +description:
> > +  Microchip EMC2101 pwm controller which supports up to 1 fan, 1 internal
> > +  temperature sensor, 1 external temperature sensor and an 8 entry look
> > +  up table to create a programmable temperature response.
> > +
> > +properties:
> > +  compatible:
> > +    enum:
> > +      - microchip,emc2101
> > +      - microchip,emc2101-r
> > +
> > +  reg:
> > +    maxItems: 1
> > +
>
> > +  '#address-cells':
> > +    const: 1
> > +
> > +  '#size-cells':
> > +    const: 0
>
> What are these for? You don't have any child nodes.

EMC2101 can control a single fan, so I guess I should add the following here:

  '#pwm-cells':
    const: 2
    description: |
      Number of cells in a PWM specifier.
      - cell 0: The PWM frequency
      - cell 1: The PWM polarity: 0 or PWM_POLARITY_INVERTED

patternProperties:
  '^fan@0$':
    $ref: fan-common.yaml#
    unevaluatedProperties: false
    properties:
      reg:
        description:
          The fan number used to determine the associated PWM channel.
        maxItems: 1

    required:
      - reg

>
> > +
> > +required:
> > +  - compatible
> > +  - reg
> > +
> > +additionalProperties: false
> > +
> > +examples:
> > +  - |
> > +    i2c {
> > +        #address-cells = <1>;
> > +        #size-cells = <0>;
> > +
> > +        fan_controller: fan-controller@4c {
> > +            compatible = "microchip,emc2101";
> > +            reg = <0x4c>;
> > +
> > +            #address-cells = <1>;
> > +            #size-cells = <0>;

And the following here:

            #pwm-cells = <2>;

            fan@0 {
                reg = <0x0>;
                pwms = <&fan_controller 5806 0>;
                #cooling-cells = <2>;
            };

Would that fix the issue?

> > +        };
> > +    };
> > +...
> > --
> > 2.39.5
> >

Best regards,
Álvaro.