diff mbox series

[4/7] drm/tegra: gr2d: Track interface version

Message ID 20180517154132.10058-5-thierry.reding@gmail.com
State Deferred
Headers show
Series drm/tegra: Preparation work for destaging ABI | expand

Commit Message

Thierry Reding May 17, 2018, 3:41 p.m. UTC
From: Thierry Reding <treding@nvidia.com>

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 <treding@nvidia.com>
---
 drivers/gpu/drm/tegra/gr2d.c | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

Comments

Dmitry Osipenko May 18, 2018, 4:05 p.m. UTC | #1
On 17.05.2018 18:41, Thierry Reding wrote:
> From: Thierry Reding <treding@nvidia.com>
> 
> 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 <treding@nvidia.com>
> ---
>  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 <linux/clk.h>
> +#include <linux/of_device.h>
>  
>  #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 },

Note: T114 also has GR2D according to the TRM, maybe it's worth add it here too
later.

>  	{ },
>  };
>  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;
>  
> 

Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
--
To unsubscribe from this list: send the line "unsubscribe linux-tegra" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox series

Patch

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 <linux/clk.h>
+#include <linux/of_device.h>
 
 #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;