28 lines
1.3 KiB
Django/Jinja
28 lines
1.3 KiB
Django/Jinja
#!/bin/bash
|
|
{{ ansible_managed | comment }}
|
|
# This is the 'default' script; resetting amdgpu clock/power/voltage tunables
|
|
#
|
|
# AMDGPU driver/sysfs references:
|
|
# https://01.org/linuxgraphics/gfx-docs/drm/gpu/amdgpu.html
|
|
# https://docs.kernel.org/gpu/amdgpu/thermal.html
|
|
#
|
|
# start by including the 'common' script; determines card/hwmon dir/power profiles/power capability
|
|
. $(dirname "${BASH_SOURCE[0]}")/amdgpu-common.sh
|
|
|
|
{# begin the templated script for 'default' profiles to reset state #}
|
|
# set control mode back to auto
|
|
# attempts to dynamically set optimal power profile for (load) conditions
|
|
echo 'auto' | tee /sys/class/drm/"${CARD}"/device/power_dpm_force_performance_level
|
|
|
|
# reset any existing profile clock changes
|
|
echo 'r' | tee /sys/class/drm/"${CARD}"/device/pp_od_clk_voltage
|
|
|
|
# adjust power limit using multiplier against board capability
|
|
POWER_LIM_DEFAULT=$(/usr/bin/awk -v m="$POWER_CAP" -v n={{ gpu_power_multi.default }} 'BEGIN {printf "%.0f", (m*n)}')
|
|
echo "$POWER_LIM_DEFAULT" | tee "${HWMON_DIR}/power1_cap"
|
|
|
|
# extract the power-saving profile ID number
|
|
PROF_DEFAULT_NUM=$(/usr/bin/awk '$0 ~ /BOOTUP_DEFAULT.*:/ {print $1}' <<< "$PROFILE_MODES")
|
|
|
|
# reset power/clock heuristics to power-saving
|
|
echo "${PROF_DEFAULT_NUM}" | tee /sys/class/drm/"${CARD}"/device/pp_power_profile_mode
|