From patchwork Thu May 17 15:41:30 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 10407029 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 7546A602C2 for ; Thu, 17 May 2018 15:42:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6306A2857E for ; Thu, 17 May 2018 15:42:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54B71285A0; Thu, 17 May 2018 15:42:15 +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=-5.1 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, MAILING_LIST_MULTI, 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 0904F2857E for ; Thu, 17 May 2018 15:42:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 69F176EAA7; Thu, 17 May 2018 15:41:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wm0-x242.google.com (mail-wm0-x242.google.com [IPv6:2a00:1450:400c:c09::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 116D86EA9D for ; Thu, 17 May 2018 15:41:44 +0000 (UTC) Received: by mail-wm0-x242.google.com with SMTP id f8-v6so9961735wmc.4 for ; Thu, 17 May 2018 08:41:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=5tbtcpEHALN+7fZv8ZNOJIJRGgvSipGTkj4kw9JQiTU=; b=VydcZP9J4tcL0GjaxPKA+Gb7Yb08e7NWVlrKefczBVVv+CR9PAG2isnega+j2TvizO QbdD5TSRp/etMCsDwX5RivJ+79WEdG5txD0IucYZMym26ap/GsRawCzxsURHbf1D4Kms ++fI+s+aETWdf8qzi7pwZtTHKHIdHCYWqVJZmE/Kom03e+yftTe7E2Jht7C7ysaPyVyu XxpO6B1klrey2QWtUe/gb3FjJbQ9ypGvZ2+dfXNXBEM9j2mfmOtLzRJm/vHgMyT7ZqQF Tj3fosFVx+iCWC9oYLT4grPnYX3WvWSl7KilUfg5++vriEAv1dHjPO+Ll6pkSCSaQohD oRpw== 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=5tbtcpEHALN+7fZv8ZNOJIJRGgvSipGTkj4kw9JQiTU=; b=g9sNaeYHcGdyUtY1tZIYhPTjN95dvZbMGgGnKV64NA55NKzr3k70vwin1vStVOea9r /AaArOIqvgODLgjI01fkS7F6pq1IgzWKD0ywkP8Od/4CKUDfPUigFyXmBw2tBklwwTXu 90bVsViF4z1BcfxjNevRtmwQGj+EDT4G1PUUdSOhqTatv7bQVKjRcxojUjqm1Nqf74y6 aPKd5zTw2CGmIEIiBoAT3oTTiCLdTMf1cA+2s6nSHXoWgCf3U7+QJqmLzZUvSdNDbIZD 8sZzC4C/ggFiAq9k0HNKt4IUBl6XZ2pEW/4Vfkm6MYxJ6nh8Pvz0n7kkhfBK/IZ/vOrD sI4w== X-Gm-Message-State: ALKqPwdu1ll9K09NGURKp2N+8oy1YMgUP/OR+zPp7tefKP9PKLvkRPPJ zulmpWi+N8MUUUydZqRZpyg= X-Google-Smtp-Source: AB8JxZopLqE7bL4b/yTAQYX8YFdsA1VI1qk/SXWCilrF91QA8C3vzlIcKIKiCZXLlIy+M0ZWQLfx4w== X-Received: by 2002:a1c:6d90:: with SMTP id b16-v6mr2094924wmi.138.1526571702549; Thu, 17 May 2018 08:41:42 -0700 (PDT) Received: from localhost (p200300E41F19FC00D958180F3872A5C5.dip0.t-ipconnect.de. [2003:e4:1f19:fc00:d958:180f:3872:a5c5]) by smtp.gmail.com with ESMTPSA id q81-v6sm2820860wmd.14.2018.05.17.08.41.41 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 May 2018 08:41:41 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH 5/7] drm/tegra: gr3d: Track interface version Date: Thu, 17 May 2018 17:41:30 +0200 Message-Id: <20180517154132.10058-6-thierry.reding@gmail.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180517154132.10058-1-thierry.reding@gmail.com> References: <20180517154132.10058-1-thierry.reding@gmail.com> 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-tegra@vger.kernel.org, Dmitry Osipenko , dri-devel@lists.freedesktop.org, Mikko Perttunen MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: Thierry Reding Set the interface version implemented by the gr3d module. This allows userspace to pass the correct command stream when programming the gr3d module. Signed-off-by: Thierry Reding Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko --- drivers/gpu/drm/tegra/gr3d.c | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c index 28c4ef63065b..0d4dce978eb2 100644 --- a/drivers/gpu/drm/tegra/gr3d.c +++ b/drivers/gpu/drm/tegra/gr3d.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include @@ -19,6 +20,10 @@ #include "gem.h" #include "gr3d.h" +struct gr3d_soc { + unsigned int version; +}; + struct gr3d { struct tegra_drm_client client; struct host1x_channel *channel; @@ -27,6 +32,8 @@ struct gr3d { struct reset_control *rst_secondary; struct reset_control *rst; + const struct gr3d_soc *soc; + DECLARE_BITMAP(addr_regs, GR3D_NUM_REGS); }; @@ -125,10 +132,22 @@ static const struct tegra_drm_client_ops gr3d_ops = { .submit = tegra_drm_submit, }; +static const struct gr3d_soc tegra20_gr3d_soc = { + .version = 0x20, +}; + +static const struct gr3d_soc tegra30_gr3d_soc = { + .version = 0x30, +}; + +static const struct gr3d_soc tegra114_gr3d_soc = { + .version = 0x35, +}; + static const struct of_device_id tegra_gr3d_match[] = { - { .compatible = "nvidia,tegra114-gr3d" }, - { .compatible = "nvidia,tegra30-gr3d" }, - { .compatible = "nvidia,tegra20-gr3d" }, + { .compatible = "nvidia,tegra114-gr3d", .data = &tegra114_gr3d_soc }, + { .compatible = "nvidia,tegra30-gr3d", .data = &tegra30_gr3d_soc }, + { .compatible = "nvidia,tegra20-gr3d", .data = &tegra20_gr3d_soc }, { } }; MODULE_DEVICE_TABLE(of, tegra_gr3d_match); @@ -250,6 +269,8 @@ static int gr3d_probe(struct platform_device *pdev) if (!gr3d) return -ENOMEM; + gr3d->soc = of_device_get_match_data(&pdev->dev); + syncpts = devm_kzalloc(&pdev->dev, sizeof(*syncpts), GFP_KERNEL); if (!syncpts) return -ENOMEM; @@ -303,6 +324,7 @@ static int gr3d_probe(struct platform_device *pdev) gr3d->client.base.ops = &gr3d_client_ops; gr3d->client.base.dev = &pdev->dev; gr3d->client.base.class = HOST1X_CLASS_GR3D; + gr3d->client.base.version = gr3d->soc->version; gr3d->client.base.syncpts = syncpts; gr3d->client.base.num_syncpts = 1;