From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: rafael@kernel.org, daniel.lezcano@linaro.org, lukasz.luba@arm.com
Cc: linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org,
Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: [PATCH 4/5] thermal: intel: int340x: Add module parameter to change slider offset
Date: Wed, 13 Aug 2025 11:55:29 -0700 [thread overview]
Message-ID: <20250813185530.635096-5-srinivas.pandruvada@linux.intel.com> (raw)
In-Reply-To: <20250813185530.635096-1-srinivas.pandruvada@linux.intel.com>
The slider offset value allows the SoC to automatically switch slider
positions in range [SOC_SLIDER … (SOC_SLIDER + slider offset)] based on
internal algorithms to improve power efficiency.
By default, the SoC slider offset is set to 0. This means that SoC is not
allowed to switch slider position.
Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
.../processor_thermal_soc_slider.c | 41 +++++++++++++++++++
1 file changed, 41 insertions(+)
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 ffc538c9b9e3..bd4ff26a488b 100644
--- a/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c
+++ b/drivers/thermal/intel/int340x_thermal/processor_thermal_soc_slider.c
@@ -87,6 +87,40 @@ static const struct kernel_param_ops slider_def_balance_ops = {
module_param_cb(slider_balance, &slider_def_balance_ops, NULL, 0644);
MODULE_PARM_DESC(slider_balance, "Set slider default value for balance.");
+static u8 slider_offset;
+
+static int slider_def_offset_set(const char *arg, const struct kernel_param *kp)
+{
+ u8 offset;
+ int ret;
+
+ guard(mutex)(&slider_param_lock);
+
+ ret = kstrtou8(arg, 16, &offset);
+ if (!ret) {
+ if (offset > SOC_SLIDER_VALUE_MAXIMUM)
+ return -EINVAL;
+
+ slider_offset = offset;
+ }
+
+ return ret;
+}
+
+static int slider_def_offset_get(char *buf, const struct kernel_param *kp)
+{
+ guard(mutex)(&slider_param_lock);
+ return sysfs_emit(buf, "%02x\n", slider_offset);
+}
+
+static const struct kernel_param_ops slider_offset_ops = {
+ .set = slider_def_offset_set,
+ .get = slider_def_offset_get,
+};
+
+module_param_cb(slider_offset, &slider_offset_ops, NULL, 0644);
+MODULE_PARM_DESC(slider_offset, "Set slider offset.");
+
/* Convert from platform power profile option to SoC slider value */
static int convert_profile_to_power_slider(enum platform_profile_option profile)
{
@@ -120,6 +154,8 @@ static int convert_power_slider_to_profile(u8 slider)
#define SLIDER_MASK GENMASK_ULL(2, 0)
#define SLIDER_ENABLE_BIT 7
+#define SLIDER_OFFSET_MASK GENMASK_ULL(6, 4)
+
static void set_soc_power_profile(struct proc_thermal_device *proc_priv, int slider)
{
u64 val;
@@ -128,6 +164,11 @@ static void set_soc_power_profile(struct proc_thermal_device *proc_priv, int sli
val &= ~SLIDER_MASK;
val |= FIELD_PREP(SLIDER_MASK, slider);
val |= BIT(SLIDER_ENABLE_BIT);
+
+ /* Set the slider offset from module params */
+ val &= ~SLIDER_OFFSET_MASK;
+ val |= FIELD_PREP(SLIDER_OFFSET_MASK, slider_offset);
+
writeq(val, proc_priv->mmio_base + SOC_POWER_SLIDER_OFFSET);
}
--
2.43.0
next prev parent reply other threads:[~2025-08-13 18:55 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-08-13 18:55 [PATCH 0/5] thermal: intel: int340x: New power slider interface Srinivas Pandruvada
2025-08-13 18:55 ` [PATCH 1/5] thermal: intel: int340x: Add support for power slider Srinivas Pandruvada
2025-08-22 12:43 ` Rafael J. Wysocki
2025-08-13 18:55 ` [PATCH 2/5] thermal: intel: int340x: Enable power slider interface Srinivas Pandruvada
2025-08-22 12:47 ` Rafael J. Wysocki
2025-08-13 18:55 ` [PATCH 3/5] thermal: intel: int340x: Add module parameter for balanced Slider Srinivas Pandruvada
2025-08-22 12:50 ` Rafael J. Wysocki
2025-08-13 18:55 ` Srinivas Pandruvada [this message]
2025-08-22 13:00 ` [PATCH 4/5] thermal: intel: int340x: Add module parameter to change slider offset Rafael J. Wysocki
2025-08-13 18:55 ` [PATCH 5/5] thermal: intel: int340x: Add suspend and resume callbacks Srinivas Pandruvada
2025-08-22 13:02 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20250813185530.635096-5-srinivas.pandruvada@linux.intel.com \
--to=srinivas.pandruvada@linux.intel.com \
--cc=daniel.lezcano@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=lukasz.luba@arm.com \
--cc=rafael@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®