mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
To: rui.zhang@intel.com, daniel.lezcano@linaro.org,
	rafael@kernel.org, lukasz.luba@arm.com
Cc: linux-kernel@vger.kernel.org, linux-pm@vger.kernel.org,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
Subject: [PATCH 1/2] thermal: intel: int340x: Add performance control for platform temperature control
Date: Wed,  4 Jun 2025 13:35:17 -0700	[thread overview]
Message-ID: <20250604203518.2330533-1-srinivas.pandruvada@linux.intel.com> (raw)

Add additional attribute to control performance of platform temperature
control feature. Two attributes are added:

gain: 0-7 levels, with 0 being most aggressive.
	7 – graceful, favors performance at the expense of temperature
	overshoots
	0 – aggressive, favors tight regulation over performance

min_performance_level: A value from 0-255. Specifies minimum Performance
	level below which the there will be no throttling.
	0 - all levels of throttling allowed including survivability
	actions.
	255 - no throttling allowed.

Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>
---
 Documentation/driver-api/thermal/intel_dptf.rst   | 10 ++++++++++
 .../platform_temperature_control.c                | 15 ++++++++++++++-
 2 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/Documentation/driver-api/thermal/intel_dptf.rst b/Documentation/driver-api/thermal/intel_dptf.rst
index ec5769accae0..794f5cce548e 100644
--- a/Documentation/driver-api/thermal/intel_dptf.rst
+++ b/Documentation/driver-api/thermal/intel_dptf.rst
@@ -206,6 +206,16 @@ All these controls needs admin privilege to update.
 	Update a new temperature target in milli degree celsius for hardware to
 	use for the temperature control.
 
+``gain`` (RW)
+	A value in the range 0-7. Sets the aggressiveness of control loop.
+	7 – graceful, favors performance at the expense of temperature overshoots.
+	0 – aggressive, favors tight regulation over performance.
+
+``min_performance_level`` (RW)
+	Minimum Performance level below which the there will be no throttling.
+	0 - all levels of throttling allowed including survivability actions.
+	256 - no throttling allowed.
+
 Given that this is platform temperature control, it is expected that a
 single user-level manager owns and manages the controls. If multiple
 user-level software applications attempt to write different targets, it
diff --git a/drivers/thermal/intel/int340x_thermal/platform_temperature_control.c b/drivers/thermal/intel/int340x_thermal/platform_temperature_control.c
index 2d6504514893..6cd05783a52d 100644
--- a/drivers/thermal/intel/int340x_thermal/platform_temperature_control.c
+++ b/drivers/thermal/intel/int340x_thermal/platform_temperature_control.c
@@ -49,7 +49,7 @@ struct mmio_reg {
 };
 
 #define MAX_ATTR_GROUP_NAME_LEN	32
-#define PTC_MAX_ATTRS		3
+#define PTC_MAX_ATTRS		5
 
 struct ptc_data {
 	u32 offset;
@@ -57,6 +57,8 @@ struct ptc_data {
 	struct attribute *ptc_attrs[PTC_MAX_ATTRS];
 	struct device_attribute temperature_target_attr;
 	struct device_attribute enable_attr;
+	struct device_attribute gain_attr;
+	struct device_attribute min_performance_level_attr;
 	char group_name[MAX_ATTR_GROUP_NAME_LEN];
 };
 
@@ -78,6 +80,8 @@ static u32 ptc_offsets[PTC_MAX_INSTANCES] = {0x5B20, 0x5B28, 0x5B30};
 static const char * const ptc_strings[] = {
 	"temperature_target",
 	"enable",
+	"gain",
+	"min_performance_level",
 	NULL
 };
 
@@ -177,6 +181,11 @@ PTC_SHOW(temperature_target);
 PTC_STORE(temperature_target);
 PTC_SHOW(enable);
 PTC_STORE(enable);
+PTC_SHOW(gain);
+PTC_STORE(gain);
+PTC_SHOW(min_performance_level);
+PTC_STORE(min_performance_level);
+
 
 #define ptc_init_attribute(_name)\
 	do {\
@@ -193,9 +202,13 @@ static int ptc_create_groups(struct pci_dev *pdev, int instance, struct ptc_data
 
 	ptc_init_attribute(temperature_target);
 	ptc_init_attribute(enable);
+	ptc_init_attribute(gain);
+	ptc_init_attribute(min_performance_level);
 
 	data->ptc_attrs[index++] = &data->temperature_target_attr.attr;
 	data->ptc_attrs[index++] = &data->enable_attr.attr;
+	data->ptc_attrs[index++] = &data->gain_attr.attr;
+	data->ptc_attrs[index++] = &data->min_performance_level_attr.attr;
 	data->ptc_attrs[index] = NULL;
 
 	snprintf(data->group_name, MAX_ATTR_GROUP_NAME_LEN,
-- 
2.49.0


             reply	other threads:[~2025-06-04 20:35 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-04 20:35 Srinivas Pandruvada [this message]
2025-06-04 20:35 ` [PATCH 2/2] thermal: intel: int340x: Allow temperature override Srinivas Pandruvada
2025-06-05  2:18   ` Zhang, Rui
2025-06-05 17:20     ` srinivas pandruvada
2025-06-06  7:22       ` Zhang, Rui
2025-06-06 21:19         ` srinivas pandruvada
2025-06-04 20:55 ` [PATCH 1/2] thermal: intel: int340x: Add performance control for platform temperature control Rafael J. Wysocki
2025-06-04 21:40   ` srinivas pandruvada
2025-06-05  3:06 ` Zhang, Rui
2025-06-05 17:25   ` srinivas pandruvada
2025-06-06  7:34     ` Zhang, Rui

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=20250604203518.2330533-1-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 \
    --cc=rui.zhang@intel.com \
    /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®