提交 28b16229 编写于 作者: D Dmitry Osipenko 提交者: Thierry Reding

drm/tegra: nvdec: 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: NUlf Hansson <ulf.hansson@linaro.org>
Signed-off-by: NDmitry Osipenko <digetx@gmail.com>
Signed-off-by: NThierry Reding <treding@nvidia.com>
上级 1e15f5b9
...@@ -113,9 +113,13 @@ static int nvdec_init(struct host1x_client *client) ...@@ -113,9 +113,13 @@ static int nvdec_init(struct host1x_client *client)
goto free_channel; goto free_channel;
} }
pm_runtime_enable(client->dev);
pm_runtime_use_autosuspend(client->dev);
pm_runtime_set_autosuspend_delay(client->dev, 500);
err = tegra_drm_register_client(tegra, drm); err = tegra_drm_register_client(tegra, drm);
if (err < 0) if (err < 0)
goto free_syncpt; goto disable_rpm;
/* /*
* Inherit the DMA parameters (such as maximum segment size) from the * Inherit the DMA parameters (such as maximum segment size) from the
...@@ -125,7 +129,10 @@ static int nvdec_init(struct host1x_client *client) ...@@ -125,7 +129,10 @@ static int nvdec_init(struct host1x_client *client)
return 0; return 0;
free_syncpt: disable_rpm:
pm_runtime_dont_use_autosuspend(client->dev);
pm_runtime_force_suspend(client->dev);
host1x_syncpt_put(client->syncpts[0]); host1x_syncpt_put(client->syncpts[0]);
free_channel: free_channel:
host1x_channel_put(nvdec->channel); host1x_channel_put(nvdec->channel);
...@@ -150,10 +157,15 @@ static int nvdec_exit(struct host1x_client *client) ...@@ -150,10 +157,15 @@ static int nvdec_exit(struct host1x_client *client)
if (err < 0) if (err < 0)
return err; return err;
pm_runtime_dont_use_autosuspend(client->dev);
pm_runtime_force_suspend(client->dev);
host1x_syncpt_put(client->syncpts[0]); host1x_syncpt_put(client->syncpts[0]);
host1x_channel_put(nvdec->channel); host1x_channel_put(nvdec->channel);
host1x_client_iommu_detach(client); host1x_client_iommu_detach(client);
nvdec->channel = NULL;
if (client->group) { if (client->group) {
dma_unmap_single(nvdec->dev, nvdec->falcon.firmware.phys, dma_unmap_single(nvdec->dev, nvdec->falcon.firmware.phys,
nvdec->falcon.firmware.size, DMA_TO_DEVICE); nvdec->falcon.firmware.size, DMA_TO_DEVICE);
...@@ -268,6 +280,8 @@ static __maybe_unused int nvdec_runtime_suspend(struct device *dev) ...@@ -268,6 +280,8 @@ static __maybe_unused int nvdec_runtime_suspend(struct device *dev)
{ {
struct nvdec *nvdec = dev_get_drvdata(dev); struct nvdec *nvdec = dev_get_drvdata(dev);
host1x_channel_stop(nvdec->channel);
clk_disable_unprepare(nvdec->clk); clk_disable_unprepare(nvdec->clk);
return 0; return 0;
...@@ -412,10 +426,6 @@ static int nvdec_probe(struct platform_device *pdev) ...@@ -412,10 +426,6 @@ static int nvdec_probe(struct platform_device *pdev)
goto exit_falcon; goto exit_falcon;
} }
pm_runtime_enable(&pdev->dev);
pm_runtime_set_autosuspend_delay(&pdev->dev, 500);
pm_runtime_use_autosuspend(&pdev->dev);
return 0; return 0;
exit_falcon: exit_falcon:
...@@ -436,11 +446,6 @@ static int nvdec_remove(struct platform_device *pdev) ...@@ -436,11 +446,6 @@ static int nvdec_remove(struct platform_device *pdev)
return err; return err;
} }
if (pm_runtime_enabled(&pdev->dev))
pm_runtime_disable(&pdev->dev);
else
nvdec_runtime_suspend(&pdev->dev);
falcon_exit(&nvdec->falcon); falcon_exit(&nvdec->falcon);
return 0; return 0;
...@@ -448,6 +453,8 @@ static int nvdec_remove(struct platform_device *pdev) ...@@ -448,6 +453,8 @@ static int nvdec_remove(struct platform_device *pdev)
static const struct dev_pm_ops nvdec_pm_ops = { static const struct dev_pm_ops nvdec_pm_ops = {
SET_RUNTIME_PM_OPS(nvdec_runtime_suspend, nvdec_runtime_resume, NULL) SET_RUNTIME_PM_OPS(nvdec_runtime_suspend, nvdec_runtime_resume, NULL)
SET_SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend,
pm_runtime_force_resume)
}; };
struct platform_driver tegra_nvdec_driver = { struct platform_driver tegra_nvdec_driver = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册