Lines Matching +full:host1x +full:- +full:class
1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (c) 2012-2013, NVIDIA Corporation.
51 struct drm_device *dev = dev_get_drvdata(client->host); in gr2d_init()
56 gr2d->channel = host1x_channel_request(client); in gr2d_init()
57 if (!gr2d->channel) in gr2d_init()
58 return -ENOMEM; in gr2d_init()
60 client->syncpts[0] = host1x_syncpt_request(client, flags); in gr2d_init()
61 if (!client->syncpts[0]) { in gr2d_init()
62 err = -ENOMEM; in gr2d_init()
63 dev_err(client->dev, "failed to request syncpoint: %d\n", err); in gr2d_init()
69 dev_err(client->dev, "failed to attach to domain: %d\n", err); in gr2d_init()
73 pm_runtime_enable(client->dev); in gr2d_init()
74 pm_runtime_use_autosuspend(client->dev); in gr2d_init()
75 pm_runtime_set_autosuspend_delay(client->dev, 200); in gr2d_init()
77 err = tegra_drm_register_client(dev->dev_private, drm); in gr2d_init()
79 dev_err(client->dev, "failed to register client: %d\n", err); in gr2d_init()
86 pm_runtime_dont_use_autosuspend(client->dev); in gr2d_init()
87 pm_runtime_force_suspend(client->dev); in gr2d_init()
91 host1x_syncpt_put(client->syncpts[0]); in gr2d_init()
93 host1x_channel_put(gr2d->channel); in gr2d_init()
100 struct drm_device *dev = dev_get_drvdata(client->host); in gr2d_exit()
101 struct tegra_drm *tegra = dev->dev_private; in gr2d_exit()
109 pm_runtime_dont_use_autosuspend(client->dev); in gr2d_exit()
110 pm_runtime_force_suspend(client->dev); in gr2d_exit()
113 host1x_syncpt_put(client->syncpts[0]); in gr2d_exit()
114 host1x_channel_put(gr2d->channel); in gr2d_exit()
116 gr2d->channel = NULL; in gr2d_exit()
131 context->channel = host1x_channel_get(gr2d->channel); in gr2d_open_channel()
132 if (!context->channel) in gr2d_open_channel()
133 return -ENOMEM; in gr2d_open_channel()
140 host1x_channel_put(context->channel); in gr2d_close_channel()
143 static int gr2d_is_addr_reg(struct device *dev, u32 class, u32 offset) in gr2d_is_addr_reg() argument
147 switch (class) { in gr2d_is_addr_reg()
159 if (test_bit(offset, gr2d->addr_regs)) in gr2d_is_addr_reg()
168 static int gr2d_is_valid_class(u32 class) in gr2d_is_valid_class() argument
170 return (class == HOST1X_CLASS_GR2D || in gr2d_is_valid_class()
171 class == HOST1X_CLASS_GR2D_SB); in gr2d_is_valid_class()
195 { .compatible = "nvidia,tegra114-gr2d", .data = &tegra114_gr2d_soc },
196 { .compatible = "nvidia,tegra30-gr2d", .data = &tegra30_gr2d_soc },
197 { .compatible = "nvidia,tegra20-gr2d", .data = &tegra20_gr2d_soc },
223 gr2d->resets[RST_MC].id = "mc"; in gr2d_get_resets()
224 gr2d->resets[RST_GR2D].id = "2d"; in gr2d_get_resets()
225 gr2d->nresets = RST_GR2D_MAX; in gr2d_get_resets()
228 dev, gr2d->nresets, gr2d->resets); in gr2d_get_resets()
234 if (WARN_ON(!gr2d->resets[RST_GR2D].rstc)) in gr2d_get_resets()
235 return -ENOENT; in gr2d_get_resets()
242 struct device *dev = &pdev->dev; in gr2d_probe()
250 return -ENOMEM; in gr2d_probe()
254 gr2d->soc = of_device_get_match_data(dev); in gr2d_probe()
258 return -ENOMEM; in gr2d_probe()
260 gr2d->clk = devm_clk_get(dev, NULL); in gr2d_probe()
261 if (IS_ERR(gr2d->clk)) { in gr2d_probe()
263 return PTR_ERR(gr2d->clk); in gr2d_probe()
270 INIT_LIST_HEAD(&gr2d->client.base.list); in gr2d_probe()
271 gr2d->client.base.ops = &gr2d_client_ops; in gr2d_probe()
272 gr2d->client.base.dev = dev; in gr2d_probe()
273 gr2d->client.base.class = HOST1X_CLASS_GR2D; in gr2d_probe()
274 gr2d->client.base.syncpts = syncpts; in gr2d_probe()
275 gr2d->client.base.num_syncpts = 1; in gr2d_probe()
277 INIT_LIST_HEAD(&gr2d->client.list); in gr2d_probe()
278 gr2d->client.version = gr2d->soc->version; in gr2d_probe()
279 gr2d->client.ops = &gr2d_ops; in gr2d_probe()
285 err = host1x_client_register(&gr2d->client.base); in gr2d_probe()
287 dev_err(dev, "failed to register host1x client: %d\n", err); in gr2d_probe()
293 set_bit(gr2d_addr_regs[i], gr2d->addr_regs); in gr2d_probe()
303 err = host1x_client_unregister(&gr2d->client.base); in gr2d_remove()
305 dev_err(&pdev->dev, "failed to unregister host1x client: %d\n", in gr2d_remove()
318 host1x_channel_stop(gr2d->channel); in gr2d_runtime_suspend()
319 reset_control_bulk_release(gr2d->nresets, gr2d->resets); in gr2d_runtime_suspend()
323 * host1x's cmdproc will stuck on trying to access any G2 register in gr2d_runtime_suspend()
324 * after reset. GR2D module could be either hot-reset or reset after in gr2d_runtime_suspend()
325 * power-gating of the HEG partition. Hence we will put in reset only in gr2d_runtime_suspend()
327 * of resetting GR2D module across power-gating. in gr2d_runtime_suspend()
333 err = reset_control_acquire(gr2d->resets[RST_MC].rstc); in gr2d_runtime_suspend()
339 err = reset_control_assert(gr2d->resets[RST_MC].rstc); in gr2d_runtime_suspend()
340 reset_control_release(gr2d->resets[RST_MC].rstc); in gr2d_runtime_suspend()
346 clk_disable_unprepare(gr2d->clk); in gr2d_runtime_suspend()
351 reset_control_bulk_acquire(gr2d->nresets, gr2d->resets); in gr2d_runtime_suspend()
352 reset_control_bulk_deassert(gr2d->nresets, gr2d->resets); in gr2d_runtime_suspend()
362 err = reset_control_bulk_acquire(gr2d->nresets, gr2d->resets); in gr2d_runtime_resume()
368 err = clk_prepare_enable(gr2d->clk); in gr2d_runtime_resume()
377 err = reset_control_bulk_deassert(gr2d->nresets, gr2d->resets); in gr2d_runtime_resume()
386 clk_disable_unprepare(gr2d->clk); in gr2d_runtime_resume()
388 reset_control_bulk_release(gr2d->nresets, gr2d->resets); in gr2d_runtime_resume()
401 .name = "tegra-gr2d",