yangkunvanpersie ( ) 通过“有道云笔记”邀请您查看以下笔记 | ||
修改CPU频率.note | ||
kernel-3.18/drivers/misc/mediatek/base/power/mt6580/mt_cpufreq.c
kernel-3.18/drivers/misc/mediatek/base/power/mt6580/mt_cpufreq.c:#define CPU_DVFS_FREQ4 (1001000) /* KHz */ kernel-3.18/drivers/misc/mediatek/base/power/mt6580/mt_cpufreq.c:#define PLL_DIV1_1001_FREQ (1001000) /* for 1G - low */
kernel-3.18/drivers/misc/mediatek/base/power/mt6580/mt_cpufreq.c (0)[54:cfinteractive][name:mt_cpufreq&][Power/cpufreq] @get_cur_phy_freq: cur_khz = 1001000, con1 = 0x8009a000, ckdiv1_val = 0x8
[FAQ17683]如何调整CPU corenum, freq, policy [DESCRIPTION]
设置平台CPUfreq 与以及core
[SOLUTION]
cpufreq控制结点位于 /sys/devices/system/cpu/cpu0/cpufreq/ C:\Users\mtk71247>adb shell root@NOBLEX:/ # cd sys/devices/system/cpu/cpu0/cpufreq cd sys/devices/system/cpu/cpu0/cpufreq root@NOBLEX:/sys/devices/system/cpu/cpu0/cpufreq # ls ls cpuinfo_cur_freq: 当前cpu正在运行的工作频率 cpuinfo_max_freq:该文件指定了处理器能够运行的最高工作频率 (单位: 千赫兹) cpuinfo_min_freq :该文件指定了处理器能够运行的最低工作频率 (单位: 千赫兹) cpuinfo_transition_latency:该文件定义了处理器在两个不同频率之间切换时所需要的时间 (单位: 纳秒) scaling_available_frequencies:所有支持的主频率列表 (单位: 千赫兹) scaling_available_governors:该文件显示当前内核中支持的所有cpufreq governor类型 scaling_cur_freq:被governor和cpufreq核决定的当前CPU工作频率。该频率是内核认为该CPU当前运行的主频率 scaling_driver:该文件显示该CPU正在使用何种cpufreq driver scaling_governor:通过echo命令,能够改变当前处理器的governor类型 scaling_max_freq:显示当前policy的上下限 (单位: 千赫兹)需要注意的是,当改变cpu policy时,需要首先设置scaling_max_freq, 然后才是scaling_min_freq scaling_setspeed:如果用户选择了“userspace” governor, 那么可以设置cpu工作主频率到某一个指定值。
只需要这个值在scaling_min_freq 和 scaling_max_freq之间即可。 root@NOBLEX:/sys/devices/system/cpu/cpu0/cpufreq #
1、查看当前CPU支持的频率档位 root@NOBLEX:/sys # cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies 1300000 1235000 1170000 1040000 819000 598000 442000 299000 root@NOBLEX:/sys # 2、查看当前支持的governor(手机型号可能略有不同) root@NOBLEX:/sys # cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors ondemand userspace powersave interactive performance performance表示不降频, ondemand表示使用内核提供的功能,可以动态调节频率, powersvae表示省电模式,通常是在最低频率下运行, userspace表示用户模式,在此模式下允许其他用户程序调节CPU频率。
root@NOBLEX:/sys # 3、查看当前选择的governor cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor interactive root@NOBLEX:/sys #
4、查看系统支持多少核数 root@NOBLEX:/ # cat sys/devices/system/cpu/present cat sys/devices/system/cpu/present 0-3 root@NOBLEX:/ #
5、全开所有cpu ,在实际设置时,还需要(有root权限才可以设置)
adb shell "echo 0 > /proc/hps/enabled" (关闭cpu hotplug) adb shell "echo performance > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor" (固定最高频) echo 1 > /sys/devices/system/cpu/cpuX/online X表示(0~3,不同平台CPU core 数是不一样的) 例:6735平台 root@NOBLEX:/ # echo 1 >sys/devices/system/cpu/cpu1/online echo 1 >sys/devices/system/cpu/cpu1/online root@NOBLEX:/ # echo 1 >sys/devices/system/cpu/cpu2/online echo 1 >sys/devices/system/cpu/cpu2/online root@NOBLEX:/ # echo 1 >sys/devices/system/cpu/cpu3/online echo 1 >sys/devices/system/cpu/cpu3/online
6、设置频率(可以先cat 出来当前的频率有哪些) C:\Users\mtk71247>adb shell "cat /proc/cpufreq/cpufreq_ptpod_freq_volt" [0] = { .cpufreq_khz = 1300000, .cpufreq_volt = 113750, .cpufreq_volt_org = 1250 00, }, [1] = { .cpufreq_khz = 1235000, .cpufreq_volt = 110000, .cpufreq_volt_org = 1231 25, }, [2] = { .cpufreq_khz = 1170000, .cpufreq_volt = 106250, .cpufreq_volt_org = 1206 25, }, [3] = { .cpufreq_khz = 1040000, .cpufreq_volt = 98750, .cpufreq_volt_org = 1150 00, }, [4] = { .cpufreq_khz = 819000, .cpufreq_volt = 95000, .cpufreq_volt_org = 1100 00, }, [5] = { .cpufreq_khz = 598000, .cpufreq_volt = 95000, .cpufreq_volt_org = 1050 00, }, [6] = { .cpufreq_khz = 442000, .cpufreq_volt = 95000, .cpufreq_volt_org = 1000 00, }, [7] = { .cpufreq_khz = 299000, .cpufreq_volt = 95000, .cpufreq_volt_org = 9500 0, },
C:\Users\mtk71247>adb shell "echo 0 >proc/cpufreq/cpufreq_oppidx"
设置后再cat 看一下当前的设置是否成功 C:\Users\mtk71247>adb shell "cat proc/cpufreq/cpufreq_oppidx" [MT_CPU_DVFS_LITTLE/0] cpufreq_oppidx = 0 OP(1300000, 113750), OP(1235000, 110000), OP(1170000, 106250), OP(1040000, 98750), OP(819000, 95000), OP(598000, 95000), OP(442000, 95000), OP(299000, 95000),
C:\Users\mtk71247>
7、查看当前状态有多少个CPU root@NOBLEX:/ # cat sys/devices/system/cpu/online cat sys/devices/system/cpu/online 0-3 root@NOBLEX:/ #
16:48分开始测试 开机向导界面 | ||
|
kernel-3.18/drivers/misc/mediatek/base/power/mt6735/mt_cpufreq.c- /* DVFS OPP table */ #ifdef CONFIG_ARCH_MT6735M-#define CPU_DVFS_FREQ0_1 (1248000) /* KHz */+#define CPU_DVFS_FREQ0_1 (1300000) /* KHz */ #define CPU_DVFS_FREQ0 (1144000) /* KHz */ #define CPU_DVFS_FREQ1_1 (1092000) /* KHz */ #define CPU_DVFS_FREQ1 (1027000) /* KHz */@@ -750,7 +749,7 @@ static struct mt_cpu_freq_info opp_tbl_e1_1[] = { /* CPU LEVEL 2, 1.25GHz segment */ static struct mt_cpu_freq_info opp_tbl_e1_2[] = {- OP(CPU_DVFS_FREQ0_1,125000),+ OP(CPU_DVFS_FREQ0_1,130000), OP(CPU_DVFS_FREQ1, 121875), OP(CPU_DVFS_FREQ5, 118750), OP(CPU_DVFS_FREQ6, 115000),
---