Skip to content

Commit

Permalink
mediatek/gpu: Drop lock volt in gpufreqv2
Browse files Browse the repository at this point in the history
* fix_custom_freq_volt is and always unstable

Signed-off-by: Rem01Gaming <[email protected]>
  • Loading branch information
Rem01Gaming committed Sep 22, 2024
1 parent 8919adf commit 4ec9b3c
Showing 1 changed file with 5 additions and 15 deletions.
20 changes: 5 additions & 15 deletions share/utils/gpu/mtk_gpufreqv2.sh
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,12 @@ source /data/data/com.termux/files/usr/share/origami-kernel/utils/gpu/mtk_ged.sh

mtk_gpufreqv2_lock_freq() {
local freq=$(fzf_select "$gpu_available_freqs" "Set frequency for GPU (NO DVFS): ")
local voltage=$(awk -v freq="$freq" '$0 ~ freq {gsub(/.*, volt: /, ""); gsub(/,.*/, ""); print}' /proc/gpufreqv2/gpu_working_opp_table)
apply "$freq $voltage" /proc/gpufreqv2/fix_custom_freq_volt
}

mtk_gpufreqv2_lock_volt() {
if [[ $(cat /proc/gpufreqv2/fix_custom_freq_volt) == *disabled* ]]; then
echo -e "\n\033[38;5;196merror:\033[0m Set fixed freq first !"
read -r -s
return 1
fi
apply "$(awk '{print $4}' /proc/gpufreqv2/fix_custom_freq_volt) $(fzf_select "$(awk '{print $5}' /proc/gpufreqv2/gpu_working_opp_table | sed 's/,//g' | sort -nu)" "Select GPU voltage: ")" /proc/gpufreq/gpufreq_fixed_freq_volt
local index=$(grep $freq /proc/gpufreqv2/gpu_working_opp_table | awk -F'[][]' '{print $2}')
apply "$index" /proc/gpufreqv2/fix_target_opp_index
}

mtk_gpufreqv2_reset_dvfs() {
apply "0 0" /proc/gpufreqv2/fix_custom_freq_volt
apply "-1" /proc/gpufreqv2/fix_target_opp_index
}

mtk_gpufreqv2_menu() {
Expand All @@ -45,19 +36,18 @@ mtk_gpufreqv2_menu() {
header_info=(
"[] GPU: ${gpu}"
"[] GPU Scalling freq: $(cat /sys/module/ged/parameters/gpu_cust_boost_freq)KHz - $(cat /sys/module/ged/parameters/gpu_cust_upbound_freq)KHz"
"[] Fixed freq & volt: $(if [[ $(awk '{print $2}' /proc/gpufreqv2/fix_custom_freq_volt) == "fix" ]]; then echo "Enabled"; else echo "Disabled"; fi)"
"[] Fixed freq & volt: $(if [[ $(awk '{print $2}' /proc/gpufreqv2/fix_target_opp_index) == "fix" ]]; then echo "Enabled"; else echo "Disabled"; fi)"
"[] GPU DVFS: $(cat /sys/module/ged/parameters/gpu_dvfs_enable)"
"[ϟ] GED Boosting: $(cat /sys/module/ged/parameters/ged_boost_enable)"
)

header "GPU Control"
selected="$(fzy_select "Set max freq\nSet min freq\nLock freq (NO DVFS)\nLock voltage (NO DVFS)\nReset DVFS\nGED GPU DVFS\nGED Boost\nGED GPU boost\nBack to main menu" "")"
selected="$(fzy_select "Set max freq\nSet min freq\nLock freq (NO DVFS)\nReset DVFS\nGED GPU DVFS\nGED Boost\nGED GPU boost\nBack to main menu" "")"

case "$selected" in
"Set max freq") ged_max_freq ;;
"Set min freq") ged_min_freq ;;
"Lock freq (NO DVFS)") mtk_gpufreqv2_lock_freq ;;
"Lock voltage (NO DVFS)") mtk_gpufreqv2_lock_volt ;;
"Reset DVFS") mtk_gpufreqv2_reset_dvfs ;;
"GED GPU DVFS") mtk_ged_dvfs ;;
"GED Boost") mtk_ged_boost ;;
Expand Down

0 comments on commit 4ec9b3c

Please sign in to comment.