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

Commit 0280dde0 authored by Ramakrishna Gottimukkula's avatar Ramakrishna Gottimukkula
Browse files

soc: qcom: Add module parameter to pass cluster CPU IDs



Add a new module parameter to enable user space to pass
CPU IDs of the cluster for which policy min is to be adjusted.

min_freq_cluster: Takes as input the list of CPU IDs of the
cluster in string format with range, comma separated or both
such as "0-3","0,1,2,3", or "0,1-3".

Change-Id: Ibda7fce87cda99a111183407183fa1a7f8793c28
Signed-off-by: default avatarRamakrishna Gottimukkula <rgottimu@codeaurora.org>
parent eddc683b
Loading
Loading
Loading
Loading
+47 −6
Original line number Diff line number Diff line
@@ -160,13 +160,12 @@ static int enable_big_min_freq_adjust(void)
	if (p->big_min_freq_on == true)
		return 0;

	INIT_DEFERRABLE_WORK(&p->min_freq_work, cpufreq_min_freq_work);
	if (!cpumask_weight(&p->cluster_cpumask)) {
		pr_err("Cluster CPU IDs not set\n");
		return -EPERM;
	}

	cpumask_clear(&p->cluster_cpumask);
	cpumask_set_cpu(4, &p->cluster_cpumask);
	cpumask_set_cpu(5, &p->cluster_cpumask);
	cpumask_set_cpu(6, &p->cluster_cpumask);
	cpumask_set_cpu(7, &p->cluster_cpumask);
	INIT_DEFERRABLE_WORK(&p->min_freq_work, cpufreq_min_freq_work);

	if (!big_min_down_delay_ms) {
		big_min_down_delay_ms = MIN_DOWN_DELAY_MSEC;
@@ -267,6 +266,48 @@ static const struct kernel_param_ops param_ops_big_min_down_delay_ms = {
module_param_cb(min_down_delay_ms, &param_ops_big_min_down_delay_ms,
		&big_min_down_delay_ms, 0644);

#define MAX_STR_LEN 16
static char big_min_freq_cluster[MAX_STR_LEN];
static struct kparam_string big_min_freq_cluster_kps = {
	.string = big_min_freq_cluster,
	.maxlen = MAX_STR_LEN,
};

static int set_big_min_freq_cluster(const char *buf,
		const struct kernel_param *kp)
{
	struct big_min_freq_adjust_data *p = &big_min_freq_adjust_data;
	int ret;

	if (p->big_min_freq_on == true) {
		ret = -EPERM;
		goto err;
	}

	ret = param_set_copystring(buf, kp);
	if (ret)
		goto err;

	ret = cpulist_parse(big_min_freq_cluster_kps.string,
			&p->cluster_cpumask);
	if (ret) {
		cpumask_clear(&p->cluster_cpumask);
		goto err;
	}

	return 0;
err:
	pr_err("Unable to set big_min_freq_cluster: %d\n", ret);
	return ret;
}

static const struct kernel_param_ops param_ops_big_min_freq_cluster = {
	.set = set_big_min_freq_cluster,
	.get = param_get_string,
};
module_param_cb(min_freq_cluster, &param_ops_big_min_freq_cluster,
		&big_min_freq_cluster_kps, 0644);

static int __init big_min_freq_adjust_init(void)
{
	big_min_freq_adjust_data.is_init = true;