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: 10185705 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 1F985601D5 for ; Fri, 26 Jan 2018 13:20:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DD2C2851E for ; Fri, 26 Jan 2018 13:20:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01DF728B94; Fri, 26 Jan 2018 13:20:48 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 88D2B2851E for ; Fri, 26 Jan 2018 13:20:48 +0000 (UTC) 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-Google-Smtp-Source: AH8x224UCcarqbvzIUljQx4uYNrz7HE9+5uju0Nis+dOK17CDRCzP2dAtcxJHRa2rdM0iKrQyIjS5g== 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" X-Virus-Scanned: ClamAV using ClamSMTP 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,