diff options
| author | Wyes Karny <[email protected]> | 2023-06-19 19:05:03 +0000 |
|---|---|---|
| committer | Shuah Khan <[email protected]> | 2023-07-18 22:07:01 +0000 |
| commit | eb426fc6bdd6b731cbc0900f24a8c5fba10a7631 (patch) | |
| tree | 93f62e6d86ad4591a5832b5cceaa1bd2ec9e7ad6 /tools/power/cpupower/utils/helpers/misc.c | |
| parent | cpupower: Add support for amd_pstate mode change (diff) | |
| download | kernel-eb426fc6bdd6b731cbc0900f24a8c5fba10a7631.tar.gz kernel-eb426fc6bdd6b731cbc0900f24a8c5fba10a7631.zip | |
cpupower: Add turbo-boost support in cpupower
If boost sysfs (/sys/devices/system/cpu/cpufreq/boost) file is present
turbo-boost is feature is supported in the hardware. By default this
feature should be enabled. But to disable/enable it write to the sysfs
file. Use the same to control this feature via cpupower.
To enable:
cpupower set --turbo-boost 1
To disable:
cpupower set --turbo-boost 0
Acked-by: Huang Rui <[email protected]>
Reviewed-by: Gautham R. Shenoy <[email protected]>
Reviewed-by: Mario Limonciello <[email protected]>
Signed-off-by: Wyes Karny <[email protected]>
Tested-by: Perry Yuan <[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 | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/tools/power/cpupower/utils/helpers/misc.c b/tools/power/cpupower/utils/helpers/misc.c index 075c136a100c..76e461ff4f74 100644 --- a/tools/power/cpupower/utils/helpers/misc.c +++ b/tools/power/cpupower/utils/helpers/misc.c @@ -124,6 +124,24 @@ int cpupower_set_amd_pstate_mode(char *mode) return 0; } +int cpupower_set_turbo_boost(int turbo_boost) +{ + char path[SYSFS_PATH_MAX]; + char linebuf[2] = {}; + + snprintf(path, sizeof(path), PATH_TO_CPU "cpufreq/boost"); + + if (!is_valid_path(path)) + return -1; + + snprintf(linebuf, sizeof(linebuf), "%d", turbo_boost); + + if (cpupower_write_sysfs(path, linebuf, 2) <= 0) + return -1; + + return 0; +} + bool cpupower_amd_pstate_enabled(void) { char *driver = cpufreq_get_driver(0); |
