diff options
author | Wyes Karny <[email protected]> | 2023-06-19 19:05:01 +0000 |
---|---|---|
committer | Shuah Khan <[email protected]> | 2023-07-18 16:06:49 -0600 |
commit | f2ab5557119a5ccd0ceaf7ecdca00ab782cd76c5 (patch) | |
tree | 6ac8de88fb10eab6ccdb3c736cb93ee9ea8aa43a /tools/power/cpupower/utils/helpers/misc.c | |
parent | 1ce5ab7c1dbfa82f0d382a48cccb51178cbf5416 (diff) |
cpupower: Add EPP value change support
amd_pstate and intel_pstate active mode drivers support energy
performance preference feature. Through this user can convey it's
energy/performance preference to platform. Add this value change
capability to cpupower.
To change the EPP value use below command:
cpupower set --epp performance
Reviewed-by: Mario Limonciello <[email protected]>
Signed-off-by: Wyes Karny <[email protected]>
Tested-by: Perry Yuan <[email protected]>
Acked-by: Huang Rui <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>
Diffstat (limited to 'tools/power/cpupower/utils/helpers/misc.c')
-rw-r--r-- | tools/power/cpupower/utils/helpers/misc.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tools/power/cpupower/utils/helpers/misc.c b/tools/power/cpupower/utils/helpers/misc.c index 0c56fc77f93b..583df38ab13c 100644 --- a/tools/power/cpupower/utils/helpers/misc.c +++ b/tools/power/cpupower/utils/helpers/misc.c @@ -87,6 +87,25 @@ int cpupower_intel_set_perf_bias(unsigned int cpu, unsigned int val) return 0; } +int cpupower_set_epp(unsigned int cpu, char *epp) +{ + char path[SYSFS_PATH_MAX]; + char linebuf[30] = {}; + + snprintf(path, sizeof(path), + PATH_TO_CPU "cpu%u/cpufreq/energy_performance_preference", cpu); + + if (!is_valid_path(path)) + return -1; + + snprintf(linebuf, sizeof(linebuf), "%s", epp); + + if (cpupower_write_sysfs(path, linebuf, 30) <= 0) + return -1; + + return 0; +} + bool cpupower_amd_pstate_enabled(void) { char *driver = cpufreq_get_driver(0); |