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

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

Merge "lpm-levels: Fix low power mode selection"

parents ad8cf1bb a69b013a
Loading
Loading
Loading
Loading
+20 −4
Original line number Diff line number Diff line
@@ -80,6 +80,14 @@ static void set_optimum_cpu_residency(struct lpm_cpu *cpu, int cpu_id,
	for (i = 0; i < cpu->nlevels; i++) {
		struct power_params *pwr = &cpu->levels[i].pwr;

		mode_avail = probe_time ||
			lpm_cpu_mode_allow(cpu_id, i, true);

		if (!mode_avail) {
			residency[i] = 0;
			continue;
		}

		residency[i] = ~0;
		for (j = i + 1; j < cpu->nlevels; j++) {
			mode_avail = probe_time ||
@@ -102,12 +110,20 @@ static void set_optimum_cluster_residency(struct lpm_cluster *cluster,
	for (i = 0; i < cluster->nlevels; i++) {
		struct power_params *pwr = &cluster->levels[i].pwr;

		pwr->max_residency = ~0;
		for (j = 0; j < cluster->nlevels; j++) {
			if (i >= j)
		mode_avail = probe_time ||
			lpm_cluster_mode_allow(cluster, i,
					true);

		if (!mode_avail) {
			pwr->max_residency = 0;
			continue;
		}

		pwr->max_residency = ~0;
		for (j = i+1; j < cluster->nlevels; j++) {
			mode_avail = probe_time ||
					lpm_cluster_mode_allow(cluster, j,
							true);
			if (mode_avail &&
				(pwr->max_residency > pwr->residencies[j]) &&
				(pwr->residencies[j] != 0))
+15 −14
Original line number Diff line number Diff line
@@ -480,24 +480,25 @@ static int cpu_power_select(struct cpuidle_device *dev,

		if (next_event_us) {
			if (next_event_us < lvl_latency_us)
				continue;
				break;

			if (((next_event_us - lvl_latency_us) < sleep_us) ||
					(next_event_us < sleep_us))
				next_wakeup_us = next_event_us - lvl_latency_us;
		}

		if (next_wakeup_us <= residency[i]) {
		best_level = i;

		if (next_event_us && next_event_us < sleep_us &&
				(mode != MSM_PM_SLEEP_MODE_WAIT_FOR_INTERRUPT))
			modified_time_us
				= next_event_us - lvl_latency_us;
		else
			modified_time_us = 0;

		if (next_wakeup_us <= residency[i])
			break;
	}
	}

	if (modified_time_us)
		msm_pm_set_timer(modified_time_us);
@@ -593,10 +594,10 @@ static int cluster_select(struct lpm_cluster *cluster, bool from_idle)
			continue;

		if (from_idle && latency_us < pwr_params->latency_us)
			continue;
			break;

		if (sleep_us < pwr_params->time_overhead_us)
			continue;
			break;

		if (suspend_in_progress && from_idle && level->notify_rpm)
			continue;
@@ -604,11 +605,11 @@ static int cluster_select(struct lpm_cluster *cluster, bool from_idle)
		if (level->notify_rpm && msm_rpm_waiting_for_ack())
			continue;

		if (sleep_us <= pwr_params->max_residency) {
		best_level = i;

		if (sleep_us <= pwr_params->max_residency)
			break;
	}
	}

	return best_level;
}