summaryrefslogtreecommitdiff
path: root/drivers/gpu
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2017-02-23 21:35:12 -0800
committerGerrit - the friendly Code Review server <code-review@localhost>2017-02-23 21:35:12 -0800
commitf7e36cc6213394167f2744cdfebd3af69e8c226b (patch)
treec732e5d6ca429bdb5e48228228a5d25507b6c28a /drivers/gpu
parentef49b42e4abb3f8c6f8a81d794332f078aeaea2a (diff)
parente5de360e6f33eaa30f1c1d1016e54a6720d919ac (diff)
Merge "drm/msm: Come out of secure before executing GPMU initialization"
Diffstat (limited to 'drivers/gpu')
-rw-r--r--drivers/gpu/drm/msm/adreno/a5xx_gpu.c10
-rw-r--r--drivers/gpu/drm/msm/adreno/a5xx_power.c13
-rw-r--r--drivers/gpu/drm/msm/msm_gpu.c14
3 files changed, 27 insertions, 10 deletions
diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index a49a7b247547..9049bf2aa68b 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -744,10 +744,6 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
if (ret)
return ret;
- ret = a5xx_power_init(gpu);
- if (ret)
- return ret;
-
/*
* Send a pipeline event stat to get misbehaving counters to start
* ticking correctly
@@ -785,6 +781,12 @@ static int a5xx_hw_init(struct msm_gpu *gpu)
gpu_write(gpu, REG_A5XX_RBBM_SECVID_TRUST_CNTL, 0x0);
}
+ /* Next, start the power */
+ ret = a5xx_power_init(gpu);
+ if (ret)
+ return ret;
+
+
/* Last step - yield the ringbuffer */
a5xx_preempt_start(gpu);
diff --git a/drivers/gpu/drm/msm/adreno/a5xx_power.c b/drivers/gpu/drm/msm/adreno/a5xx_power.c
index 2040b18f731f..e77592e2272b 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_power.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_power.c
@@ -1,4 +1,4 @@
-/* Copyright (c) 2016 The Linux Foundation. All rights reserved.
+/* Copyright (c) 2016-2017 The Linux Foundation. All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 and
@@ -250,8 +250,9 @@ static int a5xx_gpmu_init(struct msm_gpu *gpu)
gpu->funcs->flush(gpu, ring);
+ /* This is "fatal" because the CP is left in a bad state */
if (!a5xx_idle(gpu, ring)) {
- DRM_ERROR("%s: Unable to load GPMU firmware. GPMU will not be active\n",
+ DRM_ERROR("%s: Unable to load GPMU firmwaren",
gpu->name);
return -EINVAL;
}
@@ -268,18 +269,18 @@ static int a5xx_gpmu_init(struct msm_gpu *gpu)
* won't have advanced power collapse.
*/
if (spin_usecs(gpu, 25, REG_A5XX_GPMU_GENERAL_0, 0xFFFFFFFF,
- 0xBABEFACE))
+ 0xBABEFACE)) {
DRM_ERROR("%s: GPMU firmware initialization timed out\n",
gpu->name);
+ return 0;
+ }
if (!adreno_is_a530(adreno_gpu)) {
u32 val = gpu_read(gpu, REG_A5XX_GPMU_GENERAL_1);
- if (val) {
+ if (val)
DRM_ERROR("%s: GPMU firmare initialization failed: %d\n",
gpu->name, val);
- return -EIO;
- }
}
/* FIXME: Clear GPMU interrupts? */
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);
}