1. 程式人生 > >MTK SPI 速度優化,提升DDR 頻率+CPU頻率

MTK SPI 速度優化,提升DDR 頻率+CPU頻率

 SPI 速度優化,提升DDR 頻率+CPU頻率

是指VCORE ddr的改動. 

一、Kernel的介面拉CPU頻率,可以使用介面:

目前UT是預留出來的.

//引入標頭檔案

//request:
//release
獲取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