aboutsummaryrefslogtreecommitdiff
path: root/target/linux/bcm27xx/patches-6.1/950-0690-dtoverlays-Add-an-overlay-for-the-Waveshare-DSI-scre.patch
blob: 855ea9bd4cb50e3ce0a54125ae371e79a86c11f8 (plain)
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
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
From 6e1ccf7cfe1b758963743b88fa1b078b011c77b3 Mon Sep 17 00:00:00 2001
From: Dave Stevenson <dave.stevenson@raspberrypi.com>
Date: Fri, 14 Apr 2023 13:57:52 +0100
Subject: [PATCH] dtoverlays: Add an overlay for the Waveshare DSI
 screens

They come in varying sizes, but all have the same MCU for
power control and touch controller.

Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
---
 arch/arm/boot/dts/overlays/Makefile           |   1 +
 arch/arm/boot/dts/overlays/README             |  28 ++++
 .../vc4-kms-dsi-waveshare-panel-overlay.dts   | 123 ++++++++++++++++++
 3 files changed, 152 insertions(+)
 create mode 100644 arch/arm/boot/dts/overlays/vc4-kms-dsi-waveshare-panel-overlay.dts

--- a/arch/arm/boot/dts/overlays/Makefile
+++ b/arch/arm/boot/dts/overlays/Makefile
@@ -272,6 +272,7 @@ dtbo-$(CONFIG_ARCH_BCM2835) += \
 	vc4-kms-dsi-7inch.dtbo \
 	vc4-kms-dsi-lt070me05000.dtbo \
 	vc4-kms-dsi-lt070me05000-v2.dtbo \
+	vc4-kms-dsi-waveshare-panel.dtbo \
 	vc4-kms-kippah-7inch.dtbo \
 	vc4-kms-v3d.dtbo \
 	vc4-kms-v3d-pi4.dtbo \
--- a/arch/arm/boot/dts/overlays/README
+++ b/arch/arm/boot/dts/overlays/README
@@ -4493,6 +4493,34 @@ Load:   dtoverlay=vc4-kms-dsi-lt070me050
 Params: <None>
 
 
+Name:   vc4-kms-dsi-waveshare-panel
+Info:   Enable a Waveshare DSI touchscreen
+        Includes the Goodix driver for the touchscreen element.
+        The default is for the display to be using the I2C0 option for control.
+        Use the i2c1 override if using the I2C1 wiring with jumper wires from
+        GPIOs 2&3 (pins 3&5).
+        invx/invy/swapxy should be used with caution as the panel specifier will
+        set the default inversions for that panel. Always use them after the
+        panel specifier, and be aware that you may need to set them as =0, not
+        just adding it.
+        Requires vc4-kms-v3d to be loaded.
+Load:   dtoverlay=vc4-kms-dsi-waveshare-panel,<param>=<val>
+Params: 2_8_inch                2.8" 480x640
+        3_4_inch                3.4" 800x800 round
+        4_0_inch                4.0" 480x800
+        7_0_inchC               7.0" C 1024x600
+        7_9_inch                7.9" 400x1280
+        8_0_inch                8.0" 1280x800
+        10_1_inch               10.1" 1280x800
+        11_9_inch               11.9" 320x1480
+        i2c1                    Use i2c-1 with jumper wires from GPIOs 2&3
+        disable_touch           Disable the touch controller
+        rotation                Set the panel orientation property
+        invx                    Touchscreen inverted x axis
+        invy                    Touchscreen inverted y axis
+        swapxy                  Touchscreen swapped x y axis
+
+
 Name:   vc4-kms-kippah-7inch
 Info:   This overlay is now deprecated - see vc4-kms-dpi-panel,kippah-7inch
 Load:   <Deprecated>
