1# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2%YAML 1.2
3---
4$id: http://devicetree.org/schemas/hwmon/pwm-fan.yaml#
5$schema: http://devicetree.org/meta-schemas/core.yaml#
6
7title: Fan connected to PWM lines
8
9maintainers:
10  - Jean Delvare <jdelvare@suse.com>
11  - Guenter Roeck <linux@roeck-us.net>
12
13properties:
14  compatible:
15    const: pwm-fan
16
17  cooling-levels:
18    description: PWM duty cycle values corresponding to thermal cooling states.
19    $ref: /schemas/types.yaml#/definitions/uint32-array
20    items:
21      maximum: 255
22
23  fan-supply:
24    description: Phandle to the regulator that provides power to the fan.
25
26  interrupts:
27    description:
28      This contains an interrupt specifier for each fan tachometer output
29      connected to an interrupt source. The output signal must generate a
30      defined number of interrupts per fan revolution, which require that
31      it must be self resetting edge interrupts.
32    maxItems: 1
33
34  pulses-per-revolution:
35    description:
36      Define the number of pulses per fan revolution for each tachometer
37      input as an integer.
38    $ref: /schemas/types.yaml#/definitions/uint32
39    minimum: 1
40    maximum: 4
41    default: 2
42
43  pwms:
44    description: The PWM that is used to control the fan.
45    maxItems: 1
46
47  "#cooling-cells": true
48
49required:
50  - compatible
51  - pwms
52
53additionalProperties: false
54
55examples:
56  - |
57    pwm-fan {
58      compatible = "pwm-fan";
59      cooling-levels = <0 102 170 230>;
60      pwms = <&pwm 0 10000 0>;
61      #cooling-cells = <2>;
62    };
63
64    thermal-zones {
65      cpu_thermal: cpu-thermal {
66        thermal-sensors = <&tmu 0>;
67        polling-delay-passive = <0>;
68        polling-delay = <0>;
69
70        trips {
71          cpu_alert1: cpu-alert1 {
72            temperature = <100000>; /* millicelsius */
73            hysteresis = <2000>; /* millicelsius */
74            type = "passive";
75          };
76        };
77
78        cooling-maps {
79          map0 {
80            trip = <&cpu_alert1>;
81            cooling-device = <&fan0 0 1>;
82          };
83        };
84      };
85    };
86
87  - |
88    #include <dt-bindings/interrupt-controller/irq.h>
89
90    pwm-fan {
91      compatible = "pwm-fan";
92      pwms = <&pwm 0 40000 0>;
93      fan-supply = <&reg_fan>;
94      interrupt-parent = <&gpio5>;
95      interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
96      pulses-per-revolution = <2>;
97    };
98