Lines Matching +full:host1x +full:- +full:class
1 // SPDX-License-Identifier: GPL-2.0-only
8 #include <linux/host1x.h>
46 struct drm_device *dev = dev_get_drvdata(client->host); in gr3d_init()
51 gr3d->channel = host1x_channel_request(client); in gr3d_init()
52 if (!gr3d->channel) in gr3d_init()
53 return -ENOMEM; in gr3d_init()
55 client->syncpts[0] = host1x_syncpt_request(client, flags); in gr3d_init()
56 if (!client->syncpts[0]) { in gr3d_init()
57 err = -ENOMEM; in gr3d_init()
58 dev_err(client->dev, "failed to request syncpoint: %d\n", err); in gr3d_init()
64 dev_err(client->dev, "failed to attach to domain: %d\n", err); in gr3d_init()
68 err = tegra_drm_register_client(dev->dev_private, drm); in gr3d_init()
70 dev_err(client->dev, "failed to register client: %d\n", err); in gr3d_init()
79 host1x_syncpt_free(client->syncpts[0]); in gr3d_init()
81 host1x_channel_put(gr3d->channel); in gr3d_init()
88 struct drm_device *dev = dev_get_drvdata(client->host); in gr3d_exit()
92 err = tegra_drm_unregister_client(dev->dev_private, drm); in gr3d_exit()
97 host1x_syncpt_free(client->syncpts[0]); in gr3d_exit()
98 host1x_channel_put(gr3d->channel); in gr3d_exit()
113 context->channel = host1x_channel_get(gr3d->channel); in gr3d_open_channel()
114 if (!context->channel) in gr3d_open_channel()
115 return -ENOMEM; in gr3d_open_channel()
122 host1x_channel_put(context->channel); in gr3d_close_channel()
125 static int gr3d_is_addr_reg(struct device *dev, u32 class, u32 offset) in gr3d_is_addr_reg() argument
129 switch (class) { in gr3d_is_addr_reg()
140 if (test_bit(offset, gr3d->addr_regs)) in gr3d_is_addr_reg()
169 { .compatible = "nvidia,tegra114-gr3d", .data = &tegra114_gr3d_soc },
170 { .compatible = "nvidia,tegra30-gr3d", .data = &tegra30_gr3d_soc },
171 { .compatible = "nvidia,tegra20-gr3d", .data = &tegra20_gr3d_soc },
283 struct device_node *np = pdev->dev.of_node; in gr3d_probe()
289 gr3d = devm_kzalloc(&pdev->dev, sizeof(*gr3d), GFP_KERNEL); in gr3d_probe()
291 return -ENOMEM; in gr3d_probe()
293 gr3d->soc = of_device_get_match_data(&pdev->dev); in gr3d_probe()
295 syncpts = devm_kzalloc(&pdev->dev, sizeof(*syncpts), GFP_KERNEL); in gr3d_probe()
297 return -ENOMEM; in gr3d_probe()
299 gr3d->clk = devm_clk_get(&pdev->dev, NULL); in gr3d_probe()
300 if (IS_ERR(gr3d->clk)) { in gr3d_probe()
301 dev_err(&pdev->dev, "cannot get clock\n"); in gr3d_probe()
302 return PTR_ERR(gr3d->clk); in gr3d_probe()
305 gr3d->rst = devm_reset_control_get(&pdev->dev, "3d"); in gr3d_probe()
306 if (IS_ERR(gr3d->rst)) { in gr3d_probe()
307 dev_err(&pdev->dev, "cannot get reset\n"); in gr3d_probe()
308 return PTR_ERR(gr3d->rst); in gr3d_probe()
311 if (of_device_is_compatible(np, "nvidia,tegra30-gr3d")) { in gr3d_probe()
312 gr3d->clk_secondary = devm_clk_get(&pdev->dev, "3d2"); in gr3d_probe()
313 if (IS_ERR(gr3d->clk_secondary)) { in gr3d_probe()
314 dev_err(&pdev->dev, "cannot get secondary clock\n"); in gr3d_probe()
315 return PTR_ERR(gr3d->clk_secondary); in gr3d_probe()
318 gr3d->rst_secondary = devm_reset_control_get(&pdev->dev, in gr3d_probe()
320 if (IS_ERR(gr3d->rst_secondary)) { in gr3d_probe()
321 dev_err(&pdev->dev, "cannot get secondary reset\n"); in gr3d_probe()
322 return PTR_ERR(gr3d->rst_secondary); in gr3d_probe()
326 err = tegra_powergate_sequence_power_up(TEGRA_POWERGATE_3D, gr3d->clk, in gr3d_probe()
327 gr3d->rst); in gr3d_probe()
329 dev_err(&pdev->dev, "failed to power up 3D unit\n"); in gr3d_probe()
333 if (gr3d->clk_secondary) { in gr3d_probe()
335 gr3d->clk_secondary, in gr3d_probe()
336 gr3d->rst_secondary); in gr3d_probe()
338 dev_err(&pdev->dev, in gr3d_probe()
344 INIT_LIST_HEAD(&gr3d->client.base.list); in gr3d_probe()
345 gr3d->client.base.ops = &gr3d_client_ops; in gr3d_probe()
346 gr3d->client.base.dev = &pdev->dev; in gr3d_probe()
347 gr3d->client.base.class = HOST1X_CLASS_GR3D; in gr3d_probe()
348 gr3d->client.base.syncpts = syncpts; in gr3d_probe()
349 gr3d->client.base.num_syncpts = 1; in gr3d_probe()
351 INIT_LIST_HEAD(&gr3d->client.list); in gr3d_probe()
352 gr3d->client.version = gr3d->soc->version; in gr3d_probe()
353 gr3d->client.ops = &gr3d_ops; in gr3d_probe()
355 err = host1x_client_register(&gr3d->client.base); in gr3d_probe()
357 dev_err(&pdev->dev, "failed to register host1x client: %d\n", in gr3d_probe()
364 set_bit(gr3d_addr_regs[i], gr3d->addr_regs); in gr3d_probe()
376 err = host1x_client_unregister(&gr3d->client.base); in gr3d_remove()
378 dev_err(&pdev->dev, "failed to unregister host1x client: %d\n", in gr3d_remove()
383 if (gr3d->clk_secondary) { in gr3d_remove()
384 reset_control_assert(gr3d->rst_secondary); in gr3d_remove()
386 clk_disable_unprepare(gr3d->clk_secondary); in gr3d_remove()
389 reset_control_assert(gr3d->rst); in gr3d_remove()
391 clk_disable_unprepare(gr3d->clk); in gr3d_remove()
398 .name = "tegra-gr3d",