Commit 62108496 authored by Srinivas Pandruvada's avatar Srinivas Pandruvada Committed by Rafael J. Wysocki
Browse files

thermal: intel: powerclamp: Return last requested state as cur_state



When the user is reading cur_state from the thermal cooling device for
Intel powerclamp device:
 - It returns the idle ratio from Package C-state counters when
   there is active idle injection session.
 - -1, when there is no active idle injection session.

This information is not very useful as the package C-state counters vary
a lot from read to read. Instead just return the last requested cur_state.

Signed-off-by: default avatarSrinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 72ffc28f
Loading
Loading
Loading
Loading
+1 −11
Original line number Diff line number Diff line
@@ -541,17 +541,7 @@ static int powerclamp_get_cur_state(struct thermal_cooling_device *cdev,
				 unsigned long *state)
{
	mutex_lock(&powerclamp_lock);

	if (powerclamp_data.clamping) {
		if (poll_pkg_cstate_enable)
			*state = pkg_cstate_ratio_cur;
		else
	*state = powerclamp_data.target_ratio;
	} else {
		/* to save power, do not poll idle ratio while not clamping */
		*state = -1; /* indicates invalid state */
	}

	mutex_unlock(&powerclamp_lock);

	return 0;