* [PATCH v2] thermal: intel_powerclamp: Return last requested state as cur_state
@ 2023-02-04 4:29 Srinivas Pandruvada
2023-02-07 19:54 ` Rafael J. Wysocki
0 siblings, 1 reply; 2+ messages in thread
From: Srinivas Pandruvada @ 2023-02-04 4:29 UTC (permalink / raw)
To: rafael
Cc: linux-pm, linux-kernel, daniel.lezcano, rui.zhang, 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.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
v2:
Fixed setting of *state
drivers/thermal/intel/intel_powerclamp.c | 12 +-----------
1 file changed, 1 insertion(+), 11 deletions(-)
diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
index 5f54c88b1977..0282503ecaaf 100644
--- a/drivers/thermal/intel/intel_powerclamp.c
+++ b/drivers/thermal/intel/intel_powerclamp.c
@@ -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;
--
2.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH v2] thermal: intel_powerclamp: Return last requested state as cur_state
2023-02-04 4:29 [PATCH v2] thermal: intel_powerclamp: Return last requested state as cur_state Srinivas Pandruvada
@ 2023-02-07 19:54 ` Rafael J. Wysocki
0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2023-02-07 19:54 UTC (permalink / raw)
To: Srinivas Pandruvada
Cc: rafael, linux-pm, linux-kernel, daniel.lezcano, rui.zhang
On Sat, Feb 4, 2023 at 5:29 AM Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
>
> 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: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> ---
> v2:
> Fixed setting of *state
>
> drivers/thermal/intel/intel_powerclamp.c | 12 +-----------
> 1 file changed, 1 insertion(+), 11 deletions(-)
>
> diff --git a/drivers/thermal/intel/intel_powerclamp.c b/drivers/thermal/intel/intel_powerclamp.c
> index 5f54c88b1977..0282503ecaaf 100644
> --- a/drivers/thermal/intel/intel_powerclamp.c
> +++ b/drivers/thermal/intel/intel_powerclamp.c
> @@ -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;
> --
Applied as 6.3 material, thanks!
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2023-02-07 19:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-02-04 4:29 [PATCH v2] thermal: intel_powerclamp: Return last requested state as cur_state Srinivas Pandruvada
2023-02-07 19:54 ` Rafael J. Wysocki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).