Android CPU高性能调速performance

cpupower设置performance

设置CPU的频率

首先我们要修改governor的模式,但在修改前需要查下CPU支持哪些governor的模式

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_governors
conservative ondemand userspace powersave interactive performance

ondemand:系统默认的超频模式,按需调节,内核提供的功能,不是很强大,但有效实现了动态频率调节,平时以低速方式运行,当系统负载提高时候自动提高频率。以这种模式运行不会因为降频造成性能降低,同时也能节约电能和降低温度。

performance:性能模式!只有最高频率,从来不考虑消耗的电量,性能没得说,但是耗电量.......流畅度

我们将模式调整performance

echo "performance" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor

对CPU的频率进行修改,CPU的频率不是可以任意设置的,需要查看scaling_available_frequencies文件,看CPU支持哪些频率。

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_frequencies
echo "1416000" > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed

 

 

// MTK Platform /

一、Kernel的接口拉CPU频率,可以使用接口:

/kernel-4.4/drivers/misc/mediatek/include/mt-plat/mt6758/include/mach/mtk_ppm_api.h

extern void mt_ppm_sysboost_freq(enum ppm_sysboost_user user, unsigned int freq);

目前UT是预留出来的.

//引入头文件

#include "mach/mtk_ppm_api.h"

//request:
mt_ppm_sysboost_freq(BOOST_BY_UT,2340000);
//release:
mt_ppm_sysboost_freq(BOOST_BY_UT, 0);

获取CPU的频率:
可以读一下节点:
大核:
cat /proc/cpufreq/MT_CPU_DVFS_L/cpufreq
小核:
cat /proc/cpufreq/MT_CPU_DVFS_LL/cpufreq
二、在下面两只文件加入高亮的部分
drivers/misc/mediatek/base/power/include/vcorefs_v3/mtk_vcorefs_governor.h
@@ -52,6 +52,7 @@ enum dvfs_kicker {
                   KIR_BOOTUP,
                    KIR_FBT,
                    KIR_WIFI,
                    KIR_SPI,
                    KIR_SYSFS,
                    KIR_MM_NON_FORCE,
                    KIR_SYSFS_N,
drivers/misc/mediatek/base/power/vcorefs_v3/mtk_vcorefs_governor.c
@@ -147,6 +147,7 @@ static char *kicker_name[] = {
                    "KIR_BOOTUP",
                    "KIR_FBT",
                    "KIR_WIFI",
                    "KIR_SPI",
                    "KIR_SYSFS",
                    "KIR_MM_NON_FORCE",
                    "KIR_SYSFS_N",
需要加入头文件

#include <mtk_vcorefs_manager.h>

api: int vcorefs_request_dvfs_opp(enum dvfs_kicker kicker, enum dvfs_opp opp)

parameters:

1) kicer: KIR_SPI

2) opp:

                   OPP_0  for 3200/0.8V

                   OPP_1  for 2667/0.7V

                   OPP_2  for 1600/0.7V

                   OPP_UNREQ for release request

e.g.

1.//request dvfs floor to 3200

vcorefs_request_dvfs_opp(KIR_WIFI, OPP_0);

2.//release request

vcorefs_request_dvfs_opp(KIR_WIFI, OPP_UNREQ );   

enum dvfs_opp {

                    OPP_UNREQ = -1,

                    OPP_0 = 0,

                    OPP_1,

                    OPP_2,

                    NUM_OPP,

                    };

Note1: 因為 api內用到mutex, 外層不能用spinlock. 且要能允許sleep

Note2: request, 請一定要有 un-request, 不然有可能拉住系統最低檔位造成power issue.

Vcore读频率:

Cat /sys/power/vcorefs/vcore_debug

下面的数值变成0

sw_opp: 0

    static unsigned char performance_on = 0;
    if(!!on) {
        if(!performance_on) {
            performance_on = 1;
            mt_ppm_sysboost_freq(BOOST_BY_UT,2340000);
            vcorefs_request_dvfs_opp(KIR_SPI, OPP_0);
        }

      mod_timer(&freq_timer, jiffies + msecs_to_jiffies(2000));
    } else {
         vcorefs_request_dvfs_opp(KIR_SPI, OPP_UNREQ );
          mt_ppm_sysboost_freq(BOOST_BY_UT, 0);
         performance_on = 0;
     }

/

 

高通CPU调速   8994

adb shell "echo Y > /sys/module/lpm_levels/parameters/sleep_disabled" 

adb shell "echo 1 > /proc/sys/kernel/sched_boost" 

https://createpoint.qti.qualcomm.com/chipcenter/contentdocument/stream/0901003981138e99
adb shell "echo performance > sys/devices/system/cpu/cpu0/cpufreq/scaling_governor" 
adb shell "echo performance > sys/devices/system/cpu/cpu1/cpufreq/scaling_governor" 
adb shell "echo performance > sys/devices/system/cpu/cpu2/cpufreq/scaling_governor" 
adb shell "echo performance > sys/devices/system/cpu/cpu3/cpufreq/scaling_governor" 
adb shell "echo performance > sys/devices/system/cpu/cpu4/cpufreq/scaling_governor" 
adb shell "echo performance > sys/devices/system/cpu/cpu5/cpufreq/scaling_governor" 
adb shell "echo performance > sys/devices/system/cpu/cpu6/cpufreq/scaling_governor" 
adb shell "echo performance > sys/devices/system/cpu/cpu7/cpufreq/scaling_governor"

 

 

评论 2
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值