android 调整cpu频率,[IMX6DL][Android4.4] CPU频率调节模式以及降频方法
Kernel branch: 3.0.35
CPU的頻率調(diào)節(jié)模式:
1. Performance.? 不考慮耗電,只用最高頻率。
2. Interactive.? 直接上最高頻率,然后看CPU負(fù)荷慢慢降低。
3. Powersave.?? ?通常以最低頻率運(yùn)行,流暢度會(huì)受影響,一般不會(huì)用這個(gè)吧!
4. Userspace.?? ?可以在用戶(hù)空間手動(dòng)調(diào)節(jié)頻率。
5. Ondemand.?? ?定期檢查負(fù)載,根據(jù)負(fù)載來(lái)調(diào)節(jié)頻率。
cpu頻率相關(guān)的目錄:
root@tek_mx6:/sys/devices/system/cpu/cpuX, X表示cpu number.
root@tek_mx6:/sys/devices/system/cpu/cpu0/cpufreq # ls
affected_cpus
cpuinfo_cur_freq
cpuinfo_max_freq
cpuinfo_min_freq
cpuinfo_transition_latency
related_cpus
scaling_available_frequencies
scaling_available_governors
scaling_cur_freq
scaling_driver
scaling_governor
scaling_max_freq
scaling_min_freq
scaling_setspeed
stats
工作模式:
當(dāng)前支持的cpu調(diào)節(jié)模式可通過(guò)scaling_available_frequencies查看,
root@tek_mx6:/sys/devices/system/cpu/cpu0/cpufreq # cat scaling_available_governors
interactive conservative ondemand userspace powersave performance
可通過(guò)defconfig編譯進(jìn)去:
kernel_imx/arch/arm/configs/imx6_tek_android_defconfig:
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE=y
......
CONFIG_CPU_FREQ_GOV_PERFORMANCE=y
CONFIG_CPU_FREQ_GOV_POWERSAVE=y
CONFIG_CPU_FREQ_GOV_USERSPACE=y
CONFIG_CPU_FREQ_GOV_ONDEMAND=y
CONFIG_CPU_FREQ_GOV_INTERACTIVE=y
CONFIG_CPU_FREQ_GOV_CONSERVATIVE=y
默認(rèn)使用了performance,不過(guò)freescale在boot完成后改成了interactive.
device/fsl/tek_mx6/init.rc:
on property:sys.boot_completed=1
# Set default CPU frequency governor
# Set timer 40ms, min sample 60ms,hispeed at cpufreq MAX freq in freq_table at load 40%
write /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor interactive
最終可通過(guò)scaling_governor文件查看。
工作頻率:
當(dāng)前支持的cpu調(diào)節(jié)模式可通過(guò) scaling_available_frequencies 查看。
root@tek_mx6:/sys/devices/system/cpu/cpu0/cpufreq # cat scaling_available_frequencies
vailable_frequencies
996000 792000 396000
當(dāng)前工作頻率可通過(guò)scaling_cur_freq查看。
支持的頻率以及最大頻率是在文件:
kernel_imx/arch/arm/mach-mx6/cpu_op-mx6.c
struct cpu_op *mx6_get_cpu_op(int *op)
{
if (cpu_is_mx6dl()) {
if (arm_max_freq == CPU_AT_1_2GHz) {
*op = num_cpu_op = ARRAY_SIZE(mx6dl_cpu_op_1_2G);
return mx6dl_cpu_op_1_2G;
} else if (arm_max_freq == CPU_AT_1GHz) {
*op = num_cpu_op = ARRAY_SIZE(mx6dl_cpu_op_1G);
return mx6dl_cpu_op_1G;
} else {
*op = num_cpu_op = ARRAY_SIZE(mx6dl_cpu_op);
return mx6dl_cpu_op;
}
} else if (cpu_is_mx6q()) {
......
} else {
......
}
}根據(jù)平臺(tái)以及默認(rèn)的最大頻率來(lái)選擇對(duì)應(yīng)的頻率列表。
所以降頻有兩種方法:
1. 直接編譯靜態(tài)修改頻率列表。
2. 通過(guò)scaling_max_freq文件動(dòng)態(tài)寫(xiě)入。
總結(jié)
以上是生活随笔為你收集整理的android 调整cpu频率,[IMX6DL][Android4.4] CPU频率调节模式以及降频方法的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: 华为手机EMUI换鸿蒙,华为手机3月全面
- 下一篇: android 环信消息红点,环信3.0