.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Copyright (C) 2013 Avionic Design GmbH |
---|
3 | 4 | * 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. |
---|
8 | 5 | */ |
---|
9 | 6 | |
---|
10 | 7 | #include <linux/clk.h> |
---|
.. | .. |
---|
26 | 23 | }; |
---|
27 | 24 | |
---|
28 | 25 | struct gr3d { |
---|
29 | | - struct iommu_group *group; |
---|
30 | 26 | struct tegra_drm_client client; |
---|
31 | 27 | struct host1x_channel *channel; |
---|
32 | 28 | struct clk *clk_secondary; |
---|
.. | .. |
---|
47 | 43 | static int gr3d_init(struct host1x_client *client) |
---|
48 | 44 | { |
---|
49 | 45 | 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); |
---|
51 | 47 | unsigned long flags = HOST1X_SYNCPT_HAS_BASE; |
---|
52 | 48 | struct gr3d *gr3d = to_gr3d(drm); |
---|
53 | 49 | int err; |
---|
54 | 50 | |
---|
55 | | - gr3d->channel = host1x_channel_request(client->dev); |
---|
| 51 | + gr3d->channel = host1x_channel_request(client); |
---|
56 | 52 | if (!gr3d->channel) |
---|
57 | 53 | return -ENOMEM; |
---|
58 | 54 | |
---|
.. | .. |
---|
63 | 59 | goto put; |
---|
64 | 60 | } |
---|
65 | 61 | |
---|
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) { |
---|
69 | 64 | dev_err(client->dev, "failed to attach to domain: %d\n", err); |
---|
70 | 65 | goto free; |
---|
71 | 66 | } |
---|
.. | .. |
---|
79 | 74 | return 0; |
---|
80 | 75 | |
---|
81 | 76 | detach: |
---|
82 | | - host1x_client_iommu_detach(client, gr3d->group); |
---|
| 77 | + host1x_client_iommu_detach(client); |
---|
83 | 78 | free: |
---|
84 | 79 | host1x_syncpt_free(client->syncpts[0]); |
---|
85 | 80 | put: |
---|
.. | .. |
---|
90 | 85 | static int gr3d_exit(struct host1x_client *client) |
---|
91 | 86 | { |
---|
92 | 87 | 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); |
---|
94 | 89 | struct gr3d *gr3d = to_gr3d(drm); |
---|
95 | 90 | int err; |
---|
96 | 91 | |
---|
.. | .. |
---|
98 | 93 | if (err < 0) |
---|
99 | 94 | return err; |
---|
100 | 95 | |
---|
101 | | - host1x_client_iommu_detach(client, gr3d->group); |
---|
| 96 | + host1x_client_iommu_detach(client); |
---|
102 | 97 | host1x_syncpt_free(client->syncpts[0]); |
---|
103 | 98 | host1x_channel_put(gr3d->channel); |
---|
104 | 99 | |
---|
.. | .. |
---|
386 | 381 | } |
---|
387 | 382 | |
---|
388 | 383 | if (gr3d->clk_secondary) { |
---|
| 384 | + reset_control_assert(gr3d->rst_secondary); |
---|
389 | 385 | tegra_powergate_power_off(TEGRA_POWERGATE_3D1); |
---|
390 | 386 | clk_disable_unprepare(gr3d->clk_secondary); |
---|
391 | 387 | } |
---|
392 | 388 | |
---|
| 389 | + reset_control_assert(gr3d->rst); |
---|
393 | 390 | tegra_powergate_power_off(TEGRA_POWERGATE_3D); |
---|
394 | 391 | clk_disable_unprepare(gr3d->clk); |
---|
395 | 392 | |
---|