Skip to content

Commit 9e51acc

Browse files
cristiccgroeck
authored andcommitted
dt-bindings: hwmon: pwm-fan: Convert to DT schema
Convert the PWM fan bindings to DT schema format. Signed-off-by: Cristian Ciocaltea <cristian.ciocaltea@collabora.com> Reviewed-by: Rob Herring <robh@kernel.org> Link: https://lore.kernel.org/r/20230406182000.956275-2-cristian.ciocaltea@collabora.com Signed-off-by: Guenter Roeck <linux@roeck-us.net>
1 parent 7a0c7b9 commit 9e51acc

2 files changed

Lines changed: 98 additions & 67 deletions

File tree

Lines changed: 1 addition & 67 deletions
Original file line numberDiff line numberDiff line change
@@ -1,67 +1 @@
1-
Bindings for a fan connected to the PWM lines
2-
3-
Required properties:
4-
- compatible : "pwm-fan"
5-
- pwms : the PWM that is used to control the PWM fan
6-
- cooling-levels : PWM duty cycle values in a range from 0 to 255
7-
which correspond to thermal cooling states
8-
9-
Optional properties:
10-
- fan-supply : phandle to the regulator that provides power to the fan
11-
- interrupts : This contains an interrupt specifier for each fan
12-
tachometer output connected to an interrupt source.
13-
The output signal must generate a defined number of
14-
interrupts per fan revolution, which require that
15-
it must be self resetting edge interrupts. See
16-
interrupt-controller/interrupts.txt for the format.
17-
- pulses-per-revolution : define the number of pulses per fan revolution for
18-
each tachometer input as an integer (default is 2
19-
interrupts per revolution). The value must be
20-
greater than zero.
21-
22-
Example:
23-
fan0: pwm-fan {
24-
compatible = "pwm-fan";
25-
#cooling-cells = <2>;
26-
pwms = <&pwm 0 10000 0>;
27-
cooling-levels = <0 102 170 230>;
28-
};
29-
30-
thermal-zones {
31-
cpu_thermal: cpu-thermal {
32-
thermal-sensors = <&tmu 0>;
33-
polling-delay-passive = <0>;
34-
polling-delay = <0>;
35-
trips {
36-
cpu_alert1: cpu-alert1 {
37-
temperature = <100000>; /* millicelsius */
38-
hysteresis = <2000>; /* millicelsius */
39-
type = "passive";
40-
};
41-
};
42-
cooling-maps {
43-
map0 {
44-
trip = <&cpu_alert1>;
45-
cooling-device = <&fan0 0 1>;
46-
};
47-
};
48-
};
49-
50-
Example 2:
51-
fan0: pwm-fan {
52-
compatible = "pwm-fan";
53-
pwms = <&pwm 0 40000 0>;
54-
fan-supply = <&reg_fan>;
55-
interrupt-parent = <&gpio5>;
56-
interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
57-
pulses-per-revolution = <2>;
58-
};
59-
60-
Example 3:
61-
fan0: pwm-fan {
62-
compatible = "pwm-fan";
63-
pwms = <&pwm1 0 25000 0>;
64-
interrupts-extended = <&gpio1 1 IRQ_TYPE_EDGE_FALLING>,
65-
<&gpio2 5 IRQ_TYPE_EDGE_FALLING>;
66-
pulses-per-revolution = <2>, <1>;
67-
};
1+
This file has moved to pwm-fan.yaml.
Lines changed: 97 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,97 @@
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+
7+
title: Fan connected to PWM lines
8+
9+
maintainers:
10+
- Jean Delvare <jdelvare@suse.com>
11+
- Guenter Roeck <linux@roeck-us.net>
12+
13+
properties:
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+
49+
required:
50+
- compatible
51+
- pwms
52+
53+
additionalProperties: false
54+
55+
examples:
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+
};

0 commit comments

Comments
 (0)