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 | 79 +++++++++++++++++++
1 file changed, 79 insertions(+)
create mode 100644 Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml
v2: add missing properties.
diff --git a/Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml b/Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml
new file mode 100644
index 000000000000..0966559d373e
--- /dev/null
+++ b/Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml
@@ -0,0 +1,79 @@
+# 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
+
+ '#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>;
+ #pwm-cells = <2>;
+
+ fan@0 {
+ reg = <0x0>;
+ pwms = <&fan_controller 5806 0>;
+ #cooling-cells = <2>;
+ };
+ };
+ };
+...
--
2.39.5
On Tue, Jul 01, 2025 at 08:12:27PM +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 | 79 +++++++++++++++++++ > 1 file changed, 79 insertions(+) > create mode 100644 Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml > > v2: add missing properties. > > diff --git a/Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml b/Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml > new file mode 100644 > index 000000000000..0966559d373e > --- /dev/null > +++ b/Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml > @@ -0,0 +1,79 @@ > +# 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 Nothing in description explains what 'r' is. > + > + reg: > + maxItems: 1 > + > + '#address-cells': > + const: 1 > + > + '#size-cells': > + const: 0 > + > + '#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$': This is just 'fan', not a pattern. See other bidnings. > + $ref: fan-common.yaml# > + unevaluatedProperties: false > + properties: > + reg: > + description: > + The fan number used to determine the associated PWM channel. I can tell you: 0. Cannot be any other PWM channel. > + maxItems: 1 > + > + required: > + - reg > + > +required: > + - compatible > + - reg Best regards, Krzysztof
On Tue, 01 Jul 2025 20:12:27 +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 | 79 +++++++++++++++++++ > 1 file changed, 79 insertions(+) > create mode 100644 Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml > > v2: add missing properties. > My bot found errors running 'make dt_binding_check' on your patch: yamllint warnings/errors: dtschema/dtc warnings/errors: /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/hwmon/microchip,emc2101.yaml: patternProperties: '^fan@0$' should not be valid under {'pattern': '^\\^[a-zA-Z0-9,\\-._#@]+\\$$'} hint: Fixed strings belong in 'properties', not 'patternProperties' from schema $id: http://devicetree.org/meta-schemas/keywords.yaml# doc reference errors (make refcheckdocs): See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20250701181228.1196102-3-noltari@gmail.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.
© 2016 - 2025 Red Hat, Inc.