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

Commit 45ad584d authored by Raghu Ananya Arabolu's avatar Raghu Ananya Arabolu
Browse files

msm: kgsl: Modify gpu_max_clock sysfs node



The intent of the gpu_max_clock node is to set / show the maximum
GPU frequency. To accomplish this, set the max_pwrlevel instead of
thermal_pwrlevel when the gpu_max_clock node is set.

Change-Id: I90c5e638f22b363c60d351c8c78814df67b256a2
Signed-off-by: default avatarRaghu Ananya Arabolu <rarabolu@codeaurora.org>
parent da2e3647
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -919,7 +919,7 @@ static ssize_t _max_clock_mhz_show(struct kgsl_device *device, char *buf)
	struct kgsl_pwrctrl *pwr = &device->pwrctrl;

	return scnprintf(buf, PAGE_SIZE, "%d\n",
		pwr->pwrlevels[pwr->thermal_pwrlevel].gpu_freq / 1000000);
		pwr->pwrlevels[pwr->max_pwrlevel].gpu_freq / 1000000);
}

static ssize_t max_clock_mhz_show(struct device *dev,
@@ -935,6 +935,7 @@ static ssize_t _max_clock_mhz_store(struct kgsl_device *device,
{
	u32 freq;
	int ret, level;
	struct kgsl_pwrctrl *pwr = &device->pwrctrl;

	ret = kstrtou32(buf, 0, &freq);
	if (ret)
@@ -944,11 +945,11 @@ static ssize_t _max_clock_mhz_store(struct kgsl_device *device,
	if (level < 0)
		return level;

	/*
	 * Confusingly this node has been setting the thermal pwrlevel despite
	 * it's name
	 */
	kgsl_pwrctrl_set_thermal_pwrlevel(device, level);
	mutex_lock(&device->mutex);
	pwr->max_pwrlevel = min_t(unsigned int, level, pwr->min_pwrlevel);
	kgsl_pwrctrl_pwrlevel_change(device, pwr->active_pwrlevel);
	mutex_unlock(&device->mutex);

	return count;
}