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

Commit f2d7bad0 authored by Manaf Meethalavalappu Pallikunhi's avatar Manaf Meethalavalappu Pallikunhi
Browse files

drivers: thermal: Update mitigation state reading logic from devicetree



Thermal cooling device uses THERMAL_MAX_LIMIT macro so that users can
define any mitigation state as an offset from max supported state for
that cooling device. But the logic to get actual state from this
offset config ignores if devicetree cooling device state is
THERMAL_MAX_LIMIT minus max supported state for that cooling device.

Update mitigation state calculation logic not accounted correctly.

Change-Id: I8fbdbf19e44e4bfbac315afe4cf79d40501bda58
Signed-off-by: default avatarManaf Meethalavalappu Pallikunhi <manafm@codeaurora.org>
parent ac5b7607
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -724,7 +724,7 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
	 * based on the MACRO determine the default state to use or the
	 * offset from the max_state.
	 */
	if (upper > (THERMAL_MAX_LIMIT - max_state)) {
	if (upper >= (THERMAL_MAX_LIMIT - max_state)) {
		/* upper default max_state */
		if (upper == THERMAL_NO_LIMIT)
			upper = max_state;
@@ -732,7 +732,7 @@ int thermal_zone_bind_cooling_device(struct thermal_zone_device *tz,
			upper = max_state - (THERMAL_MAX_LIMIT - upper);
	}

	if (lower > (THERMAL_MAX_LIMIT - max_state)) {
	if (lower >= (THERMAL_MAX_LIMIT - max_state)) {
		/* lower default 0 */
		if (lower == THERMAL_NO_LIMIT)
			lower = 0;