aboutsummaryrefslogtreecommitdiff
path: root/0001-arm64-dts-rockchip-pin-RK3328-rkvdec-RGA-clocks-at-the-mpp-advanced-rate.patch
blob: 19c0d003d7fa781c0fdfc31549f73b4275ba6372 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
From 06532e55c4984fa40919d492afe996f6bfc77a51 Mon Sep 17 00:00:00 2001
From: Nick Moore <nicholasvmoore@gmail.com>
Date: Tue, 17 Nov 2026 08:19:07 -0600
Subject: [PATCH] arm64: dts: rockchip: pin RK3328 rkvdec/RGA clocks at the mpp
 advanced rate

The rk3328.dtsi CRU assigned-clock-rates boot the video decoder
interfaces at 100 MHz (ACLK_RKVDEC_PRE, SCLK_VDEC_CABAC,
SCLK_VDEC_CORE) and the RGA at 100 MHz. On the Rockchip 6.12 BSP (rkr)
mpp stack the rkvdec auto-frequency path never fires on RK3328:
/proc/mpp_service/rkvdec/{aclk,clk_core,clk_cabac,clk_hevc_cabac}
report real_rate_hz of 0, idle and under full load, so the driver's
rockchip,normal-rates (300 MHz) and rockchip,advanced-rates (400 MHz)
are never applied and decode runs at the 100 MHz boot pin - 33.8 fps
4K HEVC vs 70.2 fps with the clocks at 400 MHz (117% of the 60 fps
datasheet spec, RK3328 datasheet v1.4).

Fix by assigning the clocks on the consumer nodes at the advanced
rate. Consumer-node assignments execute at device probe, after the CRU
has raised CPLL to 1.2 GHz, so the rate resolves exactly (1200/3) and
CCF selects the CPLL parent. The venc (H.264 encoder) side is left
alone: the venc driver self-manages its clocks (runtime-resume ->
300 MHz default, idle -> 50 MHz reduce rate) via working CCF writes.

Measured on Rock Pi E (RK3328, kernel 6.12.81-rkr12, 2160p50 HEVC
11.6 Mbps test stream):

  clocks                         decode 4K HEVC   dec->RGA->null
  boot pins (100/50 MHz)         33.79 fps        31.55 fps
  decoder + RGA @ 400 MHz        70.21 fps        40.84 fps

RGA note: the clk_rga mux can rest on GPLL (reset default), leaving it
at 491.52/3 = 163.84 MHz even after a divider change. Assigning
SCLK_RGA at boot forces the CPLL parent; measured dec->RGA->null went
31.4 -> 40.8 fps.

Signed-off-by: Nick Moore <nicholasvmoore@gmail.com>
---
 arch/arm64/boot/dts/rockchip/rk3328.dtsi | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/arch/arm64/boot/dts/rockchip/rk3328.dtsi b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
index ccbbd5f..4ff019e 100644
--- a/arch/arm64/boot/dts/rockchip/rk3328.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3328.dtsi
@@ -1066,6 +1066,10 @@
 		operating-points-v2 = <&rkvdec_opp_table>;
 		#cooling-cells = <2>;
 		devfreq = <&dmc>;
+		assigned-clocks = <&cru ACLK_RKVDEC_PRE>, <&cru SCLK_VDEC_CORE>,
+			<&cru SCLK_VDEC_CABAC>;
+		assigned-clock-rates = <400000000>, <400000000>,
+			<400000000>;
 		status = "disabled";
 
 		vcodec_power_model: vcodec_power_model {
@@ -1215,6 +1219,8 @@
 		interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
 		clocks = <&cru ACLK_RGA>, <&cru HCLK_RGA>, <&cru SCLK_RGA>;
 		clock-names = "aclk_rga", "hclk_rga", "clk_rga";
+		assigned-clocks = <&cru ACLK_RGA_PRE>, <&cru SCLK_RGA>;
+		assigned-clock-rates = <400000000>, <400000000>;
 		status = "disabled";
 	};
 
-- 
2.56.1