Merge "msm: kgsl: Ensure GPU gdscs are off in SLUMBER and during hard reset"

tirimbino
qctecmdr 6 years ago committed by Gerrit - the friendly Code Review server
commit e2e5fb8aff
  1. 32
      drivers/gpu/msm/adreno.c

@ -3976,6 +3976,9 @@ static void adreno_iommu_sync(struct kgsl_device *device, bool sync)
struct scm_desc desc = {0};
int ret;
if (!ADRENO_QUIRK(ADRENO_DEVICE(device), ADRENO_QUIRK_IOMMU_SYNC))
return;
if (sync == true) {
mutex_lock(&kgsl_mmu_sync);
desc.args[0] = true;
@ -3992,25 +3995,29 @@ static void adreno_iommu_sync(struct kgsl_device *device, bool sync)
}
}
static void _regulator_disable(struct kgsl_regulator *regulator, bool poll)
static void
_regulator_disable(struct kgsl_regulator *regulator, unsigned int timeout)
{
unsigned long wait_time = jiffies + msecs_to_jiffies(200);
unsigned long wait_time;
if (IS_ERR_OR_NULL(regulator->reg))
return;
regulator_disable(regulator->reg);
if (poll == false)
return;
wait_time = jiffies + msecs_to_jiffies(timeout);
/* Poll for regulator status to ensure it's OFF */
while (!time_after(jiffies, wait_time)) {
if (!regulator_is_enabled(regulator->reg))
return;
cpu_relax();
usleep_range(10, 100);
}
KGSL_CORE_ERR("regulator '%s' still on after 200ms\n", regulator->name);
if (!regulator_is_enabled(regulator->reg))
return;
KGSL_CORE_ERR("regulator '%s' disable timed out\n", regulator->name);
}
static void adreno_regulator_disable_poll(struct kgsl_device *device)
@ -4018,18 +4025,13 @@ static void adreno_regulator_disable_poll(struct kgsl_device *device)
struct adreno_device *adreno_dev = ADRENO_DEVICE(device);
struct kgsl_pwrctrl *pwr = &device->pwrctrl;
int i;
/* Fast path - hopefully we don't need this quirk */
if (!ADRENO_QUIRK(adreno_dev, ADRENO_QUIRK_IOMMU_SYNC)) {
for (i = KGSL_MAX_REGULATORS - 1; i >= 0; i--)
_regulator_disable(&pwr->regulators[i], false);
return;
}
unsigned int timeout =
ADRENO_QUIRK(adreno_dev, ADRENO_QUIRK_IOMMU_SYNC) ? 200 : 5000;
adreno_iommu_sync(device, true);
for (i = 0; i < KGSL_MAX_REGULATORS; i++)
_regulator_disable(&pwr->regulators[i], true);
for (i = KGSL_MAX_REGULATORS - 1; i >= 0; i--)
_regulator_disable(&pwr->regulators[i], timeout);
adreno_iommu_sync(device, false);
}

Loading…
Cancel
Save