zoukankan      html  css  js  c++  java
  • [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文件动态写入。

  • 相关阅读:
    程序员要善于在工作中找到偷懒的办法
    关于count(1) 和 count(*)
    前端设计+程序开发那点事
    关于MySQL Connector/C++那点事儿
    windows下编译php5.2.17这是闹哪样?
    easyui使用时出现这个Uncaught TypeError: Cannot read property 'combo' of undefined
    视频文件自动转rtsp流
    Jenkins Pipeline如何动态的并行任务
    Jenkins的Dockerfile中如何批量迁移原Jenkins安装的插件
    Groovy中json的一些操作
  • 原文地址:https://www.cnblogs.com/Ph-one/p/11356103.html
Copyright © 2011-2022 走看看