From patchwork Fri Jan 26 13:20:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 125965 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp330672ljd; Fri, 26 Jan 2018 05:20:45 -0800 (PST) X-Google-Smtp-Source: AH8x227+Bw6+XOS7Q9ek38Jj2OVL72IS0JYNqveTxY/UU9IDx2vZrJlej1YVcXpmlQrQW+2pMRgL X-Received: by 10.98.228.5 with SMTP id r5mr19643604pfh.193.1516972845063; Fri, 26 Jan 2018 05:20:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516972845; cv=none; d=google.com; s=arc-20160816; b=F2hw8tftc8w14jpwpHUv/Mvosrq6iEDwvE9CWB5WSgE9zon6Z3cNPg/0hIfU40y8Vl 8Jc6HVWAwK3pEa2cyO0e7VWIgVIYtQqwDMN/fsWZ4rG4zpH/YXapa46N9r9xbBZBXFb/ BKxNASipEwUwAHCYjo9Ig/3s5UlJMea1MpCBckAIBgpnADUz5qD7OeACCfX8AJsK07Q/ CIm+Ezdb2SIqUx4ez/6mpt9kxbeA8ETIO5K+i6wU1T8GTqAFAL37W9mRa6ouNMquUgov pfX7ImOSwWAEOzsbFUFZ1ZkmejwH41fDjxAjCM77p3JlJUu4oKsVZKmuu7l2FkQPfT+P prMw== 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=iV7KXGgm9X//dapNRlbBvik8oc9J5funDeVgnQwOJR8=; b=rf4rQ9crdKSp+J7fttypEb9CFiwSxtdB/fGFP4HAu5fH+6xT2gl0W1YAJFv20VG1J+ GXxvWDcr6Fw2J5KjXtQQ1xKPS+edgd83/HIH9GeqtnDzx8fvE3GjXFzx/VFpiJ0M+tBu yliuOaR8Eup8SbFKXXDK2TTGhNYs+hBay7fmXHIkNRX6h09z6ZY4kpkbX/aclTH4GZez /kGwFbLf64on4p5ANY0mLtgaYKff+MiRRTSkI8yuL7DFXUNVWb8mMyG8EYqKjASo2Drf 8lhRvvJiZoG3HozjVHfR4/sARH073l/rm19hv7KosuN+Wt6n4rpfcb1j1vlXfeM6Uonh qXRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Z/C0NrR9; 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 y20si6452351pfj.54.2018.01.26.05.20.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Jan 2018 05:20:45 -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=Z/C0NrR9; 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 BEF906E176; Fri, 26 Jan 2018 13:20:43 +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 5E4DF6E176 for ; Fri, 26 Jan 2018 13:20:42 +0000 (UTC) Received: by mail-lf0-x242.google.com with SMTP id o89so644574lfg.10 for ; Fri, 26 Jan 2018 05:20:42 -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=Q47rlS+oWZ01AoXsipqIQT5sxkBpdi+W9BbMoCFdoDk=; b=Z/C0NrR9gb+XrYpC9wf5ey4id9YfuavfIBej0+eJKtFqoTZ1xGx5ZzkSvc2Y7oVHqB 2G5IRKECoOTViGtCCe2sAhzkj1Yg62Xz88f2A3MEiFnPWQM7h34hykINObuCIBbkFPmh +9MCQlPptGpPmPM55Ohqjaqt27XO2F2JMFBLg= 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=Q47rlS+oWZ01AoXsipqIQT5sxkBpdi+W9BbMoCFdoDk=; b=DOYJLN32+xeyQgKCbqptWwLX+doDzNCm9yvvLLAR1lxpsrtcoGiHGxkd5Qu7YQhmN3 Z1LshbIxMzjhRuBfHhF4uZFV2ftr9n/RmkShmlOgys8Fmv4TVQV5Hg4ztqtPTu8WzUSy 8Rwg6eTMBYWFwb/qydMUGcubeWGOv8IpM0J0LfPchqoqIGQNvnrwPFUmjeWKj7l8hfNm IWxdTgKXpvD4ihsJ8XqLzvBYIQ7tb6oBxxFWyWm1E4blBFQBimJ59S/6qKEtFFfvtck3 86xtcuKEpbsiO8ZNw90gxDYXZQpjnXzQT8rMET6KeoLQ28ZbffJ/uQxYUhC00UjmbW6k cotw== X-Gm-Message-State: AKwxytei6S+25YY3GcAFHnhU8DIpfRRywtGVbRgBLZviZB2FauTtKpUT Pf2v4n57b2zGFdumGXcpA5i13Q== X-Received: by 10.46.4.15 with SMTP id 15mr8254537lje.64.1516972840488; Fri, 26 Jan 2018 05:20:40 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id h15sm937704ljh.77.2018.01.26.05.20.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Jan 2018 05:20:39 -0800 (PST) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 1/4] drm/pl111: Error handling for CMA framebuffer Date: Fri, 26 Jan 2018 14:20:30 +0100 Message-Id: <20180126132033.19744-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" When attaching the CMA framebuffer we need to check for returned error pointers. Signed-off-by: Linus Walleij --- drivers/gpu/drm/pl111/pl111_drv.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c index 101a9c7db6ff..31a0c4268cc6 100644 --- a/drivers/gpu/drm/pl111/pl111_drv.c +++ b/drivers/gpu/drm/pl111/pl111_drv.c @@ -141,6 +141,11 @@ static int pl111_modeset_init(struct drm_device *dev) priv->fbdev = drm_fbdev_cma_init(dev, 32, dev->mode_config.num_connector); + if (IS_ERR(priv->fbdev)) { + dev_err(dev->dev, "Failed to initialize CMA framebuffer\n"); + ret = PTR_ERR(priv->fbdev); + goto out_bridge; + } drm_kms_helper_poll_init(dev); From patchwork Fri Jan 26 13:20:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 125967 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp331016ljd; Fri, 26 Jan 2018 05:21:18 -0800 (PST) X-Google-Smtp-Source: AH8x227lCbUyVIJ0iPXF1AURLppKTfGJ8paQwVkZCjKSeyk5+VmcvNmZhWMUZsttMmElaaCqk/HY X-Received: by 10.99.96.138 with SMTP id u132mr15522460pgb.436.1516972878468; Fri, 26 Jan 2018 05:21:18 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516972878; cv=none; d=google.com; s=arc-20160816; b=TlBMxJNFUKiE1VD3tfSTi2MGuZRxQu6rOBh6/jbDyMoRz4AsEmJX6YUBe0ekfJX89Z 4a9LQftFC6R89ANv8CIOBa7nsuT3Obb3DZ0FTGSxisILgBusEvFIcwg2L84Y5lomOlpE JjQOFh42rykoSxrKE30IrR4elk8qLT4Tosfj+nWe3FcTLcw5CC50PlyHAFzMTA81FnJu E7mHkhpFGAgS2ipm7NVVBS1shOrZOqyzx9f/0d8lOwPwo0+jPJ+3hZ1ddee0yL2DI9sZ M7IJPAfRS1vHhxFvmdPoc+4qLwgtI/Hao6paZQHSabxLg6RPIJJ9u7oWD1Iwme5+RTp4 noqQ== 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=n45D7X482myISsXhmCBX3EQhvOtglm3e+rvXhh5ojDA=; b=enCKlp4Os6XXX8SgWgvq/EMSCvP0dN7n3t6uu2UGSNctHWSNxy2DwEDS4FVm42A3iZ A+FEg3w/RJ7h5hKeaJUiVy5Ee97c+A/yZDivt38RQG/rWx40lvS45+u1a1EndUBYaN9V dzQYBvI5O++df7BTaC7vEc+Vew5ccrgASQKka0FT0gCHuHKIMnRXRIS58Y8v8lxhO2mT UoIv6LAm3gS4aiLio6C9mIzeqApNZbt5wo/ADLtFzexFtaj8r4DGkX5p+18Q/ED0gNcp kX205a1yfz/kzinlLB1AyPhF36M2A+cvdo9EYNDni9MI9yJLlnDnn+WR1vKapsMxmwr0 f/1w== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=ebkfux1y; 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 u79si6362149pfi.315.2018.01.26.05.21.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Jan 2018 05:21:18 -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=ebkfux1y; 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 5945E6E21E; Fri, 26 Jan 2018 13:20:47 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4FF916E21E for ; Fri, 26 Jan 2018 13:20:45 +0000 (UTC) Received: by mail-lf0-x241.google.com with SMTP id g72so661619lfg.5 for ; Fri, 26 Jan 2018 05:20:45 -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=EfSz4luTjCOQDNKOj6VqYnMgJjJlCqqsN/yHDgcNKzg=; b=ebkfux1yx95ht6rJ9OUvcDNCS3lC/kFblpjN4XERRkWtYdMJuHm4W4ZK7b5eUNkOmX 5i3W6tir0UB3381QmJTnhbrC5yti7mAEOT0CmSws3hodyhah9lvVzgY03W20SGGO3IVU O8X/FR5JnsNpdFAVuOQ92ispTt0KvwGwm5LTA= 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=EfSz4luTjCOQDNKOj6VqYnMgJjJlCqqsN/yHDgcNKzg=; b=OGk/hb1WWd/5235C4vwHXOftAw4V/lRWCY5Dbg8OqyIGMuIk1UOOOUAjiKYdM/2eew HUg2mXiF3uuapHtS8LATsPM767jT2Enxbc/h/D2ih/X+7rgJrZarqFz9qP9t4DZux4J8 cWl2xRWZVOSbV01mIX0UgoD4N6sF0rjagOB1uQ4+kP9TZD0dGlAc+JIi9rvslZ4KCWI1 VIkXbpCYEZdvhUcQxCmQK+NBA9wgjV1XGD9WcGi8thgQ99I3bQ8RZQdtWXray1a7x9jt GboeBprhC7sHkh9mc1zpX5hLKyGCQTJzCGP27hdlhqzXD7B6f8Nnp7mzEes6k4FnGAEe 5dIw== X-Gm-Message-State: AKwxyteXuRJ8QhMBl3yBzf4f13Ifgo8jefySSMXvBIyS0tdw/BUdyxVB EKg/xlJ7HqSQx+eUCV6eEodxJg== X-Received: by 10.25.148.75 with SMTP id w72mr5618927lfd.54.1516972843597; Fri, 26 Jan 2018 05:20:43 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id h15sm937704ljh.77.2018.01.26.05.20.42 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Jan 2018 05:20:43 -0800 (PST) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 2/4] drm/pl111: Properly detect the PL110+ variant Date: Fri, 26 Jan 2018 14:20:31 +0100 Message-Id: <20180126132033.19744-2-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180126132033.19744-1-linus.walleij@linaro.org> References: <20180126132033.19744-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 "PL110+" version that is somewhere inbetween PL110 and PL111. This is used on the ARM Versatile AB and Versatile PB. Signed-off-by: Linus Walleij Reviewed-by: Eric Anholt --- drivers/gpu/drm/pl111/pl111_drm.h | 2 + drivers/gpu/drm/pl111/pl111_drv.c | 106 +++++++++++++++++++++----------------- 2 files changed, 60 insertions(+), 48 deletions(-) diff --git a/drivers/gpu/drm/pl111/pl111_drm.h b/drivers/gpu/drm/pl111/pl111_drm.h index 440f53ebee8c..9cc0d424ff16 100644 --- a/drivers/gpu/drm/pl111/pl111_drm.h +++ b/drivers/gpu/drm/pl111/pl111_drm.h @@ -36,12 +36,14 @@ struct drm_minor; * struct pl111_variant_data - encodes IP differences * @name: the name of this variant * @is_pl110: this is the early PL110 variant + * @is_pl110_plus: this is the Versatile Pl110+ variant * @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 is_pl110_plus; 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..8da75089dc59 100644 --- a/drivers/gpu/drm/pl111/pl111_drv.c +++ b/drivers/gpu/drm/pl111/pl111_drv.c @@ -200,12 +200,67 @@ static struct drm_driver pl111_drm_driver = { #endif }; +/* + * This variant exist in early versions like the ARM Integrator + * and this version lacks the 565 and 444 pixel formats. + */ +static const u32 pl110_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, +}; + +static const struct pl111_variant_data pl110_variant = { + .name = "PL110", + .is_pl110 = true, + .formats = pl110_pixel_formats, + .nformats = ARRAY_SIZE(pl110_pixel_formats), +}; + +/* This is the in-between PL110+ variant found in the ARM Versatile */ +static const struct pl111_variant_data pl110_plus_variant = { + .name = "PL110+", + .is_pl110 = true, + .is_pl110_plus = true, + .formats = pl110_pixel_formats, + .nformats = ARRAY_SIZE(pl110_pixel_formats), +}; + +/* RealView, Versatile Express etc use this modern variant */ +static const u32 pl111_pixel_formats[] = { + DRM_FORMAT_ABGR8888, + DRM_FORMAT_XBGR8888, + DRM_FORMAT_ARGB8888, + DRM_FORMAT_XRGB8888, + DRM_FORMAT_BGR565, + DRM_FORMAT_RGB565, + DRM_FORMAT_ABGR1555, + DRM_FORMAT_XBGR1555, + DRM_FORMAT_ARGB1555, + DRM_FORMAT_XRGB1555, + DRM_FORMAT_ABGR4444, + DRM_FORMAT_XBGR4444, + DRM_FORMAT_ARGB4444, + DRM_FORMAT_XRGB4444, +}; + +static const struct pl111_variant_data pl111_variant = { + .name = "PL111", + .formats = pl111_pixel_formats, + .nformats = ARRAY_SIZE(pl111_pixel_formats), +}; + static int pl111_amba_probe(struct amba_device *amba_dev, const struct amba_id *id) { 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; @@ -219,7 +274,6 @@ static int pl111_amba_probe(struct amba_device *amba_dev, amba_set_drvdata(amba_dev, drm); priv->drm = drm; drm->dev_private = priv; - priv->variant = variant; /* * The PL110 and PL111 variants have two registers @@ -236,6 +290,7 @@ static int pl111_amba_probe(struct amba_device *amba_dev, */ if (of_machine_is_compatible("arm,versatile-ab") || of_machine_is_compatible("arm,versatile-pb")) { + variant = &pl110_plus_variant; priv->ienb = CLCD_PL111_IENB; priv->ctrl = CLCD_PL111_CNTL; } else { @@ -246,6 +301,7 @@ static int pl111_amba_probe(struct amba_device *amba_dev, priv->ienb = CLCD_PL111_IENB; priv->ctrl = CLCD_PL111_CNTL; } + priv->variant = variant; priv->regs = devm_ioremap_resource(dev, &amba_dev->res); if (IS_ERR(priv->regs)) { @@ -298,52 +354,6 @@ static int pl111_amba_remove(struct amba_device *amba_dev) return 0; } -/* - * This variant exist in early versions like the ARM Integrator - * and this version lacks the 565 and 444 pixel formats. - */ -static const u32 pl110_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, -}; - -static const struct pl111_variant_data pl110_variant = { - .name = "PL110", - .is_pl110 = true, - .formats = pl110_pixel_formats, - .nformats = ARRAY_SIZE(pl110_pixel_formats), -}; - -/* RealView, Versatile Express etc use this modern variant */ -static const u32 pl111_pixel_formats[] = { - DRM_FORMAT_ABGR8888, - DRM_FORMAT_XBGR8888, - DRM_FORMAT_ARGB8888, - DRM_FORMAT_XRGB8888, - DRM_FORMAT_BGR565, - DRM_FORMAT_RGB565, - DRM_FORMAT_ABGR1555, - DRM_FORMAT_XBGR1555, - DRM_FORMAT_ARGB1555, - DRM_FORMAT_XRGB1555, - DRM_FORMAT_ABGR4444, - DRM_FORMAT_XBGR4444, - DRM_FORMAT_ARGB4444, - DRM_FORMAT_XRGB4444, -}; - -static const struct pl111_variant_data pl111_variant = { - .name = "PL111", - .formats = pl111_pixel_formats, - .nformats = ARRAY_SIZE(pl111_pixel_formats), -}; - static const struct amba_id pl111_id_table[] = { { .id = 0x00041110, From patchwork Fri Jan 26 13:20:32 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 125966 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp330735ljd; Fri, 26 Jan 2018 05:20:51 -0800 (PST) X-Google-Smtp-Source: AH8x227gaQEaqg2oYbBDI86nLTFWFiUcRNhNpDEaQfewThqMMpBnUfkaUJIhrtZKyCDMQbcIfGCP X-Received: by 2002:a17:902:a503:: with SMTP id s3-v6mr14736461plq.161.1516972851240; Fri, 26 Jan 2018 05:20:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516972851; cv=none; d=google.com; s=arc-20160816; b=Vy2ldk440A1zsFDFHVqH6/RHqRQkiY4m2rOQql/o3QmkjeizVUY7jmabp9RTiQHPcG Da5wzRQ3as82vNnhqci1Ng5VA7brg1wakSVvO1lDhODBHZutb26m1C5xjGunDxgfRwui 0eymfKH1nx69Gq8Z3pGP8ydnU2TckVuVx6gQyPydQTLOUtoS5LCOfIgsgurek20D0kRz LIeldTRHddUPUMR/WK9iD6RuWepWZF31fjjhetNtWzC5jxkH6Gg7Fqm9PAfa85CSNJD4 hADLmbkjplILvbKpq/GI1Z8HR2f+9OgI1zQqH9B8vKT4AsDkkq+ilUk+GSzSJgDEs5dy BohA== 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=f0XJC4QpZCg9Ifu9/pQyCvon8xagLdmcIFH5x2K7i4s=; b=NAFwiOQlsENIsGFR/KGSBVwXKgz1n6CdNYRZJjm/EQYgIW5lxGq/0C4nN/COtOuJo0 fR1KkYOiJE8pEnRifd5jJCp+/ypV3n/Y1EzU9cj985QGpHS0TODzP2n91HFyzh2/F2w1 RBEJYbrklxomMtw2pavT6n8NizGdYo473q1DmWJqk8/6ccWPbWaJc7rSW0Kv1ymo+ieh H3gM+eZD1pZFn2Fb26KkumBNc+wWJAJGg3czNPR01orwY9trEQwK7xrlrtOCqi25Y/gc lHqXx4icIGllw7fQm2opC96HmESwLfWu7s5cTr3qB8kcBU35kMHoUvXqOrxSoQkTR8Wk 5PSg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Oluizxxs; 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 h9-v6si3736307plt.274.2018.01.26.05.20.50 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Jan 2018 05:20: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=Oluizxxs; 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 E79166E22D; Fri, 26 Jan 2018 13:20:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-lf0-x241.google.com (mail-lf0-x241.google.com [IPv6:2a00:1450:4010:c07::241]) by gabe.freedesktop.org (Postfix) with ESMTPS id E88756E22D for ; Fri, 26 Jan 2018 13:20:47 +0000 (UTC) Received: by mail-lf0-x241.google.com with SMTP id t139so678565lff.0 for ; Fri, 26 Jan 2018 05:20:47 -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=LUficvmegzKDbUcrg7I8TqzLHSxG4Y8MvxG3dxl22Cg=; b=OluizxxsH8XROfT+MlUFv2CD8QYIyL11Mmf73X/hIs7jU6sgCiDCdI34DYooc7wyRL zWRGYMWFzd/jTcb8Et+SQbmO7SlcKuO+HF//3o1qHCKIU0ujhvLXNv/3BGyfJPaSpCbU 3zm+3kk8vXgG1C4Y6yGNDsa01AtEigTn7tdgU= 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=LUficvmegzKDbUcrg7I8TqzLHSxG4Y8MvxG3dxl22Cg=; b=WFaAyB/Aff+UnQJYg7NbE+KfH/qbtAQGsIAFb5LMIBT2GJSF54rBINhKv54ITZfMMy pfBe4y48HH6RiloUkmrenYuvgQEON8IahaIvTb+bV+emyzdN22zJ6qvJPMbt60HfGKTz 9BGRnFxXO2kKejRQHc6569MgVDSr6I59SZn/lzchI2/wjmJhzgEZTcLf/RcVRcLO/zJv EOB95eEX7BeQ+pts0W6IOKrgNbQgUF+B0iJ5ndWIOAiYkseY/77cQ/kcIpi243aAHsZs vlZatJdwwsnv5eqqfNqxvnqsr7O6sYdjoW3y58Ol74T7Zla89RvqGpHwirPv3mdvEBw2 87jg== X-Gm-Message-State: AKwxytcXdmWks2ocxivhJasz+9CMvRV7S0Iaup6rDMYduvYoI9I+XRir vFPiztP0VXb6M6N0pcFAJk3Rgg== X-Received: by 10.46.99.75 with SMTP id x72mr8702382ljb.136.1516972846404; Fri, 26 Jan 2018 05:20:46 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id h15sm937704ljh.77.2018.01.26.05.20.45 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Jan 2018 05:20:45 -0800 (PST) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 3/4] drm/pl111: Handle the Versatile RGB/BGR565 mode Date: Fri, 26 Jan 2018 14:20:32 +0100 Message-Id: <20180126132033.19744-3-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180126132033.19744-1-linus.walleij@linaro.org> References: <20180126132033.19744-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 --- drivers/gpu/drm/pl111/pl111_display.c | 15 +++++++++++++-- drivers/gpu/drm/pl111/pl111_drv.c | 2 ++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/pl111/pl111_display.c b/drivers/gpu/drm/pl111/pl111_display.c index 7fe4040aea46..90946fcd65ef 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+ does the BGR routing externally */ + if (priv->variant->is_pl110_plus) + cntl &= ~CNTL_BGR; + /* Power sequence: first enable and chill */ writel(cntl, priv->regs + priv->ctrl); diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c index 8da75089dc59..f1f1b87b0e44 100644 --- a/drivers/gpu/drm/pl111/pl111_drv.c +++ b/drivers/gpu/drm/pl111/pl111_drv.c @@ -209,6 +209,8 @@ static const u32 pl110_pixel_formats[] = { DRM_FORMAT_XBGR8888, DRM_FORMAT_ARGB8888, DRM_FORMAT_XRGB8888, + DRM_FORMAT_BGR565, + DRM_FORMAT_RGB565, DRM_FORMAT_ABGR1555, DRM_FORMAT_XBGR1555, DRM_FORMAT_ARGB1555, From patchwork Fri Jan 26 13:20:33 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 125968 Delivered-To: patch@linaro.org Received: by 10.46.84.92 with SMTP id y28csp331081ljd; Fri, 26 Jan 2018 05:21:24 -0800 (PST) X-Google-Smtp-Source: AH8x225OV1BBkK34ZIxi6wHD4JcWjl4dL15Nx/KrXSuWNVCZ2/rYa8SLVTI48GVnO6SnNVvLqW2M X-Received: by 10.99.125.13 with SMTP id y13mr15449809pgc.282.1516972884689; Fri, 26 Jan 2018 05:21:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516972884; cv=none; d=google.com; s=arc-20160816; b=TAR5POhXKXmK3V0CcbW2iabEv+tq56qF8UvNqtj782yIB7L8Q7+rkdhOKO/GoB1ndL tmr3a6GP7XBAhuxxdL76oS4ZtZQT1Ek7aX3R9UkhR+Q9nhhLJ2hUQCH36/9S6R+yGM2u fsgqj40xsd3qWZNSCzS5KXVZflU4rn+SRpGik5pMvdMQ96YXEVs5DPQUrskdZ3WzLlUi BnCMaf6NgJzLUZP8gNUGuxu8moAwoCw7hYA5112RcIRukn92uc/e28/9dg49EqmV+QFi OZIybGpq+LOGDhQhvdMDmLhEDS5iSzyjCIixgBXHlHM7OpfeyXp13GOOa1z3gGlhtQ7r JHdA== 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=ZlqNqiGHvAFZN1wVyQ+JGwEOdvucQwyW9DIabMV09fU=; b=eQgDI8WbYj/+LOTGTp9ZIPIPkBylGDFpZuUxmrhUjSH4tt+TTNTU0EOlQ/Fpp59cFg ozB3U46HXgjBsnP3Db/bpK1xDhXMdNMLmssEaVAoT5zj4lZdrQ5za4t9DGejZq7Pg8qz GErMdmykMnnvdx7PKuKVijmATeUXPUo8CaxEfuM0UF1ppt+kmVeUDUK0A/31HmFSrVAd bgx1Is7ZNw2g97SmBsZsdGLFzo290JqmnGVGLpi6vEixn5PkrixoPoU5hKybMd6AxPpL kchokSvf9Lh/pKfbTF0hz5MwzSdMMSZzWTBcSMJkregniVs0Qoa2yN8bYRY7WWrtGaVV 8/aQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=frJYlJMj; 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 w16-v6si3725114plk.271.2018.01.26.05.21.24 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Jan 2018 05:21:24 -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=frJYlJMj; 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 7CF746E247; Fri, 26 Jan 2018 13:20:53 +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 E043D6E247 for ; Fri, 26 Jan 2018 13:20:51 +0000 (UTC) Received: by mail-lf0-x243.google.com with SMTP id q17so649744lfa.9 for ; Fri, 26 Jan 2018 05:20:51 -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=ZkcZ3Hz9axvmxaEvTJhtt3GYiNfBHdF5l5Hj42qYwyc=; b=frJYlJMjqgpPxcmnVrwYcDqRc1AixVyRcJjDumeUoUxjNVTEkEZAHpXtJr6En5k5k6 CoQtg6GHG59UeyxoyfhxiwWD6GnMO6UmskIeudScU0X3xIH8UTXhEUw35vxd3B2K+rBw 894blbDdBgKUQ5CmiAINnHix6ek6vu6rCvSyg= 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=ZkcZ3Hz9axvmxaEvTJhtt3GYiNfBHdF5l5Hj42qYwyc=; b=FzJutuHpeGeFBtpT1y3f1tYjMFxjhisdnJY8SLnMrpbQW39q+AbZhP0pb0Vk4+TIuH R0VnrqMCXWsiLDFnfosxcd94C9zYSI3F+77hEE4iEnK2AnLxoh48GyNPNqPjTzfojcNR 8b+/TApc4949izr4BjB7DzFzOg8Gx7kZaK56QRSxdEj8q+yzb+fjoglrvPEGwOTSKEve aG+g5g/BLenHm13Y2s2sI+YFRtHNuIRU7BNtklNSE6nbr5nCN7j6G6XdxU0gdyYyCIv3 i3Ug8n3ar04p5HRnFGGDFz4eDLWjOt4qREa51ZOoHdxgw7NXOt6XcA8P1Pg9KSOD0fGX xLMA== X-Gm-Message-State: AKwxytfQtk8bSyrW13tlLUhBx9H7tw7TwH+uGqh6suebTYrccOI7EJtO owzl04UuXAij+1eQVBjMWEnUBX2/3NY= X-Received: by 10.46.29.138 with SMTP id w10mr1712425lje.120.1516972850029; Fri, 26 Jan 2018 05:20:50 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id h15sm937704ljh.77.2018.01.26.05.20.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Jan 2018 05:20:49 -0800 (PST) From: Linus Walleij To: Daniel Vetter , Jani Nikula , Sean Paul , Eric Anholt Subject: [PATCH 4/4] drm/pl111: Support multiple endpoints on the CLCD Date: Fri, 26 Jan 2018 14:20:33 +0100 Message-Id: <20180126132033.19744-4-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180126132033.19744-1-linus.walleij@linaro.org> References: <20180126132033.19744-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 f1f1b87b0e44..7e9f5efe3274 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);