Skip to content

Commit 7954001

Browse files
spandruvadarafaeljw
authored andcommitted
thermal: intel: int340x: Add throttling control interface to PTC
Firmware-based thermal temperature control loops may aggressively throttle performance to prevent temperature overshoots relative to the defined target temperature. This can negatively impact performance. User space may prefer to prioritize performance, even if it results in temperature overshoots with in acceptable range. For example, user space might tolerate temperature overshoots when the device is placed on a desk, as opposed to when it's on a lap. To accommodate such scenarios, an optional attribute is provided to specify a tolerance level for temperature overshoots while maintaining acceptable performance. Attribute: thermal_tolerance: This attribute ranges from 0 to 7, where 0 represents the most aggressive control to avoid any temperature overshoots, and 7 represents a more graceful approach, favoring performance even at the expense of temperature overshoots. Note: This level may not scale linearly. For example, a value of 3 does not necessarily imply a 50% improvement in performance compared to a value of 0. Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Reviewed-by: Zhang Rui <rui.zhang@intel.com> Link: https://patch.msgid.link/20250613214923.2910397-1-srinivas.pandruvada@linux.intel.com Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent e04c78d commit 7954001

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

Documentation/driver-api/thermal/intel_dptf.rst

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -206,6 +206,15 @@ All these controls needs admin privilege to update.
206206
Update a new temperature target in milli degree celsius for hardware to
207207
use for the temperature control.
208208

209+
``thermal_tolerance`` (RW)
210+
This attribute ranges from 0 to 7, where 0 represents
211+
the most aggressive control to avoid any temperature overshoots, and
212+
7 represents a more graceful approach, favoring performance even at
213+
the expense of temperature overshoots.
214+
Note: This level may not scale linearly. For example, a value of 3 does
215+
not necessarily imply a 50% improvement in performance compared to a
216+
value of 0.
217+
209218
Given that this is platform temperature control, it is expected that a
210219
single user-level manager owns and manages the controls. If multiple
211220
user-level software applications attempt to write different targets, it

drivers/thermal/intel/int340x_thermal/platform_temperature_control.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,14 +49,15 @@ struct mmio_reg {
4949
};
5050

5151
#define MAX_ATTR_GROUP_NAME_LEN 32
52-
#define PTC_MAX_ATTRS 3
52+
#define PTC_MAX_ATTRS 4
5353

5454
struct ptc_data {
5555
u32 offset;
5656
struct attribute_group ptc_attr_group;
5757
struct attribute *ptc_attrs[PTC_MAX_ATTRS];
5858
struct device_attribute temperature_target_attr;
5959
struct device_attribute enable_attr;
60+
struct device_attribute thermal_tolerance_attr;
6061
char group_name[MAX_ATTR_GROUP_NAME_LEN];
6162
};
6263

@@ -78,6 +79,7 @@ static u32 ptc_offsets[PTC_MAX_INSTANCES] = {0x5B20, 0x5B28, 0x5B30};
7879
static const char * const ptc_strings[] = {
7980
"temperature_target",
8081
"enable",
82+
"thermal_tolerance",
8183
NULL
8284
};
8385

@@ -177,6 +179,8 @@ PTC_SHOW(temperature_target);
177179
PTC_STORE(temperature_target);
178180
PTC_SHOW(enable);
179181
PTC_STORE(enable);
182+
PTC_SHOW(thermal_tolerance);
183+
PTC_STORE(thermal_tolerance);
180184

181185
#define ptc_init_attribute(_name)\
182186
do {\
@@ -193,9 +197,11 @@ static int ptc_create_groups(struct pci_dev *pdev, int instance, struct ptc_data
193197

194198
ptc_init_attribute(temperature_target);
195199
ptc_init_attribute(enable);
200+
ptc_init_attribute(thermal_tolerance);
196201

197202
data->ptc_attrs[index++] = &data->temperature_target_attr.attr;
198203
data->ptc_attrs[index++] = &data->enable_attr.attr;
204+
data->ptc_attrs[index++] = &data->thermal_tolerance_attr.attr;
199205
data->ptc_attrs[index] = NULL;
200206

201207
snprintf(data->group_name, MAX_ATTR_GROUP_NAME_LEN,

0 commit comments

Comments
 (0)