987bdee290c302cc97ee3bd4b18f29c0ce74781a
[openwrt/staging/blogic.git] /
1 From 67cd4f249333f3de9b449b9e6ebadd08facc6957 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.com>
3 Date: Mon, 4 Oct 2021 14:15:38 +0100
4 Subject: [PATCH] dtoverlays: Add overlay for ST7735R (160x128) TinyDRM
5 driver
6
7 Adds an overlay to configure the TinyDRM driver for ST7735R
8 based 160x128 and 128x128 (untested) displays such as the
9 Adafruit 1.8" display.
10
11 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
12 ---
13 arch/arm/boot/dts/overlays/Makefile | 1 +
14 arch/arm/boot/dts/overlays/README | 14 ++++
15 .../dts/overlays/adafruit-st7735r-overlay.dts | 83 +++++++++++++++++++
16 3 files changed, 98 insertions(+)
17 create mode 100644 arch/arm/boot/dts/overlays/adafruit-st7735r-overlay.dts
18
19 --- a/arch/arm/boot/dts/overlays/Makefile
20 +++ b/arch/arm/boot/dts/overlays/Makefile
21 @@ -4,6 +4,7 @@ dtb-$(CONFIG_ARCH_BCM2835) += overlay_ma
22
23 dtbo-$(CONFIG_ARCH_BCM2835) += \
24 act-led.dtbo \
25 + adafruit-st7735r.dtbo \
26 adafruit18.dtbo \
27 adau1977-adc.dtbo \
28 adau7002-simple.dtbo \
29 --- a/arch/arm/boot/dts/overlays/README
30 +++ b/arch/arm/boot/dts/overlays/README
31 @@ -299,9 +299,23 @@ Params: activelow Set to "
32 REQUIRED
33
34
35 +Name: adafruit-st7735r
36 +Info: Overlay for the SPI-connected Adafruit 1.8" 160x128 or 128x128 displays,
37 + based on the ST7735R chip.
38 + This overlay uses the newer DRM/KMS "Tiny" driver.
39 +Load: dtoverlay=adafruit-st7735r,<param>=<val>
40 +Params: 128x128 Select the 128x128 driver (default 160x128)
41 + rotate Display rotation {0,90,180,270} (default 90)
42 + speed SPI bus speed in Hz (default 4000000)
43 + dc_pin GPIO pin for D/C (default 24)
44 + reset_pin GPIO pin for RESET (default 25)
45 + led_pin GPIO used to control backlight (default 18)
46 +
47 +
48 Name: adafruit18
49 Info: Overlay for the SPI-connected Adafruit 1.8" display (based on the
50 ST7735R chip). It includes support for the "green tab" version.
51 + This overlay uses the older fbtft driver.
52 Load: dtoverlay=adafruit18,<param>=<val>
53 Params: green Use the adafruit18_green variant.
54 rotate Display rotation {0,90,180,270}
55 --- /dev/null
56 +++ b/arch/arm/boot/dts/overlays/adafruit-st7735r-overlay.dts
57 @@ -0,0 +1,83 @@
58 +/*
59 + * adafruit-st7735r-overlay.dts
60 + *
61 + * ST7735R based SPI LCD displays. Either
62 + * Adafruit 1.8" 160x128
63 + * or
64 + * Okaya 1.44" 128x128
65 + */
66 +
67 +/dts-v1/;
68 +/plugin/;
69 +
70 +#include <dt-bindings/gpio/gpio.h>
71 +
72 +/ {
73 + compatible = "brcm,bcm2835";
74 +
75 + fragment@0 {
76 + target = <&spidev0>;
77 + __overlay__ {
78 + status = "disabled";
79 + };
80 + };
81 +
82 + fragment@1 {
83 + target = <&gpio>;
84 + __overlay__ {
85 + adafruit_pins: adafruit_pins {
86 + brcm,pins = <25 24>;
87 + brcm,function = <1>; /* out */
88 + };
89 + backlight_pins: backlight_pins {
90 + brcm,pins = <18>;
91 + brcm,function = <1>; /* out */
92 + };
93 + };
94 + };
95 +
96 + fragment@2 {
97 + target-path = "/";
98 + __overlay__ {
99 + af18_backlight: backlight {
100 + compatible = "gpio-backlight";
101 + gpios = <&gpio 18 GPIO_ACTIVE_HIGH>;
102 + pinctrl-names = "default";
103 + pinctrl-0 = <&backlight_pins>;
104 + };
105 + };
106 + };
107 +
108 + fragment@3 {
109 + target = <&spi0>;
110 + __overlay__ {
111 + /* needed to avoid dtc warning */
112 + #address-cells = <1>;
113 + #size-cells = <0>;
114 + status = "okay";
115 +
116 + af18: adafruit18@0 {
117 + compatible = "jianda,jd-t18003-t01";
118 + reg = <0>;
119 + spi-max-frequency = <32000000>;
120 + dc-gpios = <&gpio 24 GPIO_ACTIVE_HIGH>;
121 + reset-gpios = <&gpio 25 GPIO_ACTIVE_HIGH>;
122 + rotate = <90>;
123 + pinctrl-names = "default";
124 + pinctrl-0 = <&adafruit_pins>;
125 + backlight = <&af18_backlight>;
126 + };
127 + };
128 + };
129 +
130 + __overrides__ {
131 + 128x128 = <&af18>, "compatible=okaya,rh128128t";
132 + speed = <&af18>,"spi-max-frequency:0";
133 + rotate = <&af18>,"rotate:0";
134 + dc_pin = <&af18>,"dc-gpios:4", <&adafruit_pins>,"brcm,pins:4";
135 + reset_pin = <&af18>,"reset-gpios:4",
136 + <&adafruit_pins>,"brcm,pins:0";
137 + led_pin = <&af18_backlight>,"gpios:4",
138 + <&backlight_pins>,"brcm,pins:0";
139 + };
140 +};