Skip to content

Commit 539d633

Browse files
authored
Merge to official Raspberry Pi repository
1 parent 6e775b3 commit 539d633

File tree

2 files changed

+70
-33
lines changed

2 files changed

+70
-33
lines changed

README.md

Lines changed: 37 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
> [!NOTE]
2+
> This device-tree overlay has been merged to the official Raspberry Pi repository on 01/01/2025 and should be part of Raspberry Pi OS Bookworm with the next firmware release. Below information does still apply, but copying the pwm-gpio-fan.dtbo to /boot/firmware/overlays will not longer be necessary.
3+
14
# pwm-gpio-fan overlay
25

36
Raspberry Pi device-tree overlay for a GPIO connected PWM cooling fan controlled by the software-based GPIO PWM kernel module
@@ -47,19 +50,40 @@ This made me write the **pwm-gpio-fan** overlay for my own use and publish it he
4750

4851
There are several parameters you can specifity in the /boot/firmware/config.txt command line to customize the behaviour of the overlay:
4952

50-
- "fan_gpio" BCM number of the pin driving the fan, default 18 (GPIO 18)
51-
- "fan_temp0" CPU temperature at which fan is started with low speed in millicelsius, default 55000 (55 °C)
52-
- "fan_temp1" CPU temperature at which fan is switched to medium speed in millicelsius, default 60000 (60 °C)
53-
- "fan_temp2" CPU temperature at which fan is switched to high speed in millicelsius, default 67500 (67.5 °C)
54-
- "fan_temp3" CPU temperature at which fan is switched to max speed in millicelsius, default 75000 (75 °C)
55-
- "fan_temp0_hyst" Temperature hysteris at which fan is stopped in millicelsius, default 5000 (resulting in 50 °C)
56-
- "fan_temp1_hyst" Temperature hysteris at which fan is switched back to low speed in millicelsius, default 5000 (resulting in 55 °C)
57-
- "fan_temp2_hyst" Temperature hysteris at which fan is switched back to medium speed in millicelsius, default 5000 (resulting in 62.5 °C)
58-
- "fan_temp3_hyst" Temperature hysteris at which fan is switched back to high speed in millicelsius, default 5000 (resulting in 70 °C)
59-
- "fan_temp0_speed" Fan speed for low cooling state in range 0 to 255, default 114 (45% PWM duty cycle)
60-
- "fan_temp1_speed" Fan speed for medium cooling state in range 0 to 255, default 152 (60% PWM duty cycle)
61-
- "fan_temp2_speed" Fan speed for high cooling state in range 0 to 255, default 204 (80% PWM duty cycle)
62-
- "fan_temp3_speed" Fan speed for max cooling state in range 0 to 255, default 255 (100% PWM duty cycle)
53+
fan_gpio BCM number of the pin driving the fan,
54+
default 18 (GPIO 18)
55+
fan_temp0 CPU temperature at which fan is started with
56+
low speed in millicelsius,
57+
default 55000 (55 °C)
58+
fan_temp1 CPU temperature at which fan is switched
59+
to medium speed in millicelsius,
60+
default 60000 (60 °C)
61+
fan_temp2 CPU temperature at which fan is switched
62+
to high speed in millicelsius,
63+
default 67500 (67.5 °C)
64+
fan_temp3 CPU temperature at which fan is switched
65+
to max speed in millicelsius,
66+
default 75000 (75 °C)
67+
fan_temp0_hyst Temperature hysteris at which fan is stopped
68+
in millicelsius,default 5000 (resulting
69+
in 50 °C)
70+
fan_temp1_hyst Temperature hysteris at which fan is switched
71+
back to low speed in millicelsius,
72+
default 5000 (resulting in 55 °C)
73+
fan_temp2_hyst Temperature hysteris at which fan is switched
74+
back to medium speed in millicelsius,
75+
default 5000 (resulting in 62.5 °C)
76+
fan_temp3_hyst Temperature hysteris at which fan is switched
77+
back to high speed in millicelsius,
78+
default 5000 (resulting in 70 °C)
79+
fan_temp0_speed Fan speed for low cooling state in range
80+
0 to 255, default 114 (45% PWM duty cycle)
81+
fan_temp1_speed Fan speed for medium cooling state in range
82+
0 to 255, default 152 (60% PWM duty cycle)
83+
fan_temp2_speed Fan speed for high cooling state in range
84+
0 to 255, default 204 (80% PWM duty cycle)
85+
fan_temp3_speed Fan speed for max cooling state in range
86+
0 to 255, default 255 (100% PWM duty cycle)
6387

6488
> [!NOTE]
6589
> Lowest temperature default is set to 55 °C, to keep the fan off when the Pi is idle. PWM duty cycles start from a rather high 45% to ensure the fan is started reliable. Many small fans have difficulties to start reliable at low duty cycle values.

pwm-gpio-fan-overlay.dts

