msm: kgsl: Toggle loop_en while disabling gx gdsc

When all sensors on GFX rail are bypassed/clamped in a certain window
after voltage settling it could cause CPR measurements to stall.
Toggle the loop_en bit, across disabling the gx gdsc, with a delay of
10 XO cycles before disabling gx gdsc.

Change-Id: I44ada515066c601a34f10993677195502fc9e341
Signed-off-by: Raghu Ananya Arabolu <rarabolu@codeaurora.org>
This commit is contained in:
Raghu Ananya Arabolu 2020-08-26 19:11:20 -07:00
commit a3e0f7fe0a
2 changed files with 18 additions and 0 deletions

View file

@ -1074,6 +1074,8 @@
#define A6XX_GPU_CC_GX_DOMAIN_MISC 0x24542
#define A6XX_GPU_CC_GX_DOMAIN_MISC3 0x24563
/* GPU CPR registers */
#define A6XX_GPU_CPR_FSM_CTL 0x26801
/* GPU RSC sequencer registers */
#define A6XX_GPU_RSCC_RSC_STATUS0_DRV0 0x00004

View file

@ -1672,11 +1672,27 @@ static void a6xx_gmu_pwrctrl_suspend(struct adreno_device *adreno_dev)
dev_err(&gmu->pdev->dev,
"suspend fail: gx enable %d\n", ret);
/*
* Toggle the loop_en bit, across disabling the gx gdsc,
* with a delay of 10 XO cycles before disabling gx
* gdsc. This is to prevent CPR measurements from
* failing.
*/
if (adreno_is_a660(adreno_dev)) {
gmu_core_regrmw(device, A6XX_GPU_CPR_FSM_CTL,
1, 0);
ndelay(520);
}
ret = regulator_disable(gmu->gx_gdsc);
if (ret)
dev_err(&gmu->pdev->dev,
"suspend fail: gx disable %d\n", ret);
if (adreno_is_a660(adreno_dev))
gmu_core_regrmw(device, A6XX_GPU_CPR_FSM_CTL,
1, 1);
if (a6xx_gmu_gx_is_on(device))
dev_err(&gmu->pdev->dev,
"gx is stuck on\n");