From patchwork Thu May 17 15:41:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 10407021 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 41D4160353 for ; Thu, 17 May 2018 15:41:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 30D4D28528 for ; Thu, 17 May 2018 15:41:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 254D528590; Thu, 17 May 2018 15:41:52 +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 A949728528 for ; Thu, 17 May 2018 15:41:51 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A72E46EA9D; Thu, 17 May 2018 15:41:48 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr0-x242.google.com (mail-wr0-x242.google.com [IPv6:2a00:1450:400c:c0c::242]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5BE936E99D for ; Thu, 17 May 2018 15:41:42 +0000 (UTC) Received: by mail-wr0-x242.google.com with SMTP id v15-v6so6157053wrm.10 for ; Thu, 17 May 2018 08:41:42 -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=a6qtTXZpepY1Co7BXJDWiSTr8wlGtpDbR9LkzQ+9mUE=; b=NRJGtPuORZ2tAKDIENvf8CbLAhMlAIwN58el3QZ7D7VkcfSdERD/sby3w0gkWNwfIF EY2j6bdI44/xD0uqJ8yi/MFN0SCsZK/X4sKwHOWnYzawC/tujiRU0Dte5NTHshUiE0wC o1TaTjC+hvLYvHZ0Ifu7EFocEKpC3ErDOpEY8zlOSUuK4U2y3OQMYD5QwIl9ojx/+Vp6 2DHVFpPq9QSl7Ck2kFtps6E3C/WcbZtwjIarSEMn/rk1nynvNQX2qYSGL8Xg5E213WS2 Lu6nvbt3hBvJN0k0BKVq/cDEr9JTVqwy2ZfOyZnWWxJariLW4ls1UooeKngxAQorCHwR Vy0A== 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=a6qtTXZpepY1Co7BXJDWiSTr8wlGtpDbR9LkzQ+9mUE=; b=HoVlFWtpa4Vxa4srR4ZGJ5vPd+OKte/X19MQgQdzVeaHkfPdlzcKt+IWDv0IEkUgW4 Yyo3UFnMDIMgTBWn4Pn9bUYoT9SHqsYlXiBE0KHrk54JU8LIdCRFywKjF55PFMc2KImq KAq8tUGq+0XnQi0rwpzE94ymjoccVbezGDnEuSQ+MAxAneZzy1sZ+cbTusK3CYID8q/7 1tU4s7VZcT6BBdJcdBYUI59TdNJiQM+zuTynOR4S1UfejMbU/mt9A8zd6eUYOTOFo91w JLVJPNiVJZv11T+0eEwABnnsvOs7t8Y+rLuQKEKvBhz67dCyaenYQSsrQX1XkiDYJO3m BJ3Q== X-Gm-Message-State: ALKqPwfV8uGXMegZ7UsEf7tqboknBjOI9XTrCkC7VGqntCYJbbVaJJED fxEmMFe4wzg5kzo/9/Px3jU= X-Google-Smtp-Source: AB8JxZoeFLjuvSKGlP7tKYhTsx/MwEk7233iLaGNKYn/KASeLkynHyCmn49s37NN19DodelO/i+Qzg== X-Received: by 2002:adf:d10f:: with SMTP id a15-v6mr4977180wri.165.1526571700998; Thu, 17 May 2018 08:41:40 -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 y68-v6sm10326013wrb.91.2018.05.17.08.41.39 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 17 May 2018 08:41:40 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH 4/7] drm/tegra: gr2d: Track interface version Date: Thu, 17 May 2018 17:41:29 +0200 Message-Id: <20180517154132.10058-5-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 gr2d module. This allows userspace to pass the correct command stream when programming the gr2d module. Signed-off-by: Thierry Reding Reviewed-by: Dmitry Osipenko Tested-by: Dmitry Osipenko --- drivers/gpu/drm/tegra/gr2d.c | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/tegra/gr2d.c b/drivers/gpu/drm/tegra/gr2d.c index 9a8ea93016a9..d13752b0d915 100644 --- a/drivers/gpu/drm/tegra/gr2d.c +++ b/drivers/gpu/drm/tegra/gr2d.c @@ -7,16 +7,23 @@ */ #include +#include #include "drm.h" #include "gem.h" #include "gr2d.h" +struct gr2d_soc { + unsigned int version; +}; + struct gr2d { struct tegra_drm_client client; struct host1x_channel *channel; struct clk *clk; + const struct gr2d_soc *soc; + DECLARE_BITMAP(addr_regs, GR2D_NUM_REGS); }; @@ -123,9 +130,17 @@ static const struct tegra_drm_client_ops gr2d_ops = { .submit = tegra_drm_submit, }; +static const struct gr2d_soc tegra20_gr2d_soc = { + .version = 0x20, +}; + +static const struct gr2d_soc tegra30_gr2d_soc = { + .version = 0x30, +}; + static const struct of_device_id gr2d_match[] = { - { .compatible = "nvidia,tegra30-gr2d" }, - { .compatible = "nvidia,tegra20-gr2d" }, + { .compatible = "nvidia,tegra30-gr2d", .data = &tegra20_gr2d_soc }, + { .compatible = "nvidia,tegra20-gr2d", .data = &tegra30_gr2d_soc }, { }, }; MODULE_DEVICE_TABLE(of, gr2d_match); @@ -158,6 +173,8 @@ static int gr2d_probe(struct platform_device *pdev) if (!gr2d) return -ENOMEM; + gr2d->soc = of_device_get_match_data(dev); + syncpts = devm_kzalloc(dev, sizeof(*syncpts), GFP_KERNEL); if (!syncpts) return -ENOMEM; @@ -178,6 +195,7 @@ static int gr2d_probe(struct platform_device *pdev) gr2d->client.base.ops = &gr2d_client_ops; gr2d->client.base.dev = dev; gr2d->client.base.class = HOST1X_CLASS_GR2D; + gr2d->client.base.version = gr2d->soc->version; gr2d->client.base.syncpts = syncpts; gr2d->client.base.num_syncpts = 1;