1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
|
From 4bf62f8dc97e24dadda64762ab47c299ac6eb8cb Mon Sep 17 00:00:00 2001
From: Phil Elwell <phil@raspberrypi.com>
Date: Tue, 3 May 2022 17:20:11 +0100
Subject: [PATCH] dtoverlays: Add i2c-fan overlay
Add an i2c-fan overlay, initially with support for the EMC2301
fan controller found on the CM4IO board.
Based on the overlay from Traverse Technologies, but modified for
the EMC2305 driver submitted to linux-hwmon.
Signed-off-by: Phil Elwell <phil@raspberrypi.com>
---
arch/arm/boot/dts/overlays/Makefile | 1 +
arch/arm/boot/dts/overlays/README | 33 +++++++
.../arm/boot/dts/overlays/i2c-fan-overlay.dts | 92 +++++++++++++++++++
3 files changed, 126 insertions(+)
create mode 100644 arch/arm/boot/dts/overlays/i2c-fan-overlay.dts
--- a/arch/arm/boot/dts/overlays/Makefile
+++ b/arch/arm/boot/dts/overlays/Makefile
@@ -85,6 +85,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
hy28b-2017.dtbo \
i-sabre-q2m.dtbo \
i2c-bcm2708.dtbo \
+ i2c-fan.dtbo \
i2c-gpio.dtbo \
i2c-mux.dtbo \
i2c-pwm-pca9685a.dtbo \
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -1530,6 +1530,39 @@ Load: dtoverlay=i2c-bcm2708
Params: <None>
+Name: i2c-fan
+Info: Adds support for a number of I2C fan controllers
+Load: dtoverlay=i2c-fan,<param>=<val>
+Params: addr Sets the address for the fan controller. Note
+ that the device must be configured to use the
+ specified address.
+
+ i2c0 Choose the I2C0 bus on GPIOs 0&1
+
+ i2c_csi_dsi Choose the I2C0 bus on GPIOs 44&45
+
+ minpwm PWM setting for the fan when the SoC is below
+ mintemp (range 0-255. default 0)
+ maxpwm PWM setting for the fan when the SoC is above
+ maxtemp (range 0-255. default 255)
+ midtemp Temperature (in millicelcius) at which the fan
+ begins to speed up (default 50000)
+
+ midtemp_hyst Temperature delta (in millicelcius) below
+ mintemp at which the fan will drop to minrpm
+ (default 2000)
+
+ maxtemp Temperature (in millicelcius) at which the fan
+ will be held at maxrpm (default 70000)
+
+ maxtemp_hyst Temperature delta (in millicelcius) below
+ maxtemp at which the fan begins to slow down
+ (default 2000)
+
+ emc2301 Select the Microchip EMC230x controller family
+ - EMC2301, EMC2302, EMC2303, EMC2305.
+
+
Name: i2c-gpio
Info: Adds support for software i2c controller on gpio pins
Load: dtoverlay=i2c-gpio,<param>=<val>
--- /dev/null
+++ b/arch/arm/boot/dts/overlays/i2c-fan-overlay.dts
@@ -0,0 +1,92 @@
+// Definitions for I2C based sensors using the Industrial IO or HWMON interface.
+/dts-v1/;
+/plugin/;
+
+#include <dt-bindings/thermal/thermal.h>
+
+/ {
+ compatible = "brcm,bcm2835";
+
+ fragment@0 {
+ target = <&i2cbus>;
+ __dormant__ {
+ #address-cells = <1>;
+ #size-cells = <0>;
+ status = "okay";
+
+ emc2301: emc2301@2f {
+ compatible = "microchip,emc2301";
+ reg = <0x2f>;
+ status = "okay";
+ #cooling-cells = <0x02>;
+ };
+ };
+ };
+
+ frag100: fragment@100 {
+ target = <&i2c_arm>;
+ i2cbus: __overlay__ {
+ status = "okay";
+ };
+ };
+
+ fragment@101 {
+ target = <&i2c0if>;
+ __dormant__ {
+ status = "okay";
+ };
+ };
+
+ fragment@102 {
+ target = <&i2c0mux>;
+ __dormant__ {
+ status = "okay";
+ };
+ };
+
+ fragment@103 {
+ target = <&cpu_thermal>;
+ polling-delay = <2000>; /* milliseconds */
+ __overlay__ {
+ trips {
+ fanmid0: fanmid0 {
+ temperature = <50000>;
+ hysteresis = <2000>;
+ type = "active";
+ };
+ fanmax0: fanmax0 {
+ temperature = <75000>;
+ hysteresis = <2000>;
+ type = "active";
+ };
+ };
+ cooling-maps {
+ map0: map0 {
+ trip = <&fanmid0>;
+ cooling-device = <&emc2301 2 6>;
+ };
+ map1: map1 {
+ trip = <&fanmax0>;
+ cooling-device = <&emc2301 7 THERMAL_NO_LIMIT>;
+ };
+ };
+ };
+ };
+
+ __overrides__ {
+ i2c0 = <&frag100>,"target:0=",<&i2c0>;
+ i2c_csi_dsi = <&frag100>,"target:0=",<&i2c_csi_dsi>,
+ <0>,"+101+102";
+ addr = <&emc2301>,"reg:0";
+ minpwm = <&emc2301>,"emc2305,pwm-min;0";
+ maxpwm = <&emc2301>,"emc2305,pwm-max;0";
+ midtemp = <&fanmid0>,"temperature:0";
+ midtemp_hyst = <&fanmid0>,"hysteresis:0";
+ maxtemp = <&fanmax0>,"temperature:0";
+ maxtemp_hyst = <&fanmax0>,"hysteresis:0";
+
+ emc2301 = <0>,"+0",
+ <&map0>,"cooling-device:0=",<&emc2301>,
+ <&map1>,"cooling-device:0=",<&emc2301>;
+ };
+};
|