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

Commit 8fe01b9c authored by Linux Build Service Account's avatar Linux Build Service Account Committed by Gerrit - the friendly Code Review server
Browse files

Merge changes I1ce26c04,I20fb32e7 into msm-4.14

* changes:
  drivers: cpuidle: lpm-levels: Add support per cluster prediction
  drivers: cpuidle: lpm-levels: LPM prediction tuning
parents a9a29e7d 64eb509d
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -77,6 +77,8 @@ that share the parameters.It contains the following properties.
	- qcom,pm-cpu-levels: The different low power modes that a CPU could
	enter. The following section explains the required properties of this
	node.
	-qcom,use-prediction: This optional property is used to indicate the
	the LPM governor is to apply sleep prediction to this cluster.

[Node bindings for qcom,pm-cpu-levels]
 Required properties:
+3 −0
Original line number Diff line number Diff line
@@ -711,6 +711,9 @@ static int parse_cpu_levels(struct device_node *node, struct lpm_cluster *c)
	if (ret)
		goto failed_parse_params;

	key = "qcom,use-prediction";
	cpu->lpm_prediction = of_property_read_bool(node, key);

	key = "parse_cpu";
	ret = parse_cpu(node, cpu);
	if (ret)
+15 −5
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,8 +437,9 @@ 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)
	if (!lpm_prediction || !cpu->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;
@@ -611,7 +621,7 @@ static int cpu_power_select(struct cpuidle_device *dev,
		struct power_params *pwr_params = &level->pwr;
		bool allow;

		allow = lpm_cpu_mode_allow(dev->cpu, i, true);
		allow = i ? lpm_cpu_mode_allow(dev->cpu, i, true) : true;

		if (!allow)
			continue;
+1 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ struct lpm_cpu {
	int nlevels;
	unsigned int psci_mode_shift;
	unsigned int psci_mode_mask;
	bool lpm_prediction;
	struct cpuidle_driver *drv;
	struct lpm_cluster *parent;
};