a5fe888565d470226bf53456665727194639b444
[openwrt/staging/linusw.git] /
1 From 16edbdfde51fc3180cecb00ad0aa311bd4567650 Mon Sep 17 00:00:00 2001
2 From: Joerg Quinten <aBUGSworstnightmare@gmail.com>
3 Date: Fri, 18 Jun 2021 13:02:29 +0200
4 Subject: [PATCH] Support RPi DPI interface in mode6 for 18-bit color
5
6 A matching media bus format was added and an overlay for using it,
7 both with FB and VC4 was added as well.
8
9 Signed-off-by: Joerg Quinten <aBUGSworstnightmare@gmail.com>
10 ---
11 .../bindings/display/panel/panel-simple.yaml | 2 +
12 .../media/v4l/subdev-formats.rst | 74 +++++++++++++++++++
13 drivers/gpu/drm/panel/panel-simple.c | 35 +++++++++
14 drivers/gpu/drm/vc4/vc4_dpi.c | 10 +++
15 include/uapi/linux/media-bus-format.h | 4 +-
16 5 files changed, 124 insertions(+), 1 deletion(-)
17
18 --- a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
19 +++ b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
20 @@ -147,6 +147,8 @@ properties:
21 - ivo,m133nwf4-r0
22 # Innolux AT043TN24 4.3" WQVGA TFT LCD panel
23 - innolux,at043tn24
24 + # Innolux AT056tN53V1 5.6" VGA (640x480) TFT LCD panel
25 + - innolux,at056tn53v1
26 # Innolux AT070TN92 7.0" WQVGA TFT LCD panel
27 - innolux,at070tn92
28 # Innolux G070Y2-L01 7" WVGA (800x480) TFT LCD panel
29 --- a/Documentation/userspace-api/media/v4l/subdev-formats.rst
30 +++ b/Documentation/userspace-api/media/v4l/subdev-formats.rst
31 @@ -908,6 +908,43 @@ The following tables list existing packe
32 - g\ :sub:`5`
33 - g\ :sub:`4`
34 - g\ :sub:`3`
35 + * .. _MEDIA-BUS-FMT-BGR666-1X18:
36 +
37 + - MEDIA_BUS_FMT_RGB666_1X18
38 + - 0x101f
39 + -
40 + -
41 + -
42 + -
43 + -
44 + -
45 + -
46 + -
47 + -
48 + -
49 + -
50 + -
51 + -
52 + -
53 + -
54 + - b\ :sub:`5`
55 + - b\ :sub:`4`
56 + - b\ :sub:`3`
57 + - b\ :sub:`2`
58 + - b\ :sub:`1`
59 + - b\ :sub:`0`
60 + - g\ :sub:`5`
61 + - g\ :sub:`4`
62 + - g\ :sub:`3`
63 + - g\ :sub:`2`
64 + - g\ :sub:`1`
65 + - g\ :sub:`0`
66 + - r\ :sub:`5`
67 + - r\ :sub:`4`
68 + - r\ :sub:`3`
69 + - r\ :sub:`2`
70 + - r\ :sub:`1`
71 + - r\ :sub:`0`
72 * .. _MEDIA-BUS-FMT-RGB666-1X18:
73
74 - MEDIA_BUS_FMT_RGB666_1X18
75 @@ -982,6 +1019,43 @@ The following tables list existing packe
76 - g\ :sub:`2`
77 - g\ :sub:`1`
78 - g\ :sub:`0`
79 + * .. _MEDIA-BUS-FMT-BGR666-1X24_CPADHI:
80 +
81 + - MEDIA_BUS_FMT_BGR666_1X24_CPADHI
82 + - 0x101e
83 + -
84 + -
85 + -
86 + -
87 + -
88 + -
89 + -
90 + -
91 + -
92 + - 0
93 + - 0
94 + - b\ :sub:`5`
95 + - b\ :sub:`4`
96 + - b\ :sub:`3`
97 + - b\ :sub:`2`
98 + - b\ :sub:`1`
99 + - b\ :sub:`0`
100 + - 0
101 + - 0
102 + - g\ :sub:`5`
103 + - g\ :sub:`4`
104 + - g\ :sub:`3`
105 + - g\ :sub:`2`
106 + - g\ :sub:`1`
107 + - g\ :sub:`0`
108 + - 0
109 + - 0
110 + - r\ :sub:`5`
111 + - r\ :sub:`4`
112 + - r\ :sub:`3`
113 + - r\ :sub:`2`
114 + - r\ :sub:`1`
115 + - r\ :sub:`0`
116 * .. _MEDIA-BUS-FMT-RGB666-1X24_CPADHI:
117
118 - MEDIA_BUS_FMT_RGB666_1X24_CPADHI
119 --- a/drivers/gpu/drm/panel/panel-simple.c
120 +++ b/drivers/gpu/drm/panel/panel-simple.c
121 @@ -2094,6 +2094,38 @@ static const struct panel_desc innolux_a
122 .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE,
123 };
124
125 +static const struct display_timing innolux_at056tn53v1_timing = {
126 + .pixelclock = { 39700000, 39700000, 39700000},
127 + .hactive = { 640, 640, 640 },
128 + .hfront_porch = { 16, 16, 16 },
129 + .hback_porch = { 134, 134, 134 },
130 + .hsync_len = { 10, 10, 10},
131 + .vactive = { 480, 480, 480 },
132 + .vfront_porch = { 32, 32, 32},
133 + .vback_porch = { 11, 11, 11 },
134 + .vsync_len = { 2, 2, 2 },
135 + .flags = DRM_MODE_FLAG_PVSYNC | DRM_MODE_FLAG_PHSYNC,
136 +};
137 +
138 +static const struct panel_desc innolux_at056tn53v1 = {
139 + .timings = &innolux_at056tn53v1_timing,
140 + .num_timings = 1,
141 + .bpc = 6,
142 + .size = {
143 + .width = 112,
144 + .height = 84,
145 + },
146 + .delay = {
147 + .prepare = 50,
148 + .enable = 200,
149 + .disable = 110,
150 + .unprepare = 200,
151 + },
152 + .bus_format = MEDIA_BUS_FMT_BGR666_1X24_CPADHI,
153 + .bus_flags = DRM_BUS_FLAG_PIXDATA_SAMPLE_POSEDGE,
154 + .connector_type = DRM_MODE_CONNECTOR_DPI,
155 +};
156 +
157 static const struct drm_display_mode innolux_at070tn92_mode = {
158 .clock = 33333,
159 .hdisplay = 800,
160 @@ -4077,6 +4109,9 @@ static const struct of_device_id platfor
161 .compatible = "innolux,at043tn24",
162 .data = &innolux_at043tn24,
163 }, {
164 + .compatible = "innolux,at056tn53v1",
165 + .data = &innolux_at056tn53v1,
166 + }, {
167 .compatible = "innolux,at070tn92",
168 .data = &innolux_at070tn92,
169 }, {
170 --- a/drivers/gpu/drm/vc4/vc4_dpi.c
171 +++ b/drivers/gpu/drm/vc4/vc4_dpi.c
172 @@ -165,10 +165,20 @@ static void vc4_dpi_encoder_enable(struc
173 dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_2,
174 DPI_FORMAT);
175 break;
176 + case MEDIA_BUS_FMT_BGR666_1X24_CPADHI:
177 + dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_2,
178 + DPI_FORMAT);
179 + dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR, DPI_ORDER);
180 + break;
181 case MEDIA_BUS_FMT_RGB666_1X18:
182 dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_1,
183 DPI_FORMAT);
184 break;
185 + case MEDIA_BUS_FMT_BGR666_1X18:
186 + dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_1,
187 + DPI_FORMAT);
188 + dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR, DPI_ORDER);
189 + break;
190 case MEDIA_BUS_FMT_RGB565_1X16:
191 dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_3,
192 DPI_FORMAT);
193 --- a/include/uapi/linux/media-bus-format.h
194 +++ b/include/uapi/linux/media-bus-format.h
195 @@ -34,7 +34,7 @@
196
197 #define MEDIA_BUS_FMT_FIXED 0x0001
198
199 -/* RGB - next is 0x101d */
200 +/* RGB - next is 0x1020 */
201 #define MEDIA_BUS_FMT_RGB444_1X12 0x1016
202 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_BE 0x1001
203 #define MEDIA_BUS_FMT_RGB444_2X8_PADHI_LE 0x1002
204 @@ -45,8 +45,10 @@
205 #define MEDIA_BUS_FMT_BGR565_2X8_LE 0x1006
206 #define MEDIA_BUS_FMT_RGB565_2X8_BE 0x1007
207 #define MEDIA_BUS_FMT_RGB565_2X8_LE 0x1008
208 +#define MEDIA_BUS_FMT_BGR666_1X18 0x101f
209 #define MEDIA_BUS_FMT_RGB666_1X18 0x1009
210 #define MEDIA_BUS_FMT_RBG888_1X24 0x100e
211 +#define MEDIA_BUS_FMT_BGR666_1X24_CPADHI 0x101e
212 #define MEDIA_BUS_FMT_RGB666_1X24_CPADHI 0x1015
213 #define MEDIA_BUS_FMT_RGB666_1X7X3_SPWG 0x1010
214 #define MEDIA_BUS_FMT_BGR888_1X24 0x1013