| .. | .. |
|---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
|---|
| 1 | 2 | /* |
|---|
| 2 | 3 | * 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. |
|---|
| 7 | 4 | */ |
|---|
| 8 | 5 | |
|---|
| 9 | 6 | #include <linux/clk.h> |
|---|
| 10 | 7 | #include <linux/iommu.h> |
|---|
| 8 | +#include <linux/module.h> |
|---|
| 11 | 9 | #include <linux/of_device.h> |
|---|
| 12 | 10 | |
|---|
| 13 | 11 | #include "drm.h" |
|---|
| .. | .. |
|---|
| 19 | 17 | }; |
|---|
| 20 | 18 | |
|---|
| 21 | 19 | struct gr2d { |
|---|
| 22 | | - struct iommu_group *group; |
|---|
| 23 | 20 | struct tegra_drm_client client; |
|---|
| 24 | 21 | struct host1x_channel *channel; |
|---|
| 25 | 22 | struct clk *clk; |
|---|
| .. | .. |
|---|
| 37 | 34 | static int gr2d_init(struct host1x_client *client) |
|---|
| 38 | 35 | { |
|---|
| 39 | 36 | 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); |
|---|
| 41 | 38 | unsigned long flags = HOST1X_SYNCPT_HAS_BASE; |
|---|
| 42 | 39 | struct gr2d *gr2d = to_gr2d(drm); |
|---|
| 43 | 40 | int err; |
|---|
| 44 | 41 | |
|---|
| 45 | | - gr2d->channel = host1x_channel_request(client->dev); |
|---|
| 42 | + gr2d->channel = host1x_channel_request(client); |
|---|
| 46 | 43 | if (!gr2d->channel) |
|---|
| 47 | 44 | return -ENOMEM; |
|---|
| 48 | 45 | |
|---|
| .. | .. |
|---|
| 53 | 50 | goto put; |
|---|
| 54 | 51 | } |
|---|
| 55 | 52 | |
|---|
| 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) { |
|---|
| 59 | 55 | dev_err(client->dev, "failed to attach to domain: %d\n", err); |
|---|
| 60 | 56 | goto free; |
|---|
| 61 | 57 | } |
|---|
| .. | .. |
|---|
| 69 | 65 | return 0; |
|---|
| 70 | 66 | |
|---|
| 71 | 67 | detach: |
|---|
| 72 | | - host1x_client_iommu_detach(client, gr2d->group); |
|---|
| 68 | + host1x_client_iommu_detach(client); |
|---|
| 73 | 69 | free: |
|---|
| 74 | 70 | host1x_syncpt_free(client->syncpts[0]); |
|---|
| 75 | 71 | put: |
|---|
| .. | .. |
|---|
| 80 | 76 | static int gr2d_exit(struct host1x_client *client) |
|---|
| 81 | 77 | { |
|---|
| 82 | 78 | 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); |
|---|
| 84 | 80 | struct tegra_drm *tegra = dev->dev_private; |
|---|
| 85 | 81 | struct gr2d *gr2d = to_gr2d(drm); |
|---|
| 86 | 82 | int err; |
|---|
| .. | .. |
|---|
| 89 | 85 | if (err < 0) |
|---|
| 90 | 86 | return err; |
|---|
| 91 | 87 | |
|---|
| 92 | | - host1x_client_iommu_detach(client, gr2d->group); |
|---|
| 88 | + host1x_client_iommu_detach(client); |
|---|
| 93 | 89 | host1x_syncpt_free(client->syncpts[0]); |
|---|
| 94 | 90 | host1x_channel_put(gr2d->channel); |
|---|
| 95 | 91 | |
|---|
| .. | .. |
|---|
| 181 | 177 | GR2D_DSTC_BASE_ADDR, |
|---|
| 182 | 178 | GR2D_SRCA_BASE_ADDR, |
|---|
| 183 | 179 | GR2D_SRCB_BASE_ADDR, |
|---|
| 180 | + GR2D_PATBASE_ADDR, |
|---|
| 184 | 181 | GR2D_SRC_BASE_ADDR_SB, |
|---|
| 185 | 182 | GR2D_DSTA_BASE_ADDR_SB, |
|---|
| 186 | 183 | GR2D_DSTB_BASE_ADDR_SB, |
|---|