drm/pl111: Handle the Versatile RGB/BGR565 mode
authorLinus Walleij <linus.walleij@linaro.org>
Tue, 6 Feb 2018 09:35:37 +0000 (10:35 +0100)
committerLinus Walleij <linus.walleij@linaro.org>
Wed, 7 Feb 2018 08:08:34 +0000 (09:08 +0100)
The ARM Versatile series can do RGB/BGR565 with an external
"PLD" (Programmable Logical Device). However the CLCD does not
have control bits for this, so it needs to be set into the
ordinary 16BPP mode, then the RGB/BGR565 handling of the pixel
data is handled by configuring the PLD through the external
register.

Reviewed-by: Eric Anholt <eric@anholt.net>
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20180206093540.8147-2-linus.walleij@linaro.org
drivers/gpu/drm/pl111/pl111_display.c

index 7fe4040aea46a040a3b61e5990d51ed67a98c0c4..55ada00ec974774555312263144004c38ef2da1f 100644 (file)
@@ -199,10 +199,17 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe,
                cntl |= CNTL_LCDBPP24 | CNTL_BGR;
                break;
        case DRM_FORMAT_BGR565:
-               cntl |= CNTL_LCDBPP16_565;
+               if (priv->variant->is_pl110)
+                       cntl |= CNTL_LCDBPP16;
+               else
+                       cntl |= CNTL_LCDBPP16_565;
                break;
        case DRM_FORMAT_RGB565:
-               cntl |= CNTL_LCDBPP16_565 | CNTL_BGR;
+               if (priv->variant->is_pl110)
+                       cntl |= CNTL_LCDBPP16;
+               else
+                       cntl |= CNTL_LCDBPP16_565;
+               cntl |= CNTL_BGR;
                break;
        case DRM_FORMAT_ABGR1555:
        case DRM_FORMAT_XBGR1555:
@@ -226,6 +233,10 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe,
                break;
        }
 
+       /* The PL110 in Integrator/Versatile does the BGR routing externally */
+       if (priv->variant->external_bgr)
+               cntl &= ~CNTL_BGR;
+
        /* Power sequence: first enable and chill */
        writel(cntl, priv->regs + priv->ctrl);