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

Commit 68fc3223 authored by Javi Merino's avatar Javi Merino Committed by Kevin Hilman
Browse files

thermal: fair_share: use the weight from the thermal instance



The fair share governor is not usable with thermal zones that use the
bind op and don't populate thermal_zone_parameters, the majority of
them.  Now that the weight is in the thermal instance, we can use that
in the fair share governor to allow every thermal zone to trivially use
this governor.  Furthermore, this simplifies the code.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: Durgadoss R <durgadoss.r@intel.com>
Reviewed-by: default avatarDurgadoss R <durgadoss.r@intel.com>
Signed-off-by: default avatarJavi Merino <javi.merino@arm.com>
Signed-off-by: default avatarEduardo Valentin <edubezval@gmail.com>
(cherry picked from commit 8b91e2cb24fbba3825d09a412ce2e1966e7c92d1)
Signed-off-by: default avatarKevin Hilman <khilman@linaro.org>
parent fe1c004d
Loading
Loading
Loading
Loading
+3 −14
Original line number Diff line number Diff line
@@ -88,24 +88,13 @@ static long get_target_state(struct thermal_zone_device *tz,
 */
static int fair_share_throttle(struct thermal_zone_device *tz, int trip)
{
	const struct thermal_zone_params *tzp;
	struct thermal_cooling_device *cdev;
	struct thermal_instance *instance;
	int i;
	int cur_trip_level = get_trip_level(tz);

	if (!tz->tzp || !tz->tzp->tbp)
		return -EINVAL;
	list_for_each_entry(instance, &tz->thermal_instances, tz_node) {
		struct thermal_cooling_device *cdev = instance->cdev;

	tzp = tz->tzp;

	for (i = 0; i < tzp->num_tbps; i++) {
		if (!tzp->tbp[i].cdev)
			continue;

		cdev = tzp->tbp[i].cdev;
		instance = get_thermal_instance(tz, cdev, trip);
		if (!instance)
		if (instance->trip != trip)
			continue;

		instance->target = get_target_state(tz, cdev,