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

Commit bd0eb61c authored by Lucille Sylvester's avatar Lucille Sylvester Committed by Gerrit - the friendly Code Review server
Browse files

msm: kgsl: Allow run time control of bus modification



Add a "bus_split" variable to sysfs.  When it is set to 1 the
bus calculation will run normally.  When set to 0 the default
but vote will be used for each GPU frequency.

Change-Id: I4e4e656664be06669d53fb5765a89943679004f2
Signed-off-by: default avatarLucille Sylvester <lsylvest@codeaurora.org>
parent 0740af51
Loading
Loading
Loading
Loading
+40 −0
Original line number Diff line number Diff line
@@ -753,6 +753,42 @@ static ssize_t kgsl_pwrctrl_force_rail_on_store(struct device *dev,
	return __force_on_store(dev, attr, buf, count, KGSL_PWRFLAGS_POWER_ON);
}

static ssize_t kgsl_pwrctrl_bus_split_show(struct device *dev,
					struct device_attribute *attr,
					char *buf)
{
	struct kgsl_device *device = kgsl_device_from_dev(dev);
	if (device == NULL)
		return 0;
	return snprintf(buf, PAGE_SIZE, "%d\n",
		device->pwrctrl.bus_control);
}

static ssize_t kgsl_pwrctrl_bus_split_store(struct device *dev,
					struct device_attribute *attr,
					const char *buf, size_t count)
{
	char temp[20];
	unsigned long val;
	struct kgsl_device *device = kgsl_device_from_dev(dev);
	int rc;

	if (device == NULL)
		return 0;

	snprintf(temp, sizeof(temp), "%.*s",
			(int)min(count, sizeof(temp) - 1), buf);
	rc = kstrtoul(temp, 0, &val);
	if (rc)
		return rc;

	mutex_lock(&device->mutex);
	device->pwrctrl.bus_control = val ? true : false;
	mutex_unlock(&device->mutex);

	return count;
}

DEVICE_ATTR(gpuclk, 0644, kgsl_pwrctrl_gpuclk_show, kgsl_pwrctrl_gpuclk_store);
DEVICE_ATTR(max_gpuclk, 0644, kgsl_pwrctrl_max_gpuclk_show,
	kgsl_pwrctrl_max_gpuclk_store);
@@ -792,6 +828,9 @@ DEVICE_ATTR(force_bus_on, 0644,
DEVICE_ATTR(force_rail_on, 0644,
	kgsl_pwrctrl_force_rail_on_show,
	kgsl_pwrctrl_force_rail_on_store);
DEVICE_ATTR(bus_split, 0644,
	kgsl_pwrctrl_bus_split_show,
	kgsl_pwrctrl_bus_split_store);

static const struct device_attribute *pwrctrl_attr_list[] = {
	&dev_attr_gpuclk,
@@ -809,6 +848,7 @@ static const struct device_attribute *pwrctrl_attr_list[] = {
	&dev_attr_force_clk_on,
	&dev_attr_force_bus_on,
	&dev_attr_force_rail_on,
	&dev_attr_bus_split,
	NULL
};

+1 −1
Original line number Diff line number Diff line
@@ -208,7 +208,7 @@ int kgsl_devfreq_target(struct device *dev, unsigned long *freq, u32 flags)
				level = i;
				break;
			}
	} else if (flags) {
	} else if (flags && pwr->bus_control) {
		/*
		 * Signal for faster or slower bus.  If KGSL isn't already
		 * running at the desired speed for the given level, modify