From patchwork Thu Feb 1 12:55:09 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 126528 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1680705ljc; Thu, 1 Feb 2018 04:55:25 -0800 (PST) X-Google-Smtp-Source: AH8x226hnTiPHNUnvUAFL7fKVv0BhH7yb2afzqa+AoWg67adPLoiyAMMp+95Xy91QT0Mwnp57yVK X-Received: by 10.98.233.10 with SMTP id j10mr36532352pfh.123.1517489725573; Thu, 01 Feb 2018 04:55:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517489725; cv=none; d=google.com; s=arc-20160816; b=O+uY2OlnWjVv+zwkeoaUhvwjreneaUzqOm56VIF+XfL37FCbpsMziH+R/cxLa+ubEk O+jlBnQcdpWUVQKwTbMtQURkgOjpRVvPmDQ6ccBZgLk5aqVeX6NXGI4EQ2Xgf9ZX/HNB bl45GhzfTEmqmqb40SafXZW/+H+LLzNDXgoPNYg24VJfSLr+fHQVKAwuy9d+xgruHmCT PjTiH11wHMJO47WnU35et+83D2JQYdeEhFZuKKIAYPfVIpUPRxQSFLhnhZ31DlmZ3lpx RuOWkydXCqSjpgXIXro/BOqzg96BJTAmOxsyEsFJFNTMJwrFibKO1mjud0KsscJI0aOd EslQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=QE5EnwgF3H8lEW2PsS2jS0VMcoTgXal3JGrkFzBrWzQ=; b=TzigpXpQFXpdwzGfNlKCNj3cAZBzL0vT1Egltj9zjP0Frcj8v8PuJB1yeuaS67rS7s M6CPWv+km+a5JAt6kbBKe5p3xWD1Q7cUUZzqbkAZsnkieUbJ5rCPcIB7I3NHNK+RqNDk K7qDIlT9U+NN8ghmO0VTx95ElmK0xkZylqxz7mEU1kZKcvlkIjI9tpntVUq/Lk/VZo/T UPatxGfMbugnqqU0dt+ywME3dvD6tJNcfYr0RUwtjEjyGTizAIxNBDY0GX1GTsDQ+Bdv XEaZHmZnn2CL4QoVKKxWYZdoy9o1X5guBwJw1Ua84DUHyLlxrTEUP89XG+g6iZ+z7JSg tQjg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Hmai6Ttu; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id v1si4253487pfj.171.2018.02.01.04.55.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Feb 2018 04:55:25 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Hmai6Ttu; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 784FD6ED9D; Thu, 1 Feb 2018 12:55:24 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x242.google.com (mail-lf0-x242.google.com [IPv6:2a00:1450:4010:c07::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4492D6ED9C for ; Thu, 1 Feb 2018 12:55:22 +0000 (UTC) Received: by mail-lf0-x242.google.com with SMTP id t79so26065965lfe.3 for ; Thu, 01 Feb 2018 04:55:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=06ppcY26ZIbpbTcKcBMcN0v6xx00aJ8ivc5dqy9DApY=; b=Hmai6TtuFzvCOGSzKc3TspEBx0STY11/Gk6aEMNy7XN39qInv1/BfdNWEKGDIDGdYm yXGzCfG74rY1RIasy+s45yQqnwtd6imqAYankqY322y/8DiyhKGtgJxNKm8n3ciRXspz sHZc0e1n3BsrgbGzS1jAe632UnIiuJVOmkmiI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=06ppcY26ZIbpbTcKcBMcN0v6xx00aJ8ivc5dqy9DApY=; b=m00gyyIrt/FHYmHEw52CeFYzcX+qkpskK1/JcUE8RyW6ezlC1xa7y3WDfgLuT1h5FA QJkM1PAMw9+DjttGnq2YPXFsRq88C+Y271i+0trPaaQ2vt0ToxYfP/sSa/Nh0DmxWmGl YCXR53F5SxZ+5zXA3yv+EVl1VFbqSAcZ5nh6hjjWt/zvDpjXYcsjqKqeDpbuGol8Iyim ud2CJmuAxnrjaMtvPKJjMbZqRgO9NEFDbzQ4hzqWMstGHpgMzbV+jjcUQgEGgpJHFoiG sykmfbk9RM82MfMflLmvinbgBv0N/0uTr5HBRm/AgFQMy9dt0FttM7HUyQNIsfByeDFd fs7Q== X-Gm-Message-State: AKwxyte+cYkC6Pi6PmTAU5hhybcPeXXXSgiPcPTXFrv3k2mfM2qlt6n0 WoyjVSg2m7xvUzYqaD7e7UtpwA== X-Received: by 10.25.99.129 with SMTP id v1mr21481892lfi.137.1517489720622; Thu, 01 Feb 2018 04:55:20 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id a129sm4300792lfa.0.2018.02.01.04.55.19 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Feb 2018 04:55:19 -0800 (PST) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 1/5 v2] drm/pl111: Properly detect the ARM PL110 variants Date: Thu, 1 Feb 2018 13:55:09 +0100 Message-Id: <20180201125513.5482-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180201125513.5482-1-linus.walleij@linaro.org> References: <20180201125513.5482-1-linus.walleij@linaro.org> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" With a bit of refactoring we can contain the variant data for the strange PL110 versions that is feature-incomplete PL110 for the ARM Integrator/CP and somewhere inbetween PL110 and PL111 for the ARM Versatile AB and Versatile PB. We also accomodate for the custom duct-taped RGB565/BGR565 support in the Versatile variant. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Push more logic into the pl111_versatile file and keep the driver core neutral. - Pave the way better for the Integrator/CP variant as well. --- drivers/gpu/drm/pl111/pl111_drm.h | 3 ++ drivers/gpu/drm/pl111/pl111_drv.c | 37 ++++---------- drivers/gpu/drm/pl111/pl111_versatile.c | 85 +++++++++++++++++++++++++-------- 3 files changed, 79 insertions(+), 46 deletions(-) diff --git a/drivers/gpu/drm/pl111/pl111_drm.h b/drivers/gpu/drm/pl111/pl111_drm.h index 440f53ebee8c..c2f410f0b12e 100644 --- a/drivers/gpu/drm/pl111/pl111_drm.h +++ b/drivers/gpu/drm/pl111/pl111_drm.h @@ -36,12 +36,15 @@ struct drm_minor; * struct pl111_variant_data - encodes IP differences * @name: the name of this variant * @is_pl110: this is the early PL110 variant + * @external_bgr: this is the Versatile Pl110 variant with external + * BGR/RGB routing * @formats: array of supported pixel formats on this variant * @nformats: the length of the array of supported pixel formats */ struct pl111_variant_data { const char *name; bool is_pl110; + bool external_bgr; const u32 *formats; unsigned int nformats; }; diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c index 31a0c4268cc6..6967cd5428b2 100644 --- a/drivers/gpu/drm/pl111/pl111_drv.c +++ b/drivers/gpu/drm/pl111/pl111_drv.c @@ -205,7 +205,7 @@ static int pl111_amba_probe(struct amba_device *amba_dev, { struct device *dev = &amba_dev->dev; struct pl111_drm_dev_private *priv; - struct pl111_variant_data *variant = id->data; + const struct pl111_variant_data *variant = id->data; struct drm_device *drm; int ret; @@ -221,27 +221,10 @@ static int pl111_amba_probe(struct amba_device *amba_dev, drm->dev_private = priv; priv->variant = variant; - /* - * The PL110 and PL111 variants have two registers - * swapped: interrupt enable and control. For this reason - * we use offsets that we can change per variant. - */ + /* The two variants swap this register */ if (variant->is_pl110) { - /* - * The ARM Versatile boards are even more special: - * their PrimeCell ID say they are PL110 but the - * control and interrupt enable registers are anyway - * swapped to the PL111 order so they are not following - * the PL110 datasheet. - */ - if (of_machine_is_compatible("arm,versatile-ab") || - of_machine_is_compatible("arm,versatile-pb")) { - priv->ienb = CLCD_PL111_IENB; - priv->ctrl = CLCD_PL111_CNTL; - } else { - priv->ienb = CLCD_PL110_IENB; - priv->ctrl = CLCD_PL110_CNTL; - } + priv->ienb = CLCD_PL110_IENB; + priv->ctrl = CLCD_PL110_CNTL; } else { priv->ienb = CLCD_PL111_IENB; priv->ctrl = CLCD_PL111_CNTL; @@ -253,6 +236,11 @@ static int pl111_amba_probe(struct amba_device *amba_dev, return PTR_ERR(priv->regs); } + /* This may override some variant settings */ + ret = pl111_versatile_init(dev, priv); + if (ret) + goto dev_unref; + /* turn off interrupts before requesting the irq */ writel(0, priv->regs + priv->ienb); @@ -263,10 +251,6 @@ static int pl111_amba_probe(struct amba_device *amba_dev, return ret; } - ret = pl111_versatile_init(dev, priv); - if (ret) - goto dev_unref; - ret = pl111_modeset_init(drm); if (ret != 0) goto dev_unref; @@ -299,8 +283,7 @@ static int pl111_amba_remove(struct amba_device *amba_dev) } /* - * This variant exist in early versions like the ARM Integrator - * and this version lacks the 565 and 444 pixel formats. + * This early variant lacks the 565 and 444 pixel formats. */ static const u32 pl110_pixel_formats[] = { DRM_FORMAT_ABGR8888, diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c index 97d4af6925a3..893d527fb42f 100644 --- a/drivers/gpu/drm/pl111/pl111_versatile.c +++ b/drivers/gpu/drm/pl111/pl111_versatile.c @@ -1,3 +1,4 @@ +#include #include #include #include @@ -64,10 +65,8 @@ static const struct of_device_id versatile_clcd_of_match[] = { #define INTEGRATOR_CLCD_LCDBIASEN BIT(8) #define INTEGRATOR_CLCD_LCDBIASUP BIT(9) #define INTEGRATOR_CLCD_LCDBIASDN BIT(10) -/* Bits 11,12,13 controls the LCD type */ -#define INTEGRATOR_CLCD_LCDMUX_MASK (BIT(11)|BIT(12)|BIT(13)) +/* Bits 11,12,13 controls the LCD or VGA bridge type */ #define INTEGRATOR_CLCD_LCDMUX_LCD24 BIT(11) -#define INTEGRATOR_CLCD_LCDMUX_VGA565 BIT(12) #define INTEGRATOR_CLCD_LCDMUX_SHARP (BIT(11)|BIT(12)) #define INTEGRATOR_CLCD_LCDMUX_VGA555 BIT(13) #define INTEGRATOR_CLCD_LCDMUX_VGA24 (BIT(11)|BIT(12)|BIT(13)) @@ -82,16 +81,7 @@ static const struct of_device_id versatile_clcd_of_match[] = { /* 0 = 24bit VGA, 1 = 18bit VGA */ #define INTEGRATOR_CLCD_LCD_N24BITEN BIT(19) -#define INTEGRATOR_CLCD_MASK (INTEGRATOR_CLCD_LCDBIASEN | \ - INTEGRATOR_CLCD_LCDBIASUP | \ - INTEGRATOR_CLCD_LCDBIASDN | \ - INTEGRATOR_CLCD_LCDMUX_MASK | \ - INTEGRATOR_CLCD_LCD0_EN | \ - INTEGRATOR_CLCD_LCD1_EN | \ - INTEGRATOR_CLCD_LCD_STATIC1 | \ - INTEGRATOR_CLCD_LCD_STATIC2 | \ - INTEGRATOR_CLCD_LCD_STATIC | \ - INTEGRATOR_CLCD_LCD_N24BITEN) +#define INTEGRATOR_CLCD_MASK GENMASK(19,8) static void pl111_integrator_enable(struct drm_device *drm, u32 format) { @@ -106,11 +96,8 @@ static void pl111_integrator_enable(struct drm_device *drm, u32 format) switch (format) { case DRM_FORMAT_XBGR8888: case DRM_FORMAT_XRGB8888: - break; - case DRM_FORMAT_BGR565: - case DRM_FORMAT_RGB565: - /* truecolor RGB565 */ - val |= INTEGRATOR_CLCD_LCDMUX_VGA565; + /* 24bit formats */ + val |= INTEGRATOR_CLCD_LCDMUX_VGA24; break; case DRM_FORMAT_XBGR1555: case DRM_FORMAT_XRGB1555: @@ -217,6 +204,55 @@ static void pl111_realview_clcd_enable(struct drm_device *drm, u32 format) SYS_CLCD_NLCDIOON | SYS_CLCD_PWR3V5SWITCH); } +/* PL110 pixel formats for Integrator, vanilla PL110 */ +static const u32 pl110_integrator_pixel_formats[] = { + DRM_FORMAT_ABGR8888, + DRM_FORMAT_XBGR8888, + DRM_FORMAT_ARGB8888, + DRM_FORMAT_XRGB8888, + DRM_FORMAT_ABGR1555, + DRM_FORMAT_XBGR1555, + DRM_FORMAT_ARGB1555, + DRM_FORMAT_XRGB1555, +}; + +/* Extended PL110 pixel formats for Integrator and Versatile */ +static const u32 pl110_versatile_pixel_formats[] = { + DRM_FORMAT_ABGR8888, + DRM_FORMAT_XBGR8888, + DRM_FORMAT_ARGB8888, + DRM_FORMAT_XRGB8888, + DRM_FORMAT_BGR565, /* Uses external PLD */ + DRM_FORMAT_RGB565, /* Uses external PLD */ + DRM_FORMAT_ABGR1555, + DRM_FORMAT_XBGR1555, + DRM_FORMAT_ARGB1555, + DRM_FORMAT_XRGB1555, +}; + +/* + * The Integrator variant is a PL110 with a bunch of broken, or not + * yet implemented features + */ +static const struct pl111_variant_data pl110_integrator = { + .name = "PL110 Integrator", + .is_pl110 = true, + .formats = pl110_integrator_pixel_formats, + .nformats = ARRAY_SIZE(pl110_integrator_pixel_formats), +}; + +/* + * This is the in-between PL110 variant found in the ARM Versatile, + * supporting RGB565/BGR565 + */ +static const struct pl111_variant_data pl110_versatile = { + .name = "PL110 Versatile", + .is_pl110 = true, + .external_bgr = true, + .formats = pl110_versatile_pixel_formats, + .nformats = ARRAY_SIZE(pl110_versatile_pixel_formats), +}; + int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv) { const struct of_device_id *clcd_id; @@ -241,14 +277,25 @@ int pl111_versatile_init(struct device *dev, struct pl111_drm_dev_private *priv) switch (versatile_clcd_type) { case INTEGRATOR_CLCD_CM: versatile_syscon_map = map; + /* This can do RGB565 with external PLD */ + priv->variant = &pl110_integrator; priv->variant_display_enable = pl111_integrator_enable; dev_info(dev, "set up callbacks for Integrator PL110\n"); break; case VERSATILE_CLCD: versatile_syscon_map = map; + /* This can do RGB565 with external PLD */ + priv->variant = &pl110_versatile; priv->variant_display_enable = pl111_versatile_enable; priv->variant_display_disable = pl111_versatile_disable; - dev_info(dev, "set up callbacks for Versatile PL110+\n"); + /* + * The Versatile has a variant halfway between PL110 + * and PL111 where these two registers have already been + * swapped. + */ + priv->ienb = CLCD_PL111_IENB; + priv->ctrl = CLCD_PL111_CNTL; + dev_info(dev, "set up callbacks for Versatile PL110\n"); break; case REALVIEW_CLCD_EB: case REALVIEW_CLCD_PB1176: From patchwork Thu Feb 1 12:55:10 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 126529 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1680723ljc; Thu, 1 Feb 2018 04:55:27 -0800 (PST) X-Google-Smtp-Source: AH8x225zBZbEURlA/KBP+0tW4ivQHV0l7BmTxOgMM9KZUf4UsgOgN52ktRjkh1t7m8ZljPhDxUxK X-Received: by 10.98.19.19 with SMTP id b19mr36957762pfj.118.1517489727717; Thu, 01 Feb 2018 04:55:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517489727; cv=none; d=google.com; s=arc-20160816; b=yhCdlLoSt2wZeBG99SV96dUvH6zrz1Y9p3cQXfv0U+D+HnrTArHnSOn6If7PrJS+Ah 1uKVMULDr3/ZWaisz0+b3E0I9rV07RNwDzwY+OGToQFIQFdmMpxNnhJ6rHpax7jr5Esa pmyD+BS3Bc0rPDSB15pEH9otVVJBZols2gjMvGAcLVsXdMLDmfIOMLp4N2gbGsSGqzmw 1EwoVpBjn0xtGHHpMEOoO8HHH3ViyhYzGPV3lxVsbq7rgCGC/b6PVc7+ttGlh01MRpi2 hSPHHD8Tc6lF5YlC8IMxp0BCxNMIfO3mGLrMSaKY0ZrUvGWziLkBpBAehiOqxfV3qcc3 6cmQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=QzVCK00Dhw5oo4dGz13lCuIgS3uPNGot7/dVQO5jRfE=; b=vLdufQTW3bP2JIIxxf3a0jHCdLwCKz3v1mmZ+ZXYZSaM6bdTPNQ5l0ZvwNJD2AGlri dpsUeS+jItVE4RKLsxszw3lorBd09SEK0dar95gDaGWZhVA3EXnIkJVEstQn0Vg/GsoJ ebDedDgx8A33KrNtX2K/Figco0yvEneTtanYrND0a/yKNYnonGZbhvjVLN9+yItgrWb9 2lG5DFl/cWygtj+PYLgtTFdq1cEGwiVtmUdD2ozdIYf5koq0tu5KFqi0eQUp25VLnS+g wAMIuPGQ5eZQTLTsun/OhFVryGstDzir3YTTKVAyZtKl7DWtmkVvmTnu4pd5PbdsQpYR wsTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=WT9xdkJS; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id bj9-v6si1646262plb.464.2018.02.01.04.55.27 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Feb 2018 04:55:27 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=WT9xdkJS; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 187F76EDA0; Thu, 1 Feb 2018 12:55:26 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x243.google.com (mail-lf0-x243.google.com [IPv6:2a00:1450:4010:c07::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id 66C616ED9C for ; Thu, 1 Feb 2018 12:55:24 +0000 (UTC) Received: by mail-lf0-x243.google.com with SMTP id a204so26058341lfa.2 for ; Thu, 01 Feb 2018 04:55:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=cypPwjRTvq7HplaNcVDWNibx5OOOa+nccfWyv7fh2bA=; b=WT9xdkJSO6BiyclX4N6gmJV5b6nGawaOvGixq2k4d1d8dbX96O+Gwx5DYCCD5Kqd8R wSZse8aMdr2kYBxKOQEuaQ4kPobDNCDhoKbR2XDnDbHtQNytOpQ2sn8ET51Z6lA4db4I Ky+0cJho8y7hEBhh64BOszkrr+ly1ajQFoHDk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=cypPwjRTvq7HplaNcVDWNibx5OOOa+nccfWyv7fh2bA=; b=pkfaEM9SQChwYh9kIsZ1eeQjASv8dDg4EhhRexta5FLtqfz8knlDcjxzess2WL9a9M xPUJaZ0e/+QL2SshLKbTAB/lmVvTPLXHkec10gFVUU7fA1IjjXpJ699Z4t2364L/M0FL WFzJOGyAbhUpfU3w9pHgQZETGeO5u6+I/NFI6Z0cEERPIKY0Y6/rPkho5K2WMLUI5yjo P29H3jrkVDG15PBbHqPsWcIVEuRNlpiGxht/IxS/xRa4CcHholKxVCpFWHTMprDPdYN1 EJbzonxAAI8on5wkdqS2KPMZMJNslUhNupqwqK1mH1NuN96HDEnAKA4IQYoZZFg/Kh6k B44A== X-Gm-Message-State: AKwxytdX2nIkRx41RvrWac3x/6+NLLmxZgu8crbSDKkD23CBOPXOKpSs ilcaydWLM6QRI9M8Jy//ZmF3fQ== X-Received: by 10.25.23.194 with SMTP id 63mr22987696lfx.100.1517489722546; Thu, 01 Feb 2018 04:55:22 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id a129sm4300792lfa.0.2018.02.01.04.55.21 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Feb 2018 04:55:21 -0800 (PST) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 2/5 v2] drm/pl111: Handle the Versatile RGB/BGR565 mode Date: Thu, 1 Feb 2018 13:55:10 +0100 Message-Id: <20180201125513.5482-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180201125513.5482-1-linus.walleij@linaro.org> References: <20180201125513.5482-1-linus.walleij@linaro.org> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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. Signed-off-by: Linus Walleij --- ChangeLog v1->v2: - Rebase on earlier changes. --- drivers/gpu/drm/pl111/pl111_display.c | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c index 7fe4040aea46..55ada00ec974 100644 --- a/drivers/gpu/drm/pl111/pl111_display.c +++ b/drivers/gpu/drm/pl111/pl111_display.c @@ -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); From patchwork Thu Feb 1 12:55:11 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 126530 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1680746ljc; Thu, 1 Feb 2018 04:55:29 -0800 (PST) X-Google-Smtp-Source: AH8x227tbxDhM80rUkl37SEcViWlV5R+0InhZvGYckUc/kJQgB1VUVNcC9Smb+P/TJK6x/hb+4e6 X-Received: by 2002:a17:902:9a41:: with SMTP id x1-v6mr24814492plv.256.1517489729390; Thu, 01 Feb 2018 04:55:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517489729; cv=none; d=google.com; s=arc-20160816; b=dQI9VpbS5a3Mc28bfPpGS5/mIDP3oMg2mu94Ozba21HonGTCM6ufJv11YXNm2xZF/b H52LMtvY5jHj7yKU+1Uv6aRXKsbHZ2E/qUolgrUnkzFhcmUMfNa6D6yKztp8ldRWiF+/ ZIPd8w9IMhl601HnREBx8dUYCOn0TrhNwMT7/syK2rk1un92X7491R1L3Y2b4WaEG+hg D5UO0rLIC6K98ion1w0RFOVGtDogf3cm3VDzx8akfz6YVqr/4U0PSl0ODOEhc/PhLrTM GduKhPC3qLiVvl6q3M6pwMXOAjug2l2s4+LGenmrDXeSStwIGuVsvpwp1K2zp/3CnoLj G2vQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=Vg7+f9ZRKdlsqkvUEkI3sXAT7P2Qc7aNu6V1SJ3DCxQ=; b=faLuQPe8qxsvkqIlsN1E9bMDu1Nzbg5Af9luG8ALRLrHmTOdO79OwcNXeqLvxfzWPK Vfc+I4Eb23X7LLNBnFidT6NmnGdpam3mUE/zUmz0d6JCWD37oqdrFR3QlyXD2+04ePwn 0GJNiJdBygNIUvc3GAH1/SxeOw3MKBvulwq2H+uATJAnSmuCKc9ZpS/FsTa34ugaQeD2 opp32uHum/jserV8r6DcRA3kFteKKnCncjWv74qXKRTR+wySyr7nok58GbpvuWxBFixg kD8iZFp6uPFQmoENKdBbcQsncrxP38BQv78szVEs9KmPU9NtO9j1TFmnwngTBqUpsGuJ qeXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=cGOtJ730; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id u10si1359039pgp.222.2018.02.01.04.55.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Feb 2018 04:55:29 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=cGOtJ730; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A4E496ED9F; Thu, 1 Feb 2018 12:55:26 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x244.google.com (mail-lf0-x244.google.com [IPv6:2a00:1450:4010:c07::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 08BAE6ED9F for ; Thu, 1 Feb 2018 12:55:25 +0000 (UTC) Received: by mail-lf0-x244.google.com with SMTP id x196so26035835lfd.12 for ; Thu, 01 Feb 2018 04:55:25 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=yAMtyCJdps5O1j3rlHRae3yXUI5uzqnLp6Klq6l0G/E=; b=cGOtJ730fDKGrD9a3QnrBU7zAtI8v+tX0WOxnWvCf7isTSl8PKZDSguqOpSLzwTA33 P0tlsT17RbTq7z3ZBb+2jLbegzCqDfN/Em3kmxpaXQVSmnyO3k282vQJdqeIZhTtSZ8/ f50UEdD0v3wIbmJTq80Qu6zcUhKhbD6N4HT0A= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=yAMtyCJdps5O1j3rlHRae3yXUI5uzqnLp6Klq6l0G/E=; b=L7Nk8Utr5h7KdxlNG5Qv6SXa3gzoeQQfOmgP9Ri9IdlW6VxSrdd5q2hcGfwGlsOO+8 iv7R9ZWb+Rr+t2plvQLc5Gn02sUsEk9q1xvbJyAMgTzduVEIdTph6061mWgwT9Yi7XVH 44QtbrWq5416IOGxkQ7DLOJYpA0MuUg1MyFZt7Ffj3fSeO0qWKJ9aIOOGvN0W7a0RNey u1BcwLqQi1lBg6q+e+J7i4kBfxWQ50b4FPuuCNcsixje9CZmtPnuRJ/6DMSxrTkq5KbZ h3fpulRz4f3Wu9rp+gMj2RjMKeanOw6o+RA+I77T9kCGOBtzOstfW7wK0oUWZb0q6Zhu MVqw== X-Gm-Message-State: AKwxytcT0FW9jrMELElFALGyAC3WIz0shXNEFXIZ3q6Xgs7xUC5lDP14 Obxy8sGgtho4MV1DHjReszWvkw== X-Received: by 10.25.79.65 with SMTP id a1mr14786639lfk.97.1517489724308; Thu, 01 Feb 2018 04:55:24 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id a129sm4300792lfa.0.2018.02.01.04.55.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Feb 2018 04:55:23 -0800 (PST) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 3/5 v2] drm/pl111: Support variants with broken clock divider Date: Thu, 1 Feb 2018 13:55:11 +0100 Message-Id: <20180201125513.5482-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180201125513.5482-1-linus.walleij@linaro.org> References: <20180201125513.5482-1-linus.walleij@linaro.org> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The early Integrator CLCD synthesized in the Integrator CP and IM-PD1 FPGAs are broken: their clock dividers do not work properly. Support disabling the clock divider and drive the clock directly from the parent under these circumstances. Signed-off-by: Linus Walleij --- drivers/gpu/drm/pl111/pl111_display.c | 8 ++++++++ drivers/gpu/drm/pl111/pl111_drm.h | 3 +++ drivers/gpu/drm/pl111/pl111_versatile.c | 1 + 3 files changed, 12 insertions(+) diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c index 55ada00ec974..4d4e38b4c9d5 100644 --- a/drivers/gpu/drm/pl111/pl111_display.c +++ b/drivers/gpu/drm/pl111/pl111_display.c @@ -138,6 +138,9 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe, tim2 = readl(priv->regs + CLCD_TIM2); tim2 &= (TIM2_BCD | TIM2_PCD_LO_MASK | TIM2_PCD_HI_MASK); + if (priv->variant->broken_clockdivider) + tim2 |= TIM2_BCD; + if (mode->flags & DRM_MODE_FLAG_NHSYNC) tim2 |= TIM2_IHS; @@ -455,6 +458,11 @@ pl111_init_clock_divider(struct drm_device *drm) dev_err(drm->dev, "CLCD: unable to get clcdclk.\n"); return PTR_ERR(parent); } + /* If the clock divider is broken, use the parent directly */ + if (priv->variant->broken_clockdivider) { + priv->clk = parent; + return 0; + } parent_name = __clk_get_name(parent); spin_lock_init(&priv->tim2_lock); diff --git a/drivers/gpu/drm/pl111/pl111_drm.h b/drivers/gpu/drm/pl111/pl111_drm.h index c2f410f0b12e..f75c5d4645b2 100644 --- a/drivers/gpu/drm/pl111/pl111_drm.h +++ b/drivers/gpu/drm/pl111/pl111_drm.h @@ -38,6 +38,8 @@ struct drm_minor; * @is_pl110: this is the early PL110 variant * @external_bgr: this is the Versatile Pl110 variant with external * BGR/RGB routing + * @broken_clockdivider: the clock divider is broken and we need to + * use the supplied clock directly * @formats: array of supported pixel formats on this variant * @nformats: the length of the array of supported pixel formats */ @@ -45,6 +47,7 @@ struct pl111_variant_data { const char *name; bool is_pl110; bool external_bgr; + bool broken_clockdivider; const u32 *formats; unsigned int nformats; }; diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c index 893d527fb42f..0f228543a97c 100644 --- a/drivers/gpu/drm/pl111/pl111_versatile.c +++ b/drivers/gpu/drm/pl111/pl111_versatile.c @@ -237,6 +237,7 @@ static const u32 pl110_versatile_pixel_formats[] = { static const struct pl111_variant_data pl110_integrator = { .name = "PL110 Integrator", .is_pl110 = true, + .broken_clockdivider = true, .formats = pl110_integrator_pixel_formats, .nformats = ARRAY_SIZE(pl110_integrator_pixel_formats), }; From patchwork Thu Feb 1 12:55:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 126531 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1680775ljc; Thu, 1 Feb 2018 04:55:31 -0800 (PST) X-Google-Smtp-Source: AH8x225Xj3bhO0kYz6/kS1puqXHXlxX2Q4IlX/ecusxuaLYo8V4VV3Zxnsn5lNRsCdmDlPkDhFgr X-Received: by 2002:a17:902:a983:: with SMTP id bh3-v6mr16079362plb.237.1517489731788; Thu, 01 Feb 2018 04:55:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517489731; cv=none; d=google.com; s=arc-20160816; b=Q71yfZsXim5z2BSHbVkUvNFsGrkjxp2dY0guW6De63ZqGRxE05Q8btO0AIgvBhKlv5 HEdWedKo8C1WyjZUpxf1xpcLQtBBPXRXJAod0+HXy5+SJaqp+x1gb6TVf+slWI9XTp9i 5dIUup83Jy5JMAzWUtDLXQG1zTzDm6vewrjW7UuZcGaFWTpukix3wtwhg4FZ9Apl1Zxq 60CwLRuq0aZPlzlKY4Rq+n50HqEtOwsAlOy92LW4RUsPUEP0R1KLUP0GUoKzLKY41Lb6 M+tAfkkZXNbABIivNFC4hM+3ZgED4XgxDEfnI0UTO74a/hdg1Ygac7il9roTPPDW0h0g 5mVg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=vGmvb1kJ1795g37T1gNbwKd9G9fvlUM+QHSXGnA/7xE=; b=pAk6A175TuGHzGbdXVwTGuV/gsYOoZFl9MquSzZBFU/DOO2j2KaqTk0vEsOqKGGEkv UzNR+AfeZ4Y/mnskL1QtfufCQB/iPqsycZocZqedBjLwJXyoTC6kkJTjuV6+bMnZW0Es o1Ap4zFpnQSQ79Ru9+xkqG07fiK66hidOa2VhssF/gnwAy+9K0MUdog3oeRP3In2Y06+ nS17sja8qu1bfDrAczalYdEd3RaCj8efI1WClDVjGctBnxH6yLP/RLtIxYrg7G35l32X KRtCnh7nxIbFBS2wUa3eetYfJcTwVkNV3f/teyXtPe8W2jRygLU9UiJP0fZitzfSQKPi +kQg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=BwE5ixqa; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id f63si4498810pfc.226.2018.02.01.04.55.31 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Feb 2018 04:55:31 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=BwE5ixqa; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EC26D6EDA5; Thu, 1 Feb 2018 12:55:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x242.google.com (mail-lf0-x242.google.com [IPv6:2a00:1450:4010:c07::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id A6AC76EDA5 for ; Thu, 1 Feb 2018 12:55:27 +0000 (UTC) Received: by mail-lf0-x242.google.com with SMTP id t139so26074335lff.0 for ; Thu, 01 Feb 2018 04:55:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=ciZ9VgirHnQI/ECz7/O46JglO/31VqcP1MaUKGmOdsg=; b=BwE5ixqaiqciFBT9tp3XyI80HkwWPR3aJcbuvg6ZqWMQckfVFmrSRFcg/O7pZmioAc 2l3UgP4QMuoS2rGBAAwsEE6X3RSH6HPvTarzbDjvTP47sqehwTAODRABfcKb9j9kMb7T nn3gakhLK9dF+fHetOFbtU4WtHlSXps06PB7I= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=ciZ9VgirHnQI/ECz7/O46JglO/31VqcP1MaUKGmOdsg=; b=Gat971vOG8iys3EoonvXaQOfFsBh/4OlyUL0HMGm0Cqvan5534Oi9WSc0O5GP9GtrS XKHfVWlxgA22KR5wkePfzAvYVUJPLKQ+cWXGndgIKqiEL93+EpNN+uLLJH8JKx2AvXOQ OaSnGqiVKZmQTOyfOLsI1RH/W/lAkWQ8mZgHgLxB400lFsLIYqjhj85ufX7YiAIzqbqS x4TnGqsJsTous+I+cjIqwUVwn0h43yphV14RXtjVKr32FGzi4kB67UivZkuLb9QjBt2L CIWebszVNDBw7udB3NiagIabBkcE04FjL6b05VUlyDuphHMLPeNgMEijHfyZCihn1Jgi S1Qg== X-Gm-Message-State: AKwxytcOzd1I3CTpKyYvL1qa+2FzKyoX1dDnf1GOT6KNXSfK7iWx09Wu 3p02Xy+Cq5tqEVn0r8xbbSVfLA== X-Received: by 10.46.87.93 with SMTP id r29mr8214706ljd.93.1517489726089; Thu, 01 Feb 2018 04:55:26 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id a129sm4300792lfa.0.2018.02.01.04.55.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Feb 2018 04:55:25 -0800 (PST) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 4/5 v2] drm/pl111: Support variants with broken VBLANK Date: Thu, 1 Feb 2018 13:55:12 +0100 Message-Id: <20180201125513.5482-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180201125513.5482-1-linus.walleij@linaro.org> References: <20180201125513.5482-1-linus.walleij@linaro.org> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The early Integrator CLCD synthesized in the Integrator CP and IM-PD1 FPGAs are broken: their vertical and next base interrupts are not functional. Support these variants by simply disabling the use of the vblank interrupt on these variants. Signed-off-by: Linus Walleij Reviewed-by: Eric Anholt --- drivers/gpu/drm/pl111/pl111_display.c | 6 ++++-- drivers/gpu/drm/pl111/pl111_drm.h | 2 ++ drivers/gpu/drm/pl111/pl111_drv.c | 19 +++++++++++-------- drivers/gpu/drm/pl111/pl111_versatile.c | 1 + 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c index 4d4e38b4c9d5..d75923896609 100644 --- a/drivers/gpu/drm/pl111/pl111_display.c +++ b/drivers/gpu/drm/pl111/pl111_display.c @@ -256,7 +256,8 @@ static void pl111_display_enable(struct drm_simple_display_pipe *pipe, cntl |= CNTL_LCDPWR; writel(cntl, priv->regs + priv->ctrl); - drm_crtc_vblank_on(crtc); + if (!priv->variant->broken_vblank) + drm_crtc_vblank_on(crtc); } void pl111_display_disable(struct drm_simple_display_pipe *pipe) @@ -266,7 +267,8 @@ void pl111_display_disable(struct drm_simple_display_pipe *pipe) struct pl111_drm_dev_private *priv = drm->dev_private; u32 cntl; - drm_crtc_vblank_off(crtc); + if (!priv->variant->broken_vblank) + drm_crtc_vblank_off(crtc); /* Power Down */ cntl = readl(priv->regs + priv->ctrl); diff --git a/drivers/gpu/drm/pl111/pl111_drm.h b/drivers/gpu/drm/pl111/pl111_drm.h index f75c5d4645b2..d74076c6b7ef 100644 --- a/drivers/gpu/drm/pl111/pl111_drm.h +++ b/drivers/gpu/drm/pl111/pl111_drm.h @@ -40,6 +40,7 @@ struct drm_minor; * BGR/RGB routing * @broken_clockdivider: the clock divider is broken and we need to * use the supplied clock directly + * @broken_vblank: the vblank IRQ is broken on this variant * @formats: array of supported pixel formats on this variant * @nformats: the length of the array of supported pixel formats */ @@ -48,6 +49,7 @@ struct pl111_variant_data { bool is_pl110; bool external_bgr; bool broken_clockdivider; + bool broken_vblank; const u32 *formats; unsigned int nformats; }; diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c index 6967cd5428b2..e6fa897c740c 100644 --- a/drivers/gpu/drm/pl111/pl111_drv.c +++ b/drivers/gpu/drm/pl111/pl111_drv.c @@ -131,10 +131,12 @@ static int pl111_modeset_init(struct drm_device *dev) if (ret) return ret; - ret = drm_vblank_init(dev, 1); - if (ret != 0) { - dev_err(dev->dev, "Failed to init vblank\n"); - goto out_bridge; + if (!priv->variant->broken_vblank) { + ret = drm_vblank_init(dev, 1); + if (ret != 0) { + dev_err(dev->dev, "Failed to init vblank\n"); + goto out_bridge; + } } drm_mode_config_reset(dev); @@ -184,10 +186,6 @@ static struct drm_driver pl111_drm_driver = { .dumb_create = drm_gem_cma_dumb_create, .gem_free_object_unlocked = drm_gem_cma_free_object, .gem_vm_ops = &drm_gem_cma_vm_ops, - - .enable_vblank = pl111_enable_vblank, - .disable_vblank = pl111_disable_vblank, - .prime_handle_to_fd = drm_gem_prime_handle_to_fd, .prime_fd_to_handle = drm_gem_prime_fd_to_handle, .gem_prime_import = drm_gem_prime_import, @@ -213,6 +211,11 @@ static int pl111_amba_probe(struct amba_device *amba_dev, if (!priv) return -ENOMEM; + if (!variant->broken_vblank) { + pl111_drm_driver.enable_vblank = pl111_enable_vblank; + pl111_drm_driver.disable_vblank = pl111_disable_vblank; + } + drm = drm_dev_alloc(&pl111_drm_driver, dev); if (IS_ERR(drm)) return PTR_ERR(drm); diff --git a/drivers/gpu/drm/pl111/pl111_versatile.c b/drivers/gpu/drm/pl111/pl111_versatile.c index 0f228543a97c..26427b838b2c 100644 --- a/drivers/gpu/drm/pl111/pl111_versatile.c +++ b/drivers/gpu/drm/pl111/pl111_versatile.c @@ -238,6 +238,7 @@ static const struct pl111_variant_data pl110_integrator = { .name = "PL110 Integrator", .is_pl110 = true, .broken_clockdivider = true, + .broken_vblank = true, .formats = pl110_integrator_pixel_formats, .nformats = ARRAY_SIZE(pl110_integrator_pixel_formats), }; From patchwork Thu Feb 1 12:55:13 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 126533 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp1681178ljc; Thu, 1 Feb 2018 04:56:05 -0800 (PST) X-Google-Smtp-Source: AH8x224RkhN2XH29QHzczRNCwOuEb+ZDtKiSBKS7vVglUxizG986zgGSk+fIWCfMIShP/JILwJwi X-Received: by 10.98.16.79 with SMTP id y76mr36905037pfi.111.1517489765182; Thu, 01 Feb 2018 04:56:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517489765; cv=none; d=google.com; s=arc-20160816; b=Wh33ApEFrQ3dmXmknFkwJTHAMzOLkmvisduooDMTg73jOUTO+PJoLBVUaCX1tzTKCJ mPoxKAl0aWnSDSoffMDsr3+gjIftRqOrcGXrmIp/YKHv1NDrk86N2/LInrzKzxNVjL9c fOYKywg9HAaOUiMy81YJC9+CgJ1H8JWdfsKEv9cXSVeYvbGn33SnjaoX6/NcPu2ThabZ qetl/M0d3veCCr+9Zc4GQy9TqZMRc/ErxiZ4KWVA+Tnd85OQRwaeckOfNL88+yFPj0si LeIx48T9GN1Z3ciWjMvGKuyuankvbiktUIpL0zVM4gqBykQFuM+8KTLE8D5s1nlTk0md 0EoA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:references:in-reply-to:message-id:date:subject :to:from:dkim-signature:delivered-to:arc-authentication-results; bh=1uR+nBOsWAEx0wGP/Xg2IYAf548O7Ee6Lig1sU/OnDY=; b=hCoKxiKYFQVHGU9DWR2+ABZh5E2EXge3nECFAZ7VjlW4g2WzmJbZ0DnrMwPD89rpA2 hGr4YEzG5T7BkejEcqfVKLJsQApMmtdhyVoUNu/F2rdqD+zmM28q1CGPCWmR1RoYXav1 kFZErVDdgraB7dpD5z8B8ozKW/QXSKIHWos8985I5dT5IfPtdLTW6kwnIuWVv7AO3txp dUt8oRt4pHc7g25rDCXKW4BvKFG9bHrPIr/nit88KaVNyKNCvecD6gY0yp7lqtBu1ISy GWVusAYzjKH6WfhKzm1RDeG/WYIKK0PqFHmpDdXpAA+QcsqBThgEuDc2Oqej8LskPd8A zvOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ITqipfh4; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id x2si5200132pgb.36.2018.02.01.04.56.04 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Feb 2018 04:56:05 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ITqipfh4; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7BCCD6EDA8; Thu, 1 Feb 2018 12:55:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x243.google.com (mail-lf0-x243.google.com [IPv6:2a00:1450:4010:c07::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id AD8ED6EDA8 for ; Thu, 1 Feb 2018 12:55:29 +0000 (UTC) Received: by mail-lf0-x243.google.com with SMTP id q17so26036180lfa.9 for ; Thu, 01 Feb 2018 04:55:29 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=wg20Qc1+jW+E9wLoViexCx2Y+tp0PmU10GBE/Anloow=; b=ITqipfh40eMpt63aP49EWrJwZNYtlK/X3hg5QIZ7soWXaCTbVT8SyX1ZaEYw0HsRvo j9oarMm54N+roNh8fv/BpmAoEiQNQY/74C1ZEZEytigVhRChSTzmqjWWM2yGZszzFpiP M9Nu1BHu9L72XFaFg+E37eosBIjCbssbxuowA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=wg20Qc1+jW+E9wLoViexCx2Y+tp0PmU10GBE/Anloow=; b=DrK/pFuMOtCHLd40FKSQAXBwEvIwX52K99fc5iC2xQaW12Kqci4L06CtlWgwPmlppV 00zMfdaMNpT6wJRKExoVFHDndeg+LabieTVuoxr24dMPLSJEx2ZGpIfphx/iztuwaqZD yn4V3L3RTmfDSdDdEEHmhWguMRnTYEmllE4S97UkdyTer+8ozUa8Je7bTuBq/kiffphk A1fzA/yfSdLQtoaJigtq2xsZTD9KRHofj7LdmUoWX3NprukkCvGVokfeKFdWxiP2Ywlt yw5WoNPrt+q+xOakudHeI4T/uaHu01QsdzCH0tFk0FNSEL5T9xqP4O7DL7RkQEN+6Vcr H4Jg== X-Gm-Message-State: AKwxyteGH2YUHesRF3fuJQ0f4bhpFdJgsW86kKVIvZnwS1KQc9V6Uhfv NA/4GsTl+qvcWEZR5ySaBf7oZh0VwWU= X-Received: by 10.46.114.2 with SMTP id n2mr1306387ljc.99.1517489728098; Thu, 01 Feb 2018 04:55:28 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id a129sm4300792lfa.0.2018.02.01.04.55.26 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 01 Feb 2018 04:55:27 -0800 (PST) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 5/5 v2] drm/pl111: Support multiple endpoints on the CLCD Date: Thu, 1 Feb 2018 13:55:13 +0100 Message-Id: <20180201125513.5482-6-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180201125513.5482-1-linus.walleij@linaro.org> References: <20180201125513.5482-1-linus.walleij@linaro.org> X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The Versatile PL110 implementations use multiple endpoints: from the PL111 port, the lines are routed through a PLD, and from there forked so the same lines go to a VGA DAC and an external TFT panel connector. This is discrete wireing so there is no way to turn of one output, i.e. this is really two endpoints, not two ports. We model this with multiple endpoints, so we need to loop over the available endpoints, check for panel or bridge on each and accumulate the result before continuing. The code already will give the panel preference over the bridge, if present, so the output will be sent to the panel if both a panel and a bridge is present on two endpoints of the same port. If they all return -EPROBE_DEFER we return -EPROBE_DEFER as well. If just one endpoint is present on the port, the behaviour is the same as before. Signed-off-by: Linus Walleij --- drivers/gpu/drm/pl111/pl111_drv.c | 62 +++++++++++++++++++++++++++++++++++---- 1 file changed, 56 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c index e6fa897c740c..221f3af02fb4 100644 --- a/drivers/gpu/drm/pl111/pl111_drv.c +++ b/drivers/gpu/drm/pl111/pl111_drv.c @@ -58,6 +58,8 @@ #include #include #include +#include +#include #include #include @@ -84,9 +86,13 @@ static int pl111_modeset_init(struct drm_device *dev) { struct drm_mode_config *mode_config; struct pl111_drm_dev_private *priv = dev->dev_private; - struct drm_panel *panel; - struct drm_bridge *bridge; + struct device_node *np = dev->dev->of_node; + struct device_node *remote; + struct drm_panel *panel = NULL; + struct drm_bridge *bridge = NULL; + bool defer = false; int ret = 0; + int i; drm_mode_config_init(dev); mode_config = &dev->mode_config; @@ -96,10 +102,54 @@ static int pl111_modeset_init(struct drm_device *dev) mode_config->min_height = 1; mode_config->max_height = 768; - ret = drm_of_find_panel_or_bridge(dev->dev->of_node, - 0, 0, &panel, &bridge); - if (ret && ret != -ENODEV) - return ret; + i = 0; + for_each_endpoint_of_node(np, remote) { + struct drm_panel *tmp_panel; + struct drm_bridge *tmp_bridge; + + dev_dbg(dev->dev, "checking endpoint %d\n", i); + + ret = drm_of_find_panel_or_bridge(dev->dev->of_node, + 0, i, + &tmp_panel, + &tmp_bridge); + if (ret) { + if (ret == -EPROBE_DEFER) { + /* + * Something deferred, but that is often just + * another way of saying -ENODEV, but let's + * cast a vote for later deferral. + */ + defer = true; + } else if (ret != -ENODEV) { + /* Continue, maybe something else is working */ + dev_err(dev->dev, + "endpoint %d returns %d\n", i, ret); + } + } + + if (tmp_panel) { + dev_info(dev->dev, + "found panel on endpoint %d\n", i); + panel = tmp_panel; + } + if (tmp_bridge) { + dev_info(dev->dev, + "found bridge on endpoint %d\n", i); + bridge = tmp_bridge; + } + + i++; + } + + /* + * If we can't find neither panel nor bridge on any of the + * endpoints, and any of them retured -EPROBE_DEFER, then + * let's defer this driver too. + */ + if ((!panel && !bridge) && defer) + return -EPROBE_DEFER; + if (panel) { bridge = drm_panel_bridge_add(panel, DRM_MODE_CONNECTOR_Unknown);