fa83feda9ec092220bb0d9931bcd84634e859c88
[openwrt/staging/blogic.git] /
1 From 322899a48088cb09b3f2a068f78c93a63615da9e Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Sat, 20 Nov 2021 10:48:36 +0000
4 Subject: [PATCH] dt: Create static regulators and clocks for camera
5 nodes
6
7 Unloading regulators through dynamic device tree doesn't work
8 as the regulators will unregister whilst clients are still
9 registered. Whilst the regulator framework does WARN when that
10 happens, the client putting the regulator then typically results
11 in a NULL dereference and badness.
12
13 Instead of creating regulators and clocks from the overlays,
14 create regulators and clocks for the sensors in the base DT.
15
16 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
17 ---
18 arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 4 ++-
19 arch/arm/boot/dts/bcm2708-rpi-b-rev1.dts | 4 ++-
20 arch/arm/boot/dts/bcm2708-rpi-b.dts | 4 ++-
21 arch/arm/boot/dts/bcm2708-rpi-cm.dts | 21 ++++--------
22 arch/arm/boot/dts/bcm2708-rpi-zero-w.dts | 4 ++-
23 arch/arm/boot/dts/bcm2708-rpi-zero.dts | 4 ++-
24 arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 4 ++-
25 arch/arm/boot/dts/bcm270x.dtsi | 33 +++++++++++++++++++
26 arch/arm/boot/dts/bcm2710-rpi-2-b.dts | 4 ++-
27 arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts | 4 ++-
28 arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 4 ++-
29 arch/arm/boot/dts/bcm2710-rpi-cm3.dts | 21 ++++--------
30 arch/arm/boot/dts/bcm2710-rpi-zero-2-w.dts | 4 ++-
31 arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 4 ++-
32 arch/arm/boot/dts/bcm2711-rpi-cm4.dts | 1 -
33 .../boot/dts/bcm283x-rpi-cam1-regulator.dtsi | 10 ------
34 16 files changed, 80 insertions(+), 50 deletions(-)
35 delete mode 100644 arch/arm/boot/dts/bcm283x-rpi-cam1-regulator.dtsi
36
37 --- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts
38 +++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts
39 @@ -5,7 +5,6 @@
40 #include "bcm283x-rpi-smsc9514.dtsi"
41 #include "bcm283x-rpi-csi1-2lane.dtsi"
42 #include "bcm283x-rpi-i2c0mux_0_28.dtsi"
43 -#include "bcm283x-rpi-cam1-regulator.dtsi"
44
45 / {
46 compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
47 @@ -116,6 +115,9 @@
48 gpio = <&gpio 41 GPIO_ACTIVE_HIGH>;
49 };
50
51 +cam0_reg: &cam_dummy_reg {
52 +};
53 +
54 / {
55 __overrides__ {
56 act_led_gpio = <&act_led>,"gpios:4";
57 --- a/arch/arm/boot/dts/bcm2708-rpi-b-rev1.dts
58 +++ b/arch/arm/boot/dts/bcm2708-rpi-b-rev1.dts
59 @@ -4,7 +4,6 @@
60 #include "bcm2708-rpi.dtsi"
61 #include "bcm283x-rpi-smsc9512.dtsi"
62 #include "bcm283x-rpi-csi1-2lane.dtsi"
63 -#include "bcm283x-rpi-cam1-regulator.dtsi"
64
65 / {
66 compatible = "raspberrypi,model-b", "brcm,bcm2835";
67 @@ -123,6 +122,9 @@ i2c_csi_dsi: &i2c1 {
68 gpio = <&gpio 27 GPIO_ACTIVE_HIGH>;
69 };
70
71 +cam0_reg: &cam_dummy_reg {
72 +};
73 +
74 / {
75 __overrides__ {
76 act_led_gpio = <&act_led>,"gpios:4";
77 --- a/arch/arm/boot/dts/bcm2708-rpi-b.dts
78 +++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts
79 @@ -5,7 +5,6 @@
80 #include "bcm283x-rpi-smsc9512.dtsi"
81 #include "bcm283x-rpi-csi1-2lane.dtsi"
82 #include "bcm283x-rpi-i2c0mux_0_28.dtsi"
83 -#include "bcm283x-rpi-cam1-regulator.dtsi"
84
85 / {
86 compatible = "raspberrypi,model-b", "brcm,bcm2835";
87 @@ -110,6 +109,9 @@
88 gpio = <&gpio 21 GPIO_ACTIVE_HIGH>;
89 };
90
91 +cam0_reg: &cam_dummy_reg {
92 +};
93 +
94 / {
95 __overrides__ {
96 act_led_gpio = <&act_led>,"gpios:4";
97 --- a/arch/arm/boot/dts/bcm2708-rpi-cm.dts
98 +++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts
99 @@ -8,21 +8,14 @@
100 / {
101 compatible = "raspberrypi,compute-module", "brcm,bcm2835";
102 model = "Raspberry Pi Compute Module";
103 +};
104 +
105 +&cam1_reg {
106 + gpio = <&gpio 2 GPIO_ACTIVE_HIGH>;
107 +};
108
109 - cam1_reg: cam1_reg {
110 - compatible = "regulator-fixed";
111 - regulator-name = "cam1-regulator";
112 - gpio = <&gpio 2 GPIO_ACTIVE_HIGH>;
113 - enable-active-high;
114 - status = "disabled";
115 - };
116 - cam0_reg: cam0_reg {
117 - compatible = "regulator-fixed";
118 - regulator-name = "cam0-regulator";
119 - gpio = <&gpio 30 GPIO_ACTIVE_HIGH>;
120 - enable-active-high;
121 - status = "disabled";
122 - };
123 +cam0_reg: &cam0_regulator {
124 + gpio = <&gpio 30 GPIO_ACTIVE_HIGH>;
125 };
126
127 &uart0 {
128 --- a/arch/arm/boot/dts/bcm2708-rpi-zero-w.dts
129 +++ b/arch/arm/boot/dts/bcm2708-rpi-zero-w.dts
130 @@ -5,7 +5,6 @@
131 #include "bcm283x-rpi-csi1-2lane.dtsi"
132 #include "bcm283x-rpi-i2c0mux_0_28.dtsi"
133 #include "bcm2708-rpi-bt.dtsi"
134 -#include "bcm283x-rpi-cam1-regulator.dtsi"
135
136 / {
137 compatible = "raspberrypi,model-zero-w", "brcm,bcm2835";
138 @@ -167,6 +166,9 @@
139 gpio = <&gpio 44 GPIO_ACTIVE_HIGH>;
140 };
141
142 +cam0_reg: &cam_dummy_reg {
143 +};
144 +
145 / {
146 __overrides__ {
147 act_led_gpio = <&act_led>,"gpios:4";
148 --- a/arch/arm/boot/dts/bcm2708-rpi-zero.dts
149 +++ b/arch/arm/boot/dts/bcm2708-rpi-zero.dts
150 @@ -4,7 +4,6 @@
151 #include "bcm2708-rpi.dtsi"
152 #include "bcm283x-rpi-csi1-2lane.dtsi"
153 #include "bcm283x-rpi-i2c0mux_0_28.dtsi"
154 -#include "bcm283x-rpi-cam1-regulator.dtsi"
155
156 / {
157 compatible = "raspberrypi,model-zero", "brcm,bcm2835";
158 @@ -114,6 +113,9 @@
159 gpio = <&gpio 41 GPIO_ACTIVE_HIGH>;
160 };
161
162 +cam0_reg: &cam_dummy_reg {
163 +};
164 +
165 / {
166 __overrides__ {
167 act_led_gpio = <&act_led>,"gpios:4";
168 --- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts
169 +++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts
170 @@ -5,7 +5,6 @@
171 #include "bcm283x-rpi-smsc9514.dtsi"
172 #include "bcm283x-rpi-csi1-2lane.dtsi"
173 #include "bcm283x-rpi-i2c0mux_0_28.dtsi"
174 -#include "bcm283x-rpi-cam1-regulator.dtsi"
175
176 / {
177 compatible = "raspberrypi,2-model-b", "brcm,bcm2836";
178 @@ -116,6 +115,9 @@
179 gpio = <&gpio 41 GPIO_ACTIVE_HIGH>;
180 };
181
182 +cam0_reg: &cam_dummy_reg {
183 +};
184 +
185 / {
186 __overrides__ {
187 act_led_gpio = <&act_led>,"gpios:4";
188 --- a/arch/arm/boot/dts/bcm270x.dtsi
189 +++ b/arch/arm/boot/dts/bcm270x.dtsi
190 @@ -153,6 +153,39 @@
191 };
192 };
193
194 + cam1_reg: cam1_regulator {
195 + compatible = "regulator-fixed";
196 + regulator-name = "cam1-reg";
197 + enable-active-high;
198 + /* Needs to be enabled, as removing a regulator is very unsafe */
199 + status = "okay";
200 + };
201 +
202 + cam1_clk: cam1_clk {
203 + compatible = "fixed-clock";
204 + #clock-cells = <0>;
205 + status = "disabled";
206 + };
207 +
208 + cam0_regulator: cam0_regulator {
209 + compatible = "regulator-fixed";
210 + regulator-name = "cam0-reg";
211 + enable-active-high;
212 + status = "disabled";
213 + };
214 +
215 + cam0_clk: cam0_clk {
216 + compatible = "fixed-clock";
217 + #clock-cells = <0>;
218 + status = "disabled";
219 + };
220 +
221 + cam_dummy_reg: cam_dummy_reg {
222 + compatible = "regulator-fixed";
223 + regulator-name = "cam-dummy-reg";
224 + status = "okay";
225 + };
226 +
227 __overrides__ {
228 cam0-pwdn-ctrl;
229 cam0-pwdn;
230 --- a/arch/arm/boot/dts/bcm2710-rpi-2-b.dts
231 +++ b/arch/arm/boot/dts/bcm2710-rpi-2-b.dts
232 @@ -5,7 +5,6 @@
233 #include "bcm283x-rpi-smsc9514.dtsi"
234 #include "bcm283x-rpi-csi1-2lane.dtsi"
235 #include "bcm283x-rpi-i2c0mux_0_28.dtsi"
236 -#include "bcm283x-rpi-cam1-regulator.dtsi"
237
238 / {
239 compatible = "raspberrypi,2-model-b-rev2", "brcm,bcm2837";
240 @@ -116,6 +115,9 @@
241 gpio = <&gpio 41 GPIO_ACTIVE_HIGH>;
242 };
243
244 +cam0_reg: &cam_dummy_reg {
245 +};
246 +
247 / {
248 __overrides__ {
249 act_led_gpio = <&act_led>,"gpios:4";
250 --- a/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts
251 +++ b/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts
252 @@ -6,7 +6,6 @@
253 #include "bcm283x-rpi-csi1-2lane.dtsi"
254 #include "bcm283x-rpi-i2c0mux_0_44.dtsi"
255 #include "bcm271x-rpi-bt.dtsi"
256 -#include "bcm283x-rpi-cam1-regulator.dtsi"
257
258 / {
259 compatible = "raspberrypi,3-model-b-plus", "brcm,bcm2837";
260 @@ -188,6 +187,9 @@
261 gpio = <&expgpio 5 GPIO_ACTIVE_HIGH>;
262 };
263
264 +cam0_reg: &cam_dummy_reg {
265 +};
266 +
267 / {
268 __overrides__ {
269 act_led_gpio = <&act_led>,"gpios:4";
270 --- a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts
271 +++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts
272 @@ -6,7 +6,6 @@
273 #include "bcm283x-rpi-csi1-2lane.dtsi"
274 #include "bcm283x-rpi-i2c0mux_0_44.dtsi"
275 #include "bcm271x-rpi-bt.dtsi"
276 -#include "bcm283x-rpi-cam1-regulator.dtsi"
277
278 / {
279 compatible = "raspberrypi,3-model-b", "brcm,bcm2837";
280 @@ -197,6 +196,9 @@
281 gpio = <&expgpio 5 GPIO_ACTIVE_HIGH>;
282 };
283
284 +cam0_reg: &cam_dummy_reg {
285 +};
286 +
287 / {
288 __overrides__ {
289 act_led_gpio = <&act_led>,"gpios:4";
290 --- a/arch/arm/boot/dts/bcm2710-rpi-cm3.dts
291 +++ b/arch/arm/boot/dts/bcm2710-rpi-cm3.dts
292 @@ -8,21 +8,14 @@
293 / {
294 compatible = "raspberrypi,3-compute-module", "brcm,bcm2837";
295 model = "Raspberry Pi Compute Module 3";
296 +};
297 +
298 +&cam1_reg {
299 + gpio = <&gpio 2 GPIO_ACTIVE_HIGH>;
300 +};
301
302 - cam1_reg: cam1_reg {
303 - compatible = "regulator-fixed";
304 - regulator-name = "cam1-regulator";
305 - gpio = <&gpio 2 GPIO_ACTIVE_HIGH>;
306 - enable-active-high;
307 - status = "disabled";
308 - };
309 - cam0_reg: cam0_reg {
310 - compatible = "regulator-fixed";
311 - regulator-name = "cam0-regulator";
312 - gpio = <&gpio 30 GPIO_ACTIVE_HIGH>;
313 - enable-active-high;
314 - status = "disabled";
315 - };
316 +cam0_reg: &cam0_regulator {
317 + gpio = <&gpio 30 GPIO_ACTIVE_HIGH>;
318 };
319
320 &uart0 {
321 --- a/arch/arm/boot/dts/bcm2710-rpi-zero-2-w.dts
322 +++ b/arch/arm/boot/dts/bcm2710-rpi-zero-2-w.dts
323 @@ -5,7 +5,6 @@
324 #include "bcm283x-rpi-csi1-2lane.dtsi"
325 #include "bcm283x-rpi-i2c0mux_0_44.dtsi"
326 #include "bcm2708-rpi-bt.dtsi"
327 -#include "bcm283x-rpi-cam1-regulator.dtsi"
328
329 / {
330 compatible = "raspberrypi,model-zero-2-w", "brcm,bcm2837";
331 @@ -188,6 +187,9 @@
332 gpio = <&gpio 40 GPIO_ACTIVE_HIGH>;
333 };
334
335 +cam0_reg: &cam_dummy_reg {
336 +};
337 +
338 / {
339 __overrides__ {
340 act_led_gpio = <&act_led>,"gpios:4";
341 --- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
342 +++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
343 @@ -279,7 +279,6 @@
344 #include "bcm2711-rpi-ds.dtsi"
345 #include "bcm283x-rpi-csi1-2lane.dtsi"
346 #include "bcm283x-rpi-i2c0mux_0_44.dtsi"
347 -#include "bcm283x-rpi-cam1-regulator.dtsi"
348
349 / {
350 chosen {
351 @@ -548,6 +547,9 @@
352 gpio = <&expgpio 5 GPIO_ACTIVE_HIGH>;
353 };
354
355 +cam0_reg: &cam_dummy_reg {
356 +};
357 +
358 / {
359 __overrides__ {
360 act_led_gpio = <&act_led>,"gpios:4";
361 --- a/arch/arm/boot/dts/bcm2711-rpi-cm4.dts
362 +++ b/arch/arm/boot/dts/bcm2711-rpi-cm4.dts
363 @@ -297,7 +297,6 @@
364 #include "bcm283x-rpi-csi0-2lane.dtsi"
365 #include "bcm283x-rpi-csi1-4lane.dtsi"
366 #include "bcm283x-rpi-i2c0mux_0_44.dtsi"
367 -#include "bcm283x-rpi-cam1-regulator.dtsi"
368
369 / {
370 chosen {
371 --- a/arch/arm/boot/dts/bcm283x-rpi-cam1-regulator.dtsi
372 +++ /dev/null
373 @@ -1,10 +0,0 @@
374 -// SPDX-License-Identifier: GPL-2.0
375 -
376 -/ {
377 - cam1_reg: cam1_reg {
378 - compatible = "regulator-fixed";
379 - regulator-name = "cam1-reg";
380 - enable-active-high;
381 - status = "disabled";
382 - };
383 -};