[PATCH 6.18 067/227] arm64: dts: rockchip: Configure MCLK for analog sound on NanoPi M5

Greg Kroah-Hartman
2026-01-28T15:55:39Z

From: Alexey Charkov <alchark@gmail.com>

commit 3e4a81881c0929b21a0577bc6e69514c09da5c3f upstream.

NanoPi M5 derives its analog sound signal from SAI2 in M0 pin mode, so the
MCLK pin should be configured accordingly for the sound codec to get its
I2S signal from the SoC. Request the required pin config.

The clock itself should also be CLK_SAI2_MCLKOUT_TO_IO for the sound to
work (otherwise there is only silence out of the audio out jack).

Fixes: 96cbdfdd3ac2 ("arm64: dts: rockchip: Add FriendlyElec NanoPi M5 support")
Cc: stable@vger.kernel.org
Signed-off-by: Alexey Charkov <alchark@gmail.com>
Link: https://patch.msgid.link/20251229-rk3576-sound-v1-2-2f59ef0d19b1@gmail.com
Signed-off-by: Heiko Stuebner <heiko@sntech.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
arch/arm64/boot/dts/rockchip/rk3576-nanopi-m5.dts | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)

diff --git a/arch/arm64/boot/dts/rockchip/rk3576-nanopi-m5.dts b/arch/arm64/boot/dts/rockchip/rk3576-nanopi-m5.dts
index 37184913f918..bb2cc2814b83 100644
--- a/arch/arm64/boot/dts/rockchip/rk3576-nanopi-m5.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3576-nanopi-m5.dts
@@ -201,6 +201,7 @@ sound {
pinctrl-names = "default";
pinctrl-0 = <&hp_det_l>;

+ simple-audio-card,bitclock-master = <&masterdai>;
simple-audio-card,format = "i2s";
simple-audio-card,hp-det-gpios = <&gpio2 RK_PD6 GPIO_ACTIVE_LOW>;
simple-audio-card,mclk-fs = <256>;
@@ -218,8 +219,9 @@ simple-audio-card,codec {
sound-dai = <&rt5616>;
};

- simple-audio-card,cpu {
+ masterdai: simple-audio-card,cpu {
sound-dai = <&sai2>;
+ system-clock-frequency = <12288000>;
};
};
};
@@ -727,10 +729,12 @@ &i2c5 {
rt5616: audio-codec@1b {
compatible = "realtek,rt5616";
reg = <0x1b>;
- assigned-clocks = <&cru CLK_SAI2_MCLKOUT>;
+ assigned-clocks = <&cru CLK_SAI2_MCLKOUT_TO_IO>;
assigned-clock-rates = <12288000>;
- clocks = <&cru CLK_SAI2_MCLKOUT>;
+ clocks = <&cru CLK_SAI2_MCLKOUT_TO_IO>;
clock-names = "mclk";
+ pinctrl-0 = <&sai2m0_mclk>;
+ pinctrl-names = "default";
#sound-dai-cells = <0>;
};
};
--
2.52.0