From patchwork Tue Feb 6 09:35:36 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 126967 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2745320ljc; Tue, 6 Feb 2018 01:35:51 -0800 (PST) X-Google-Smtp-Source: AH8x224Aac5rxYg0NiLO4muIpQ6mP3iHMSDgosJgR+aAmdOUZSImSoCiF/sbz4IAVybZNRK1NKHz X-Received: by 2002:a17:902:6945:: with SMTP id k5-v6mr1804965plt.389.1517909751257; Tue, 06 Feb 2018 01:35:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517909751; cv=none; d=google.com; s=arc-20160816; b=bCnF8+O/3IXBle0AdXJ2Q6R7Ln3BcU25kW74QvigEYOTlBy7F15SU36tiqS8/gdHJ/ amc7QEX8wT6V8Aoa6+5d0mdB0UKvJDh8iFGT/Qlh71psc/Kh/yZNk7l7pc9sBm9ZtWcK eQ2aD0ZI9B1iuCBgoWHBXhH9Gkf4hUB/CuVydLseiL3Nghs413gHAaXy1dpsmAAs/nc8 VtkdgkinPBF2wJ6dPX+JVSpiKiIYA22b8ItZpeU1KN/dJxb0iTH2XyTqhljKyW9Urdha sxFwCns8/fI0F8CSNlP/1jS+Q5LS89QxmTE9taGtqKZ6QoLVYfnsG4SBpQZs/+BPw7wm L6kA== 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:message-id:date:subject:to:from:dkim-signature :delivered-to:arc-authentication-results; bh=qwG8K8IIKB+0iveIQhN0FgjRsQ9uptZfGYTq6SpUe1k=; b=c3EKc4k7UzRv1jfsm2xA4+hYRAq9zXv/s8YXSSmBJyq6xJ1jbqMXgvmV9b+sacYVCD qiqPQMzYDLaPY80sBEXRAA6OSlYRt0qfUhXeUhzr8++cg/wC0lY9iM9SH13iOqLnt2zX BGGYV/F0CJOac5/PfltTsyUpckVz2GnkXJjVGBZwluFVggA+3aPkEqRFuXwCQqRYIXkS /UyeFIqM1lQzkx/yeyV+5FpkNW87dSOgiRKmcHSeCKPTl8tVN8HaP+Ldbk2PAqI1TtQY +5KhJzvrJb8MVc6TjDGSOx+XZcpCfe46WN/6WfQGuJQY8QqV7p0x3prQkxdVVpHfURaE IOQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=aBp5MyVe; 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 w6si1008655pgo.491.2018.02.06.01.35.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2018 01:35:51 -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=aBp5MyVe; 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 E03F36E3CB; Tue, 6 Feb 2018 09:35:49 +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 8B4746E3CB for ; Tue, 6 Feb 2018 09:35:48 +0000 (UTC) Received: by mail-lf0-x243.google.com with SMTP id t139so1772430lff.0 for ; Tue, 06 Feb 2018 01:35:48 -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; bh=IXIaZrTR7NHk8YSGNdQ4KkU7PzLHgK4MJr13oHtS5PM=; b=aBp5MyVeRuLZkqgfL9ZsPgbay5QvUpdjF22rwD8Jh+A7tC4Pf8nnDKd+yK+HCeH15i FNR1xvlOcNzaXO6ePA9dJZktOiZTYpC+gG4llVPsxdPr5sMcewg3mmzD8bo4i1EqmK73 JtqQWPcHJMP11aTyLW7k1tj8MaJ/2xGR5iaLE= 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; bh=IXIaZrTR7NHk8YSGNdQ4KkU7PzLHgK4MJr13oHtS5PM=; b=rxRRj5q1kA3yC0dNzuilTeRBEnZC9p4sLNbLJWn8twkzjtpF3HbIM5UxS+9gZtV9tC xiI23/S0/uJ4Gp94yPgWMo0IcmMKts3Jc1lrdfhBorRxct978Siu71uKIH1lFp7f3n6Q wlqetQ3liPnbTPq9j47ldpKokA629cEAfmu1+nrmp9Q8I2sFY49LU4UxlcHsH/p7zGyp R+cFSi55+oUCzpqpmXPhWYU7mt7llR2eu9jmQHIrnTUQLzeFwjr10e68bzZz0WyrpcYm v+F7n0ubbuvd6YjqoRPiQIyiE4PY+qo6KWfrKaqXgGpFGS/EyZYbtEVsNYvaJmmRNZ1L htqQ== X-Gm-Message-State: APf1xPBUPuU1MzUcWhlXB0J4AfE25zH2oGmeegOdCIjg5hzfdGlzxcwE epX25KXopwIPmp/cIfyfKeHMYA== X-Received: by 10.25.67.67 with SMTP id m3mr1278887lfj.105.1517909746566; Tue, 06 Feb 2018 01:35:46 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id m129sm2253675lfg.75.2018.02.06.01.35.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2018 01:35:45 -0800 (PST) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 1/5 v3] drm/pl111: Properly detect the ARM PL110 variants Date: Tue, 6 Feb 2018 10:35:36 +0100 Message-Id: <20180206093540.8147-1-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 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. Reviewed-by: Eric Anholt Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - Drop misplaced leftover comment in the Integrator detection code. - Collect Eric's Reviewed-by. 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 | 84 +++++++++++++++++++++++++-------- 3 files changed, 78 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..ec05c7e5319b 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,24 @@ 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; + 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 Tue Feb 6 09:35:37 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 126970 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2745798ljc; Tue, 6 Feb 2018 01:36:23 -0800 (PST) X-Google-Smtp-Source: AH8x225D0Caix9BAToNRvh2R3Jo6a/DwaLIly6gxOV5+4fguft7M2Dzx9vRKa/u6yHaNdnvUN0Hz X-Received: by 2002:a17:902:968b:: with SMTP id n11-v6mr1836748plp.168.1517909783614; Tue, 06 Feb 2018 01:36:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517909783; cv=none; d=google.com; s=arc-20160816; b=bVC3fUn5hJ/VoEWxtbqdr4KBa6dnzMyWu2Fk1AFkvK71qFx1UwG5rOViSKC7/IjR0v d9FaZgI6JWp437iWUjzUN0S5IeDCjo2jz95GkqSBjbNbYdctHRX1UNvKL5qHnyVdmL25 6FZqQaodKgm6ETaqq13BEWZoMBoTi17v68q+lFa1mxiiiazvELSWI6DV8A9JqkUy6fNG xWNPLH1CGifMyO9sxVEBE3eksMW9/qDaYz8TvmPs1iNmjAMXjxhg2wM31T6Crq9RX7/X EjhSMd9Q5dZeln3u8jdlRyTpuFH9j9mnNxkeuonf8qGURcOJw1pZb+QtQcs7vf2zLIDY HDhg== 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=8+hXWjzw1Y0xvgJ/6zSOPQ3VYWbSnvCjtJhyjzIj+Zo=; b=WveUOEZpMLZ5P6Ild3wJEmqSd7s0uGZp/8c/VOr1jMUdvVQEgAuABFcU4rmiP4jUcq 62/K53KE+JN/Qm8weS9qVa7082+9sdibv6i2QQFATNWtJ3tpL2My0aMs3QRzDL4FoerN S/+gX8pNh/Un3nEUp1aiGEr9b4qsLG+JbELOi2BeJUzkKIyfGY1KnsvTZt3B3KdFj2Pb ceYWHK77Qu3SBua9wCWw5Mecr3mnbSjFfQYbKTLZXPGeCz+SE0qB09BMdgyEUVYAcodb Y8cjBUp6mvOZW8Qlu3y15hzRUC7fqMQdBgmYupoJIgwl8KGMh6YbCPQDSZp/i6Rjb10j gpFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=QFjzV/4M; 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 c24-v6si6044163plo.608.2018.02.06.01.36.23 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2018 01:36:23 -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=QFjzV/4M; 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 1B86E6E3CC; Tue, 6 Feb 2018 09:35:52 +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 83DAB6E3CC for ; Tue, 6 Feb 2018 09:35:50 +0000 (UTC) Received: by mail-lf0-x243.google.com with SMTP id v188so1732644lfa.11 for ; Tue, 06 Feb 2018 01:35:50 -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=EqwBE8CLCCA2Ayav7WE9l0FTEdiEt2ZX9LyCHlUq6WI=; b=QFjzV/4M0lv+HsZMiXQTxXx2ZYn+ADK7ymjaRz3bE8kJY+bGvnZhO0XivjCKfKIjgq StbxsZfPJ/QPdothiXkif7ZXU33Yl0gcegrhKklTIBRg2LikdAoSI4Svzsinzefbj1k+ OElKUy+DynR1mB58mMvla7J7QBFsx6AXxdHs4= 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=EqwBE8CLCCA2Ayav7WE9l0FTEdiEt2ZX9LyCHlUq6WI=; b=MZVOr/3gIPV7bLzbloK3T9NrUWm91nMjdpSfmldhqDCzkZn6By9kPhG4dYrGSvc5LN dl+juY2QX6bZVu8lBgoO590ijL1JwwgaLW34t4oogOV1mVERdSKwVda7qUqT4xiQNQ6S 2IIC2aWCYyVSnTtG1T4aJ5HlI7XzrId0B2Va3EFNgtF5OuJDU3tj5WDOfciEFIRD3y/M Od52kC5/gLLy1w9nDYuhwBenU3ED7LmtFjq8PZvFF8KnZrmXevzxOdAMRKmmGoxaby/I zmb3PhaO+ayspGifyj9osCDK2M2l+KqN0lFmDS85c8JCTiHKUuM3+33QNt0y/ftuJJo0 EqAg== X-Gm-Message-State: APf1xPBOF/wB1CIwBcSC/Hkq2RxxPG4K82rah/t5WyCBFegLRccQz0sa wPDPLUKdQvb9i2FhyFie8pjJxg== X-Received: by 10.25.121.21 with SMTP id u21mr1200102lfc.79.1517909749001; Tue, 06 Feb 2018 01:35:49 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id m129sm2253675lfg.75.2018.02.06.01.35.47 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2018 01:35:48 -0800 (PST) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 2/5 v3] drm/pl111: Handle the Versatile RGB/BGR565 mode Date: Tue, 6 Feb 2018 10:35:37 +0100 Message-Id: <20180206093540.8147-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180206093540.8147-1-linus.walleij@linaro.org> References: <20180206093540.8147-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. Reviewed-by: Eric Anholt Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - Collect Eric's Review tag. 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 Tue Feb 6 09:35:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 126971 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2745824ljc; Tue, 6 Feb 2018 01:36:26 -0800 (PST) X-Google-Smtp-Source: AH8x225syWkbFSfSlLGwWtZ64TZ0HpkBlYLlz15nmaISTTphf3qpKza/56Qwznc20nMJRfJL+/Ek X-Received: by 2002:a17:902:d905:: with SMTP id c5-v6mr1760214plz.225.1517909785981; Tue, 06 Feb 2018 01:36:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517909785; cv=none; d=google.com; s=arc-20160816; b=A2HDTFk23gMXB9fZL0EH2vUR0fdUvVB1qpqWZ5AcmRYQmL50UBziIoyWfMUX6u+m8k n/gxPX/1qGY4i8SR5zJ41Q2uIn9mZdSRg07JW/J3jtMzljKryDdk/J7noqcbqgtYCbtS jw0sSIDHv2S4EvAGAWN9bWO7FsiQ+gRU2LnlKy3IRLkRsexoNE+aLkbpI389X42AZJWi ko4178elT1wKefn+l2gSJeBfrEqxVZvIM1g5D2MafBA9KWHEQnorHz4+O969S5IBhPaS v80mnFh7Jc+5y0RAjuc+cUg6f0xtl56T4c5BYgMM93FYnMdKogxeCbfFYjtOOrJN4DG2 WKBw== 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=ALsQqHWx2DUHq+mqXYQL7IOcZZREAAgrbb+CeVCgp7c=; b=ri90sO0DMHHvPD+Twujb04NGeVZjgpAqOXLMFsFA0Kf/qphnHexk1Hi7jlO2AgRLvg 3I7VwFrMDPpi+kLiruQnnM2CZiU6yYd2g220HvgjCxzXunhJVA5ooFtP9Wm53/uYgq8U nv+tb2gfpVAfKuy48v0Czyi9kSAllqrg+bbUWeGMVUMq+seCpbJcD/AlR7NkvFqmAg3/ qSct0G3WF88mkX+XNx7hUlF0hsn/CwXYMnuaDCm3/N1yWzkXDhTRbZGAAS3BZSO1fzRf +R0mWuGoxzxol9O3yZoGSlhtc+H21ehwdXl88yiHEIMH160+fxxRKMGKOacDAAc+xEvv b+sQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=aggrhEaB; 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 o4-v6si2284038plk.582.2018.02.06.01.36.25 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2018 01:36: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=aggrhEaB; 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 6F8286E3D1; Tue, 6 Feb 2018 09:35:54 +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 AE7766E3CF for ; Tue, 6 Feb 2018 09:35:52 +0000 (UTC) Received: by mail-lf0-x244.google.com with SMTP id f136so1743727lff.8 for ; Tue, 06 Feb 2018 01:35:52 -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=7myVeNaubicFvVaANhnaVp2sPrpGuGLpcgezpNQhWBM=; b=aggrhEaBbxjgYS5wIFY3LvWJm4TXHnq/wf0+pYAzpsv6JmgeP/Tqk3D1laGqUbHzRp c+sB0/Va7Nv+5bkRf8JiiTX40M8jhlGJmqMxS9qmGhGKBXurN/7wHvrLR5xAwykeRlYp Z6A4GdFMYCJvwxFQMAITQD/tYnCTSwJUu6GE4= 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=7myVeNaubicFvVaANhnaVp2sPrpGuGLpcgezpNQhWBM=; b=lc7fi1vNZSy1pFJ95wn725GBbA/IRJ+hikZZ3ruvuLZ+JzQXcJFJO6fTPVeBSYqHaM saftyZPzDP8MW2pszEV9GXbj0e6V0TgzwjtE7LqEowSi8B2mDrdocwvk/MZwqzcOCXYm igY/R5Ur6d4Lp2K5aAPzLNDIKgn7sqVJb5KT0I6d7Ln+YD9r+L96z/LuzYLaAZJql9NI 8nHqWYHYJ/rwvC/EcvHM6m1y23+0pwsBpyczOK8eraZQ0nlvrnCy5fxTI6lw8LbFt+5V CdRed3MwAm7fq+ASuNK19FbSoxU0WBGVbl4Gu6OelaOxb3C1GFMheXpXjgNXxTII7lEo +H+Q== X-Gm-Message-State: APf1xPDIMVYO7KtrbLmSoe/3C1aE/3lABOWdGTTXZtXRL+49mnHLFKTq GzbQlPIRg3d7e0j+Zdzkt64dYrNxqv0= X-Received: by 10.25.81.13 with SMTP id f13mr1270547lfb.50.1517909750926; Tue, 06 Feb 2018 01:35:50 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id m129sm2253675lfg.75.2018.02.06.01.35.49 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2018 01:35:50 -0800 (PST) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 3/5 v3] drm/pl111: Support variants with broken clock divider Date: Tue, 6 Feb 2018 10:35:38 +0100 Message-Id: <20180206093540.8147-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180206093540.8147-1-linus.walleij@linaro.org> References: <20180206093540.8147-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. Reviewed-by: Eric Anholt Signed-off-by: Linus Walleij --- ChangeLog ->v3: - Collect Eric's Review tag. --- 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 ec05c7e5319b..93cf2d82074b 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 Tue Feb 6 09:35:39 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 126968 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2745379ljc; Tue, 6 Feb 2018 01:35:57 -0800 (PST) X-Google-Smtp-Source: AH8x22465GOBz33U07OgAV8X4Ko7JvL77yPqolHEISS7lhUaW1x1seibUeYdm53RAaYJ1VfxIEF9 X-Received: by 2002:a17:902:8a8a:: with SMTP id p10-v6mr1747096plo.261.1517909757783; Tue, 06 Feb 2018 01:35:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517909757; cv=none; d=google.com; s=arc-20160816; b=nLPfyRDplgKROcSSq9VLeAXmAyphMwhfDwVgOGZtVXZrdWVYKgopGzb/QEE2fQjfxz IDpqh8ha1IlzB0UwLjoR+bMs+jABNMGmTPbyUP0+kVirhS8LVJP9KmDUyTHuzaZYko5C bSp8UYYDHUEqpw0oAD6vmTmWebsnsnny5kg8IranaFa11tg3Z+nSGAMk/mn103i7csOH VWLeEz+yjAjWFslwAODfr9kijva4ygt4NGH1y2eomfsyjYd4rIYE8k/w+TGuiUKRYKc3 K/aHi3R7QC1oG+4R/MN+X5eCMtm/KE5z8IPYZ49+dGdRxnde/t3MOR/f95C4p/QQfJ5R blXw== 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=Otl3rFRFWv8D6Bw7S1BoKDHp41+W49G/7m8pLv0QXgc=; b=09weto52MLgY+y0dEy6VzUOIpHEs6Fi3d/ocDuoSYFg7dNRTEo4TBZYP7vRRnbtD/a ECl7SFY5Vy7yBTOC7L2ddioVg6FUZXlxPb49sfAyyUIgW8czKIksGGxt6Lb1lWUQqxdz ETAdCGny26SohHQur/HCEuV9DPDlazXuAjdXgJyHmewlovQLZ1yLR5i9jl/1ewombinG mplBic/eP8sJ5IgRHNQis3G3E/rhtlo0MPmOY5nR8+hEmBl+Ca5PLHIPWTHIO/6Hmoh3 IwaFSBbo+oUX0dNCl11nyxeyF3HYRej6a/+HjALzGHsGZaH7nKa7tjjU+uqHVhu5+hc3 5ABQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=SRh4rubd; 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 s69si780085pgc.378.2018.02.06.01.35.57 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2018 01:35:57 -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=SRh4rubd; 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 3D70D6E3D4; Tue, 6 Feb 2018 09:35:55 +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 531836E3D0 for ; Tue, 6 Feb 2018 09:35:54 +0000 (UTC) Received: by mail-lf0-x243.google.com with SMTP id x196so1730635lfd.12 for ; Tue, 06 Feb 2018 01:35:54 -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=gZ7UeLosqBcnhaH/nfwJNsAIx/MJqeHNqSNB85BvedQ=; b=SRh4rubd40NxoKP/KHBWgWyXFZYoak2et0mXA8imjYKHYKxlG5Wv3vC26MfYn3ocp+ NqnhYmz555mHVdgsPoskjiUuXA29mc2IkRyjCvBxCqTk6uLy4nkmqDLe9s668g2W5sa+ fP/teUsd24AOZ2TtAt7BM/N3XSunHmajqPXro= 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=gZ7UeLosqBcnhaH/nfwJNsAIx/MJqeHNqSNB85BvedQ=; b=PvPiRG5CNJbmrHm/E0H2O9LGPBDcRJ/4ufz3AT1+06UNgLiUsuwTVJ27hjduJMkSIx AOjuXaF4knro2Z/K/etOsWaU/6Hw/hNyuoWtj0tTT/TnIQUIU1VTnM+uMrzdlJ0dlOjp SEBv7HvBklENrrngwJJXowP2jMQmDdlFBTxBmosSEXlZx11h65JcYXoyIkizFAi2ytLJ ybwUQr9vV67HmieGgQNW0HQzjz/Vb3tbZBvUqxI7imkR52wYAynMcxRsfBKainmjZh/9 TXFGat0c2UKMIg3sj8TPvXs0v04WyNnPYdPtKEeo1gISbUBZ+Oy0G6PT0Tg+zr+OAciK HEVQ== X-Gm-Message-State: APf1xPCbqPZvL4mPsK2JIgReTC4iaHnA/5XcZVNrSnuyvJeApbmTGZq+ a0rFdJF7Jt8jhqFYLwZFaocLxQ== X-Received: by 10.25.235.86 with SMTP id j83mr1313387lfh.20.1517909752736; Tue, 06 Feb 2018 01:35:52 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id m129sm2253675lfg.75.2018.02.06.01.35.51 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2018 01:35:52 -0800 (PST) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 4/5 v3] drm/pl111: Support variants with broken VBLANK Date: Tue, 6 Feb 2018 10:35:39 +0100 Message-Id: <20180206093540.8147-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180206093540.8147-1-linus.walleij@linaro.org> References: <20180206093540.8147-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. Reviewed-by: Eric Anholt Signed-off-by: Linus Walleij --- ChangeLog ->v3: - Collect Eric's review tag. --- 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 93cf2d82074b..11024ad64181 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 Tue Feb 6 09:35:40 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 126969 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp2745442ljc; Tue, 6 Feb 2018 01:36:02 -0800 (PST) X-Google-Smtp-Source: AH8x226Zetxcr+WmEkejN4H+AISzGXetj+BCPJ/3MxNmQm0NHFKkvcOD+vCpn+QPE3x+bbL663pF X-Received: by 2002:a17:902:7441:: with SMTP id e1-v6mr1836436plt.204.1517909762372; Tue, 06 Feb 2018 01:36:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517909762; cv=none; d=google.com; s=arc-20160816; b=xsCrLaIaAw6LnIvhBuO1v6xzDG1N60fq2GqXIIAhDnOrwZxuxDTk+Wa7e8RNGaCf7y vqsjB8UyDyOF79wp9e4s7H2P6+9juyaQHbljLwI8qZmw9sGX8t0+GarCBJUQFm9sWh7U pm3enXWwPqRy5ySejBzg3eMvmMMWkRIT3CRSH6GYwVQO4H3kS3bAU7Rs09XxKSIpYJnh qUqBPtEGKwW24JDuPUUIWdBYFtJ7Nr0RB8MjGr5rvtlHI7nnq2edEZCpcShskjcvp7Jw cWmo7FNjHbi7BDTJ63nmOPoj/HIgSBq6Z4bYXcHc4T35m2xgoVn1KCCV6bKX+cuQk/lR cpQg== 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=KQwHpbJGbJwqieLXriljZul1IAvjrvxCVb/DZsl3Eng=; b=FeU7X20ZKc037eTiYFeBnYu2tjxoEvAz3n8HZ+bmLi6um3rHWFhq/nmVfaxr2EFT2V eM/PTcSvGVUrc1y3m789eSEl5gWlEIguDss0zeTP4FPYwE7OFcs76HPuQAYUKMY08wXz JN0j+kjj2KGjuHHhcOm2oIBO/+yJp5nvjfZ+is55RRQhW5uNjotTSBWG7Bb+gbXTykL4 KHUE4lx2mRjMfB+teuisNCiI0psWn/M4+OZTzmj3DuhHGubaMgbtmi/RUDuxa/LQr6Sf jjMmTgdy0X1KKx+DRmKRKR130RPhvqGT4mm7/ytu4vnwa9HwBN4qSwWkEhUeDbo7iGu/ xAwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=jy05onFO; 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 y11si1065815pgv.625.2018.02.06.01.36.02 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2018 01:36:02 -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=jy05onFO; 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 67A016E3D7; Tue, 6 Feb 2018 09:35:57 +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 61CDD6E3D7 for ; Tue, 6 Feb 2018 09:35:56 +0000 (UTC) Received: by mail-lf0-x242.google.com with SMTP id v188so1733019lfa.11 for ; Tue, 06 Feb 2018 01:35:56 -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=G78Hhtf6Ya/TZC/+9D5XKSJ8jxZ2NyRWibBWPLE3bMQ=; b=jy05onFOpfseKgAi4J7vBhP0AKLYgDvnqeSzmy1OJH00cOs2M9mvCP+ngs5JH8IVlZ eTYZjOjkxC0gCxLQs4GCJBQ6fj5D7e2rbG21pS87r7hprhlL3uUyUO2lCNzpJY70p+UL 7oQiu5DKWFNEEtfXwYLOYKhtc0CXLHVOZwwOM= 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=G78Hhtf6Ya/TZC/+9D5XKSJ8jxZ2NyRWibBWPLE3bMQ=; b=PlkS06zLLyfM12yBUz0f3NwfSycmmquwQuz1WkAaxcud2pr3MC4j6M3adwrpplu5RP wcZPgiYilXSwI+gbL8RSi6UI1DxcVcaRvei8sAcoiYU7fwX82sGupp8Wi/eA5TmaVxQZ 6vU0+ZKhE7iF/CuhYPK/ME4GkabuiVaE0dbpdll2ZXbrLEg7qiWNKaVlzAeWylktTZhp Wp1lwrZqr+AnqBvx1fHO+8+ysbf1RtmmbUsKamLIFhEvcB6qhLuyaUUhIPHkr4Bt3o8S YZYRqz8xlq/sQE7J6dfleeiQf5sEfvOF7X84LQ8qZPfCC4tv8tQsGlZIBHL4UIFjIy0s yHAw== X-Gm-Message-State: APf1xPDakjhCen/aG+sI2UlUXkJc9ew+vLott+KPqjORMsHLvkdi+1PZ Ha9XPW+JZbVuqHM8jLUFe3qbFw== X-Received: by 10.46.17.91 with SMTP id f88mr1195674lje.54.1517909754602; Tue, 06 Feb 2018 01:35:54 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id m129sm2253675lfg.75.2018.02.06.01.35.53 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 06 Feb 2018 01:35:53 -0800 (PST) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 5/5 v3] drm/pl111: Support multiple endpoints on the CLCD Date: Tue, 6 Feb 2018 10:35:40 +0100 Message-Id: <20180206093540.8147-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180206093540.8147-1-linus.walleij@linaro.org> References: <20180206093540.8147-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. Reviewed-by: Eric Anholt Signed-off-by: Linus Walleij --- ChangeLog v2->v3: - Collect Eric's Review tag. --- 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);