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

Commit d0a7c6bb authored by Saravana Kannan's avatar Saravana Kannan
Browse files

cpufreq: schedutil: Add tunable to control WALT pl use



By default these are set to off.

Change-Id: I54f19553bc518705d9234a576219e4232cec960a
Signed-off-by: default avatarSaravana Kannan <skannan@codeaurora.org>
parent a25de292
Loading
Loading
Loading
Loading
+23 −1
Original line number Diff line number Diff line
@@ -24,6 +24,7 @@ struct sugov_tunables {
	struct gov_attr_set attr_set;
	unsigned int rate_limit_us;
	unsigned int hispeed_freq;
	bool pl;
};

struct sugov_policy {
@@ -224,6 +225,7 @@ static void sugov_walt_adjust(struct sugov_cpu *sg_cpu, unsigned long *util,
	if (is_hiload && nl >= mult_frac(cpu_util, NL_RATIO, 100))
		*util = *max;

	if (sg_policy->tunables->pl)
		*util = max(*util, sg_cpu->walt_load.pl);
}

@@ -450,12 +452,32 @@ static ssize_t hispeed_freq_store(struct gov_attr_set *attr_set,
	return count;
}

static ssize_t pl_show(struct gov_attr_set *attr_set, char *buf)
{
	struct sugov_tunables *tunables = to_sugov_tunables(attr_set);

	return sprintf(buf, "%u\n", tunables->pl);
}

static ssize_t pl_store(struct gov_attr_set *attr_set, const char *buf,
				   size_t count)
{
	struct sugov_tunables *tunables = to_sugov_tunables(attr_set);

	if (kstrtobool(buf, &tunables->pl))
		return -EINVAL;

	return count;
}

static struct governor_attr rate_limit_us = __ATTR_RW(rate_limit_us);
static struct governor_attr hispeed_freq = __ATTR_RW(hispeed_freq);
static struct governor_attr pl = __ATTR_RW(pl);

static struct attribute *sugov_attributes[] = {
	&rate_limit_us.attr,
	&hispeed_freq.attr,
	&pl.attr,
	NULL
};