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

Commit c7b1c57f authored by Manaf Meethalavalappu Pallikunhi's avatar Manaf Meethalavalappu Pallikunhi Committed by Gerrit - the friendly Code Review server
Browse files

thermal: cpu_cooling: Aggregate cooling device vote for all related CPUs



There can be multiple cpu cooling devices among same related CPUs
and these cpu cooling devices can place different request at same
time. In such cases, it needs to check and aggregate request for
all cooling devices of related CPUs of that cpu freq policy.

Add support to aggregate cpu cooling vote for all related CPUs cooling
devices in cpu frequency callback.

Change-Id: I0a7a7be98458ac7a3902f2be4d98b025128c4c8a
Signed-off-by: default avatarManaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
parent b18b809f
Loading
Loading
Loading
Loading
+23 −24
Original line number Diff line number Diff line
@@ -330,7 +330,7 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb,
				    unsigned long event, void *data)
{
	struct cpufreq_policy *policy = data;
	unsigned long clipped_freq, floor_freq;
	unsigned long clipped_freq = ULONG_MAX, floor_freq = 0;
	struct cpufreq_cooling_device *cpufreq_dev;

	if (event != CPUFREQ_ADJUST)
@@ -338,9 +338,14 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb,

	mutex_lock(&cooling_list_lock);
	list_for_each_entry(cpufreq_dev, &cpufreq_dev_list, node) {
		if (!cpumask_test_cpu(policy->cpu, &cpufreq_dev->allowed_cpus))
		if (!cpumask_intersects(&cpufreq_dev->allowed_cpus,
					policy->related_cpus))
			continue;

		if (cpufreq_dev->clipped_freq < clipped_freq)
			clipped_freq = cpufreq_dev->clipped_freq;
		if (cpufreq_dev->floor_freq > floor_freq)
			floor_freq = cpufreq_dev->floor_freq;
	}
	/*
	 * policy->max is the maximum allowed frequency defined by user
	 * and clipped_freq is the maximum that thermal constraints
@@ -355,14 +360,8 @@ static int cpufreq_thermal_notifier(struct notifier_block *nb,
	 * Similarly, if policy minimum set by the user is less than
	 * the floor_frequency, then adjust the policy->min.
	 */
		clipped_freq = cpufreq_dev->clipped_freq;
		floor_freq = cpufreq_dev->floor_freq;

	if (policy->max > clipped_freq || policy->min < floor_freq)
			cpufreq_verify_within_limits(policy, floor_freq,
						     clipped_freq);
		break;
	}
		cpufreq_verify_within_limits(policy, floor_freq, clipped_freq);
	mutex_unlock(&cooling_list_lock);

	return NOTIFY_OK;