Reducing Rock Pi 4 power usage?

I was wondering if there have been any more recent discoveries on reducing Rock Pi 4 power usage, especially during idle usage.

My situation: I’m using a Rock Pi 4 B+, 128GB eMMC, M.2 extension board, and a Samsung 970 Evo Plus 2TB NVMe SSD as a file and application server in a camper van powered by solar PV and 12V battery system. It is currently running the Armbian_22.08.1_Rockpi-4b_jammy_current_5.15.63 image with the OS running from the NVMe drive.

I’m currently using a 12V 60W USB-C power supply to power the system. For home testing, I’m using a 12V 8.5A AC-DC converter to power the USB-C power supply and a Kill-A-Watt AC power meter to get a rough power usage estimate (and knowing it includes power loss from the AC-DC converter),

I’m seeing:

  • 4W idle
  • 3W idle after applying either powersave or powersupersave to /sys/module/pcie_aspm/parameters/policy
  • Up to 8W during heavy disk IO

One idea I’ve had was to try turning off bits of the hardware I don’t use, like HDMI, GPU, audio, Bluetooth, WiFi, LEDs, etc. but I don’t see easy ways to do so. I’ve seen some Raspberry Pi features disabled for power saving by using device tree overlays but don’t see any for the Rock Pi 4, so it might involve learning how to make device tree overlay files to see if disabling those bits of hardware would reduce power consumption.

Older threads I found on the topic:


I would recommend running latest version of my sbc-bench since the interactive mode will report probably performance relevant governors. Such governors are always about both performance and consumption at the same time as such even knowing where you could adjust stuff might point to tunables worth looking into.

The whole point of sbc-bench isn’t ‘yet another benchmark’ but understanding hardware, software, settings and capabilities better to act on accordingly.

On a Rock 5B for example sbc-bench will print this when starting:

Status of probably performance related governors below /sys:
dmc: powersave (dmc_ondemand userspace powersave performance simple_ondemand)
fb000000.gpu: simple_ondemand (dmc_ondemand userspace powersave performance simple_ondemand)
fdab0000.npu: userspace (dmc_ondemand userspace powersave performance simple_ondemand)

dmc is key to powersavings in idle. You’re running 5.15 so no idea whether dmc is there or not. It’s a feature of Rockchip’s BSP kernels and many such features get lost with mainline kernel. sbc-bench will tell.

As for ASPM (/sys/module/pcie_aspm/parameters/policy) I would be really careful with powersupersave. At least I got data corruption on both ARM and x86 with it. The lowest I would go is powersave.

Wi-Fi/BT is another good spot to look at if it’s not needed. Either by using a device-tree overlay to disable the respective nodes or by using rfkill in some start scripts.

Turning off internal SoC features (like HDMI, GPU) is usually done automagically with BSP kernels (the stuff from the SoC vendor) but often gets lost with mainline kernel. It’s often a bit tricky to measure since after a cold boot the HDMI PHY (and some GPU parts) may be active to be then disabled after n minutes of inactivity.

Using something like a Kill-A-Watt or some USB powermeter is often not sufficient to get the bigger picture since consumption fluctuations hide little gains and without longterm graphs that show tendencies stuff like “internal HDMI gets disabled automatically after 10 minutes” won’t be spotted.

LEDs are not worth the efforts since just a few mW so all that remains left to be checked is maybe broken/stupid DVFS settings (DVFS = dynamic voltage frequency scaling). Since you’re using an Armbian image you can rest assured that not a single brain cell has been wasted on this. At least not by anyone ‘working’ over at Armbian.

I tried to integrate DVFS OPP reporting into latest sbc-bench version (though requires an export MODE=extensive prior to starting the benchmark). But there’s at least one bug remaining reporting bogus clockspeeds. You could give it a try and I may fix it with your help on the way…

Everything about limiting count of CPU cores or limiting maximum cpufreq is more about reducing peak consumption and doesn’t affect idle (that much). As such a different area.

Is there a method to boot either Radxa BSP kernels or Armbian kernels using the same boot/root filesystem? I can’t find one after some quick searches.

One hopeful sign - running the Armbian 5.15.69-rockchip64 kernel I see a /sys/bus/platform/drivers/rk3399-dmc-freq directory.

Probably not a good sign for the Armbain 5.15.69-rockchip64 kernel build - running sbc-bench showed empty output for the probably performance related governors:

Status of probably performance related governors: below /sys:

sbc-bench v0.9.9

I’m still digging in to this, but I’ve seen some indications that the Rockchip rk3399 DMC and DDR DVFS support may have been merged into the mainline Linux kernel:

https://patchwork.kernel.org/project/linux-pm/cover/20220127230727.3369358-1-briannorris@chromium.org/

Edit: Perhaps starting with 5.19 though, since the memory-controller dtsi change did not appear until then:

https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/arch/arm64/boot/dts/rockchip/rk3399.dtsi?h=linux-5.19.y

Edit 2: I see the memory-controller section has status=“disabled” - I wonder if that means Armbian’s build system will need some config/patch to enable things:

Not that I know.

I’m having a few RK3399 still running with 4.4 BSP kernel around so let’s take this thing and measure:

First try with Armbian defaults back then (everything set to performance except cpufreq) ends up with idle consumption: 2690mW:

Status of probably performance related governors below /sys:
dmc: performance
ff9a0000.gpu: performance

Retesting with only GPU set to powersave we’re at idle consumption: 2600mW:

Status of probably performance related governors below /sys:
dmc: performance
ff9a0000.gpu: powersave (dmc_ondemand userspace powersave performance simple_ondemand)

Retesting with DMC and GPU both set to powersave we’re at idle consumption: 2040mW:

