summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSharat Masetty <smasetty@codeaurora.org>2017-08-17 11:10:41 +0530
committerSharat Masetty <smasetty@codeaurora.org>2017-08-18 10:48:27 +0530
commit93f66037edbc5135becbb961e96131e3febf2708 (patch)
tree7c42b915edbc47eba4af6f0bc7c650dadee5bc91
parenta49bb61510b938152025049730fa922c5da950a1 (diff)
drm/msm: Set memory retention flags on the GPU core clock
After enabling the GPU clocks, the GPU can pagefault when trying to access memory(example the ringbuffer). This patch addresses the pagefault issue by enabling the memory retention flags on the GPU core clock. Change-Id: Ibabecba77501d6a3b188b19c90c172de7d667c8c Signed-off-by: Sharat Masetty <smasetty@codeaurora.org>
-rw-r--r--drivers/gpu/drm/msm/adreno/a5xx_gpu.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
index 45a38b247727..765c1c087c76 100644
--- a/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
+++ b/drivers/gpu/drm/msm/adreno/a5xx_gpu.c
@@ -15,6 +15,7 @@
#include "msm_iommu.h"
#include "msm_trace.h"
#include "a5xx_gpu.h"
+#include <linux/clk/msm-clk.h>
#define SECURE_VA_START 0xc0000000
#define SECURE_VA_SIZE SZ_256M
@@ -1169,6 +1170,17 @@ static int a5xx_pm_resume(struct msm_gpu *gpu)
{
int ret;
+ /*
+ * Between suspend/resumes the GPU clocks need to be turned off
+ * but not a complete power down, typically between frames. Set the
+ * memory retention flags on the GPU core clock to retain memory
+ * across clock toggles.
+ */
+ if (gpu->core_clk) {
+ clk_set_flags(gpu->core_clk, CLKFLAG_RETAIN_PERIPH);
+ clk_set_flags(gpu->core_clk, CLKFLAG_RETAIN_MEM);
+ }
+
/* Turn on the core power */
ret = msm_gpu_pm_resume(gpu);
if (ret)
@@ -1208,6 +1220,12 @@ static int a5xx_pm_suspend(struct msm_gpu *gpu)
{
struct adreno_gpu *adreno_gpu = to_adreno_gpu(gpu);
+ /* Turn off the memory retention flag when not necessary */
+ if (gpu->core_clk) {
+ clk_set_flags(gpu->core_clk, CLKFLAG_NORETAIN_PERIPH);
+ clk_set_flags(gpu->core_clk, CLKFLAG_NORETAIN_MEM);
+ }
+
/* Only do this next bit if we are about to go down */
if (gpu->active_cnt == 1) {
/* Clear the VBIF pipe before shutting down */