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

Commit 6cd9e9f6 authored by Kapileshwar Singh's avatar Kapileshwar Singh Committed by Eduardo Valentin
Browse files

thermal: of: fix cooling device weights in device tree



Currently you can specify the weight of the cooling device in the device
tree but that information is not populated to the
thermal_bind_params where the fair share governor expects it to
be.  The of thermal zone device doesn't have a thermal_bind_params
structure and arguably it's better to pass the weight inside the
thermal_instance as it is specific to the bind of a cooling device to a
thermal zone parameter.

Core thermal code is fixed to populate the weight in the instance from
the thermal_bind_params, so platform code that was passing the weight
inside the thermal_bind_params continue to work seamlessly.

While we are at it, create a default value for the weight parameter for
those thermal zones that currently don't define it and remove the
hardcoded default in of-thermal.

Cc: Zhang Rui <rui.zhang@intel.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Cc: Len Brown <lenb@kernel.org>
Cc: Peter Feuerer <peter@piie.net>
Cc: Darren Hart <dvhart@infradead.org>
Cc: Eduardo Valentin <edubezval@gmail.com>
Cc: Kukjin Kim <kgene@kernel.org>
Cc: Durgadoss R <durgadoss.r@intel.com>
Signed-off-by: default avatarKapileshwar Singh <kapileshwar.singh@arm.com>
Signed-off-by: default avatarEduardo Valentin <edubezval@gmail.com>
parent 5ebe6afa
Loading
Loading
Loading
Loading
+3 −1
Original line number Original line Diff line number Diff line
@@ -95,7 +95,7 @@ temperature) and throttle appropriate devices.
1.3 interface for binding a thermal zone device with a thermal cooling device
1.3 interface for binding a thermal zone device with a thermal cooling device
1.3.1 int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
1.3.1 int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
	int trip, struct thermal_cooling_device *cdev,
	int trip, struct thermal_cooling_device *cdev,
	unsigned long upper, unsigned long lower);
	unsigned long upper, unsigned long lower, unsigned int weight);


    This interface function bind a thermal cooling device to the certain trip
    This interface function bind a thermal cooling device to the certain trip
    point of a thermal zone device.
    point of a thermal zone device.
@@ -110,6 +110,8 @@ temperature) and throttle appropriate devices.
    lower:the Minimum cooling state can be used for this trip point.
    lower:the Minimum cooling state can be used for this trip point.
          THERMAL_NO_LIMIT means no lower limit,
          THERMAL_NO_LIMIT means no lower limit,
	  and the cooling device can be in cooling state 0.
	  and the cooling device can be in cooling state 0.
    weight: the influence of this cooling device in this thermal
            zone.  See 1.4.1 below for more information.


1.3.2 int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz,
1.3.2 int thermal_zone_unbind_cooling_device(struct thermal_zone_device *tz,
		int trip, struct thermal_cooling_device *cdev);
		int trip, struct thermal_cooling_device *cdev);
+6 −3
Original line number Original line Diff line number Diff line
@@ -800,7 +800,8 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
				result =
				result =
					thermal_zone_bind_cooling_device
					thermal_zone_bind_cooling_device
					(thermal, trip, cdev,
					(thermal, trip, cdev,
					 THERMAL_NO_LIMIT, THERMAL_NO_LIMIT);
					 THERMAL_NO_LIMIT, THERMAL_NO_LIMIT,
					 THERMAL_WEIGHT_DEFAULT);
			else
			else
				result =
				result =
					thermal_zone_unbind_cooling_device
					thermal_zone_unbind_cooling_device
@@ -824,7 +825,8 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
			if (bind)
			if (bind)
				result = thermal_zone_bind_cooling_device
				result = thermal_zone_bind_cooling_device
					(thermal, trip, cdev,
					(thermal, trip, cdev,
					 THERMAL_NO_LIMIT, THERMAL_NO_LIMIT);
					 THERMAL_NO_LIMIT, THERMAL_NO_LIMIT,
					 THERMAL_WEIGHT_DEFAULT);
			else
			else
				result = thermal_zone_unbind_cooling_device
				result = thermal_zone_unbind_cooling_device
					(thermal, trip, cdev);
					(thermal, trip, cdev);
@@ -841,7 +843,8 @@ static int acpi_thermal_cooling_device_cb(struct thermal_zone_device *thermal,
				result = thermal_zone_bind_cooling_device
				result = thermal_zone_bind_cooling_device
						(thermal, THERMAL_TRIPS_NONE,
						(thermal, THERMAL_TRIPS_NONE,
						 cdev, THERMAL_NO_LIMIT,
						 cdev, THERMAL_NO_LIMIT,
						 THERMAL_NO_LIMIT);
						 THERMAL_NO_LIMIT,
						 THERMAL_WEIGHT_DEFAULT);
			else
			else
				result = thermal_zone_unbind_cooling_device
				result = thermal_zone_unbind_cooling_device
						(thermal, THERMAL_TRIPS_NONE,
						(thermal, THERMAL_TRIPS_NONE,
+2 −1
Original line number Original line Diff line number Diff line
@@ -372,7 +372,8 @@ static int acerhdf_bind(struct thermal_zone_device *thermal,
		return 0;
		return 0;


	if (thermal_zone_bind_cooling_device(thermal, 0, cdev,
	if (thermal_zone_bind_cooling_device(thermal, 0, cdev,
			THERMAL_NO_LIMIT, THERMAL_NO_LIMIT)) {
			THERMAL_NO_LIMIT, THERMAL_NO_LIMIT,
			THERMAL_WEIGHT_DEFAULT)) {
		pr_err("error binding cooling dev\n");
		pr_err("error binding cooling dev\n");
		return -EINVAL;
		return -EINVAL;
	}
	}
+1 −1
Original line number Original line Diff line number Diff line
@@ -76,7 +76,7 @@ static int db8500_cdev_bind(struct thermal_zone_device *thermal,
		upper = lower = i > max_state ? max_state : i;
		upper = lower = i > max_state ? max_state : i;


		ret = thermal_zone_bind_cooling_device(thermal, i, cdev,
		ret = thermal_zone_bind_cooling_device(thermal, i, cdev,
			upper, lower);
			upper, lower, THERMAL_WEIGHT_DEFAULT);


		dev_info(&cdev->device, "%s bind to %d: %d-%s\n", cdev->type,
		dev_info(&cdev->device, "%s bind to %d: %d-%s\n", cdev->type,
			i, ret, ret ? "fail" : "succeed");
			i, ret, ret ? "fail" : "succeed");
+1 −1
Original line number Original line Diff line number Diff line
@@ -109,7 +109,7 @@ static int fair_share_throttle(struct thermal_zone_device *tz, int trip)
			continue;
			continue;


		instance->target = get_target_state(tz, cdev,
		instance->target = get_target_state(tz, cdev,
					tzp->tbp[i].weight, cur_trip_level);
					instance->weight, cur_trip_level);


		instance->cdev->updated = false;
		instance->cdev->updated = false;
		thermal_cdev_update(cdev);
		thermal_cdev_update(cdev);
Loading