imx6 CPU frequency adjustment mode and frequency reduction method

Kernel branch: 3.0.35


CPU frequency adjustment mode:
1. Performance. Regardless of power consumption, only the highest frequency is used.
2. Interactive. Go directly to the highest frequency, and then watch the CPU load slowly decrease.
3. Powersave. Usually run at the lowest frequency, the fluency will be affected, generally do not use this!
4. Userspace. You can manually adjust the frequency in the user space.
5. Ondemand. Check the load regularly and adjust the frequency according to the load.


cpu frequency related directory:
root@tek_mx6:/sys/devices/system/cpu/cpuX, X represents 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


working mode:
The currently supported cpu adjustment mode can be viewed through scaling_available_frequencies,
root@tek_mx6:/sys/devices/system/cpu/cpu0/cpufreq # cat scaling_available_governors
interactive conservative ondemand userspace powersave performance


can be compiled in through defconfig:
kernel_imx/arch/ ARM / configs / imx6_tek_android_defconfig:
CONFIG_CPU_FREQ_DEFAULT_GOV_PERFORMANCE = the y-
......
CONFIG_CPU_FREQ_GOV_PERFORMANCE = the y-
CONFIG_CPU_FREQ_GOV_POWERSAVE = the y-
CONFIG_CPU_FREQ_GOV_USERSPACE = the y-
CONFIG_CPU_FREQ_GOV_ONDEMAND = the y-
CONFIG_CPU_FREQ_GOV_INTERACTIVE = the y-
CONFIG_CPU_FREQ_GOV_CONSERVATIVE = the y-

default of performance, but freescale after boot into a complete 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

can finally be viewed through the scaling_governor file.


Operating frequency:
The currently supported CPU adjustment modes can be viewed through scaling_available_frequencies.
root@tek_mx6:/sys/devices/system/cpu/cpu0/cpufreq # cat scaling_available_frequencies
vailable_frequencies                                                          
996000 792000 396000


The current operating frequency can be viewed through scaling_cur_freq.

The supported frequencies and maximum frequencies are in the file: 
kernel_imx/arch/arm/mach-mx6/cpu_op-mx6.c

[cpp]  view plain copy  
  1. struct  cpu_op *mx6_get_cpu_op( int  *op)  
  2. {  
  3.     if (cpu_is_mx6dl()) {  
  4.         if (arm_max_freq == CPU_AT_1_2GHz) {  
  5.             *op =  num_cpu_op = ARRAY_SIZE(mx6dl_cpu_op_1_2G);  
  6.             return mx6dl_cpu_op_1_2G;  
  7.         } else if (arm_max_freq == CPU_AT_1GHz) {  
  8.             *op =  num_cpu_op = ARRAY_SIZE(mx6dl_cpu_op_1G);  
  9.             return mx6dl_cpu_op_1G;  
  10.         } else {  
  11.             *op =  num_cpu_op = ARRAY_SIZE(mx6dl_cpu_op);  
  12.             return mx6dl_cpu_op;  
  13.         }  
  14.     } else if (cpu_is_mx6q()) {  
  15. ......  
  16.     } else {  
  17. ......  
  18.     }  
  19. }  
根据平台以及默认的最大频率来选择对应的频率列表。

所以降频有两种方法:
1. 直接编译静态修改频率列表。
2. 通过scaling_max_freq文件动态写入。

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325796519&siteId=291194637