* [PATCH v2 0/3] arm64: dts: rockchip: fix audio on Firefly-RK3399
@ 2026-09-21 6:34 Yaozhong Li
2026-09-21 6:34 ` [PATCH v2 1/3] arm64: dts: rockchip: fix analog headphone output on rk3399-firefly Yaozhong Li
` (3 more replies)
0 siblings, 4 replies; 5+ messages in thread
From: Yaozhong Li @ 2026-09-21 6:34 UTC (permalink / raw)
To: heiko; +Cc: linux-rockchip, linux-arm-kernel
This supersedes my earlier two-patch series [1].
Patch 1/2 there dropped the &i2s0 override outright. That is wrong: the
i2s0 pin groups also list GPIO4_A0, which carries SCLK_I2S_8CH_OUT, the
codec MCLK. Dropping the override unmuxes that pin and leaves analog
audio dead. I have asked for that series to be dropped. The HDMI patch
depended on it, so it is not resent on its own but as 3/3 here.
1/3 is independent of the other two and fixes a separate bug: the GPIO
that gates the headphone output is muxed by the board file but never
claimed or driven, so the jack has never worked with a mainline kernel.
2/3 and 3/3 have to stay in this order; 3/3 needs the pl330 channels
that 2/3 frees.
Changes in v2:
- 1/3 is new: model the headphone output enable GPIO as a
simple-audio-amplifier aux device, the way rk3399-roc-pc-plus.dts
does.
- 2/3 replaces the old 1/2. It now splits GPIO4_A0 into its own pinctrl
group and gives it to i2s1 before disabling i2s0, instead of just
removing the override.
- 3/3 is the old 2/2, unchanged apart from the commit message.
Tested on a Firefly-RK3399 running 6.18. What was not done: the patched
tree was not built as a full kernel, and the DTS was compiled and the
resulting DTB inspected instead; the changes were exercised on the board
through an equivalent DTB rather than a kernel built from this tree. I
have no schematic for the board, so 1/3 relies on measurement rather
than on knowing what the GPIO switches.
[1] https://lore.kernel.org/all/20260903082713.192-1-yaozhonguwl@gmail.com/
Yaozhong Li (3):
arm64: dts: rockchip: fix analog headphone output on rk3399-firefly
arm64: dts: rockchip: disable unused i2s0 on rk3399-firefly
arm64: dts: rockchip: enable HDMI audio on rk3399-firefly
.../boot/dts/rockchip/rk3399-firefly.dts | 36 +++++++++++++------
1 file changed, 26 insertions(+), 10 deletions(-)
--
2.55.0.windows.3
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 1/3] arm64: dts: rockchip: fix analog headphone output on rk3399-firefly
2026-09-21 6:34 [PATCH v2 0/3] arm64: dts: rockchip: fix audio on Firefly-RK3399 Yaozhong Li
@ 2026-09-21 6:34 ` Yaozhong Li
2026-09-21 6:34 ` [PATCH v2 2/3] arm64: dts: rockchip: disable unused i2s0 " Yaozhong Li
` (2 subsequent siblings)
3 siblings, 0 replies; 5+ messages in thread
From: Yaozhong Li @ 2026-09-21 6:34 UTC (permalink / raw)
To: heiko; +Cc: linux-rockchip, linux-arm-kernel
The analog headphone jack on this board has never produced any sound
with a mainline kernel.
GPIO4_C5 has to be high for audio to reach the jack. The board file
muxes the pin to GPIO through the rt5640_hpcon pinctrl group and
references that group from the codec node, but nothing ever requests or
drives the line:
pin 149 (gpio4-21): 1-001c (GPIO UNCLAIMED) function rt5640 \
group rt5640-hpcon
It therefore stays an input and reads low. The vendor tree drives it
from a hp-con-gpio property that was dropped during review of the
original board submission because it is not part of the RT5640 binding,
but the pinmux half was kept, leaving the description incomplete.
Describe it the way rk3399-roc-pc-plus.dts already describes the
equivalent signal, as a simple-audio-amplifier auxiliary component, so
that DAPM asserts the GPIO while the headphone path is active. That
board's DTS carries the same caveat in a comment: the binding is used
because it expresses a DAPM-controlled output enable, not because the
hardware is necessarily an amplifier.
Measured on a Firefly-RK3399 by toggling only this line while a 1 kHz
tone kept playing, with the playback PCM in state: RUNNING throughout:
high -> audible, low -> silent, high -> audible
With this change the line is claimed and follows the audio path:
pin 149 (gpio4-21): headphones-amp gpio4:149
idle: gpio-21 (|enable) out lo
playing: gpio-21 (|enable) out hi
Fixes: 171582e00db1 ("arm64: dts: rockchip: add support for firefly-rk3399 board")
Assisted-by: LLM
Signed-off-by: Yaozhong Li <yaozhonguwl@gmail.com>
---
.../arm64/boot/dts/rockchip/rk3399-firefly.dts | 18 ++++++++++++++----
1 file changed, 14 insertions(+), 4 deletions(-)
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts b/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts
index 0568dfa..2fdfdd3 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts
@@ -96,6 +96,15 @@ key-power {
};
};
+ /* GPIO that enables the headphone output path */
+ headphones_amp: headphones-amp {
+ compatible = "simple-audio-amplifier";
+ pinctrl-names = "default";
+ pinctrl-0 = <&rt5640_hpcon>;
+ enable-gpios = <&gpio4 RK_PC5 GPIO_ACTIVE_HIGH>;
+ sound-name-prefix = "Headphone Amp";
+ };
+
ir-receiver {
compatible = "gpio-ir-receiver";
gpios = <&gpio0 RK_PA6 GPIO_ACTIVE_LOW>;
@@ -132,8 +141,11 @@ rt5640-sound {
simple-audio-card,routing =
"Mic Jack", "MICBIAS1",
"IN1P", "Mic Jack",
- "Headphone Jack", "HPOL",
- "Headphone Jack", "HPOR";
+ "Headphone Amp INL", "HPOL",
+ "Headphone Amp INR", "HPOR",
+ "Headphone Jack", "Headphone Amp OUTL",
+ "Headphone Jack", "Headphone Amp OUTR";
+ simple-audio-card,aux-devs = <&headphones_amp>;
simple-audio-card,cpu {
sound-dai = <&i2s1>;
@@ -547,8 +559,6 @@ rt5640: rt5640@1c {
clock-names = "mclk";
realtek,in1-differential;
#sound-dai-cells = <0>;
- pinctrl-names = "default";
- pinctrl-0 = <&rt5640_hpcon>;
};
};
--
2.55.0.windows.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 2/3] arm64: dts: rockchip: disable unused i2s0 on rk3399-firefly
2026-09-21 6:34 [PATCH v2 0/3] arm64: dts: rockchip: fix audio on Firefly-RK3399 Yaozhong Li
2026-09-21 6:34 ` [PATCH v2 1/3] arm64: dts: rockchip: fix analog headphone output on rk3399-firefly Yaozhong Li
@ 2026-09-21 6:34 ` Yaozhong Li
2026-09-21 6:34 ` [PATCH v2 3/3] arm64: dts: rockchip: enable HDMI audio " Yaozhong Li
2026-10-04 21:17 ` [PATCH v2 0/3] arm64: dts: rockchip: fix audio on Firefly-RK3399 Heiko Stuebner
3 siblings, 0 replies; 5+ messages in thread
From: Yaozhong Li @ 2026-09-21 6:34 UTC (permalink / raw)
To: heiko; +Cc: linux-rockchip, linux-arm-kernel
The board file enables i2s0, but no sound card references it: the
on-board RT5640 is wired to i2s1 and the S/PDIF transmitter has its own
controller. Keeping it enabled starves the other controllers.
The pl330 instance that serves the audio block has six channels:
dma-pl330 ff6d0000.dma-controller: DBUFF-32x8bytes Num_Chans-6 \
Num_Peri-12 Num_Events-12
snd_dmaengine_pcm_register() requests the channels named in "dmas" when
the controller probes and holds them until it goes away, so this is
decided per controller and not per card. The demand is i2s0 2 + i2s1 2
+ i2s2 2 + spdif 1 = 7, one controller always loses, and which one
depends on probe order:
rockchip-spdif ff870000.spdif: Missing dma channel for stream: 0
i2s0 cannot simply be dropped, though. Its pin groups also list
GPIO4_A0, which carries SCLK_I2S_8CH_OUT, the MCLK the codec runs on,
rather than an i2s0 data, bit clock or frame clock signal:
i2s0-8ch-bus ... <4 RK_PA0 1 &pcfg_pull_none>
i2s0-8ch-bus-bclk-off ... <4 RK_PA0 1 &pcfg_pull_none>
i2s1-2ch-bus ... GPIO4_A3..A7 only
rt5640: rt5640@1c {
clocks = <&cru SCLK_I2S_8CH_OUT>;
clock-names = "mclk";
};
Removing the &i2s0 override on its own would therefore leave that pin
unmuxed and analog audio dead. Both changes are required in one step:
disabling i2s0 without splitting out the MCLK pin leaves GPIO4_A0
unmuxed, while giving the new group to i2s1 without disabling i2s0
makes the two controllers contend for the same pin.
rk3399-roc-pc-plus.dts already carries the same i2s_8ch_mclk_pin split.
Measured on a Firefly-RK3399. The pin moves to the controller that
actually drives the codec:
pin 128 (gpio4-0): ff890000.i2s function i2s1 group i2s-8ch-mclk-pin
The RT5640 and S/PDIF cards then register with no DMA errors, and a
1 kHz tone measured through the codec's internal HPOL/HPOR loopback is
unchanged (L 2135 -> 2138, R 2202 -> 2203), confirming that MCLK still
reaches the codec.
Fixes: 171582e00db1 ("arm64: dts: rockchip: add support for firefly-rk3399 board")
Assisted-by: LLM
Signed-off-by: Yaozhong Li <yaozhonguwl@gmail.com>
---
arch/arm64/boot/dts/rockchip/rk3399-firefly.dts | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts b/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts
index 2fdfdd3..dbc38dd 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts
@@ -628,13 +628,9 @@ accelerometer@68 {
};
};
-&i2s0 {
- rockchip,playback-channels = <8>;
- rockchip,capture-channels = <8>;
- status = "okay";
-};
-
&i2s1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2s_8ch_mclk_pin>, <&i2s1_2ch_bus>;
rockchip,playback-channels = <2>;
rockchip,capture-channels = <2>;
status = "okay";
@@ -689,6 +685,12 @@ ir_int: ir-int {
};
};
+ i2s1 {
+ i2s_8ch_mclk_pin: i2s-8ch-mclk-pin {
+ rockchip,pins = <4 RK_PA0 1 &pcfg_pull_none>;
+ };
+ };
+
lcd-panel {
lcd_panel_reset: lcd-panel-reset {
rockchip,pins = <4 RK_PD6 RK_FUNC_GPIO &pcfg_pull_up>;
--
2.55.0.windows.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH v2 3/3] arm64: dts: rockchip: enable HDMI audio on rk3399-firefly
2026-09-21 6:34 [PATCH v2 0/3] arm64: dts: rockchip: fix audio on Firefly-RK3399 Yaozhong Li
2026-09-21 6:34 ` [PATCH v2 1/3] arm64: dts: rockchip: fix analog headphone output on rk3399-firefly Yaozhong Li
2026-09-21 6:34 ` [PATCH v2 2/3] arm64: dts: rockchip: disable unused i2s0 " Yaozhong Li
@ 2026-09-21 6:34 ` Yaozhong Li
2026-10-04 21:17 ` [PATCH v2 0/3] arm64: dts: rockchip: fix audio on Firefly-RK3399 Heiko Stuebner
3 siblings, 0 replies; 5+ messages in thread
From: Yaozhong Li @ 2026-09-21 6:34 UTC (permalink / raw)
To: heiko; +Cc: linux-rockchip, linux-arm-kernel
The Firefly-RK3399 carries audio over its HDMI connector, but
hdmi_sound is left disabled, so the only outputs are the analog RT5640
jacks and S/PDIF.
Enable it. This needs the previous patch: with i2s0 still holding two
pl330 channels there is none left for i2s2 and the card fails to probe.
Tested on a Firefly-RK3399 with a 1920x1080 display attached. All three
cards register and the hdmi-sound card plays at both 44.1 and 48 kHz:
0 [hdmisound ]: simple-card - hdmi-sound
1 [rockchiprt5640c]: simple-card - rockchip,rt5640-codec
2 [SPDIF ]: SPDIF - SPDIF
Assisted-by: LLM
Signed-off-by: Yaozhong Li <yaozhonguwl@gmail.com>
---
arch/arm64/boot/dts/rockchip/rk3399-firefly.dts | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts b/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts
index dbc38dd..0469807 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3399-firefly.dts
@@ -323,6 +323,10 @@ &hdmi {
status = "okay";
};
+&hdmi_sound {
+ status = "okay";
+};
+
&i2c0 {
clock-frequency = <400000>;
i2c-scl-rising-time-ns = <168>;
--
2.55.0.windows.3
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 0/3] arm64: dts: rockchip: fix audio on Firefly-RK3399
2026-09-21 6:34 [PATCH v2 0/3] arm64: dts: rockchip: fix audio on Firefly-RK3399 Yaozhong Li
` (2 preceding siblings ...)
2026-09-21 6:34 ` [PATCH v2 3/3] arm64: dts: rockchip: enable HDMI audio " Yaozhong Li
@ 2026-10-04 21:17 ` Heiko Stuebner
3 siblings, 0 replies; 5+ messages in thread
From: Heiko Stuebner @ 2026-10-04 21:17 UTC (permalink / raw)
To: Yaozhong Li; +Cc: Heiko Stuebner, linux-rockchip, linux-arm-kernel
On Mon, 21 Sep 2026 14:34:27 +0800, Yaozhong Li wrote:
> This supersedes my earlier two-patch series [1].
>
> Patch 1/2 there dropped the &i2s0 override outright. That is wrong: the
> i2s0 pin groups also list GPIO4_A0, which carries SCLK_I2S_8CH_OUT, the
> codec MCLK. Dropping the override unmuxes that pin and leaves analog
> audio dead. I have asked for that series to be dropped. The HDMI patch
> depended on it, so it is not resent on its own but as 3/3 here.
>
> [...]
Applied, thanks!
[1/3] arm64: dts: rockchip: fix analog headphone output on rk3399-firefly
commit: 23eab1a5e36099fd1269f8a18dc389e04dc19011
[2/3] arm64: dts: rockchip: disable unused i2s0 on rk3399-firefly
commit: 9416a641cfe5b75dd9178c15960ee741c1091b45
[3/3] arm64: dts: rockchip: enable HDMI audio on rk3399-firefly
commit: 86936f4c25cdb2d138a09dbcbbdd587c3d73cc1f
Best regards,
--
Heiko Stuebner <heiko@sntech.de>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-10-04 21:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-09-21 6:34 [PATCH v2 0/3] arm64: dts: rockchip: fix audio on Firefly-RK3399 Yaozhong Li
2026-09-21 6:34 ` [PATCH v2 1/3] arm64: dts: rockchip: fix analog headphone output on rk3399-firefly Yaozhong Li
2026-09-21 6:34 ` [PATCH v2 2/3] arm64: dts: rockchip: disable unused i2s0 " Yaozhong Li
2026-09-21 6:34 ` [PATCH v2 3/3] arm64: dts: rockchip: enable HDMI audio " Yaozhong Li
2026-10-04 21:17 ` [PATCH v2 0/3] arm64: dts: rockchip: fix audio on Firefly-RK3399 Heiko Stuebner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox