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

Commit e4d70df5 authored by Lina Iyer's avatar Lina Iyer Committed by Gerrit - the friendly Code Review server
Browse files

drivers: cpuidle: lpm-levels: use addition to build up PSCI state id



Use addition instead of OR to build up CPU PSCI state id for the CPU and
its clusters. This allows us flexibility to compound state ids for
single CPU clusters. This is also per PSCI spec.

Change-Id: I1179af40ebd230667261134d2eb4a7af95b5a8de
Signed-off-by: default avatarLina Iyer <ilina@codeaurora.org>
parent 88532b42
Loading
Loading
Loading
Loading
+4 −4
Original line number Original line Diff line number Diff line
@@ -1250,13 +1250,13 @@ static int get_cluster_id(struct lpm_cluster *cluster, int *aff_lvl,
				&cluster->child_cpus))
				&cluster->child_cpus))
		goto unlock_and_return;
		goto unlock_and_return;


	state_id |= get_cluster_id(cluster->parent, aff_lvl, from_idle);
	state_id += get_cluster_id(cluster->parent, aff_lvl, from_idle);


	if (cluster->last_level != cluster->default_level) {
	if (cluster->last_level != cluster->default_level) {
		struct lpm_cluster_level *level
		struct lpm_cluster_level *level
			= &cluster->levels[cluster->last_level];
			= &cluster->levels[cluster->last_level];


		state_id |= (level->psci_id & cluster->psci_mode_mask)
		state_id += (level->psci_id & cluster->psci_mode_mask)
					<< cluster->psci_mode_shift;
					<< cluster->psci_mode_shift;


		/*
		/*
@@ -1266,7 +1266,7 @@ static int get_cluster_id(struct lpm_cluster *cluster, int *aff_lvl,
		if (level->notify_rpm)
		if (level->notify_rpm)
			if (sys_pm_ops && sys_pm_ops->update_wakeup)
			if (sys_pm_ops && sys_pm_ops->update_wakeup)
				sys_pm_ops->update_wakeup(from_idle);
				sys_pm_ops->update_wakeup(from_idle);
		if (level->psci_id)
		if (cluster->psci_mode_shift)
			(*aff_lvl)++;
			(*aff_lvl)++;
	}
	}
unlock_and_return:
unlock_and_return:
@@ -1297,7 +1297,7 @@ static bool psci_enter_sleep(struct lpm_cpu *cpu, int idx, bool from_idle)
	state_id = get_cluster_id(cpu->parent, &affinity_level, from_idle);
	state_id = get_cluster_id(cpu->parent, &affinity_level, from_idle);
	power_state = PSCI_POWER_STATE(cpu->levels[idx].is_reset);
	power_state = PSCI_POWER_STATE(cpu->levels[idx].is_reset);
	affinity_level = PSCI_AFFINITY_LEVEL(affinity_level);
	affinity_level = PSCI_AFFINITY_LEVEL(affinity_level);
	state_id |= power_state | affinity_level | cpu->levels[idx].psci_id;
	state_id += power_state + affinity_level + cpu->levels[idx].psci_id;


	update_debug_pc_event(CPU_ENTER, state_id,
	update_debug_pc_event(CPU_ENTER, state_id,
			0xdeaffeed, 0xdeaffeed, from_idle);
			0xdeaffeed, 0xdeaffeed, from_idle);