--- /dev/null
+++ b/arch/arm/boot/dts/overlays/vc4-kms-dsi-waveshare-panel-overlay.dts
@@ -0,0 +1,123 @@
+/*
+ * Device Tree overlay for Waveshare DSI Touchscreens
+ *
+ */
+
+/dts-v1/;
+/plugin/;
+
+/ {
+	compatible = "brcm,bcm2835";
+
+	fragment@0 {
+		target = <&dsi1>;
+		__overlay__ {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "okay";
+			port {
+				dsi_out: endpoint {
+					remote-endpoint = <&panel_in>;
+				};
+			};
+		};
+	};
+
+	fragment@1 {
+		target-path = "/";
+		__overlay__ {
+		};
+	};
+
+	frag2: fragment@2 {
+		target = <&i2c_csi_dsi>;
+		__overlay__ {
+			#address-cells = <1>;
+			#size-cells = <0>;
+			status = "okay";
+
+			panel: panel_disp1@45 {
+				reg = <0x45>;
+				compatible = "waveshare,10.1inch-panel";
+
+				port {
+					panel_in: endpoint {
+						remote-endpoint = <&dsi_out>;
+					};
+				};
+			};
+
+			touch: goodix@14 {
+				reg = <0x14>;
+				compatible = "goodix,gt911";
+			};
+		};
+	};
+
+	fragment@3 {
+		target = <&i2c0if>;
+		__overlay__ {
+			status = "okay";
+		};
+	};
+
+	fragment@4 {
+		target = <&i2c0mux>;
+		__overlay__ {
+			status = "okay";
+		};
+	};
+
+	fragment@5 {
+		target = <&i2c_arm>;
+		__dormant__ {
+			status = "okay";
+		};
+	};
+
+	__overrides__ {
+		2_8_inch = <&panel>, "compatible=waveshare,2.8inch-panel",
+				   <&touch>, "touchscreen-size-x:0=640",
+				   <&touch>, "touchscreen-size-y:0=480",
+				   <&touch>, "touchscreen-inverted-y?",
+				   <&touch>, "touchscreen-swapped-x-y?";
+		3_4_inch = <&panel>, "compatible=waveshare,3.4inch-panel",
+				   <&touch>, "touchscreen-size-x:0=800",
+				   <&touch>, "touchscreen-size-y:0=800";
+		4_0_inch = <&panel>, "compatible=waveshare,4.0inch-panel",
+				   <&touch>, "touchscreen-size-x:0=800",
+				   <&touch>, "touchscreen-size-y:0=480",
+				   <&touch>, "touchscreen-inverted-x?",
+				   <&touch>, "touchscreen-swapped-x-y?";
+		7_0_inchC = <&panel>, "compatible=waveshare,7.0inch-c-panel",
+				   <&touch>, "touchscreen-size-x:0=800",
+				   <&touch>, "touchscreen-size-y:0=480";
+		7_9_inch = <&panel>, "compatible=waveshare,7.9inch-panel",
+				   <&touch>, "touchscreen-size-x:0=400",
+				   <&touch>, "touchscreen-size-y:0=1280",
+				   <&touch>, "touchscreen-inverted-x?",
+				   <&touch>, "touchscreen-inverted-y?";
+		8_0_inch = <&panel>, "compatible=waveshare,8.0inch-panel",
+				   <&touch>, "touchscreen-size-x:0=800",
+				   <&touch>, "touchscreen-size-y:0=1280",
+				   <&touch>, "touchscreen-inverted-x?",
+				   <&touch>, "touchscreen-swapped-x-y?";
+		10_1_inch = <&panel>, "compatible=waveshare,10.1inch-panel",
+				   <&touch>, "touchscreen-size-x:0=800",
+				   <&touch>, "touchscreen-size-y:0=1280",
+				   <&touch>, "touchscreen-inverted-x?",
+				   <&touch>, "touchscreen-swapped-x-y?";
+		11_9_inch = <&panel>, "compatible=waveshare,11.9inch-panel",
+				   <&touch>, "touchscreen-size-x:0=320",
+				   <&touch>, "touchscreen-size-y:0=1480",
+				   <&touch>, "touchscreen-inverted-x?",
+				   <&touch>, "touchscreen-swapped-x-y?";
+		i2c1 = <&frag2>, "target:0=",<&i2c1>,
+		       <0>, "-3-4+5";
+		disable_touch = <&touch>, "status=disabled";
+		rotation = <&panel>, "rotation:0";
+		invx = <&touch>,"touchscreen-inverted-x?";
+		invy = <&touch>,"touchscreen-inverted-y?";
+		swapxy = <&touch>,"touchscreen-swapped-x-y?";
+	};
+};