From 65172415d18c437a8e1a4e3bd7aecb74786663ee Mon Sep 17 00:00:00 2001 From: Harshdeep Dhatt Date: Sat, 8 Aug 2020 14:43:24 -0600 Subject: [PATCH] msm: kgsl: Add suspend_context to gmu based targets This needs to be explicitly added to the new slumber entry sequence for gmu and rgmu based targets. Change-Id: I582067d065b1c58cab3d1d149292dd94e182bd66 Signed-off-by: Harshdeep Dhatt --- drivers/gpu/msm/adreno.c | 2 +- drivers/gpu/msm/adreno.h | 11 +++++++++++ drivers/gpu/msm/adreno_a6xx_gmu.c | 2 ++ drivers/gpu/msm/adreno_a6xx_rgmu.c | 2 ++ 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/msm/adreno.c b/drivers/gpu/msm/adreno.c index ab4aa761f4c5..b4e8bbcea393 100644 --- a/drivers/gpu/msm/adreno.c +++ b/drivers/gpu/msm/adreno.c @@ -2927,7 +2927,7 @@ static int adreno_drain(struct kgsl_device *device) } /* Caller must hold the device mutex. */ -static int adreno_suspend_context(struct kgsl_device *device) +int adreno_suspend_context(struct kgsl_device *device) { /* process any profiling results that are available */ adreno_profile_process_results(ADRENO_DEVICE(device)); diff --git a/drivers/gpu/msm/adreno.h b/drivers/gpu/msm/adreno.h index c5ad9d41038d..5a4e39d1d075 100644 --- a/drivers/gpu/msm/adreno.h +++ b/drivers/gpu/msm/adreno.h @@ -1912,4 +1912,15 @@ void adreno_clear_dcvs_counters(struct adreno_device *adreno_dev); * Set the gmu fault and take snapshot when we hit a gmu fault */ void gmu_fault_snapshot(struct kgsl_device *device); + +/** + * adreno_suspend_context - Make sure device is idle + * @device: Pointer to the kgsl device + * + * This function processes the profiling results and checks if the + * device is idle so that it can be turned off safely + * + * Return: 0 on success or negative error on failure + */ +int adreno_suspend_context(struct kgsl_device *device); #endif /*__ADRENO_H */ diff --git a/drivers/gpu/msm/adreno_a6xx_gmu.c b/drivers/gpu/msm/adreno_a6xx_gmu.c index 3ac50f63588b..45ef842e329b 100644 --- a/drivers/gpu/msm/adreno_a6xx_gmu.c +++ b/drivers/gpu/msm/adreno_a6xx_gmu.c @@ -3048,6 +3048,8 @@ static int a6xx_power_off(struct adreno_device *adreno_dev) trace_kgsl_pwr_request_state(device, KGSL_STATE_SLUMBER); + adreno_suspend_context(device); + ret = a6xx_gmu_oob_set(device, oob_gpu); if (ret) { a6xx_gmu_oob_clear(device, oob_gpu); diff --git a/drivers/gpu/msm/adreno_a6xx_rgmu.c b/drivers/gpu/msm/adreno_a6xx_rgmu.c index a4b5a4daa8af..dd312269c080 100644 --- a/drivers/gpu/msm/adreno_a6xx_rgmu.c +++ b/drivers/gpu/msm/adreno_a6xx_rgmu.c @@ -1042,6 +1042,8 @@ static int a6xx_power_off(struct adreno_device *adreno_dev) trace_kgsl_pwr_request_state(device, KGSL_STATE_SLUMBER); + adreno_suspend_context(device); + ret = a6xx_rgmu_oob_set(device, oob_gpu); if (ret) { a6xx_rgmu_oob_clear(device, oob_gpu);