[IMX6DL] CPU頻率調節模式以及降頻方法


本文轉自http://blog.csdn.net/kris_fei/article/details/51822435

Kernel branch: 3.0.35

CPU的頻率調節模式:
1. Performance.  不考慮耗電,只用最高頻率。
2. Interactive.  直接上最高頻率,然后看CPU負荷慢慢降低。
3. Powersave.    通常以最低頻率運行,流暢度會受影響,一般不會用這個吧!
4. Userspace.    可以在用戶空間手動調節頻率。
5. Ondemand.    定期檢查負載,根據負載來調節頻率。

cpu頻率相關的目錄:
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


工作模式:
當前支持的cpu調節模式可通過scaling_available_frequencies查看,
root@tek_mx6:/sys/devices/system/cpu/cpu0/cpufreq # cat scaling_available_governors
interactive conservative ondemand userspace powersave performance


可通過defconfig編譯進去:
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

默認使用了performance,不過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

最終可通過scaling_governor文件查看。

工作頻率:
當前支持的cpu調節模式可通過 scaling_available_frequencies 查看。
root@tek_mx6:/sys/devices/system/cpu/cpu0/cpufreq # cat scaling_available_frequencies
vailable_frequencies                                                          
996000 792000 396000


當前工作頻率可通過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 {
......
}
}

 

根據平台以及默認的最大頻率來選擇對應的頻率列表。


所以降頻有兩種方法:
1. 直接編譯靜態修改頻率列表。
2. 通過scaling_max_freq文件動態寫入。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM