[IMX6DL][Android4.4] CPU频率调节模式以及降频方法

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文件动态写入。

  • 2
    点赞
  • 8
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值