aboutsummaryrefslogtreecommitdiff
path: root/scripts/vpu-clocks.service
diff options
context:
space:
mode:
authorNick Moore <nicholasvmoore@gmail.com>2026-11-17 08:13:59 -0600
committerNick Moore <nicholasvmoore@gmail.com>2026-11-17 08:14:12 -0600
commit8a4e71cb0f3dda9c3c9f981f825302ce69616719 (patch)
treee1dd11ef23cea3cbd1d50a933c1dd11054407580 /scripts/vpu-clocks.service
RK3328 VPU clock fix: DTS patch, CRU tool, boot-pin units, watchdog, write-ups
Out-of-box RK3328 BSP kernels boot the video decoder clocks at 100 MHz and the mpp driver's auto-frequency path never fires, capping 4K HEVC decode at 33.8 fps (57% of datasheet spec). Consumer-node clock assignment at 400 MHz restores the driver's own declared advanced rate: 70.2 fps decode, 40.8 fps dec->RGA. Includes a no-rebuild boot-pin alternative (OpenRC + systemd) and a repin watchdog.
Diffstat (limited to 'scripts/vpu-clocks.service')
-rw-r--r--scripts/vpu-clocks.service20
1 files changed, 20 insertions, 0 deletions
diff --git a/scripts/vpu-clocks.service b/scripts/vpu-clocks.service
new file mode 100644
index 0000000..b837659
--- /dev/null
+++ b/scripts/vpu-clocks.service
@@ -0,0 +1,20 @@
+[Unit]
+Description=Pin RK3328 VPU decoder/RGA clocks to 400 MHz (rkmpp BSP workaround)
+Documentation=https://github.com/nicholasvmoore/rk3328-vpu-clocks
+After=multi-user.target
+
+[Service]
+Type=oneshot
+# CRU CLKSEL_CON(n) = 0xFF440000 + 0x100 + 4n; hiword [31:16] of each write
+# is the per-bit write-enable mask. Field: bits[4:0] divider (rate =
+# parent/(div+1)), bits[7:6] mux (0 = CPLL @ 1200 MHz). 0x0202 per halfword
+# = div 2 + mux CPLL = 400 MHz. See README + blog.md for the full story.
+# CON(51) (venc) is deliberately not pinned: the venc driver self-manages.
+ExecStart=/usr/local/bin/cru 0x1c0 0xFFFF0202
+ExecStart=/usr/local/bin/cru 0x1c4 0x00FF0202
+ExecStart=/usr/local/bin/cru 0x190 0xFFFF0202
+ExecStart=/bin/sh -c 'echo 1000 > /proc/mpp_service/load_interval'
+RemainAfterExit=yes
+
+[Install]
+WantedBy=multi-user.target