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

Commit a8f76a63 authored by Harshdeep Dhatt's avatar Harshdeep Dhatt
Browse files

msm: kgsl: Fix KGSL_PROP_PWRCTRL property for gmu based targets



This property is used to enable dcvs or disable both dcvs and slumber
using kgsl power state transitions. Since gmu or rgmu based targets
don't use the power states, add and use gmu core flag to enable and disable
slumber for those targets.

Change-Id: Iace3af9427c7b84509c9041604972cf14e7cd675
Signed-off-by: default avatarHarshdeep Dhatt <hdhatt@codeaurora.org>
parent dbfff929
Loading
Loading
Loading
Loading
+27 −5
Original line number Diff line number Diff line
@@ -2572,6 +2572,27 @@ int adreno_set_constraint(struct kgsl_device *device,
	return status;
}

static void adreno_force_on(struct adreno_device *adreno_dev)
{
	struct kgsl_device *device = KGSL_DEVICE(adreno_dev);

	if (gmu_core_isenabled(device)) {

		set_bit(GMU_DISABLE_SLUMBER, &device->gmu_core.flags);

		if (!adreno_active_count_get(adreno_dev))
			adreno_active_count_put(adreno_dev);

		return;
	}

	kgsl_pwrctrl_change_state(device, KGSL_STATE_ACTIVE);

	device->pwrctrl.ctrl_flags = KGSL_PWR_ON;

	adreno_fault_detect_stop(adreno_dev);
}

static int adreno_setproperty(struct kgsl_device_private *dev_priv,
				unsigned int type,
				void __user *value,
@@ -2596,6 +2617,10 @@ static int adreno_setproperty(struct kgsl_device_private *dev_priv,
			mutex_lock(&device->mutex);

			if (enable) {
				if (gmu_core_isenabled(device))
					clear_bit(GMU_DISABLE_SLUMBER,
						&device->gmu_core.flags);
				else
					device->pwrctrl.ctrl_flags = 0;

				if (!adreno_active_count_get(adreno_dev)) {
@@ -2605,10 +2630,7 @@ static int adreno_setproperty(struct kgsl_device_private *dev_priv,

				kgsl_pwrscale_enable(device);
			} else {
				kgsl_pwrctrl_change_state(device,
							KGSL_STATE_ACTIVE);
				device->pwrctrl.ctrl_flags = KGSL_PWR_ON;
				adreno_fault_detect_stop(adreno_dev);
				adreno_force_on(adreno_dev);
				kgsl_pwrscale_disable(device, true);
			}

+4 −0
Original line number Diff line number Diff line
@@ -3108,6 +3108,9 @@ static void gmu_idle_check(struct work_struct *work)

	mutex_lock(&device->mutex);

	if (test_bit(GMU_DISABLE_SLUMBER, &device->gmu_core.flags))
		goto done;

	if (!atomic_read(&device->active_cnt)) {
		if (test_bit(GMU_PRIV_GPU_STARTED, &gmu->flags))
			a6xx_power_off(adreno_dev);
@@ -3116,6 +3119,7 @@ static void gmu_idle_check(struct work_struct *work)
			jiffies + device->pwrctrl.interval_timeout);
	}

done:
	mutex_unlock(&device->mutex);
}

+4 −0
Original line number Diff line number Diff line
@@ -849,12 +849,16 @@ static void rgmu_idle_check(struct work_struct *work)

	mutex_lock(&device->mutex);

	if (test_bit(GMU_DISABLE_SLUMBER, &device->gmu_core.flags))
		goto done;

	if (!atomic_read(&device->active_cnt))
		a6xx_power_off(adreno_dev);
	else
		mod_timer(&device->idle_timer,
			jiffies + device->pwrctrl.interval_timeout);

done:
	mutex_unlock(&device->mutex);
}

+1 −0
Original line number Diff line number Diff line
@@ -39,6 +39,7 @@ enum gmu_core_flags {
	GMU_DCVS_REPLAY,
	GMU_ENABLED,
	GMU_RSCC_SLEEP_SEQ_DONE,
	GMU_DISABLE_SLUMBER,
};

/*