1aa699f3fa595138d27616722751d32334250eea
[openwrt/staging/blogic.git] /
1 From 2cc810fd22f30acabbf5e6726e003c5da56d3212 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Mon, 31 Jan 2022 17:25:19 +0000
4 Subject: [PATCH] dtoverlays: Rework vc4-kms-dpi overlays to remove
5 duplication
6
7 Removes all the common panel, dpi, and backlight configuration
8 from the individual vc4-kms-dpi-* files into vc4-kms-dpi.dtsi.
9
10 Creates a new vc4-kms-dpi-panel-overlay.dts for preconfigured
11 panels, with overrides to enable the different panel configurations.
12
13 Deprecates vc4-kms-dpi-at056tn53v1 as superceded by vc4-kms-dpi-panel.
14 vc4-kms-kippah-7inch not deprecated for now as it is likely to be
15 in wider use than at056tn53v1.
16
17 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
18 ---
19 arch/arm/boot/dts/overlays/Makefile | 2 +-
20 arch/arm/boot/dts/overlays/README | 33 ++++-
21 arch/arm/boot/dts/overlays/overlay_map.dts | 4 +
22 .../vc4-kms-dpi-at056tn53v1-overlay.dts | 44 ------
23 .../overlays/vc4-kms-dpi-generic-overlay.dts | 138 ++++--------------
24 .../overlays/vc4-kms-dpi-panel-overlay.dts | 62 ++++++++
25 arch/arm/boot/dts/overlays/vc4-kms-dpi.dtsi | 109 ++++++++++++++
26 .../overlays/vc4-kms-kippah-7inch-overlay.dts | 27 +---
27 8 files changed, 235 insertions(+), 184 deletions(-)
28 delete mode 100644 arch/arm/boot/dts/overlays/vc4-kms-dpi-at056tn53v1-overlay.dts
29 create mode 100644 arch/arm/boot/dts/overlays/vc4-kms-dpi-panel-overlay.dts
30 create mode 100644 arch/arm/boot/dts/overlays/vc4-kms-dpi.dtsi
31
32 --- a/arch/arm/boot/dts/overlays/Makefile
33 +++ b/arch/arm/boot/dts/overlays/Makefile
34 @@ -234,8 +234,8 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
35 upstream-pi4.dtbo \
36 vc4-fkms-v3d.dtbo \
37 vc4-fkms-v3d-pi4.dtbo \
38 - vc4-kms-dpi-at056tn53v1.dtbo \
39 vc4-kms-dpi-generic.dtbo \
40 + vc4-kms-dpi-panel.dtbo \
41 vc4-kms-dsi-7inch.dtbo \
42 vc4-kms-dsi-lt070me05000.dtbo \
43 vc4-kms-dsi-lt070me05000-v2.dtbo \
44 --- a/arch/arm/boot/dts/overlays/README
45 +++ b/arch/arm/boot/dts/overlays/README
46 @@ -3624,10 +3624,8 @@ Params: cma-512 CMA is 5
47
48
49 Name: vc4-kms-dpi-at056tn53v1
50 -Info: Enable an Innolux 5.6in VGA TFT connected to DPI interface under KMS.
51 - Requires vc4-kms-v3d to be loaded.
52 -Load: dtoverlay=vc4-kms-dpi-at056tn53v1
53 -Params: <None>
54 +Info: This overlay is now deprecated - see vc4-kms-dpi-panel,at056tn53v1
55 +Load: <Deprecated>
56
57
58 Name: vc4-kms-dpi-generic
59 @@ -3659,6 +3657,33 @@ Params: clock-frequency Display
60 backlight-gpio Defines a GPIO to be used for backlight control
61 (default of none).
62 backlight-pwm Defines a PWM channel to be used for backlight
63 + control (default of none). NB Disables audio
64 + headphone output as that also uses PWM.
65 + backlight-pwm-chan Choose channel on &pwm node for backlight
66 + control.
67 + (default 0).
68 + backlight-pwm-gpio GPIO pin to be used for the PWM backlight. See
69 + pwm-2chan for valid options.
70 + (default 18 - note this can only work with
71 + rgb666-padhi).
72 + backlight-pwm-func Pin function of GPIO used for the PWM
73 + backlight.
74 + See pwm-2chan for valid options.
75 + (default 2).
76 + backlight-def-brightness
77 + Set the default brightness. Normal range 1-16.
78 + (default 16).
79 +
80 +
81 +Name: vc4-kms-dpi-panel
82 +Info: Enable a preconfigured KMS DPI panel.
83 + Requires vc4-kms-v3d to be loaded.
84 +Load: dtoverlay=vc4-kms-dpi-panel,<param>=<val>
85 +Params: at056tn53v1 Enable an Innolux 5.6in VGA TFT
86 + kippah-7inch Enable an Adafruit Kippah with 7inch panel.
87 + backlight-gpio Defines a GPIO to be used for backlight control
88 + (default of none).
89 + backlight-pwm Defines a PWM channel to be used for backlight
90 control (default of none). NB Disables audio
91 headphone output as that also uses PWM.
92 backlight-pwm-chan Choose channel on &pwm node for backlight
93 --- a/arch/arm/boot/dts/overlays/overlay_map.dts
94 +++ b/arch/arm/boot/dts/overlays/overlay_map.dts
95 @@ -151,6 +151,10 @@
96 bcm2711;
97 };
98
99 + vc4-kms-dpi-at056tn53v1 {
100 + deprecated = "use vc4-kms-dpi-panel,at056tn53v1";
101 + };
102 +
103 vc4-kms-v3d {
104 bcm2835;
105 bcm2711 = "vc4-kms-v3d-pi4";
106 --- a/arch/arm/boot/dts/overlays/vc4-kms-dpi-at056tn53v1-overlay.dts
107 +++ /dev/null
108 @@ -1,44 +0,0 @@
109 -/*
110 - * vc4-kms-dpi-at056tn53v1-overlay.dts
111 - */
112 -
113 -/dts-v1/;
114 -/plugin/;
115 -
116 -#include <dt-bindings/gpio/gpio.h>
117 -#include <dt-bindings/pinctrl/bcm2835.h>
118 -
119 -/ {
120 - compatible = "brcm,bcm2835";
121 -
122 - fragment@0 {
123 - target-path = "/";
124 - __overlay__ {
125 - panel: panel {
126 - compatible = "innolux,at056tn53v1", "simple-panel";
127 -
128 - port {
129 - panel_in: endpoint {
130 - remote-endpoint = <&dpi_out>;
131 - };
132 - };
133 - };
134 - };
135 - };
136 -
137 - fragment@1 {
138 - target = <&dpi>;
139 - __overlay__ {
140 - status = "okay";
141 -
142 - pinctrl-names = "default";
143 - pinctrl-0 = <&dpi_18bit_cpadhi_gpio0>;
144 -
145 - port {
146 - dpi_out: endpoint {
147 - remote-endpoint = <&panel_in>;
148 - };
149 - };
150 - };
151 - };
152 -};
153 --- a/arch/arm/boot/dts/overlays/vc4-kms-dpi-generic-overlay.dts
154 +++ b/arch/arm/boot/dts/overlays/vc4-kms-dpi-generic-overlay.dts
155 @@ -5,124 +5,43 @@
156 /dts-v1/;
157 /plugin/;
158
159 -#include <dt-bindings/gpio/gpio.h>
160 -#include <dt-bindings/pinctrl/bcm2835.h>
161 +#include "vc4-kms-dpi.dtsi"
162
163 / {
164 compatible = "brcm,bcm2835";
165
166 fragment@0 {
167 - target-path = "/";
168 - __overlay__ {
169 - panel: panel {
170 - compatible = "panel-dpi";
171 -
172 - width-mm = <154>;
173 - height-mm = <83>;
174 - bus-format = <0x1009>;
175 -
176 - timing: panel-timing {
177 - clock-frequency = <29500000>;
178 - hactive = <800>;
179 - hfront-porch = <24>;
180 - hsync-len = <72>;
181 - hback-porch = <96>;
182 - hsync-active = <1>;
183 - vactive = <480>;
184 - vfront-porch = <3>;
185 - vsync-len = <10>;
186 - vback-porch = <7>;
187 - vsync-active = <1>;
188 -
189 - de-active = <1>;
190 - pixelclk-active = <1>;
191 - };
192 -
193 - port {
194 - panel_in: endpoint {
195 - remote-endpoint = <&dpi_out>;
196 - };
197 - };
198 - };
199 - };
200 - };
201 -
202 - fragment@1 {
203 - target = <&dpi>;
204 - dpi_node: __overlay__ {
205 - status = "okay";
206 -
207 - pinctrl-names = "default";
208 - pinctrl-0 = <&dpi_18bit_gpio0>;
209 -
210 - port {
211 - dpi_out: endpoint {
212 - remote-endpoint = <&panel_in>;
213 - };
214 - };
215 - };
216 - };
217 -
218 - fragment@2 {
219 - target = <&panel>;
220 - __dormant__ {
221 - backlight = <&backlight>;
222 - };
223 - };
224 -
225 - fragment@3 {
226 - target-path = "/";
227 - __dormant__ {
228 - backlight: backlight {
229 - compatible = "gpio-backlight";
230 - gpios = <&gpio 255 GPIO_ACTIVE_HIGH>;
231 - };
232 - };
233 - };
234 -
235 - fragment@4 {
236 target = <&panel>;
237 - __dormant__ {
238 - backlight = <&backlight_pwm>;
239 - };
240 - };
241 -
242 - fragment@5 {
243 - target-path = "/";
244 - __dormant__ {
245 - backlight_pwm: backlight_pwm {
246 - compatible = "pwm-backlight";
247 - brightness-levels = <0 6 8 12 16 24 32 40 48 64 96 128 160 192 224 255>;
248 - default-brightness-level = <16>;
249 - pwms = <&pwm 0 200000>;
250 - };
251 - };
252 - };
253 + __overlay__ {
254 + compatible = "panel-dpi";
255
256 - fragment@6 {
257 - target = <&pwm>;
258 - __dormant__ {
259 - pinctrl-names = "default";
260 - pinctrl-0 = <&pwm_pins>;
261 - assigned-clock-rates = <1000000>;
262 - status = "okay";
263 - };
264 - };
265 + width-mm = <154>;
266 + height-mm = <83>;
267 + bus-format = <0x1009>;
268 +
269 + timing: panel-timing {
270 + clock-frequency = <29500000>;
271 + hactive = <800>;
272 + hfront-porch = <24>;
273 + hsync-len = <72>;
274 + hback-porch = <96>;
275 + hsync-active = <1>;
276 + vactive = <480>;
277 + vfront-porch = <3>;
278 + vsync-len = <10>;
279 + vback-porch = <7>;
280 + vsync-active = <1>;
281
282 - fragment@7 {
283 - target = <&gpio>;
284 - __dormant__ {
285 - pwm_pins: pwm_pins {
286 - brcm,pins = <18>;
287 - brcm,function = <2>; /* Alt5 */
288 + de-active = <1>;
289 + pixelclk-active = <1>;
290 };
291 };
292 };
293
294 - fragment@8 {
295 - target = <&audio>;
296 - __dormant__ {
297 - brcm,disable-headphones;
298 + fragment@1 {
299 + target = <&dpi>;
300 + __overlay__ {
301 + pinctrl-0 = <&dpi_18bit_gpio0>;
302 };
303 };
304
305 @@ -151,12 +70,5 @@
306 rgb888 = <&panel>, "bus-format:0=0x100a",
307 <&dpi_node>, "pinctrl-0:0=",<&dpi_gpio0>;
308 bus-format = <&panel>, "bus-format:0";
309 - backlight-gpio = <0>, "+2+3",
310 - <&backlight>, "gpios:4";
311 - backlight-pwm = <0>, "+4+5+6+7+8";
312 - backlight-pwm-chan = <&backlight_pwm>, "pwms:4";
313 - backlight-pwm-gpio = <&pwm_pins>, "brcm,pins:0";
314 - backlight-pwm-func = <&pwm_pins>, "brcm,function:0";
315 - backlight-def-brightness = <&backlight_pwm>, "default-brightness-level:0";
316 };
317 };
318 --- /dev/null
319 +++ b/arch/arm/boot/dts/overlays/vc4-kms-dpi-panel-overlay.dts
320 @@ -0,0 +1,62 @@
321 +/*
322 + * vc4-kms-dpi-panel-overlay.dts
323 + * Support for any predefined DPI panel.
324 + */
325 +
326 +/dts-v1/;
327 +/plugin/;
328 +
329 +#include "vc4-kms-dpi.dtsi"
330 +
331 +/ {
332 + compatible = "brcm,bcm2835";
333 +
334 + fragment@0 {
335 + target = <&panel>;
336 + __dormant__ {
337 + compatible = "innolux,at056tn53v1", "simple-panel";
338 + };
339 + };
340 + fragment@1 {
341 + target = <&panel>;
342 + __dormant__ {
343 + compatible = "ontat,yx700wv03", "simple-panel";
344 + };
345 + };
346 +
347 + fragment@90 {
348 + target = <&dpi>;
349 + __dormant__ {
350 + pinctrl-0 = <&dpi_18bit_cpadhi_gpio0>;
351 + };
352 + };
353 + fragment@91 {
354 + target = <&dpi>;
355 + __dormant__ {
356 + pinctrl-0 = <&dpi_18bit_gpio0>;
357 + };
358 + };
359 + fragment@92 {
360 + target = <&dpi>;
361 + __dormant__ {
362 + pinctrl-0 = <&dpi_gpio0>;
363 + };
364 + };
365 + fragment@93 {
366 + target = <&dpi>;
367 + __dormant__ {
368 + pinctrl-0 = <&dpi_16bit_cpadhi_gpio0>;
369 + };
370 + };
371 + fragment@94 {
372 + target = <&dpi>;
373 + __dormant__ {
374 + pinctrl-0 = <&dpi_16bit_gpio0>;
375 + };
376 + };
377 +
378 + __overrides__ {
379 + at056tn53v1 = <0>, "+0+90";
380 + kippah-7inch = <0>, "+1+91";
381 + };
382 +};
383 --- /dev/null
384 +++ b/arch/arm/boot/dts/overlays/vc4-kms-dpi.dtsi
385 @@ -0,0 +1,109 @@
386 +/*
387 + * vc4-kms-dpi.dtsi
388 + */
389 +
390 +#include <dt-bindings/gpio/gpio.h>
391 +#include <dt-bindings/pinctrl/bcm2835.h>
392 +
393 +/ {
394 + fragment@100 {
395 + target-path = "/";
396 + __overlay__ {
397 + panel: panel {
398 + port {
399 + panel_in: endpoint {
400 + remote-endpoint = <&dpi_out>;
401 + };
402 + };
403 + };
404 + };
405 + };
406 +
407 + fragment@101 {
408 + target = <&dpi>;
409 + dpi_node: __overlay__ {
410 + status = "okay";
411 +
412 + pinctrl-names = "default";
413 +
414 + port {
415 + dpi_out: endpoint {
416 + remote-endpoint = <&panel_in>;
417 + };
418 + };
419 + };
420 + };
421 +
422 + fragment@102 {
423 + target = <&panel>;
424 + __dormant__ {
425 + backlight = <&backlight>;
426 + };
427 + };
428 +
429 + fragment@103 {
430 + target-path = "/";
431 + __dormant__ {
432 + backlight: backlight {
433 + compatible = "gpio-backlight";
434 + gpios = <&gpio 255 GPIO_ACTIVE_HIGH>;
435 + };
436 + };
437 + };
438 +
439 + fragment@104 {
440 + target = <&panel>;
441 + __dormant__ {
442 + backlight = <&backlight_pwm>;
443 + };
444 + };
445 +
446 + fragment@105 {
447 + target-path = "/";
448 + __dormant__ {
449 + backlight_pwm: backlight_pwm {
450 + compatible = "pwm-backlight";
451 + brightness-levels = <0 6 8 12 16 24 32 40 48 64 96 128 160 192 224 255>;
452 + default-brightness-level = <16>;
453 + pwms = <&pwm 0 200000>;
454 + };
455 + };
456 + };
457 +
458 + fragment@106 {
459 + target = <&pwm>;
460 + __dormant__ {
461 + pinctrl-names = "default";
462 + pinctrl-0 = <&pwm_pins>;
463 + assigned-clock-rates = <1000000>;
464 + status = "okay";
465 + };
466 + };
467 +
468 + fragment@107 {
469 + target = <&gpio>;
470 + __dormant__ {
471 + pwm_pins: pwm_pins {
472 + brcm,pins = <18>;
473 + brcm,function = <2>; /* Alt5 */
474 + };
475 + };
476 + };
477 +
478 + fragment@108 {
479 + target = <&audio>;
480 + __dormant__ {
481 + brcm,disable-headphones;
482 + };
483 + };
484 +
485 + __overrides__ {
486 + backlight-gpio = <0>, "+102+103",
487 + <&backlight>, "gpios:4";
488 + backlight-pwm = <0>, "+104+105+106+107+108";
489 + backlight-pwm-chan = <&backlight_pwm>, "pwms:4";
490 + backlight-pwm-gpio = <&pwm_pins>, "brcm,pins:0";
491 + backlight-pwm-func = <&pwm_pins>, "brcm,function:0";
492 + backlight-def-brightness = <&backlight_pwm>, "default-brightness-level:0";
493 + };
494 +};
495 --- a/arch/arm/boot/dts/overlays/vc4-kms-kippah-7inch-overlay.dts
496 +++ b/arch/arm/boot/dts/overlays/vc4-kms-kippah-7inch-overlay.dts
497 @@ -1,43 +1,26 @@
498 /*
499 - * vc4-kms-v3d-overlay.dts
500 + * vc4-kms-kippah-7inch-overlay.dts
501 */
502
503 /dts-v1/;
504 /plugin/;
505
506 -#include <dt-bindings/pinctrl/bcm2835.h>
507 +#include "vc4-kms-dpi.dtsi"
508
509 / {
510 compatible = "brcm,bcm2835";
511
512 fragment@0 {
513 - target-path = "/";
514 - __overlay__ {
515 - panel: panel {
516 - compatible = "ontat,yx700wv03", "simple-panel";
517 -
518 - port {
519 - panel_in: endpoint {
520 - remote-endpoint = <&dpi_out>;
521 - };
522 - };
523 - };
524 + target = <&panel>;
525 + __overlay__ {
526 + compatible = "ontat,yx700wv03", "simple-panel";
527 };
528 };
529
530 fragment@1 {
531 target = <&dpi>;
532 __overlay__ {
533 - status = "okay";
534 -
535 - pinctrl-names = "default";
536 pinctrl-0 = <&dpi_18bit_gpio0>;
537 -
538 - port {
539 - dpi_out: endpoint@0 {
540 - remote-endpoint = <&panel_in>;
541 - };
542 - };
543 };
544 };
545 };