1 From a08e51a8b93f857cde93ddd7730c1cdedb6ccdd1 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
6 A matching media bus format was added and an overlay for using it,
7 both with FB and VC4 was added as well.
9 Signed-off-by: Joerg Quinten <aBUGSworstnightmare@gmail.com>
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(-)
18 --- a/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
19 +++ b/Documentation/devicetree/bindings/display/panel/panel-simple.yaml
20 @@ -162,6 +162,8 @@ properties:
22 # Innolux AT043TN24 4.3" WQVGA TFT LCD panel
24 + # Innolux AT056tN53V1 5.6" VGA (640x480) TFT LCD panel
25 + - innolux,at056tn53v1
26 # Innolux AT070TN92 7.0" WQVGA TFT LCD panel
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 @@ -912,6 +912,43 @@ The following tables list existing packe
35 + * .. _MEDIA-BUS-FMT-BGR666-1X18:
37 + - MEDIA_BUS_FMT_RGB666_1X18
72 * .. _MEDIA-BUS-FMT-RGB666-1X18:
74 - MEDIA_BUS_FMT_RGB666_1X18
75 @@ -986,6 +1023,43 @@ The following tables list existing packe
79 + * .. _MEDIA-BUS-FMT-BGR666-1X24_CPADHI:
81 + - MEDIA_BUS_FMT_BGR666_1X24_CPADHI
116 * .. _MEDIA-BUS-FMT-RGB666-1X24_CPADHI:
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 @@ -2472,6 +2472,38 @@ static const struct panel_desc innolux_a
122 .bus_flags = DRM_BUS_FLAG_DE_HIGH | DRM_BUS_FLAG_PIXDATA_DRIVE_POSEDGE,
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,
138 +static const struct panel_desc innolux_at056tn53v1 = {
139 + .timings = &innolux_at056tn53v1_timing,
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,
157 static const struct drm_display_mode innolux_at070tn92_mode = {
160 @@ -4662,6 +4694,9 @@ static const struct of_device_id platfor
161 .compatible = "innolux,at043tn24",
162 .data = &innolux_at043tn24,
164 + .compatible = "innolux,at056tn53v1",
165 + .data = &innolux_at056tn53v1,
167 .compatible = "innolux,at070tn92",
168 .data = &innolux_at070tn92,
170 --- a/drivers/gpu/drm/vc4/vc4_dpi.c
171 +++ b/drivers/gpu/drm/vc4/vc4_dpi.c
172 @@ -167,10 +167,20 @@ static void vc4_dpi_encoder_enable(struc
173 dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_2,
176 + case MEDIA_BUS_FMT_BGR666_1X24_CPADHI:
177 + dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_2,
179 + dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR, DPI_ORDER);
181 case MEDIA_BUS_FMT_RGB666_1X18:
182 dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_1,
185 + case MEDIA_BUS_FMT_BGR666_1X18:
186 + dpi_c |= VC4_SET_FIELD(DPI_FORMAT_18BIT_666_RGB_1,
188 + dpi_c |= VC4_SET_FIELD(DPI_ORDER_BGR, DPI_ORDER);
190 case MEDIA_BUS_FMT_RGB565_1X16:
191 dpi_c |= VC4_SET_FIELD(DPI_FORMAT_16BIT_565_RGB_1,
193 --- a/include/uapi/linux/media-bus-format.h
194 +++ b/include/uapi/linux/media-bus-format.h
197 #define MEDIA_BUS_FMT_FIXED 0x0001
199 -/* RGB - next is 0x101e */
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
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