diff options
author | Thierry Reding <treding@nvidia.com> | 2018-05-16 11:06:36 -0400 |
---|---|---|
committer | Thierry Reding <treding@nvidia.com> | 2018-05-18 16:00:13 -0400 |
commit | 840fd213fca23b185f71b45a5b563e4e9b6d1759 (patch) | |
tree | 713e1cd70599e08b9787e238145ee52a495846f8 | |
parent | f3b3cfcc3f09490ffb8e1e997e8a8695a6a55b1b (diff) |
drm/tegra: gr2d: Track interface version
Set the interface version implemented by the gr2d module. This allows
userspace to pass the correct command stream when programming the gr2d
module.
Reviewed-by: Dmitry Osipenko <digetx@gmail.com>
Tested-by: Dmitry Osipenko <digetx@gmail.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
-rw-r--r-- | drivers/gpu/drm/tegra/gr2d.c | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/drivers/gpu/drm/tegra/gr2d.c b/drivers/gpu/drm/tegra/gr2d.c index 2cd0f66c8aa9..673059fd2fcb 100644 --- a/drivers/gpu/drm/tegra/gr2d.c +++ b/drivers/gpu/drm/tegra/gr2d.c | |||
@@ -8,17 +8,24 @@ | |||
8 | 8 | ||
9 | #include <linux/clk.h> | 9 | #include <linux/clk.h> |
10 | #include <linux/iommu.h> | 10 | #include <linux/iommu.h> |
11 | #include <linux/of_device.h> | ||
11 | 12 | ||
12 | #include "drm.h" | 13 | #include "drm.h" |
13 | #include "gem.h" | 14 | #include "gem.h" |
14 | #include "gr2d.h" | 15 | #include "gr2d.h" |
15 | 16 | ||
17 | struct gr2d_soc { | ||
18 | unsigned int version; | ||
19 | }; | ||
20 | |||
16 | struct gr2d { | 21 | struct gr2d { |
17 | struct iommu_group *group; | 22 | struct iommu_group *group; |
18 | struct tegra_drm_client client; | 23 | struct tegra_drm_client client; |
19 | struct host1x_channel *channel; | 24 | struct host1x_channel *channel; |
20 | struct clk *clk; | 25 | struct clk *clk; |
21 | 26 | ||
27 | const struct gr2d_soc *soc; | ||
28 | |||
22 | DECLARE_BITMAP(addr_regs, GR2D_NUM_REGS); | 29 | DECLARE_BITMAP(addr_regs, GR2D_NUM_REGS); |
23 | }; | 30 | }; |
24 | 31 | ||
@@ -150,9 +157,17 @@ static const struct tegra_drm_client_ops gr2d_ops = { | |||
150 | .submit = tegra_drm_submit, | 157 | .submit = tegra_drm_submit, |
151 | }; | 158 | }; |
152 | 159 | ||
160 | static const struct gr2d_soc tegra20_gr2d_soc = { | ||
161 | .version = 0x20, | ||
162 | }; | ||
163 | |||
164 | static const struct gr2d_soc tegra30_gr2d_soc = { | ||
165 | .version = 0x30, | ||
166 | }; | ||
167 | |||
153 | static const struct of_device_id gr2d_match[] = { | 168 | static const struct of_device_id gr2d_match[] = { |
154 | { .compatible = "nvidia,tegra30-gr2d" }, | 169 | { .compatible = "nvidia,tegra30-gr2d", .data = &tegra20_gr2d_soc }, |
155 | { .compatible = "nvidia,tegra20-gr2d" }, | 170 | { .compatible = "nvidia,tegra20-gr2d", .data = &tegra30_gr2d_soc }, |
156 | { }, | 171 | { }, |
157 | }; | 172 | }; |
158 | MODULE_DEVICE_TABLE(of, gr2d_match); | 173 | MODULE_DEVICE_TABLE(of, gr2d_match); |
@@ -185,6 +200,8 @@ static int gr2d_probe(struct platform_device *pdev) | |||
185 | if (!gr2d) | 200 | if (!gr2d) |
186 | return -ENOMEM; | 201 | return -ENOMEM; |
187 | 202 | ||
203 | gr2d->soc = of_device_get_match_data(dev); | ||
204 | |||
188 | syncpts = devm_kzalloc(dev, sizeof(*syncpts), GFP_KERNEL); | 205 | syncpts = devm_kzalloc(dev, sizeof(*syncpts), GFP_KERNEL); |
189 | if (!syncpts) | 206 | if (!syncpts) |
190 | return -ENOMEM; | 207 | return -ENOMEM; |
@@ -209,6 +226,7 @@ static int gr2d_probe(struct platform_device *pdev) | |||
209 | gr2d->client.base.num_syncpts = 1; | 226 | gr2d->client.base.num_syncpts = 1; |
210 | 227 | ||
211 | INIT_LIST_HEAD(&gr2d->client.list); | 228 | INIT_LIST_HEAD(&gr2d->client.list); |
229 | gr2d->client.version = gr2d->soc->version; | ||
212 | gr2d->client.ops = &gr2d_ops; | 230 | gr2d->client.ops = &gr2d_ops; |
213 | 231 | ||
214 | err = host1x_client_register(&gr2d->client.base); | 232 | err = host1x_client_register(&gr2d->client.base); |