public inbox for stable@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] thermal: intel: int340x: Power Slider: Set offset only for balanced mode
@ 2026-03-24 17:23 Srinivas Pandruvada
  2026-03-24 18:26 ` Rafael J. Wysocki
  0 siblings, 1 reply; 2+ messages in thread
From: Srinivas Pandruvada @ 2026-03-24 17:23 UTC (permalink / raw)
  To: rafael, daniel.lezcano
  Cc: linux-pm, linux-kernel, Srinivas Pandruvada, Erin Park, stable

The slider offset can be set via debugfs for balanced mode. The offset
should be only applicable in balanced mode. For other modes, it should
be set 0 when writing to MMIO offset,

Fixes: 8306bcaba06d ("thermal: intel: int340x: Add module parameter to change slider offset")
Tested-by: Erin Park <erin.park@intel.com>
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Cc: stable@vger.kernel.org # v6.18+
---
 .../intel/int340x_thermal/processor_thermal_soc_slider.c  | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c
index 49ff3bae7271..91f291627132 100644
--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c
+++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c
@@ -176,15 +176,21 @@ static inline void write_soc_slider(struct proc_thermal_device *proc_priv, u64 v
 
 static void set_soc_power_profile(struct proc_thermal_device *proc_priv, int slider)
 {
+	u8 offset;
 	u64 val;
 
 	val = read_soc_slider(proc_priv);
 	val &= ~SLIDER_MASK;
 	val |= FIELD_PREP(SLIDER_MASK, slider) | BIT(SLIDER_ENABLE_BIT);
 
+	if (slider == SOC_SLIDER_VALUE_MINIMUM || slider == SOC_SLIDER_VALUE_MAXIMUM)
+		offset = 0;
+	else
+		offset = slider_offset;
+
 	/* Set the slider offset from module params */
 	val &= ~SLIDER_OFFSET_MASK;
-	val |= FIELD_PREP(SLIDER_OFFSET_MASK, slider_offset);
+	val |= FIELD_PREP(SLIDER_OFFSET_MASK, offset);
 
 	write_soc_slider(proc_priv, val);
 }
-- 
2.52.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH] thermal: intel: int340x: Power Slider: Set offset only for balanced mode
  2026-03-24 17:23 [PATCH] thermal: intel: int340x: Power Slider: Set offset only for balanced mode Srinivas Pandruvada
@ 2026-03-24 18:26 ` Rafael J. Wysocki
  0 siblings, 0 replies; 2+ messages in thread
From: Rafael J. Wysocki @ 2026-03-24 18:26 UTC (permalink / raw)
  To: Srinivas Pandruvada
  Cc: rafael, daniel.lezcano, linux-pm, linux-kernel, Erin Park, stable

On Tue, Mar 24, 2026 at 6:23 PM Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
>
> The slider offset can be set via debugfs for balanced mode. The offset
> should be only applicable in balanced mode. For other modes, it should
> be set 0 when writing to MMIO offset,
>
> Fixes: 8306bcaba06d ("thermal: intel: int340x: Add module parameter to change slider offset")
> Tested-by: Erin Park <erin.park@intel.com>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
> Cc: stable@vger.kernel.org # v6.18+
> ---
>  .../intel/int340x_thermal/processor_thermal_soc_slider.c  | 8 +++++++-
>  1 file changed, 7 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c
> index 49ff3bae7271..91f291627132 100644
> --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c
> +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c
> @@ -176,15 +176,21 @@ static inline void write_soc_slider(struct proc_thermal_device *proc_priv, u64 v
>
>  static void set_soc_power_profile(struct proc_thermal_device *proc_priv, int slider)
>  {
> +       u8 offset;
>         u64 val;
>
>         val = read_soc_slider(proc_priv);
>         val &= ~SLIDER_MASK;
>         val |= FIELD_PREP(SLIDER_MASK, slider) | BIT(SLIDER_ENABLE_BIT);
>
> +       if (slider == SOC_SLIDER_VALUE_MINIMUM || slider == SOC_SLIDER_VALUE_MAXIMUM)
> +               offset = 0;
> +       else
> +               offset = slider_offset;
> +
>         /* Set the slider offset from module params */
>         val &= ~SLIDER_OFFSET_MASK;
> -       val |= FIELD_PREP(SLIDER_OFFSET_MASK, slider_offset);
> +       val |= FIELD_PREP(SLIDER_OFFSET_MASK, offset);
>
>         write_soc_slider(proc_priv, val);
>  }
> --

Applied as 7.0-rc material, thanks!

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2026-03-24 18:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-24 17:23 [PATCH] thermal: intel: int340x: Power Slider: Set offset only for balanced mode Srinivas Pandruvada
2026-03-24 18:26 ` 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