Lines changed: 33 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,31 @@
33
*
44
* Optional parameters:
55
* - "fan_gpio" BCM number of the pin driving the fan, default 18 (GPIO18)
6-
* - "fan_temp0" CPU temperature at which fan is started with low speed in millicelsius, default 55000 (55 °C)
7-
* - "fan_temp1" CPU temperature at which fan is switched to medium speed in millicelsius, default 60000 (60 °C)
8-
* - "fan_temp2" CPU temperature at which fan is switched to high speed in millicelsius, default 67500 (67.5 °C)
9-
* - "fan_temp3" CPU temperature at which fan is switched to max speed in millicelsius, default 75000 (75 °C)
10-
* - "fan_temp0_hyst" Temperature hysteris at which fan is stopped in millicelsius, default 5000 (resulting in 50 °C)
11-
* - "fan_temp1_hyst" Temperature hysteris at which fan is switched back to low speed in millicelsius, default 5000 (resulting in 55 °C)
12-
* - "fan_temp2_hyst" Temperature hysteris at which fan is switched back to medium speed in millicelsius, default 5000 (resulting in 62.5 °C)
13-
* - "fan_temp3_hyst" Temperature hysteris at which fan is switched back to high speed in millicelsius, default 5000 (resulting in 70 °C)
14-
* - "fan_temp0_speed" Fan speed for low cooling state in range 0 to 255, default 114 (45% PWM duty cycle)
15-
* - "fan_temp1_speed" Fan speed for medium cooling state in range 0 to 255, default 152 (60% PWM duty cycle)
16-
* - "fan_temp2_speed" Fan speed for high cooling state in range 0 to 255, default 204 (80% PWM duty cycle)
17-
* - "fan_temp3_speed" Fan speed for max cooling state in range 0 to 255, default 255 (100% PWM duty cycle)
6+
*
7+
* - "fan_temp0" CPU temperature at which fan is started with low speed in millicelsius,
8+
* default 55000 (55 °C)
9+
* - "fan_temp1" CPU temperature at which fan is switched to medium speed in millicelsius,
10+
* default 60000 (60 °C)
11+
* - "fan_temp2" CPU temperature at which fan is switched to high speed in millicelsius,
12+
* default 67500 (67.5 °C)
13+
* - "fan_temp3" CPU temperature at which fan is switched to max speed in millicelsius,
14+
* default 75000 (75 °C)
15+
* - "fan_temp0_hyst" Temperature hysteris at which fan is stopped in millicelsius,
16+
* default 5000 (resulting in 50 °C)
17+
* - "fan_temp1_hyst" Temperature hysteris at which fan is switched back to low speed
18+
* in millicelsius, default 5000 (resulting in 55 °C)
19+
* - "fan_temp2_hyst" Temperature hysteris at which fan is switched back to medium speed
20+
* in millicelsius, default 5000 (resulting in 62.5 °C)
21+
* - "fan_temp3_hyst" Temperature hysteris at which fan is switched back to high speed
22+
* in millicelsius, default 5000 (resulting in 70 °C)
23+
* - "fan_temp0_speed" Fan speed for low cooling state in range 0 to 255,
24+
* default 114 (45% PWM duty cycle)
25+
* - "fan_temp1_speed" Fan speed for medium cooling state in range 0 to 255,
26+
* default 152 (60% PWM duty cycle)
27+
* - "fan_temp2_speed" Fan speed for high cooling state in range 0 to 255,
28+
* default 204 (80% PWM duty cycle)
29+
* - "fan_temp3_speed" Fan speed for max cooling state in range 0 to 255,
30+
* default 255 (100% PWM duty cycle)
1831
*
1932
* N.B.
2033
* - Uses the software GPIO PWM kernel module instead of the Pis hardware PWMs (PWM0/PWM1).
@@ -73,8 +86,8 @@
7386

7487
cooling-min-state = <0>;
7588
cooling-max-state = <4>;
76-
/* PWM duty cycle values in a range from 0 to 255
77-
which correspond to thermal cooling states 0 to 4 */
89+
/* PWM duty cycle values in a range from 0 to 255 */
90+
/* which correspond to thermal cooling states 0 to 4 */
7891
cooling-levels = <0 114 152 204 255>;
7992
};
8093
};
@@ -138,20 +151,20 @@
138151
};
139152

140153
__overrides__ {
141-
fan_gpio = <&pwm_gpio>,"gpios:4",
154+
fan_gpio = <&pwm_gpio>,"gpios:4",
142155
<&pwm_gpio_pins>,"brcm,pins:0";
143156
fan_temp0 = <&trip0>,"temperature:0";
144157
fan_temp0_hyst = <&trip0>,"hysteresis:0";
145-
fan_temp0_speed = <&fan0>,"cooling-levels:4";
158+
fan_temp0_speed = <&fan0>,"cooling-levels:4";
146159
fan_temp1 = <&trip1>,"temperature:0";
147160
fan_temp1_hyst = <&trip1>,"hysteresis:0";
148-
fan_temp1_speed = <&fan0>,"cooling-levels:8";
161+
fan_temp1_speed = <&fan0>,"cooling-levels:8";
149162
fan_temp2 = <&trip2>,"temperature:0";
150163
fan_temp2_hyst = <&trip2>,"hysteresis:0";
151-
fan_temp2_speed = <&fan0>,"cooling-levels:12";
164+
fan_temp2_speed = <&fan0>,"cooling-levels:12";
152165
fan_temp3 = <&trip3>,"temperature:0";
153166
fan_temp3_hyst = <&trip3>,"hysteresis:0";
154-
fan_temp3_speed = <&fan0>,"cooling-levels:16";
167+
fan_temp3_speed = <&fan0>,"cooling-levels:16";
155168
};
156-
169+
157170
};

0 commit comments

Comments
 (0)