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

Commit 3d5ebabe authored by Harshdeep Dhatt's avatar Harshdeep Dhatt
Browse files

msm: kgsl: Fix kgsl_state_is_awake for gmu targets



KGSL_STATE_AWARE has worked for non gmu targets to indicate that
power and clocks are on. Set the KGSL_STATE_AWARE once gmu clocks
and power is turned on and clear it when clocks and power is turned
off.

Change-Id: I6be046ca2a076b24bc6708c88bf9637276df2244
Signed-off-by: default avatarHarshdeep Dhatt <hdhatt@codeaurora.org>
parent c832a7c9
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -1691,6 +1691,7 @@ static int a6xx_gmu_notify_slumber(struct adreno_device *adreno_dev)
static void a6xx_gmu_suspend(struct adreno_device *adreno_dev)
{
	struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);

	a6xx_gmu_irq_disable(adreno_dev);

@@ -1708,6 +1709,8 @@ static void a6xx_gmu_suspend(struct adreno_device *adreno_dev)
		regulator_set_mode(gmu->cx_gdsc, REGULATOR_MODE_NORMAL);

	dev_err(&gmu->pdev->dev, "Suspended GMU\n");

	device->state = KGSL_STATE_NONE;
}

static int a6xx_gmu_dcvs_set(struct adreno_device *adreno_dev,
@@ -2049,6 +2052,7 @@ static int a6xx_gmu_clk_set_rate(struct a6xx_gmu_device *gmu, const char *id,
static int a6xx_gmu_enable_clks(struct adreno_device *adreno_dev)
{
	struct a6xx_gmu_device *gmu = to_a6xx_gmu(adreno_dev);
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);
	int ret;

	ret = a6xx_gmu_clk_set_rate(gmu, "gmu_clk", GMU_FREQUENCY);
@@ -2069,6 +2073,8 @@ static int a6xx_gmu_enable_clks(struct adreno_device *adreno_dev)
		return ret;
	}

	device->state = KGSL_STATE_AWARE;

	return 0;
}

@@ -2740,6 +2746,8 @@ static int a6xx_gmu_power_off(struct adreno_device *adreno_dev)
	if (!kgsl_regulator_disable_wait(gmu->cx_gdsc, 5000))
		dev_err(&gmu->pdev->dev, "GMU CX gdsc off timeout\n");

	device->state = KGSL_STATE_NONE;

	return ret;

error:
@@ -3014,8 +3022,6 @@ static int a6xx_power_off(struct adreno_device *adreno_dev)

	clear_bit(GMU_PRIV_GPU_STARTED, &gmu->flags);

	device->state = KGSL_STATE_NONE;

	del_timer_sync(&device->idle_timer);

	kgsl_pwrscale_sleep(device);
+6 −2
Original line number Diff line number Diff line
@@ -508,12 +508,16 @@ static void a6xx_rgmu_disable_clks(struct adreno_device *adreno_dev)
static int a6xx_rgmu_disable_gdsc(struct adreno_device *adreno_dev)
{
	struct a6xx_rgmu_device *rgmu = to_a6xx_rgmu(adreno_dev);
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);

	/* Wait up to 5 seconds for the regulator to go off */
	if (kgsl_regulator_disable_wait(rgmu->cx_gdsc, 5000))
		return 0;

	dev_err(&rgmu->pdev->dev, "RGMU CX gdsc off timeout\n");

	device->state = KGSL_STATE_NONE;

	return -ETIMEDOUT;
}

@@ -579,6 +583,8 @@ static int a6xx_rgmu_enable_clks(struct adreno_device *adreno_dev)
		return ret;
	}

	device->state = KGSL_STATE_AWARE;

	return 0;
}

@@ -1051,8 +1057,6 @@ static int a6xx_power_off(struct adreno_device *adreno_dev)

	clear_bit(RGMU_PRIV_GPU_STARTED, &rgmu->flags);

	device->state = KGSL_STATE_NONE;

	del_timer_sync(&device->idle_timer);

	kgsl_pwrscale_sleep(device);
+0 −3
Original line number Diff line number Diff line
@@ -592,9 +592,6 @@ static inline int kgsl_state_is_awake(struct kgsl_device *device)
	if (device->state == KGSL_STATE_ACTIVE ||
		device->state == KGSL_STATE_AWARE)
		return true;
	else if (gmu_core_isenabled(device) &&
			test_bit(GMU_CLK_ON, &device->gmu_core.flags))
		return true;
	else
		return false;
}
+0 −1
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ enum gmu_core_boot {
/* Bits for the flags field in the gmu structure */
enum gmu_core_flags {
	GMU_BOOT_INIT_DONE = 0,
	GMU_CLK_ON,
	GMU_HFI_ON,
	GMU_FAULT,
	GMU_DCVS_REPLAY,