Status of probably performance related governors below /sys:
dmc: powersave (dmc_ondemand userspace powersave performance simple_ondemand)
ff9a0000.gpu: powersave (dmc_ondemand userspace powersave performance simple_ondemand)

All CPU cores were at 408 MHz while measuring idle consumption and loadavg / CPU utilization were confirmed to be low enough (that’s why sbc-bench has been invented):

Time       big.LITTLE   load %cpu %sys %usr %nice %io %irq   Temp     mW
12:56:48:  408/ 408MHz  0.66   5%   2%   3%   0%   0%   0%  27.5°C     20
12:57:18:  408/ 408MHz  0.41   1%   0%   0%   0%   0%   0%  27.5°C   2000
12:57:49:  408/ 408MHz  0.25   1%   0%   0%   0%   0%   0%  26.9°C   2000
12:58:19:  408/ 408MHz  0.15   1%   0%   0%   0%   0%   0%  26.9°C   2030
12:58:49:  408/ 408MHz  0.16   1%   0%   0%   0%   0%   0%  26.9°C   2010
12:59:19:  408/ 408MHz  0.20   1%   0%   0%   0%   0%   0%  26.9°C   2050
12:59:49:  408/ 408MHz  0.12   1%   0%   0%   0%   0%   0%  27.5°C   2040
13:00:19:  408/ 408MHz  0.07   1%   0%   0%   0%   0%   0%  27.5°C   2060

So keeping GPU clock low saves ~100mW, keeping DRAM clock low saves another ~560mW.

Can you please upload the contents of /sys/kernel/debug/clk/clk_summary to pastebin or something like that?

The OPP tables of this old Armbian image look like this (you get this as well when running sbc-bench and do an export MODE=extensive before):

opp-table0 (Cortex-A53):
    408 MHz   800.0 mV
    600 MHz   800.0 mV
    816 MHz   850.0 mV
   1008 MHz   925.0 mV
   1200 MHz  1000.0 mV
   1416 MHz  1125.0 mV
   1512 MHz  1200.0 mV

opp-table1 (Cortex-A72):
    408 MHz   800.0 mV
    600 MHz   800.0 mV
    816 MHz   825.0 mV
   1008 MHz   875.0 mV
   1200 MHz   950.0 mV
   1416 MHz  1025.0 mV
   1608 MHz  1100.0 mV
   1800 MHz  1200.0 mV
   1992 MHz  1300.0 mV

opp-table2 (GPU):
    200 MHz   800.0 mV
    300 MHz   800.0 mV
    400 MHz   825.0 mV
    600 MHz   925.0 mV
    800 MHz  1100.0 mV

opp-table3 (DMC):
    200 MHz   900.0 mV
    300 MHz   900.0 mV
    400 MHz   900.0 mV
    528 MHz   900.0 mV
    600 MHz   900.0 mV
    800 MHz   900.0 mV

As for the Armbian questions better ask those guys who haven’t left the project (like me for example): @lanefu @Tonymac32

I booted up an Armbian jammy edge image for Rock Pi 4 B+ with kernel 5.19.12 and:

  • I see a few more /sys dmc files are present (see below) but nothing in dmesg.
  • No new device tree overlay files in /boot/dtb/rockchip/overlay/*.dtbo
  • I have managed to crash the machine once in under five minutes though, so it may not be stable.

Output:

root@rockpi-4bplus:~# uname -a
Linux rockpi-4bplus 5.19.12-rockchip64 #trunk.0047 SMP PREEMPT Wed Sep 28 17:10:41 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

root@rockpi-4bplus:~# cd /sys/
root@rockpi-4bplus:/sys# find . -iname "*dmc*" -print
./bus/platform/drivers/rk3399-dmc-freq
./bus/platform/drivers/rk3328-dmc
./firmware/devicetree/base/dmc_opp_table
./firmware/devicetree/base/__symbols__/dmc
./firmware/devicetree/base/__symbols__/dmc_opp_table

In the meantime I started to collect OPP tables from various SoCs: https://github.com/ThomasKaiser/sbc-bench/tree/master/results/opp-tables

And indeed with 5.19 dmc with RK3399 is back with these settings:

400 MHz   900.0 mV
666 MHz   900.0 mV
800 MHz   900.0 mV
928 MHz   925.0 mV

With Rockchip’s 4.4 BSP kernel it was this back then:

200 MHz   900.0 mV
300 MHz   900.0 mV
400 MHz   900.0 mV
528 MHz   900.0 mV
600 MHz   900.0 mV
800 MHz   900.0 mV

If I find some spare time I’ll measure with 5.19 and a NanoPi NEO4 the next days to see whether there’s something different wrt idle consumption (since with 5.19 it seems 400 MHz would be the lowest DRAM clock).

Still interested in /sys/kernel/debug/clk/clk_summary with 5.19 if you could provide…

https://paste.ubuntu.com/p/GDqxGgqK3x/

From Armbian kernel 5.19.12-rockchip64:

root@rockpi-4bplus:/home/jasons# uname -a
Linux rockpi-4bplus 5.19.12-rockchip64 #trunk.0047 SMP PREEMPT Wed Sep 28 17:10:41 UTC 2022 aarch64 aarch64 aarch64 GNU/Linux

Edit: for some reason cpu governor was “performance” that boot, so I updated, rebooted, verified governor “ondemand” via cpufreq-info, and uploaded again: https://paste.ubuntu.com/p/ky4wyQqmGN/

Edit2: and it seems PCIe is stuck at Gen1 speed even tho overlay pcie-gen2 is specificed in armbianEnv.txt: https://paste.ubuntu.com/p/yVg9BXshFK/

Did you use a pre-built 5.19 kernel (if so, which one?) or build one yourself?