Skip to content

Commit

Permalink
mediatek/cpu: Introducing CPU Voltage offset via /proc/eemg
Browse files Browse the repository at this point in the history
Signed-off-by: Rem01Gaming <[email protected]>
  • Loading branch information
Rem01Gaming committed Dec 13, 2024
1 parent 3e7a46d commit 9d1b452
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 2 deletions.
7 changes: 5 additions & 2 deletions share/utils/cpu/cpu_util.sh
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,9 @@ cpu_menu() {
fi

if [ -d /proc/eem ]; then
options="$options\nCPU Voltage offset"
options="$options\nCPU Voltage offset (EEM)"
elif [ -d /proc/eemg ]; then
options="$options\nCPU Voltage offset (EEMG)"
fi
fi

Expand All @@ -328,7 +330,8 @@ cpu_menu() {
"Mediatek CCI mode") mtk_cpufreq_cci_mode ;;
"Mediatek Power mode") mtk_cpufreq_power_mode ;;
"Mediatek Sched Boost") mtk_sched_boost ;;
"CPU Voltage offset") mtk_cpu_volt_offset ;;
"CPU Voltage offset (EEM)") mtk_cpu_volt_offset ;;
"CPU Voltage offset (EEMG)") mtk_cpu_volt_offset2 ;;
"CPU Bus Control") qcom_cpubus ;;
"Back to main menu") break ;;
esac
Expand Down
20 changes: 20 additions & 0 deletions share/utils/cpu/mtk_cpumisc.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,26 @@ mtk_cpu_volt_offset() {
fi
}

mtk_cpu_volt_offset2() {
if [[ $1 == "-exec" ]]; then
local offset=$2
local selected=$3
apply $offset /proc/eemg/$selected/eemg_offset
else
local path=()
for dir in /proc/eemg/EEMG_DET_*; do
if [[ $dir != *GPU* ]] && [ -f $dir/eemg_offset ]; then
path+=($(basename $dir))
fi
done
local selected=$(fzf_select "$(echo ${path[@]})" "Select CPU Part to voltage offset: ")
menu_value_tune "Voltage Offset for CPU $selected\nOffset will take original voltage from Operating Performance Point (OPP) and add or subtract the given voltage, you can use it for Overvolting or Undervolting.\nOne tick is equal to 6,25mV." /proc/eemg/$selected/eemg_offset 50 -50 1
local offset=$number
command2db cpu.mtk.volt_offset "mtk_cpu_volt_offset2 -exec $offset $selected" TRUE
unset path
fi
}

mtk_sched_boost() {
if [[ $1 == "-exec" ]]; then
local selected=$2
Expand Down

0 comments on commit 9d1b452

Please sign in to comment.