summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm
diff options
context:
space:
mode:
authorJordan Crouse <jcrouse@codeaurora.org>2017-02-13 10:14:33 -0700
committerJordan Crouse <jcrouse@codeaurora.org>2017-02-22 09:52:33 -0700
commit8b98ed8588a7a5db1b4bf85c798aa8f653de497a (patch)
treecebabc02d2f5e3d10bf8247f3dc70e7eb50aad3a /drivers/gpu/drm
parent9f8cd5dfb437c689b563c6e9a2d3d4316655ab28 (diff)
drm/msm: Enable pm_runtime for the GPU
Enable pm_runtime for the GPU to keep power collapse from hitting us while we expect the GPU to be powered. Change-Id: Ic0dedbad693f1d01776a87bc7a145a65510ac3fb Signed-off-by: Jordan Crouse <jcrouse@codeaurora.org>
Diffstat (limited to 'drivers/gpu/drm')
-rw-r--r--drivers/gpu/drm/msm/msm_gpu.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/gpu/drm/msm/msm_gpu.c b/drivers/gpu/drm/msm/msm_gpu.c
index 3fb480f41fde..3176f301e7a8 100644
--- a/drivers/gpu/drm/msm/msm_gpu.c
+++ b/drivers/gpu/drm/msm/msm_gpu.c
@@ -155,6 +155,8 @@ static int disable_axi(struct msm_gpu *gpu)
int msm_gpu_pm_resume(struct msm_gpu *gpu)
{
struct drm_device *dev = gpu->dev;
+ struct msm_drm_private *priv = dev->dev_private;
+ struct platform_device *pdev = priv->gpu_pdev;
int ret;
DBG("%s: active_cnt=%d", gpu->name, gpu->active_cnt);
@@ -167,6 +169,8 @@ int msm_gpu_pm_resume(struct msm_gpu *gpu)
if (WARN_ON(gpu->active_cnt <= 0))
return -EINVAL;
+ WARN_ON(pm_runtime_get_sync(&pdev->dev) < 0);
+
ret = enable_pwrrail(gpu);
if (ret)
return ret;
@@ -185,6 +189,8 @@ int msm_gpu_pm_resume(struct msm_gpu *gpu)
int msm_gpu_pm_suspend(struct msm_gpu *gpu)
{
struct drm_device *dev = gpu->dev;
+ struct msm_drm_private *priv = dev->dev_private;
+ struct platform_device *pdev = priv->gpu_pdev;
int ret;
DBG("%s: active_cnt=%d", gpu->name, gpu->active_cnt);
@@ -209,6 +215,7 @@ int msm_gpu_pm_suspend(struct msm_gpu *gpu)
if (ret)
return ret;
+ pm_runtime_put(&pdev->dev);
return 0;
}
@@ -685,6 +692,8 @@ int msm_gpu_init(struct drm_device *drm, struct platform_device *pdev,
goto fail;
}
+ pm_runtime_enable(&pdev->dev);
+
ret = get_clocks(pdev, gpu);
if (ret)
goto fail;
@@ -776,11 +785,15 @@ fail:
msm_ringbuffer_destroy(gpu->rb[i]);
}
+ pm_runtime_disable(&pdev->dev);
return ret;
}
void msm_gpu_cleanup(struct msm_gpu *gpu)
{
+ struct drm_device *dev = gpu->dev;
+ struct msm_drm_private *priv = dev->dev_private;
+ struct platform_device *pdev = priv->gpu_pdev;
int i;
DBG("%s", gpu->name);
@@ -800,4 +813,5 @@ void msm_gpu_cleanup(struct msm_gpu *gpu)
}
msm_snapshot_destroy(gpu, gpu->snapshot);
+ pm_runtime_disable(&pdev->dev);
}