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

Commit c0df4dc2 authored by Jordan Crouse's avatar Jordan Crouse Committed by Jeremy Gebben
Browse files

msm: kgsl: Fixup the idle_timer save/store functions



Use standard kernel functions to convert between jiffies and
milliseconds.

Change-Id: Ic0dedbad8244518ec77024aaae170736dec9b93a
Signed-off-by: default avatarJordan Crouse <jcrouse@codeaurora.org>
parent e29967ac
Loading
Loading
Loading
Loading
+12 −6
Original line number Diff line number Diff line
@@ -443,7 +443,6 @@ static ssize_t kgsl_pwrctrl_idle_timer_store(struct device *dev,
{
	unsigned int val = 0;
	struct kgsl_device *device = kgsl_device_from_dev(dev);
	const long div = 1000/HZ;
	int ret;

	if (device == NULL)
@@ -453,11 +452,19 @@ static ssize_t kgsl_pwrctrl_idle_timer_store(struct device *dev,
	if (ret)
		return ret;

	/*
	 * We don't quite accept a maximum of 0xFFFFFFFF due to internal jiffy
	 * math, so make sure the value falls within the largest offset we can
	 * deal with
	 */

	if (val > jiffies_to_usecs(MAX_JIFFY_OFFSET))
		return -EINVAL;

	mutex_lock(&device->mutex);

	/* Let the timeout be requested in ms, but convert to jiffies. */
	val /= div;
	device->pwrctrl.interval_timeout = val;
	device->pwrctrl.interval_timeout = msecs_to_jiffies(val);

	mutex_unlock(&device->mutex);

@@ -469,12 +476,11 @@ static ssize_t kgsl_pwrctrl_idle_timer_show(struct device *dev,
					char *buf)
{
	struct kgsl_device *device = kgsl_device_from_dev(dev);
	int mul = 1000/HZ;
	if (device == NULL)
		return 0;
	/* Show the idle_timeout converted to msec */
	return snprintf(buf, PAGE_SIZE, "%d\n",
		device->pwrctrl.interval_timeout * mul);
	return snprintf(buf, PAGE_SIZE, "%u\n",
		jiffies_to_msecs(device->pwrctrl.interval_timeout));
}

static ssize_t kgsl_pwrctrl_pmqos_latency_store(struct device *dev,
+1 −1
Original line number Diff line number Diff line
@@ -95,7 +95,7 @@ struct kgsl_pwrctrl {
	unsigned int max_pwrlevel;
	unsigned int min_pwrlevel;
	unsigned int num_pwrlevels;
	unsigned int interval_timeout;
	unsigned long interval_timeout;
	bool strtstp_sleepwake;
	struct regulator *gpu_reg;
	struct regulator *gpu_cx;