forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-11 04dd17822334871b23ea2862f7798fb0e0007777
kernel/drivers/gpu/drm/tegra/gr3d.c
....@@ -1,10 +1,7 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 2013 Avionic Design GmbH
34 * Copyright (C) 2013 NVIDIA Corporation
4
- *
5
- * This program is free software; you can redistribute it and/or modify
6
- * it under the terms of the GNU General Public License version 2 as
7
- * published by the Free Software Foundation.
85 */
96
107 #include <linux/clk.h>
....@@ -26,7 +23,6 @@
2623 };
2724
2825 struct gr3d {
29
- struct iommu_group *group;
3026 struct tegra_drm_client client;
3127 struct host1x_channel *channel;
3228 struct clk *clk_secondary;
....@@ -47,12 +43,12 @@
4743 static int gr3d_init(struct host1x_client *client)
4844 {
4945 struct tegra_drm_client *drm = host1x_to_drm_client(client);
50
- struct drm_device *dev = dev_get_drvdata(client->parent);
46
+ struct drm_device *dev = dev_get_drvdata(client->host);
5147 unsigned long flags = HOST1X_SYNCPT_HAS_BASE;
5248 struct gr3d *gr3d = to_gr3d(drm);
5349 int err;
5450
55
- gr3d->channel = host1x_channel_request(client->dev);
51
+ gr3d->channel = host1x_channel_request(client);
5652 if (!gr3d->channel)
5753 return -ENOMEM;
5854
....@@ -63,9 +59,8 @@
6359 goto put;
6460 }
6561
66
- gr3d->group = host1x_client_iommu_attach(client, false);
67
- if (IS_ERR(gr3d->group)) {
68
- err = PTR_ERR(gr3d->group);
62
+ err = host1x_client_iommu_attach(client);
63
+ if (err < 0) {
6964 dev_err(client->dev, "failed to attach to domain: %d\n", err);
7065 goto free;
7166 }
....@@ -79,7 +74,7 @@
7974 return 0;
8075
8176 detach:
82
- host1x_client_iommu_detach(client, gr3d->group);
77
+ host1x_client_iommu_detach(client);
8378 free:
8479 host1x_syncpt_free(client->syncpts[0]);
8580 put:
....@@ -90,7 +85,7 @@
9085 static int gr3d_exit(struct host1x_client *client)
9186 {
9287 struct tegra_drm_client *drm = host1x_to_drm_client(client);
93
- struct drm_device *dev = dev_get_drvdata(client->parent);
88
+ struct drm_device *dev = dev_get_drvdata(client->host);
9489 struct gr3d *gr3d = to_gr3d(drm);
9590 int err;
9691
....@@ -98,7 +93,7 @@
9893 if (err < 0)
9994 return err;
10095
101
- host1x_client_iommu_detach(client, gr3d->group);
96
+ host1x_client_iommu_detach(client);
10297 host1x_syncpt_free(client->syncpts[0]);
10398 host1x_channel_put(gr3d->channel);
10499
....@@ -386,10 +381,12 @@
386381 }
387382
388383 if (gr3d->clk_secondary) {
384
+ reset_control_assert(gr3d->rst_secondary);
389385 tegra_powergate_power_off(TEGRA_POWERGATE_3D1);
390386 clk_disable_unprepare(gr3d->clk_secondary);
391387 }
392388
389
+ reset_control_assert(gr3d->rst);
393390 tegra_powergate_power_off(TEGRA_POWERGATE_3D);
394391 clk_disable_unprepare(gr3d->clk);
395392