ee53d7acaf6d451ad1baa0a2971b7b0d6c07fe19
[openwrt/staging/ynezz.git] /
1 From 7782ca4dcb10a244ae476126220890a0843c439e Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Wed, 6 Jan 2021 17:28:57 +0000
4 Subject: [PATCH] dt: Add a camera regulator node to all downstream Pi
5 platforms
6
7 The current firmware fixup of camera sensor overlays is not
8 particularly nice, and it stops you being able to load them
9 dynamically.
10 It's also incompatible with creating a simple DT that can be
11 loaded for both CAM1 and CAM0 on a CM as they would both
12 try to claim the one GPIO.
13
14 Almost all sensors have a hook of some form for a regulator, so
15 it's relatively straightforward to convert them all to use a
16 fixed regulator with GPIO control.
17
18 Add a fixed regulator node for each platform with the GPIO
19 correctly configured for the camera shutdown line. (The LED line
20 is ignored).
21
22 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
23 ---
24 arch/arm/boot/dts/bcm2708-rpi-b-plus.dts | 5 +++++
25 arch/arm/boot/dts/bcm2708-rpi-b-rev1.dts | 5 +++++
26 arch/arm/boot/dts/bcm2708-rpi-b.dts | 5 +++++
27 arch/arm/boot/dts/bcm2708-rpi-cm.dts | 15 +++++++++++++++
28 arch/arm/boot/dts/bcm2708-rpi-zero-w.dts | 5 +++++
29 arch/arm/boot/dts/bcm2708-rpi-zero.dts | 5 +++++
30 arch/arm/boot/dts/bcm2709-rpi-2-b.dts | 5 +++++
31 arch/arm/boot/dts/bcm2710-rpi-2-b.dts | 5 +++++
32 arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts | 5 +++++
33 arch/arm/boot/dts/bcm2710-rpi-3-b.dts | 5 +++++
34 arch/arm/boot/dts/bcm2710-rpi-cm3.dts | 15 +++++++++++++++
35 arch/arm/boot/dts/bcm2711-rpi-4-b.dts | 5 +++++
36 arch/arm/boot/dts/bcm2711-rpi-cm4.dts | 8 ++++++++
37 arch/arm/boot/dts/bcm283x-rpi-cam1-regulator.dtsi | 10 ++++++++++
38 14 files changed, 98 insertions(+)
39 create mode 100644 arch/arm/boot/dts/bcm283x-rpi-cam1-regulator.dtsi
40
41 --- a/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts
42 +++ b/arch/arm/boot/dts/bcm2708-rpi-b-plus.dts
43 @@ -5,6 +5,7 @@
44 #include "bcm283x-rpi-smsc9514.dtsi"
45 #include "bcm283x-rpi-csi1-2lane.dtsi"
46 #include "bcm283x-rpi-i2c0mux_0_28.dtsi"
47 +#include "bcm283x-rpi-cam1-regulator.dtsi"
48
49 / {
50 compatible = "raspberrypi,model-b-plus", "brcm,bcm2835";
51 @@ -111,6 +112,10 @@
52 pinctrl-0 = <&audio_pins>;
53 };
54
55 +&cam1_reg {
56 + gpio = <&gpio 41 GPIO_ACTIVE_HIGH>;
57 +};
58 +
59 / {
60 __overrides__ {
61 act_led_gpio = <&act_led>,"gpios:4";
62 --- a/arch/arm/boot/dts/bcm2708-rpi-b-rev1.dts
63 +++ b/arch/arm/boot/dts/bcm2708-rpi-b-rev1.dts
64 @@ -4,6 +4,7 @@
65 #include "bcm2708-rpi.dtsi"
66 #include "bcm283x-rpi-smsc9512.dtsi"
67 #include "bcm283x-rpi-csi1-2lane.dtsi"
68 +#include "bcm283x-rpi-cam1-regulator.dtsi"
69
70 / {
71 compatible = "raspberrypi,model-b", "brcm,bcm2835";
72 @@ -118,6 +119,10 @@ i2c_csi_dsi: &i2c1 {
73 pinctrl-0 = <&audio_pins>;
74 };
75
76 +&cam1_reg {
77 + gpio = <&gpio 27 GPIO_ACTIVE_HIGH>;
78 +};
79 +
80 / {
81 __overrides__ {
82 act_led_gpio = <&act_led>,"gpios:4";
83 --- a/arch/arm/boot/dts/bcm2708-rpi-b.dts
84 +++ b/arch/arm/boot/dts/bcm2708-rpi-b.dts
85 @@ -5,6 +5,7 @@
86 #include "bcm283x-rpi-smsc9512.dtsi"
87 #include "bcm283x-rpi-csi1-2lane.dtsi"
88 #include "bcm283x-rpi-i2c0mux_0_28.dtsi"
89 +#include "bcm283x-rpi-cam1-regulator.dtsi"
90
91 / {
92 compatible = "raspberrypi,model-b", "brcm,bcm2835";
93 @@ -105,6 +106,10 @@
94 pinctrl-0 = <&audio_pins>;
95 };
96
97 +&cam1_reg {
98 + gpio = <&gpio 21 GPIO_ACTIVE_HIGH>;
99 +};
100 +
101 / {
102 __overrides__ {
103 act_led_gpio = <&act_led>,"gpios:4";
104 --- a/arch/arm/boot/dts/bcm2708-rpi-cm.dts
105 +++ b/arch/arm/boot/dts/bcm2708-rpi-cm.dts
106 @@ -8,6 +8,21 @@
107 / {
108 compatible = "raspberrypi,compute-module", "brcm,bcm2835";
109 model = "Raspberry Pi Compute Module";
110 +
111 + cam1_reg: cam1_reg {
112 + compatible = "regulator-fixed";
113 + regulator-name = "cam1-regulator";
114 + gpio = <&gpio 2 GPIO_ACTIVE_HIGH>;
115 + enable-active-high;
116 + status = "disabled";
117 + };
118 + cam0_reg: cam0_reg {
119 + compatible = "regulator-fixed";
120 + regulator-name = "cam0-regulator";
121 + gpio = <&gpio 30 GPIO_ACTIVE_HIGH>;
122 + enable-active-high;
123 + status = "disabled";
124 + };
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,6 +5,7 @@
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 @@ -155,6 +156,10 @@
139 brcm,disable-headphones = <1>;
140 };
141
142 +&cam1_reg {
143 + gpio = <&gpio 44 GPIO_ACTIVE_HIGH>;
144 +};
145 +
146 / {
147 __overrides__ {
148 act_led_gpio = <&act_led>,"gpios:4";
149 --- a/arch/arm/boot/dts/bcm2708-rpi-zero.dts
150 +++ b/arch/arm/boot/dts/bcm2708-rpi-zero.dts
151 @@ -4,6 +4,7 @@
152 #include "bcm2708-rpi.dtsi"
153 #include "bcm283x-rpi-csi1-2lane.dtsi"
154 #include "bcm283x-rpi-i2c0mux_0_28.dtsi"
155 +#include "bcm283x-rpi-cam1-regulator.dtsi"
156
157 / {
158 compatible = "raspberrypi,model-zero", "brcm,bcm2835";
159 @@ -109,6 +110,10 @@
160 brcm,disable-headphones = <1>;
161 };
162
163 +&cam1_reg {
164 + gpio = <&gpio 41 GPIO_ACTIVE_HIGH>;
165 +};
166 +
167 / {
168 __overrides__ {
169 act_led_gpio = <&act_led>,"gpios:4";
170 --- a/arch/arm/boot/dts/bcm2709-rpi-2-b.dts
171 +++ b/arch/arm/boot/dts/bcm2709-rpi-2-b.dts
172 @@ -5,6 +5,7 @@
173 #include "bcm283x-rpi-smsc9514.dtsi"
174 #include "bcm283x-rpi-csi1-2lane.dtsi"
175 #include "bcm283x-rpi-i2c0mux_0_28.dtsi"
176 +#include "bcm283x-rpi-cam1-regulator.dtsi"
177
178 / {
179 compatible = "raspberrypi,2-model-b", "brcm,bcm2836";
180 @@ -111,6 +112,10 @@
181 pinctrl-0 = <&audio_pins>;
182 };
183
184 +&cam1_reg {
185 + gpio = <&gpio 41 GPIO_ACTIVE_HIGH>;
186 +};
187 +
188 / {
189 __overrides__ {
190 act_led_gpio = <&act_led>,"gpios:4";
191 --- a/arch/arm/boot/dts/bcm2710-rpi-2-b.dts
192 +++ b/arch/arm/boot/dts/bcm2710-rpi-2-b.dts
193 @@ -5,6 +5,7 @@
194 #include "bcm283x-rpi-smsc9514.dtsi"
195 #include "bcm283x-rpi-csi1-2lane.dtsi"
196 #include "bcm283x-rpi-i2c0mux_0_28.dtsi"
197 +#include "bcm283x-rpi-cam1-regulator.dtsi"
198
199 / {
200 compatible = "raspberrypi,2-model-b-rev2", "brcm,bcm2837";
201 @@ -111,6 +112,10 @@
202 pinctrl-0 = <&audio_pins>;
203 };
204
205 +&cam1_reg {
206 + gpio = <&gpio 41 GPIO_ACTIVE_HIGH>;
207 +};
208 +
209 / {
210 __overrides__ {
211 act_led_gpio = <&act_led>,"gpios:4";
212 --- a/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts
213 +++ b/arch/arm/boot/dts/bcm2710-rpi-3-b-plus.dts
214 @@ -6,6 +6,7 @@
215 #include "bcm283x-rpi-csi1-2lane.dtsi"
216 #include "bcm283x-rpi-i2c0mux_0_44.dtsi"
217 #include "bcm271x-rpi-bt.dtsi"
218 +#include "bcm283x-rpi-cam1-regulator.dtsi"
219
220 / {
221 compatible = "raspberrypi,3-model-b-plus", "brcm,bcm2837";
222 @@ -176,6 +177,10 @@
223 microchip,downshift-after = <2>;
224 };
225
226 +&cam1_reg {
227 + gpio = <&expgpio 5 GPIO_ACTIVE_HIGH>;
228 +};
229 +
230 / {
231 __overrides__ {
232 act_led_gpio = <&act_led>,"gpios:4";
233 --- a/arch/arm/boot/dts/bcm2710-rpi-3-b.dts
234 +++ b/arch/arm/boot/dts/bcm2710-rpi-3-b.dts
235 @@ -6,6 +6,7 @@
236 #include "bcm283x-rpi-csi1-2lane.dtsi"
237 #include "bcm283x-rpi-i2c0mux_0_44.dtsi"
238 #include "bcm271x-rpi-bt.dtsi"
239 +#include "bcm283x-rpi-cam1-regulator.dtsi"
240
241 / {
242 compatible = "raspberrypi,3-model-b", "brcm,bcm2837";
243 @@ -185,6 +186,10 @@
244 pinctrl-0 = <&audio_pins>;
245 };
246
247 +&cam1_reg {
248 + gpio = <&expgpio 5 GPIO_ACTIVE_HIGH>;
249 +};
250 +
251 / {
252 __overrides__ {
253 act_led_gpio = <&act_led>,"gpios:4";
254 --- a/arch/arm/boot/dts/bcm2710-rpi-cm3.dts
255 +++ b/arch/arm/boot/dts/bcm2710-rpi-cm3.dts
256 @@ -8,6 +8,21 @@
257 / {
258 compatible = "raspberrypi,3-compute-module", "brcm,bcm2837";
259 model = "Raspberry Pi Compute Module 3";
260 +
261 + cam1_reg: cam1_reg {
262 + compatible = "regulator-fixed";
263 + regulator-name = "cam1-regulator";
264 + gpio = <&gpio 2 GPIO_ACTIVE_HIGH>;
265 + enable-active-high;
266 + status = "disabled";
267 + };
268 + cam0_reg: cam0_reg {
269 + compatible = "regulator-fixed";
270 + regulator-name = "cam0-regulator";
271 + gpio = <&gpio 30 GPIO_ACTIVE_HIGH>;
272 + enable-active-high;
273 + status = "disabled";
274 + };
275 };
276
277 &uart0 {
278 --- a/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
279 +++ b/arch/arm/boot/dts/bcm2711-rpi-4-b.dts
280 @@ -320,6 +320,7 @@
281 #include "bcm2711-rpi.dtsi"
282 #include "bcm283x-rpi-csi1-2lane.dtsi"
283 #include "bcm283x-rpi-i2c0mux_0_44.dtsi"
284 +#include "bcm283x-rpi-cam1-regulator.dtsi"
285
286 / {
287 chosen {
288 @@ -586,6 +587,10 @@
289 pinctrl-0 = <&audio_pins>;
290 };
291
292 +&cam1_reg {
293 + gpio = <&expgpio 5 GPIO_ACTIVE_HIGH>;
294 +};
295 +
296 / {
297 __overrides__ {
298 act_led_gpio = <&act_led>,"gpios:4";
299 --- a/arch/arm/boot/dts/bcm2711-rpi-cm4.dts
300 +++ b/arch/arm/boot/dts/bcm2711-rpi-cm4.dts
301 @@ -327,6 +327,14 @@
302 };
303
304 /delete-node/ wifi-pwrseq;
305 +
306 + cam0_reg: cam1_reg: cam1_reg {
307 + compatible = "regulator-fixed";
308 + regulator-name = "cam1-reg";
309 + gpio = <&expgpio 5 GPIO_ACTIVE_HIGH>;
310 + enable-active-high;
311 + status = "disabled";
312 + };
313 };
314
315 &mmcnr {
316 --- /dev/null
317 +++ b/arch/arm/boot/dts/bcm283x-rpi-cam1-regulator.dtsi
318 @@ -0,0 +1,10 @@
319 +// SPDX-License-Identifier: GPL-2.0
320 +
321 +/ {
322 + cam1_reg: cam1_reg {
323 + compatible = "regulator-fixed";
324 + regulator-name = "cam1-reg";
325 + enable-active-high;
326 + status = "disabled";
327 + };
328 +};