Skip to content

Commit 1e15f5b

Browse files
digetxthierryreding
authored andcommitted
drm/tegra: vic: Stop channel on suspend
CDMA must be stopped before hardware is suspended. Add channel stopping to RPM suspend callback. Add system level suspend-resume callbacks. Runtime PM initialization is moved to host1x client init phase because RPM callback now uses host1x channel that is available only when host1x client is registered. Reviewed-by: Ulf Hansson <[email protected]> Signed-off-by: Dmitry Osipenko <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent 2421b20 commit 1e15f5b

File tree

1 file changed

+18
-18
lines changed
  • drivers/gpu/drm/tegra

1 file changed

+18
-18
lines changed

drivers/gpu/drm/tegra/vic.c

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -152,9 +152,13 @@ static int vic_init(struct host1x_client *client)
152152
goto free_channel;
153153
}
154154

155+
pm_runtime_enable(client->dev);
156+
pm_runtime_use_autosuspend(client->dev);
157+
pm_runtime_set_autosuspend_delay(client->dev, 500);
158+
155159
err = tegra_drm_register_client(tegra, drm);
156160
if (err < 0)
157-
goto free_syncpt;
161+
goto disable_rpm;
158162

159163
/*
160164
* Inherit the DMA parameters (such as maximum segment size) from the
@@ -164,7 +168,10 @@ static int vic_init(struct host1x_client *client)
164168

165169
return 0;
166170

167-
free_syncpt:
171+
disable_rpm:
172+
pm_runtime_dont_use_autosuspend(client->dev);
173+
pm_runtime_force_suspend(client->dev);
174+
168175
host1x_syncpt_put(client->syncpts[0]);
169176
free_channel:
170177
host1x_channel_put(vic->channel);
@@ -189,10 +196,15 @@ static int vic_exit(struct host1x_client *client)
189196
if (err < 0)
190197
return err;
191198

199+
pm_runtime_dont_use_autosuspend(client->dev);
200+
pm_runtime_force_suspend(client->dev);
201+
192202
host1x_syncpt_put(client->syncpts[0]);
193203
host1x_channel_put(vic->channel);
194204
host1x_client_iommu_detach(client);
195205

206+
vic->channel = NULL;
207+
196208
if (client->group) {
197209
dma_unmap_single(vic->dev, vic->falcon.firmware.phys,
198210
vic->falcon.firmware.size, DMA_TO_DEVICE);
@@ -316,6 +328,8 @@ static int vic_runtime_suspend(struct device *dev)
316328
struct vic *vic = dev_get_drvdata(dev);
317329
int err;
318330

331+
host1x_channel_stop(vic->channel);
332+
319333
err = reset_control_assert(vic->rst);
320334
if (err < 0)
321335
return err;
@@ -483,19 +497,8 @@ static int vic_probe(struct platform_device *pdev)
483497
goto exit_falcon;
484498
}
485499

486-
pm_runtime_enable(&pdev->dev);
487-
if (!pm_runtime_enabled(&pdev->dev)) {
488-
err = vic_runtime_resume(&pdev->dev);
489-
if (err < 0)
490-
goto unregister_client;
491-
}
492-
pm_runtime_set_autosuspend_delay(&pdev->dev, 500);
493-
pm_runtime_use_autosuspend(&pdev->dev);
494-
495500
return 0;
496501

497-
unregister_client:
498-
host1x_client_unregister(&vic->client.base);
499502
exit_falcon:
500503
falcon_exit(&vic->falcon);
501504

@@ -514,18 +517,15 @@ static int vic_remove(struct platform_device *pdev)
514517
return err;
515518
}
516519

517-
if (pm_runtime_enabled(&pdev->dev))
518-
pm_runtime_disable(&pdev->dev);
519-
else
520-
vic_runtime_suspend(&pdev->dev);
521-
522520
falcon_exit(&vic->falcon);
523521

524522
return 0;
525523
}
526524

527525
static const struct dev_pm_ops vic_pm_ops = {
528526
SET_RUNTIME_PM_OPS(vic_runtime_suspend, vic_runtime_resume, NULL)
527+
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
528+
pm_runtime_force_resume)
529529
};
530530

531531
struct platform_driver tegra_vic_driver = {

0 commit comments

Comments
 (0)