bcm27xx: add support for linux v5.15
[openwrt/staging/chunkeey.git] / target / linux / bcm27xx / patches-5.15 / 950-0798-overlays-rpi-display-Add-support-for-DRM-driver.patch
1 From 33020d03596ae7767f278716ba539589b316299e Mon Sep 17 00:00:00 2001
2 From: =?UTF-8?q?Noralf=20Tr=C3=B8nnes?= <noralf@tronnes.org>
3 Date: Sun, 27 Mar 2022 18:54:17 +0200
4 Subject: [PATCH] overlays/rpi-display: Add support for DRM driver
5 MIME-Version: 1.0
6 Content-Type: text/plain; charset=UTF-8
7 Content-Transfer-Encoding: 8bit
8
9 Add a "drm" parameter that enables use of the drm/mi0283qt driver instead
10 of fbtft/fb_ili9341. Also add a "backlight-pwm" parameter that can be used
11 with the "drm" parameter.
12
13 Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
14 ---
15 arch/arm/boot/dts/overlays/README | 26 +++++++-
16 .../boot/dts/overlays/rpi-display-overlay.dts | 61 ++++++++++++++++++-
17 2 files changed, 84 insertions(+), 3 deletions(-)
18
19 --- a/arch/arm/boot/dts/overlays/README
20 +++ b/arch/arm/boot/dts/overlays/README
21 @@ -2913,14 +2913,36 @@ Params: <None>
22
23 Name: rpi-display
24 Info: RPi-Display - 2.8" Touch Display by Watterott
25 + Linux has 2 drivers that support this display and this overlay supports
26 + both.
27 +
28 + Examples:
29 + fbtft/fb_ili9341: dtoverlay=rpi-display
30 + drm/mi0283qt: dtoverlay=rpi-display,drm,backlight-pwm,rotate=180
31 +
32 + Some notable differences with the DRM driver compared to fbtft:
33 + - The display is turned on when it's first used and not on driver load
34 + as with fbtft. So if nothing uses the display it stays off.
35 + - Can run with a higher SPI clock increasing framerate. This is possible
36 + since the driver avoids messing up the controller configuration due to
37 + transmission errors by running config commands at 10MHz and only pixel
38 + data at full speed (occasional pixel glitch might occur).
39 + - PWM backlight is supported.
40 +
41 Load: dtoverlay=rpi-display,<param>=<val>
42 Params: speed Display SPI bus speed
43 rotate Display rotation {0,90,180,270}
44 - fps Delay between frame updates
45 - debug Debug output level {0-7}
46 + fps Delay between frame updates (fbtft only)
47 + debug Debug output level {0-7} (fbtft only)
48 xohms Touchpanel sensitivity (X-plate resistance)
49 swapxy Swap x and y axis
50 backlight Change backlight GPIO pin {e.g. 12, 18}
51 + (fbtft only)
52 + drm Use DRM/KMS driver mi0283qt instead of fbtft.
53 + Set the SPI clock to 70MHz.
54 + This has to be the first parameter.
55 + backlight-pwm Use pwm for backlight (drm only). NB: Disables
56 + audio headphone output as that also uses PWM.
57
58
59 Name: rpi-ft5406
60 --- a/arch/arm/boot/dts/overlays/rpi-display-overlay.dts
61 +++ b/arch/arm/boot/dts/overlays/rpi-display-overlay.dts
62 @@ -78,14 +78,73 @@
63 };
64 };
65 };
66 +
67 + fragment@10 {
68 + target = <&rpidisplay>;
69 + __dormant__ {
70 + backlight = <&backlight_gpio>;
71 + };
72 + };
73 +
74 + fragment@11 {
75 + target-path = "/";
76 + __dormant__ {
77 + backlight_gpio: backlight_gpio {
78 + compatible = "gpio-backlight";
79 + gpios = <&gpio 18 0>; /* GPIO_ACTIVE_HIGH */
80 + };
81 + };
82 + };
83 +
84 + fragment@20 {
85 + target = <&rpidisplay>;
86 + __dormant__ {
87 + backlight = <&backlight_pwm>;
88 + };
89 + };
90 +
91 + fragment@21 {
92 + target-path = "/";
93 + __dormant__ {
94 + backlight_pwm: backlight_pwm {
95 + compatible = "pwm-backlight";
96 + brightness-levels = <0 6 8 12 16 24 32 40 48 64 96 128 160 192 224 255>;
97 + default-brightness-level = <16>;
98 + pwms = <&pwm 0 200000>;
99 + };
100 + };
101 + };
102 +
103 + fragment@22 {
104 + target = <&pwm>;
105 + __dormant__ {
106 + assigned-clock-rates = <1000000>;
107 + status = "okay";
108 + };
109 + };
110 +
111 + fragment@23 {
112 + target = <&audio>;
113 + __dormant__ {
114 + brcm,disable-headphones;
115 + };
116 + };
117 +
118 __overrides__ {
119 speed = <&rpidisplay>,"spi-max-frequency:0";
120 - rotate = <&rpidisplay>,"rotate:0";
121 + rotate = <&rpidisplay>,"rotate:0", /* fbtft */
122 + <&rpidisplay>,"rotation:0"; /* drm */
123 fps = <&rpidisplay>,"fps:0";
124 debug = <&rpidisplay>,"debug:0";
125 xohms = <&rpidisplay_ts>,"ti,x-plate-ohms;0";
126 swapxy = <&rpidisplay_ts>,"ti,swap-xy?";
127 backlight = <&rpidisplay>,"led-gpios:4",
128 <&rpi_display_pins>,"brcm,pins:0";
129 + drm = <&rpidisplay>, "compatible=multi-inno,mi0283qt",
130 + <&rpidisplay>, "spi-max-frequency:0=70000000",
131 + <&rpidisplay>, "reset-gpios:8=0", /* GPIO_ACTIVE_HIGH */
132 + <0>, "+10+11";
133 + backlight-pwm = <0>, "-10-11+20+21+22+23",
134 + <&rpi_display_pins>, "brcm,function:0=2"; /* Alt5 */
135 };
136 };