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

Commit 5f92cd09 authored by Srinivas Rao L's avatar Srinivas Rao L Committed by Lina Iyer
Browse files

drivers: cpuidle: lpm-levels: LPM prediction tuning



Update the tunables for LPM prediction for better
power consumption.

Change-Id: I20fb32e7101f26fc9904aeeb577b2044075ffd3c
Signed-off-by: default avatarSrinivas Rao L <lsrao@codeaurora.org>
parent cb57e6b4
Loading
Loading
Loading
Loading
+13 −3
Original line number Diff line number Diff line
@@ -84,12 +84,13 @@ struct lpm_cluster *lpm_root_node;
static bool lpm_prediction = true;
module_param_named(lpm_prediction, lpm_prediction, bool, 0664);

static uint32_t ref_stddev = 100;
static uint32_t ref_stddev = 500;
module_param_named(ref_stddev, ref_stddev, uint, 0664);

static uint32_t tmr_add = 100;
static uint32_t tmr_add = 1000;
module_param_named(tmr_add, tmr_add, uint, 0664);

static uint32_t ref_premature_cnt = 1;
static uint32_t bias_hyst;
module_param_named(bias_hyst, bias_hyst, uint, 0664);

@@ -436,6 +437,7 @@ static uint64_t lpm_cpuidle_predict(struct cpuidle_device *dev,
	int64_t thresh = LLONG_MAX;
	struct lpm_history *history = &per_cpu(hist, dev->cpu);
	uint32_t *min_residency = get_per_cpu_min_residency(dev->cpu);
	uint32_t *max_residency = get_per_cpu_max_residency(dev->cpu);

	if (!lpm_prediction)
		return 0;
@@ -522,9 +524,17 @@ static uint64_t lpm_cpuidle_predict(struct cpuidle_device *dev,
					total += history->resi[i];
				}
			}
			if (failed > (MAXSAMPLES/2)) {
			if (failed >= ref_premature_cnt) {
				*idx_restrict = j;
				do_div(total, failed);
				for (i = 0; i < j; i++) {
					if (total < max_residency[i]) {
						*idx_restrict = i+1;
						total = max_residency[i];
						break;
					}
				}

				*idx_restrict_time = total;
				history->stime = ktime_to_us(ktime_get())
						+ *idx_restrict_time;