0bfe1c9e303919e739aa899b07184a19d9094bc0
[openwrt/staging/chunkeey.git] / target / linux / bcm27xx / patches-5.10 / 950-0479-dtoverlays-Add-an-overlay-for-the-VGA666-when-used-w.patch
1 From 99f2ab0dad947049e0fa62e88c1e4c1feb7ab379 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Thu, 4 Feb 2021 14:41:10 +0000
4 Subject: [PATCH] dtoverlays: Add an overlay for the VGA666 when used
5 with vc4-kms-v3d
6
7 Includes optional use of GPIOs 0&1 / BSC0 for DDC to read the EDID
8 from the display.
9
10 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
11 ---
12 arch/arm/boot/dts/overlays/Makefile | 1 +
13 arch/arm/boot/dts/overlays/README | 10 ++
14 .../dts/overlays/vc4-kms-vga666-overlay.dts | 100 ++++++++++++++++++
15 3 files changed, 111 insertions(+)
16 create mode 100644 arch/arm/boot/dts/overlays/vc4-kms-vga666-overlay.dts
17
18 --- a/arch/arm/boot/dts/overlays/Makefile
19 +++ b/arch/arm/boot/dts/overlays/Makefile
20 @@ -211,6 +211,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
21 vc4-kms-kippah-7inch.dtbo \
22 vc4-kms-v3d.dtbo \
23 vc4-kms-v3d-pi4.dtbo \
24 + vc4-kms-vga666.dtbo \
25 vga666.dtbo \
26 w1-gpio.dtbo \
27 w1-gpio-pullup.dtbo \
28 --- a/arch/arm/boot/dts/overlays/README
29 +++ b/arch/arm/boot/dts/overlays/README
30 @@ -3120,10 +3120,20 @@ Params: cma-512 CMA is 5
31 outputs)
32
33
34 +Name: vc4-kms-vga666
35 +Info: Enable the VGA666 (resistor ladder ADC) for the vc4-kms-v3d driver.
36 + Requires vc4-kms-v3d to be loaded.
37 +Load: dtoverlay=vc4-kms-vga666,<param>
38 +Params: ddc Enables GPIOs 0&1 as the I2C to read the EDID
39 + from the display. NB These are NOT 5V tolerant
40 + GPIOs, therefore level shifters are required.
41 +
42 +
43 Name: vga666
44 Info: Overlay for the Fen Logic VGA666 board
45 This uses GPIOs 2-21 (so no I2C), and activates the output 2-3 seconds
46 after the kernel has started.
47 + NOT for use with vc4-kms-v3d.
48 Load: dtoverlay=vga666
49 Params: <None>
50
51 --- /dev/null
52 +++ b/arch/arm/boot/dts/overlays/vc4-kms-vga666-overlay.dts
53 @@ -0,0 +1,100 @@
54 +/*
55 + * vc4-kms-vga666-overlay.dts
56 + * Configures a FenLogic or similar VGA666 DPI adapter when using the
57 + * vc4-kms-v3d driver.
58 + * If a suitable I2C level shifter is connected to GPIOs 0&1 and the VGA
59 + * ID1/SDA (pin 12) and ID3/SCL (pin 15) lines, then there is the option to
60 + * enable reading the EDID from the display.
61 + */
62 +
63 +/dts-v1/;
64 +/plugin/;
65 +
66 +#include <dt-bindings/pinctrl/bcm2835.h>
67 +
68 +/ {
69 + compatible = "brcm,bcm2835";
70 +
71 + fragment@0 {
72 + target-path = "/";
73 + __overlay__ {
74 + vga_connector: vga_connector {
75 + compatible = "vga-connector";
76 + label = "vga";
77 +
78 + port {
79 + vga_con_in: endpoint {
80 + remote-endpoint = <&vga666_out>;
81 + };
82 + };
83 + };
84 +
85 + vga_dac {
86 + compatible = "dumb-vga-dac";
87 +
88 + ports {
89 + #address-cells = <1>;
90 + #size-cells = <0>;
91 +
92 + port@0 {
93 + reg = <0>;
94 +
95 + vga666_in: endpoint {
96 + remote-endpoint = <&dpi_out>;
97 + };
98 + };
99 +
100 + port@1 {
101 + reg = <1>;
102 +
103 + vga666_out: endpoint {
104 + remote-endpoint = <&vga_con_in>;
105 + };
106 + };
107 + };
108 + };
109 +
110 + };
111 + };
112 +
113 + fragment@1 {
114 + target = <&dpi>;
115 + __overlay__ {
116 + status = "okay";
117 +
118 + pinctrl-names = "default";
119 + pinctrl-0 = <&dpi_18bit_gpio2>;
120 +
121 + port {
122 + dpi_out: endpoint@0 {
123 + remote-endpoint = <&vga666_in>;
124 + };
125 + };
126 + };
127 + };
128 +
129 + fragment@2 {
130 + target = <&vga_connector>;
131 + __dormant__ {
132 + ddc-i2c-bus = <&i2c_vc>;
133 + };
134 + };
135 +
136 + fragment@3 {
137 + target = <&i2c0if>;
138 + __dormant__ {
139 + status = "okay";
140 + };
141 + };
142 +
143 + fragment@4 {
144 + target = <&i2c0mux>;
145 + __dormant__ {
146 + status = "okay";
147 + };
148 + };
149 +
150 + __overrides__ {
151 + ddc = <0>,"=2", <0>,"=3", <0>,"=4";
152 + };
153 +};