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,