Skip to contentSkip to conversation

thermal: intel_powerclamp: Return last requested state as cur_state

PATCH Applied Srinivas Pandruvada 2 participants 2 messages Feb 4, 2023 – Feb 7, 2023 Thermal

lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 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.

---
v2:
Fixed setting of *state

 drivers/thermal/intel/intel_powerclamp.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/thermal/intel/intel_powerclamp.c +1 -11
index 5f54c88b1977..0282503ecaaf 100644
@@ -539,17 +539,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 */
-	}
-
+	*state = powerclamp_data.target_ratio;
 	mutex_unlock(&powerclamp_lock);
 
 	return 0;
Signature · 1 line
2.17.1
maintainer Applied
#1 lore raw
Quoted 32 lines · Srinivas Pandruvada

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.

---
v2:
Fixed setting of *state

 drivers/thermal/intel/intel_powerclamp.c | 12 +-----------
 1 file changed, 1 insertion(+), 11 deletions(-)
drivers/thermal/intel/intel_powerclamp.c +0 -6
index 5f54c88b1977..0282503ecaaf 100644
@@ -539,17 +539,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;

drivers/thermal/intel/intel_powerclamp.c static int powerclamp_get_cur_state(struct thermal_cooling_device *cdev,

Quoted 10 lines
drivers/thermal/intel/intel_powerclamp.c +1 -6
-       } else {
-               /* to save power, do not poll idle ratio while not clamping */
-               *state = -1; /* indicates invalid state */
-       }
-
+       *state = powerclamp_data.target_ratio;
        mutex_unlock(&powerclamp_lock);
 
        return 0;
--

Applied as 6.3 material, thanks!