[高通平臺小米4]的電源管理配置學習
阿新 • • 發佈:2019-01-04
1.溫控調頻
/system/etc/thermal-engine-8974.conf
sampling 5000
[CPU0_MONITOR]
algo_type monitor
sensor cpu0
sampling 1000
thresholds 55000 60000 65000 70000 85000 105000 115000
thresholds_clr 50000 55000 60000 66000 80000 90000 110000
actions cpu cpu cpu cpu cpu cpu shutdown
action_info 1728000 1497600 1190400 1036800 960000 6528000 0
[CPU1_MONITOR]
algo_type monitor
sensor cpu1
sampling 65
thresholds 115000
thresholds_clr 110000
actions shutdown
action_info 0
[CPU2_MONITOR]
……
[CPU3_MONITOR]
……
-(溫度閾值) thresholds 55000 60000 65000 70000 85000 105000 115000
-(條件解除閾值)thresholds_clr 50000 55000 60000 66000 80000 90000 110000
- (CPU頻率)action_info 1728000 1497600 1190400 1036800 960000 6528000 0
例如 55 ℃ 則調節CPU頻率為1728000Hz,50 ℃ 時解除CPU頻率設定
2.CPU 高效能模式
/system/bin/changepowermode.sh
#!/system/bin/sh
target=`getprop ro.product.model`
powermode=`getprop persist.sys.aries.power_profile`
dev_governor=`ls /sys/class/devfreq/qcom,cpubw*/governor`
case "$target" in
……
"LEO "* | "MI 4"* | "MI NOTE"* | "VIRGO" *)
case "$powermode" in
"high")
stop mpdecision
sleep 1
echo 1 > /sys/devices/system/cpu/cpu1/online
echo 1 > /sys/devices/system/cpu/cpu2/online
echo 1 > /sys/devices/system/cpu/cpu3/online
echo 1 > /sys/devices/system/cpu/cpu1/online
echo 1 > /sys/devices/system/cpu/cpu2/online
echo 1 > /sys/devices/system/cpu/cpu3/online
echo 2457600 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 2457600 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
echo 2457600 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
echo 2457600 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo performance > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
echo 20 > /sys/module/cpu_boost/parameters/boost_ms
echo 1728000 > /sys/module/cpu_boost/parameters/sync_threshold
echo 1497600 > /sys/module/cpu_boost/parameters/input_boost_freq
echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
echo 255 > /sys/class/leds/lcd-backlight/max_brightness
echo 578000000 > /sys/class/kgsl/kgsl-3d0/max_gpuclk
echo performance > /sys/class/kgsl/kgsl-3d0/devfreq/governor
echo "msm_cpufreq" > $dev_governor
;;
"middle")
echo interactive > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
echo interactive > /sys/devices/system/cpu/cpu1/cpufreq/scaling_governor
echo interactive > /sys/devices/system/cpu/cpu2/cpufreq/scaling_governor
echo interactive > /sys/devices/system/cpu/cpu3/cpufreq/scaling_governor
echo 2457600 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 2457600 > /sys/devices/system/cpu/cpu1/cpufreq/scaling_max_freq
echo 2457600 > /sys/devices/system/cpu/cpu2/cpufreq/scaling_max_freq
echo 2457600 > /sys/devices/system/cpu/cpu3/cpufreq/scaling_max_freq
echo "20000 1400000:40000 1700000:20000" > /sys/devices/system/cpu/cpufreq/interactive/above_hispeed_delay
echo 90 > /sys/devices/system/cpu/cpufreq/interactive/go_hispeed_load
echo 1190400 > /sys/devices/system/cpu/cpufreq/interactive/hispeed_freq
echo "85 1500000:99" > /sys/devices/system/cpu/cpufreq/interactive/target_loads
echo 40000 > /sys/devices/system/cpu/cpufreq/interactive/min_sample_time
echo 20 > /sys/module/cpu_boost/parameters/boost_ms
echo 1497600 > /sys/module/cpu_boost/parameters/sync_threshold
echo 1190400 > /sys/module/cpu_boost/parameters/input_boost_freq
echo 40 > /sys/module/cpu_boost/parameters/input_boost_ms
echo 255 > /sys/class/leds/lcd-backlight/max_brightness
echo 578000000 > /sys/class/kgsl/kgsl-3d0/max_gpuclk
echo msm-adreno-tz > /sys/class/kgsl/kgsl-3d0/devfreq/governor
echo "cpubw_hwmon" > $dev_governor
start mpdecision
;;
esac
;;
esac
上述主要通過開核,升頻率,設定performance模式,和場景調頻完成高效能的切換
3.小結
感覺這樣的高通平臺設定簡直是low,這裡貼出MTK的CPU場景調頻進行對比
CMD_SET_SCN_VALID, SCN_SW_FRAME_UPDATE, 0
CMD_SET_CLUSTER_CPU_CORE_MIN, SCN_APP_SWITCH, 0, 4
CMD_SET_CLUSTER_CPU_FREQ_MIN, SCN_APP_SWITCH, 0, 3000000
CMD_SET_TA_BOOST_VALUE, SCN_APP_SWITCH, 1100
CMD_SET_CLUSTER_CPU_CORE_MIN, SCN_PACKAGE_SWITCH, 0, 4
CMD_SET_CLUSTER_CPU_FREQ_MIN, SCN_PACKAGE_SWITCH, 0, 3000000
CMD_SET_VCORE_MIN, SCN_PACKAGE_SWITCH, 0
CMD_SET_TA_BOOST_VALUE, SCN_PACKAGE_SWITCH, 1100
CMD_SET_PPM_LIMIT_BIG_FREQ, SCN_PACKAGE_SWITCH, 0
CMD_SET_CLUSTER_CPU_CORE_MIN, SCN_PROCESS_CREATE, 0, 4
CMD_SET_CLUSTER_CPU_FREQ_MIN, SCN_PROCESS_CREATE, 0, 3000000
CMD_SET_VCORE_MIN, SCN_PROCESS_CREATE, 0
CMD_SET_TA_BOOST_VALUE, SCN_PROCESS_CREATE, 1100
CMD_SET_PPM_LIMIT_BIG_FREQ, SCN_PROCESS_CREATE, 0
CMD_SET_CLUSTER_CPU_CORE_MIN, SCN_APP_LAUNCH, 0, 4
CMD_SET_CLUSTER_CPU_FREQ_MIN, SCN_APP_LAUNCH, 0, 3000000
CMD_SET_VCORE_MIN, SCN_APP_LAUNCH, 0
CMD_SET_TA_BOOST_VALUE, SCN_APP_LAUNCH, 1100
CMD_SET_FPSGO_ENABLE, SCN_APP_LAUNCH, 0
CMD_SET_CLUSTER_CPU_CORE_MIN, SCN_APP_INSTALL, 0, 4
CMD_SET_CLUSTER_CPU_FREQ_MIN, SCN_APP_INSTALL, 0, 3000000
CMD_SET_VCORE_MIN, SCN_APP_INSTALL, 0
CMD_SET_TA_BOOST_VALUE, SCN_APP_INSTALL, 1100
CMD_SET_FPSGO_ENABLE, SCN_APP_INSTALL, 0
CMD_SET_CLUSTER_CPU_CORE_MIN, SCN_APP_ROTATE, 0, 4
CMD_SET_CLUSTER_CPU_FREQ_MIN, SCN_APP_ROTATE, 0, 3000000
CMD_SET_VCORE_MIN, SCN_APP_ROTATE, 0
CMD_SET_TA_BOOST_VALUE, SCN_APP_ROTATE, 1100
CMD_SET_CLUSTER_CPU_CORE_MIN, SCN_GAME_LAUNCH, 0, 4
CMD_SET_CLUSTER_CPU_FREQ_MIN, SCN_GAME_LAUNCH, 0, 3000000
CMD_SET_VCORE_MIN, SCN_GAME_LAUNCH, 0
CMD_SET_TA_BOOST_VALUE, SCN_GAME_LAUNCH, 1100
CMD_SET_PPM_LIMIT_BIG_FREQ, SCN_GAME_LAUNCH, 0
CMD_SET_FPSGO_ENABLE, SCN_GAME_LAUNCH, 0
CMD_SET_CLUSTER_CPU_CORE_MIN, SCN_GALLERY_BOOST, 0, 4
CMD_SET_CLUSTER_CPU_FREQ_MIN, SCN_GALLERY_BOOST, 0, 3000000
CMD_SET_TA_BOOST_VALUE, SCN_GALLERY_BOOST, 1100
CMD_SET_GX_BOOST, SCN_GLSURFACE, 1
CMD_SET_SCN_VALID, SCN_GLSURFACE, 1
CMD_SET_CLUSTER_CPU_CORE_MIN, SCN_SP_MODE, 0, 0
CMD_SET_CLUSTER_CPU_CORE_MIN, SCN_VR_MODE, 0, 0
MTK提供各個使用場景的動態調頻,比如切換應用場景,遊戲場景,自旋轉切換等開核,頻率數,模式,溫控調節