Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 433b0c79 authored by George Shen's avatar George Shen
Browse files

msm: kgsl: Ensure GFX CX GDSC off in SLUMBER



Polls CX GDSC status to ensure it's off before transitioning
to SLUMBER (GPU power collapse) state.

CRs-Fixed: 2017390
Change-Id: I7594f8d5ddec00bdb7cc90a5000e963e56065f9b
Signed-off-by: default avatarGeorge Shen <sqiao@codeaurora.org>
parent 92b0fef6
Loading
Loading
Loading
Loading
+21 −2
Original line number Diff line number Diff line
@@ -1238,21 +1238,40 @@ static int gmu_enable_gdsc(struct gmu_device *gmu)
	return ret;
}

#define CX_GDSC_TIMEOUT	10	/* ms */
static int gmu_disable_gdsc(struct gmu_device *gmu)
{
	int ret;
	unsigned long t;

	if (IS_ERR_OR_NULL(gmu->cx_gdsc))
		return 0;

	ret = regulator_disable(gmu->cx_gdsc);
	if (ret)
	if (ret) {
		dev_err(&gmu->pdev->dev,
			"Failed to disable GMU CX gdsc, error %d\n", ret);

		return ret;
	}

	/*
	 * After GX GDSC is off, CX GDSC must be off
	 * Voting off alone from GPU driver cannot
	 * Guarantee CX GDSC off. Polling with 10ms
	 * timeout to ensure
	 */
	t = jiffies + msecs_to_jiffies(CX_GDSC_TIMEOUT);
	do {
		if (!regulator_is_enabled(gmu->cx_gdsc))
			return 0;
		udelay(100);

	} while (!(time_after(jiffies, t)));

	dev_err(&gmu->pdev->dev, "GMU CX gdsc off timeout");
	return -ETIMEDOUT;
}

static int gmu_fast_boot(struct kgsl_device *device)
{
	int ret;