During system suspend callback save slider register and restore during
resume callback.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
.../int340x_thermal/processor_thermal_device.c | 10 ++++++++++
.../int340x_thermal/processor_thermal_device.h | 2 ++
.../processor_thermal_soc_slider.c | 15 +++++++++++++++
3 files changed, 27 insertions(+)
diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
index 4aea5c9baae9..a772c187bedb 100644
--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
+++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
@@ -338,10 +338,17 @@ static int tcc_offset_save = -1;
int proc_thermal_suspend(struct device *dev)
{
+ struct proc_thermal_device *proc_dev;
+
tcc_offset_save = intel_tcc_get_offset(-1);
if (tcc_offset_save < 0)
dev_warn(dev, "failed to save offset (%d)\n", tcc_offset_save);
+ proc_dev = dev_get_drvdata(dev);
+
+ if (proc_dev->mmio_feature_mask & PROC_THERMAL_FEATURE_SOC_POWER_SLIDER)
+ proc_thermal_soc_power_slider_suspend(proc_dev);
+
return 0;
}
EXPORT_SYMBOL_GPL(proc_thermal_suspend);
@@ -357,6 +364,9 @@ int proc_thermal_resume(struct device *dev)
if (tcc_offset_save >= 0)
intel_tcc_set_offset(-1, tcc_offset_save);
+ if (proc_dev->mmio_feature_mask & PROC_THERMAL_FEATURE_SOC_POWER_SLIDER)
+ proc_thermal_soc_power_slider_resume(proc_dev);
+
return 0;
}
EXPORT_SYMBOL_GPL(proc_thermal_resume);
diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.h b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.h
index ba3f64742f2f..30760475102f 100644
--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.h
+++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.h
@@ -130,5 +130,7 @@ int proc_thermal_ptc_add(struct pci_dev *pdev, struct proc_thermal_device *proc_
void proc_thermal_ptc_remove(struct pci_dev *pdev);
int proc_thermal_soc_power_slider_add(struct pci_dev *pdev, struct proc_thermal_device *proc_priv);
+void proc_thermal_soc_power_slider_suspend(struct proc_thermal_device *proc_priv);
+void proc_thermal_soc_power_slider_resume(struct proc_thermal_device *proc_priv);
#endif
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 bd4ff26a488b..268bf9124d95 100644
--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c
+++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c
@@ -248,6 +248,21 @@ int proc_thermal_soc_power_slider_add(struct pci_dev *pdev, struct proc_thermal_
}
EXPORT_SYMBOL_NS_GPL(proc_thermal_soc_power_slider_add, "INT340X_THERMAL");
+static u64 soc_slider_save;
+
+void proc_thermal_soc_power_slider_suspend(struct proc_thermal_device *proc_priv)
+{
+ soc_slider_save = readq(proc_priv->mmio_base + SOC_POWER_SLIDER_OFFSET);
+
+}
+EXPORT_SYMBOL_NS_GPL(proc_thermal_soc_power_slider_suspend, "INT340X_THERMAL");
+
+void proc_thermal_soc_power_slider_resume(struct proc_thermal_device *proc_priv)
+{
+ writeq(soc_slider_save, proc_priv->mmio_base + SOC_POWER_SLIDER_OFFSET);
+}
+EXPORT_SYMBOL_NS_GPL(proc_thermal_soc_power_slider_resume, "INT340X_THERMAL");
+
MODULE_IMPORT_NS("INT340X_THERMAL");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("Processor Thermal Power Slider Interface");
--
2.43.0
On Wed, Aug 13, 2025 at 8:55 PM Srinivas Pandruvada
<srinivas.pandruvada@linux.intel.com> wrote:
>
> During system suspend callback save slider register and restore during
> resume callback.
>
> Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
I would combine this with the first patch.
It doesn't add extra functionality, it's mandatory stuff.
> ---
> .../int340x_thermal/processor_thermal_device.c | 10 ++++++++++
> .../int340x_thermal/processor_thermal_device.h | 2 ++
> .../processor_thermal_soc_slider.c | 15 +++++++++++++++
> 3 files changed, 27 insertions(+)
>
> diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> index 4aea5c9baae9..a772c187bedb 100644
> --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.c
> @@ -338,10 +338,17 @@ static int tcc_offset_save = -1;
>
> int proc_thermal_suspend(struct device *dev)
> {
> + struct proc_thermal_device *proc_dev;
> +
> tcc_offset_save = intel_tcc_get_offset(-1);
> if (tcc_offset_save < 0)
> dev_warn(dev, "failed to save offset (%d)\n", tcc_offset_save);
>
> + proc_dev = dev_get_drvdata(dev);
> +
> + if (proc_dev->mmio_feature_mask & PROC_THERMAL_FEATURE_SOC_POWER_SLIDER)
> + proc_thermal_soc_power_slider_suspend(proc_dev);
> +
> return 0;
> }
> EXPORT_SYMBOL_GPL(proc_thermal_suspend);
> @@ -357,6 +364,9 @@ int proc_thermal_resume(struct device *dev)
> if (tcc_offset_save >= 0)
> intel_tcc_set_offset(-1, tcc_offset_save);
>
> + if (proc_dev->mmio_feature_mask & PROC_THERMAL_FEATURE_SOC_POWER_SLIDER)
> + proc_thermal_soc_power_slider_resume(proc_dev);
> +
> return 0;
> }
> EXPORT_SYMBOL_GPL(proc_thermal_resume);
> diff --git a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.h b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.h
> index ba3f64742f2f..30760475102f 100644
> --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_device.h
> +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_device.h
> @@ -130,5 +130,7 @@ int proc_thermal_ptc_add(struct pci_dev *pdev, struct proc_thermal_device *proc_
> void proc_thermal_ptc_remove(struct pci_dev *pdev);
>
> int proc_thermal_soc_power_slider_add(struct pci_dev *pdev, struct proc_thermal_device *proc_priv);
> +void proc_thermal_soc_power_slider_suspend(struct proc_thermal_device *proc_priv);
> +void proc_thermal_soc_power_slider_resume(struct proc_thermal_device *proc_priv);
>
> #endif
> 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 bd4ff26a488b..268bf9124d95 100644
> --- a/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c
> +++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c
> @@ -248,6 +248,21 @@ int proc_thermal_soc_power_slider_add(struct pci_dev *pdev, struct proc_thermal_
> }
> EXPORT_SYMBOL_NS_GPL(proc_thermal_soc_power_slider_add, "INT340X_THERMAL");
>
> +static u64 soc_slider_save;
> +
> +void proc_thermal_soc_power_slider_suspend(struct proc_thermal_device *proc_priv)
> +{
> + soc_slider_save = readq(proc_priv->mmio_base + SOC_POWER_SLIDER_OFFSET);
> +
> +}
> +EXPORT_SYMBOL_NS_GPL(proc_thermal_soc_power_slider_suspend, "INT340X_THERMAL");
> +
> +void proc_thermal_soc_power_slider_resume(struct proc_thermal_device *proc_priv)
> +{
> + writeq(soc_slider_save, proc_priv->mmio_base + SOC_POWER_SLIDER_OFFSET);
> +}
> +EXPORT_SYMBOL_NS_GPL(proc_thermal_soc_power_slider_resume, "INT340X_THERMAL");
> +
> MODULE_IMPORT_NS("INT340X_THERMAL");
> MODULE_LICENSE("GPL");
> MODULE_DESCRIPTION("Processor Thermal Power Slider Interface");
> --
> 2.43.0
>
>
© 2016 - 2026 Red Hat, Inc.