From: Fabio Estevam <[email protected]>

Since commit 559358282e5b ("drm/fb-helper: Don't use the preferred depth
for the BPP default") an RGB565 CFAF240320X display no longer works
correctly: the colors are wrong and the content appears twice on the
screen, side by side.

The reason for the regression is that bits per pixel is now 32 instead
of 16 in the fb-helper driver.

Fix this problem by passing drm_client_setup_with_fourcc() with the correct
format depending on the bits per pixel information.

Cc: [email protected]
Fixes: 559358282e5b ("drm/fb-helper: Don't use the preferred depth for the BPP 
default")
Signed-off-by: Fabio Estevam <[email protected]>
---
 drivers/gpu/drm/tiny/panel-mipi-dbi.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/gpu/drm/tiny/panel-mipi-dbi.c 
b/drivers/gpu/drm/tiny/panel-mipi-dbi.c
index 0460ecaef4bd..23914a9f7fd3 100644
--- a/drivers/gpu/drm/tiny/panel-mipi-dbi.c
+++ b/drivers/gpu/drm/tiny/panel-mipi-dbi.c
@@ -390,7 +390,10 @@ static int panel_mipi_dbi_spi_probe(struct spi_device *spi)
 
        spi_set_drvdata(spi, drm);
 
-       drm_client_setup(drm, NULL);
+       if (bpp == 16)
+               drm_client_setup_with_fourcc(drm, DRM_FORMAT_RGB565);
+       else
+               drm_client_setup_with_fourcc(drm, DRM_FORMAT_RGB888);
 
        return 0;
 }
-- 
2.34.1

Reply via email to