forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/gpu/drm/tegra/gr2d.c
....@@ -1,13 +1,11 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (c) 2012-2013, NVIDIA Corporation.
3
- *
4
- * This program is free software; you can redistribute it and/or modify
5
- * it under the terms of the GNU General Public License version 2 as
6
- * published by the Free Software Foundation.
74 */
85
96 #include <linux/clk.h>
107 #include <linux/iommu.h>
8
+#include <linux/module.h>
119 #include <linux/of_device.h>
1210
1311 #include "drm.h"
....@@ -19,7 +17,6 @@
1917 };
2018
2119 struct gr2d {
22
- struct iommu_group *group;
2320 struct tegra_drm_client client;
2421 struct host1x_channel *channel;
2522 struct clk *clk;
....@@ -37,12 +34,12 @@
3734 static int gr2d_init(struct host1x_client *client)
3835 {
3936 struct tegra_drm_client *drm = host1x_to_drm_client(client);
40
- struct drm_device *dev = dev_get_drvdata(client->parent);
37
+ struct drm_device *dev = dev_get_drvdata(client->host);
4138 unsigned long flags = HOST1X_SYNCPT_HAS_BASE;
4239 struct gr2d *gr2d = to_gr2d(drm);
4340 int err;
4441
45
- gr2d->channel = host1x_channel_request(client->dev);
42
+ gr2d->channel = host1x_channel_request(client);
4643 if (!gr2d->channel)
4744 return -ENOMEM;
4845
....@@ -53,9 +50,8 @@
5350 goto put;
5451 }
5552
56
- gr2d->group = host1x_client_iommu_attach(client, false);
57
- if (IS_ERR(gr2d->group)) {
58
- err = PTR_ERR(gr2d->group);
53
+ err = host1x_client_iommu_attach(client);
54
+ if (err < 0) {
5955 dev_err(client->dev, "failed to attach to domain: %d\n", err);
6056 goto free;
6157 }
....@@ -69,7 +65,7 @@
6965 return 0;
7066
7167 detach:
72
- host1x_client_iommu_detach(client, gr2d->group);
68
+ host1x_client_iommu_detach(client);
7369 free:
7470 host1x_syncpt_free(client->syncpts[0]);
7571 put:
....@@ -80,7 +76,7 @@
8076 static int gr2d_exit(struct host1x_client *client)
8177 {
8278 struct tegra_drm_client *drm = host1x_to_drm_client(client);
83
- struct drm_device *dev = dev_get_drvdata(client->parent);
79
+ struct drm_device *dev = dev_get_drvdata(client->host);
8480 struct tegra_drm *tegra = dev->dev_private;
8581 struct gr2d *gr2d = to_gr2d(drm);
8682 int err;
....@@ -89,7 +85,7 @@
8985 if (err < 0)
9086 return err;
9187
92
- host1x_client_iommu_detach(client, gr2d->group);
88
+ host1x_client_iommu_detach(client);
9389 host1x_syncpt_free(client->syncpts[0]);
9490 host1x_channel_put(gr2d->channel);
9591
....@@ -181,6 +177,7 @@
181177 GR2D_DSTC_BASE_ADDR,
182178 GR2D_SRCA_BASE_ADDR,
183179 GR2D_SRCB_BASE_ADDR,
180
+ GR2D_PATBASE_ADDR,
184181 GR2D_SRC_BASE_ADDR_SB,
185182 GR2D_DSTA_BASE_ADDR_SB,
186183 GR2D_DSTB_BASE_ADDR_SB,