5949b92be1947afc74ecdd54c803025c8b687811
[openwrt/openwrt.git] / target / linux / gemini / patches-5.4 / 0004-ARM-dts-gemini-Add-thermal-zone-to-DIR-685.patch
1 From 2b2e9d0e1ee4765b21c648235489028c6dc7e336 Mon Sep 17 00:00:00 2001
2 From: Linus Walleij <linus.walleij@linaro.org>
3 Date: Tue, 31 Dec 2019 18:18:08 +0100
4 Subject: [PATCH 4/7] ARM: dts: gemini: Add thermal zone to DIR-685
5
6 The DIR-685 can now exploit the thermal zone added by the
7 drive temperature sensor inside the hard drive. We have
8 patched the libata subsystem to assign the device nodes
9 properly to the SCSI devices and this is what the drivetemp
10 driver will use to populate the sensor and the thermal
11 zone, so pick that up into the thermal zone and let this
12 control the fan.
13
14 The hardware lacks an embedded temperature sensor so the
15 D-Link vendor firmware uses this method to control the
16 temperature of the NAS enclosure using the thermal sensor
17 inside the hard drive.
18
19 The drive temperature trigger points to be used comes from
20 the vendor firmware.
21
22 Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
23 ---
24 arch/arm/boot/dts/gemini-dlink-dir-685.dts | 48 ++++++++++++++++++++--
25 1 file changed, 45 insertions(+), 3 deletions(-)
26
27 --- a/arch/arm/boot/dts/gemini-dlink-dir-685.dts
28 +++ b/arch/arm/boot/dts/gemini-dlink-dir-685.dts
29 @@ -119,13 +119,11 @@
30
31 /*
32 * This is a Sunon Maglev GM0502PFV2-8 cooling fan @10000 RPM.
33 - * Since the platform has no temperature sensor, this is controlled
34 - * from userspace by using the hard disks S.M.A.R.T. temperature
35 * sensor. It is turned on when the temperature exceeds 46 degrees
36 * and turned off when the temperatures goes below 41 degrees
37 * (celsius).
38 */
39 - gpio-fan {
40 + fan0: gpio-fan {
41 compatible = "gpio-fan";
42 /* Collides with IDE */
43 gpios = <&gpio1 6 GPIO_ACTIVE_HIGH>;
44 @@ -133,6 +131,40 @@
45 #cooling-cells = <2>;
46 };
47
48 + thermal-zones {
49 + chassis-thermal {
50 + /* Poll every 20 seconds */
51 + polling-delay = <20000>;
52 + /* Poll every 2nd second when cooling */
53 + polling-delay-passive = <2000>;
54 + /* Use the thermal sensor in the hard drive */
55 + thermal-sensors = <&drive0>;
56 +
57 + /* Tripping points from the fan.script in the rootfs */
58 + trips {
59 + alert: chassis-alert {
60 + /* At 43 degrees turn on the fan */
61 + temperature = <43000>;
62 + hysteresis = <3000>;
63 + type = "active";
64 + };
65 + crit: chassis-crit {
66 + /* Just shut down at 60 degrees */
67 + temperature = <60000>;
68 + hysteresis = <2000>;
69 + type = "critical";
70 + };
71 + };
72 +
73 + cooling-maps {
74 + map0 {
75 + trip = <&alert>;
76 + cooling-device = <&fan0 1 1>;
77 + };
78 + };
79 + };
80 + };
81 +
82 /*
83 * The touchpad input is connected to a GPIO bit-banged
84 * I2C bus.
85 @@ -445,6 +477,16 @@
86
87 ide@63000000 {
88 status = "okay";
89 +
90 + /*
91 + * This drive may have a temperature sensor with a
92 + * thermal zone we can use for thermal control of the
93 + * chassis temperature using the fan.
94 + */
95 + drive0: ide-port@0 {
96 + reg = <0>;
97 + #thermal-sensor-cells = <0>;
98 + };
99 };
100
101 display-controller@6a000000 {