RK3588 CPU GPU DDR NPU 频率设置
查看RK3588 CPU GPU DDR NPU 的频率电压表(opp)
以下⼏种策略:
- interactive:根据 CPU 负载动态调频调压;
- conservative:保守策略,逐级调整频率和电压;
- ondemand:根据 CPU 负载动态调频调压,⽐ interactive 策略反应慢;
- userspace:⽤⼾⾃⼰设置电压和频率,系统不会⾃动调整;
- powersave:功耗优先,始终将频率设置在最低值;
- performance:性能优先,始终将频率设置为最⾼值;
# cat /sys/kernel/debug/opp/opp_summary
device rate(Hz) target(uV) min(uV) max(uV)
-------------------------------------------------------------------
platform-fdab0000.npu
300000000 675000 675000 850000
675000 675000 850000
400000000 675000 675000 850000
675000 675000 850000
500000000 675000 675000 850000
675000 675000 850000
600000000 675000 675000 850000
675000 675000 850000
700000000 700000 700000 850000
700000 700000 850000
800000000 737500 737500 850000
737500 737500 850000
900000000 775000 775000 850000
775000 775000 850000
1000000000 825000 825000 850000
825000 825000 850000
platform-fb000000.gpu
300000000 675000 675000 850000
675000 675000 850000
400000000 675000 675000 850000
675000 675000 850000
500000000 675000 675000 850000
675000 675000 850000
600000000 675000 675000 850000
675000 675000 850000
700000000 687500 687500 850000
687500 687500 850000
800000000 725000 725000 850000
725000 725000 850000
900000000 775000 775000 850000
775000 775000 850000
1000000000 825000 825000 850000
825000 825000 850000
platform-dmc
528000000 675000 675000 875000
700000 700000 750000
1068000000 700000 700000 875000
712500 712500 750000
1560000000 775000 775000 875000
725000 725000 750000
2112000000 850000 850000 875000
750000 750000 750000
platform-fdbe0000.rkvenc-core
800000000 775000 775000 850000
775000 775000 850000
platform-fdbd0000.rkvenc-core
800000000 775000 775000 850000
775000 775000 850000
CPU
CPU fixed frequency CPU固定频率
RK3588的CPU为4个A55+4个A76,分为3组进行单独管理,节点分别为:
/sys/devices/system/cpu/cpufreq/policy0:(4 A55:CPU0-3)
affected_cpus cpuinfo_max_freq cpuinfo_transition_latency scaling_available_frequencies scaling_cur_freq scaling_governor scaling_min_freq stats
cpuinfo_cur_freq cpuinfo_min_freq related_cpus scaling_available_governors scaling_driver scaling_max_freq scaling_setspeed
/sys/devices/system/cpu/cpufreq/policy4:(2 A76:CPU4-5)
affected_cpus cpuinfo_max_freq cpuinfo_transition_latency scaling_available_frequencies scaling_cur_freq scaling_governor scaling_min_freq stats
cpuinfo_cur_freq cpuinfo_min_freq related_cpus scaling_available_governors scaling_driver scaling_max_freq scaling_setspeed
/sys/devices/system/cpu/cpufreq/policy6:(2 A76:CPU6-7)
affected_cpus cpuinfo_max_freq cpuinfo_transition_latency scaling_available_frequencies scaling_cur_freq scaling_governor scaling_min_freq stats
cpuinfo_cur_freq cpuinfo_min_freq related_cpus scaling_available_governors scaling_driver scaling_max_freq scaling_setspeed
以上3个CPU是独立控制的,下面以设置CPU6-7为例,说明如何设置CPU6-7的频率
获取当前 CPU 支持的频率
$ cat /sys/devices/system/cpu/cpufreq/policy*/scaling_available_frequencies
408000 600000 816000 1008000 1200000 1416000 1608000 1800000
408000 600000 816000 1008000 1200000 1416000 1608000 1800000 2016000 2208000 2304000
408000 600000 816000 1008000 1200000 1416000 1608000 1800000 2016000 2208000 2352000
获取 cpu 的运行模式
$ cat /sys/devices/system/cpu/cpufreq/policy6/scaling_available_governors
interactive conservative ondemand userspace powersave performance schedutil默认为自动变频模式:schedutil(如果恢复,可以设置为此模式)
设置手动固定频率模式:用户空间
# echo userspace > /sys/devices/system/cpu/cpufreq/policy6/scaling_governor
设置频率为 2352000
# echo 2352000 > /sys/devices/system/cpu/cpufreq/policy6/scaling_setspeed
确认设置是否成功
# cat /sys/devices/system/cpu/cpufreq/policy6/cpuinfo_cur_freq
2352000
另外两组CPU也是以类似的方式设置的,只是操作相应的节点。
GPU
GPU固定频率
GPU 节点路径
root@NanoPi-R6C:/home/pi# ls /sys/class/devfreq/fb000000.gpu/
available_frequencies cur_freq governor max_freq name power target_freq trans_stat
available_governors device load min_freq polling_interval subsystem timer uevent
获取 GPU 支持的频率
root@NanoPi-R6C:/home/pi# cat /sys/class/devfreq/fb000000.gpu/available_frequencies
1000000000 900000000 800000000 700000000 600000000 500000000 400000000 300000000
获取 GPU 运行的模式
root@NanoPi-R6C:/home/pi# cat /sys/class/devfreq/fb000000.gpu/available_governors
rknpu_ondemand dmc_ondemand userspace powersave performance simple_ondemand
默认为自动变频模式:simple_ondemand(如果恢复,可以设置为此模式)
将频率设置为 10000000000
#修改为用户态自定义设置
root@NanoPi-R6C:/home/pi# echo userspace > /sys/class/devfreq/fb000000.gpu/governor
# 设置为 1000000000
root@NanoPi-R6C:/home/pi# echo 1000000000 > /sys/class/devfreq/fb000000.gpu/userspace/set_freq
# 检查是否设置成功
root@NanoPi-R6C:/home/pi# cat /sys/class/devfreq/fb000000.gpu/cur_freq
1000000000
View GPU load 查看 GPU 负载
# glmark2-es2-wayland
root@NanoPi-R6C:/home/pi# cat /sys/class/devfreq/fb000000.gpu/load
66@300000000Hz
NPU
NPU固定频率
NPU 节点路径
root@NanoPi-R6C:/home/pi# ls /sys/class/devfreq/fdab0000.npu/
available_frequencies available_governors cur_freq device governor load max_freq min_freq name power subsystem target_freq trans_stat uevent
获取NPU支持的频率
root@NanoPi-R6C:/home/pi# cat /sys/class/devfreq/fdab0000.npu/available_frequencies
300000000 400000000 500000000 600000000 700000000 800000000 900000000 1000000000
获取 NPU 运行的模式
root@NanoPi-R6C:/home/pi# cat /sys/class/devfreq/fdab0000.npu/available_governors
rknpu_ondemand dmc_ondemand userspace powersave performance simple_ondemand
默认为自动变频模式:simple_ondemand(如果恢复,可以设置为此模式)
将频率设置为 10000000000
root@NanoPi-R6C:/home/pi# echo userspace > /sys/class/devfreq/fdab0000.npu/governor
root@NanoPi-R6C:/home/pi# echo 1000000000 > /sys/class/devfreq/fdab0000.npu/userspace/set_freq
root@NanoPi-R6C:/home/pi# cat /sys/class/devfreq/fdab0000.npu/cur_freq
1000000000
查看 NPU 负载
root@NanoPi-R6C:/home/pi# cat /sys/kernel/debug/rknpu/load
NPU load: Core0: 0%, Core1: 0%, Core2: 0%,
DDR
DDR 固定频率
DDR 节点路径
root@NanoPi-R6C:/home/pi# ls /sys/class/devfreq/dmc/
available_frequencies cur_freq downdifferential load min_freq power system_status trans_stat upthreshold
available_governors device governor max_freq name subsystem target_freq uevent userspace
获取 DDR 支持的频率
root@NanoPi-R6C:/home/pi# cat /sys/class/devfreq/dmc/available_frequencies
528000000 1068000000 1560000000 2112000000
获取 DDR 运行的模式
root@NanoPi-R6C:/home/pi# cat /sys/class/devfreq/dmc/available_governors
rknpu_ondemand dmc_ondemand userspace powersave performance simple_ondemand
默认为自动变频模式:dmc_ondemand(如果恢复,可以设置为此模式)
将频率设置为 2112000000
#将DDR频率设置为2112000000
root@NanoPi-R6C:/home/pi# echo userspace > /sys/class/devfreq/dmc/governor
root@NanoPi-R6C:/home/pi# Set the frequency to 2112000000
root@NanoPi-R6C:/home/pi# echo 2112000000 > /sys/class/devfreq/dmc/userspace/set_freq
# 确任是否设置成功
root@NanoPi-R6C:/home/pi# cat /sys/class/devfreq/dmc/cur_freq
2112000000
View DDR load 查看 DDR 负载
root@NanoPi-R6C:/home/pi# cat /sys/class/devfreq/dmc/load
57@2112000000Hz
CPU,GPU,NPU,DDR Performance Mode
CPU,GPU,NPU,DDR 性能模式
root@NanoPi-R6C:/home/pi# echo performance > /sys/devices/system/cpu/cpufreq/policy6/scaling_governor
root@NanoPi-R6C:/home/pi# echo performance > sys/class/devfreq/fb000000.gpu/governor
root@NanoPi-R6C:/home/pi# echo performance > /sys/class/devfreq/dmc/governor
root@NanoPi-R6C:/home/pi# echo performance > /sys/class/devfreq/fdab0000.npu/governor
或添加到启动脚本 /etc/rc.local