gr3d.c (5c1b19b45a22820e9570da58415ebffa61e28741) gr3d.c (62fa0a985e2c99f716688e6bfbc37338a283a301)
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) 2013 Avionic Design GmbH
4 * Copyright (C) 2013 NVIDIA Corporation
5 */
6
7#include <linux/clk.h>
8#include <linux/delay.h>

--- 66 unchanged lines hidden (view full) ---

75 }
76
77 err = host1x_client_iommu_attach(client);
78 if (err < 0) {
79 dev_err(client->dev, "failed to attach to domain: %d\n", err);
80 goto free;
81 }
82
1// SPDX-License-Identifier: GPL-2.0-only
2/*
3 * Copyright (C) 2013 Avionic Design GmbH
4 * Copyright (C) 2013 NVIDIA Corporation
5 */
6
7#include <linux/clk.h>
8#include <linux/delay.h>

--- 66 unchanged lines hidden (view full) ---

75 }
76
77 err = host1x_client_iommu_attach(client);
78 if (err < 0) {
79 dev_err(client->dev, "failed to attach to domain: %d\n", err);
80 goto free;
81 }
82
83 pm_runtime_enable(client->dev);
84 pm_runtime_use_autosuspend(client->dev);
85 pm_runtime_set_autosuspend_delay(client->dev, 200);
86
87 err = tegra_drm_register_client(dev->dev_private, drm);
88 if (err < 0) {
89 dev_err(client->dev, "failed to register client: %d\n", err);
83 err = tegra_drm_register_client(dev->dev_private, drm);
84 if (err < 0) {
85 dev_err(client->dev, "failed to register client: %d\n", err);
90 goto disable_rpm;
86 goto detach_iommu;
91 }
92
93 return 0;
94
87 }
88
89 return 0;
90
95disable_rpm:
96 pm_runtime_dont_use_autosuspend(client->dev);
97 pm_runtime_force_suspend(client->dev);
98
91detach_iommu:
99 host1x_client_iommu_detach(client);
100free:
101 host1x_syncpt_put(client->syncpts[0]);
102put:
103 host1x_channel_put(gr3d->channel);
104 return err;
105}
106

--- 442 unchanged lines hidden (view full) ---

549
550 return 0;
551}
552
553static void gr3d_remove(struct platform_device *pdev)
554{
555 struct gr3d *gr3d = platform_get_drvdata(pdev);
556
92 host1x_client_iommu_detach(client);
93free:
94 host1x_syncpt_put(client->syncpts[0]);
95put:
96 host1x_channel_put(gr3d->channel);
97 return err;
98}
99

--- 442 unchanged lines hidden (view full) ---

542
543 return 0;
544}
545
546static void gr3d_remove(struct platform_device *pdev)
547{
548 struct gr3d *gr3d = platform_get_drvdata(pdev);
549
550 pm_runtime_disable(&pdev->dev);
557 host1x_client_unregister(&gr3d->client.base);
558}
559
560static int __maybe_unused gr3d_runtime_suspend(struct device *dev)
561{
562 struct gr3d *gr3d = dev_get_drvdata(dev);
563 int err;
564

--- 37 unchanged lines hidden (view full) ---

602 }
603
604 err = reset_control_bulk_deassert(gr3d->nresets, gr3d->resets);
605 if (err) {
606 dev_err(dev, "failed to deassert reset: %d\n", err);
607 goto disable_clk;
608 }
609
551 host1x_client_unregister(&gr3d->client.base);
552}
553
554static int __maybe_unused gr3d_runtime_suspend(struct device *dev)
555{
556 struct gr3d *gr3d = dev_get_drvdata(dev);
557 int err;
558

--- 37 unchanged lines hidden (view full) ---

596 }
597
598 err = reset_control_bulk_deassert(gr3d->nresets, gr3d->resets);
599 if (err) {
600 dev_err(dev, "failed to deassert reset: %d\n", err);
601 goto disable_clk;
602 }
603
604 pm_runtime_enable(dev);
605 pm_runtime_use_autosuspend(dev);
606 pm_runtime_set_autosuspend_delay(dev, 500);
607
610 return 0;
611
612disable_clk:
613 clk_bulk_disable_unprepare(gr3d->nclocks, gr3d->clocks);
614release_reset:
615 reset_control_bulk_release(gr3d->nresets, gr3d->resets);
616
617 return err;

--- 17 unchanged lines hidden ---
608 return 0;
609
610disable_clk:
611 clk_bulk_disable_unprepare(gr3d->nclocks, gr3d->clocks);
612release_reset:
613 reset_control_bulk_release(gr3d->nresets, gr3d->resets);
614
615 return err;

--- 17 unchanged lines hidden ---