Restore RockPI-S audio again (#8360)

* set clocks to the old default rate if the codec never calls set_sysclk

After mainline kernel commit 21cfbeae7d7c54a6cdea4b00096150f438f4fbde
rockchip i2s requires that soc codecs call set_sysclk to explicity select a rate.
This patch simply reverts to the old behavior if the codec does call set_sysclk.
(rather that failing in that case with a bogus rate of 0hz)

Also adds rk3308 vendor ASoC support to 6.16 kernel

* Require use of device tree overlay to enable pcm5102a CODEC
This commit is contained in:
brentr 2025-07-06 10:50:50 -07:00 committed by GitHub
parent 0cc8ccf3c6
commit 224b35ab28
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 7256 additions and 74 deletions

View File

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Paolo Sabatino <paolo.sabatino@gmail.com>
Date: Wed, 27 Nov 2024 19:06:49 +0100
Subject: rk3308: fixes for rock pi s dts
From: Brent Roman <brent@mbari.org>
Date: Sat, 05 Jul 2025 11:48:31 -0800
Subject: rk3308: fixes for rock pi s dts (sans pcm5102)
---
arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts | 73 ++++++++++
@ -11,7 +11,7 @@ diff --git a/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts b/arch/arm64/boot
index 111111111111..222222222222 100644
--- a/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts
@@ -48,6 +48,54 @@ blue-led {
@@ -48,6 +48,30 @@ blue-led {
};
};
@ -38,30 +38,6 @@ index 111111111111..222222222222 100644
+ };
+
+ };
+
+ pcm5102_sound: pcm5102-sound {
+ compatible = "simple-audio-card";
+ simple-audio-card,format = "i2s";
+ simple-audio-card,mclk-fs = <256>;
+ simple-audio-card,name = "pcm5102a";
+
+ simple-audio-card,dai-link@1 {
+ format = "i2s";
+ cpu {
+ sound-dai = <&i2s_8ch_0>;
+ };
+
+ codec {
+ sound-dai = <&pcm5102a>;
+ };
+ };
+ };
+
+ pcm5102a: pcm5102a {
+ #sound-dai-cells = <0>;
+ compatible = "ti,pcm5102a";
+ pcm510x,format = "i2s";
+ };
+
sdio_pwrseq: sdio-pwrseq {
compatible = "mmc-pwrseq-simple";
@ -78,18 +54,10 @@ index 111111111111..222222222222 100644
&cpu0 {
cpu-supply = <&vdd_core>;
};
@@ -242,6 +295,19 @@ &io_domains {
@@ -242,6 +295,11 @@ &io_domains {
status = "okay";
};
+&i2s_8ch_0 {
+ #sound-dai-cells = <0>;
+ assigned-clocks = <&cru SCLK_I2S0_8CH_RX>;
+ assigned-clock-parents = <&cru SCLK_I2S0_8CH_TX_MUX>;
+ rockchip,clk-trcm = <1>;
+ status = "okay";
+};
+
+&i2s_8ch_2 {
+ #sound-dai-cells = <0>;
+ status = "okay";

View File

@ -0,0 +1,44 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Brent Roman <genosenosor@gmail.com>
Date: Fri, 4 Jul 2025 22:45:29 -0700
Subject: Restore rockchip_i2s_tdm default clk rates
sound/soc/rockchip/rockchip_i2s_tdm.c
Signed-off-by: Brent Roman <genosenosor@gmail.com>
---
sound/soc/rockchip/rockchip_i2s_tdm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c
index 7feefeb6b..50737e647 100644
--- a/sound/soc/rockchip/rockchip_i2s_tdm.c
+++ b/sound/soc/rockchip/rockchip_i2s_tdm.c
@@ -20,10 +20,11 @@
#include "rockchip_i2s_tdm.h"
#define DRV_NAME "rockchip-i2s-tdm"
+#define DEFAULT_MCLK_FS 256
#define CH_GRP_MAX 4 /* The max channel 8 / 2 */
#define MULTIPLEX_CH_MAX 10
#define TRCM_TXRX 0
#define TRCM_TX 1
@@ -691,10 +692,13 @@ static int rockchip_i2s_tdm_hw_params(struct snd_pcm_substream *substream,
} else {
mclk = i2s_tdm->mclk_rx;
mclk_rate = i2s_tdm->mclk_rx_freq;
}
+ /* set to default rate if set_sysclk was never called */
+ if (!mclk_rate)
+ mclk_rate = DEFAULT_MCLK_FS * params_rate(params);
err = clk_set_rate(mclk, mclk_rate);
if (err)
return err;
mclk_rate = clk_get_rate(mclk);
--
Created with Armbian build tools https://github.com/armbian/build

View File

@ -1,7 +1,7 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Paolo Sabatino <paolo.sabatino@gmail.com>
Date: Wed, 27 Nov 2024 19:06:49 +0100
Subject: rk3308: fixes for rock pi s dts
From: Brent Roman <brent@mbari.org>
Date: Sat, 05 Jul 2025 11:48:31 -0800
Subject: rk3308: fixes for rock pi s dts (sans pcm5102)
---
arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts | 73 ++++++++++
@ -11,7 +11,7 @@ diff --git a/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts b/arch/arm64/boot
index 111111111111..222222222222 100644
--- a/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3308-rock-pi-s.dts
@@ -48,6 +48,54 @@ blue-led {
@@ -48,6 +48,30 @@ blue-led {
};
};
@ -38,30 +38,6 @@ index 111111111111..222222222222 100644
+ };
+
+ };
+
+ pcm5102_sound: pcm5102-sound {
+ compatible = "simple-audio-card";
+ simple-audio-card,format = "i2s";
+ simple-audio-card,mclk-fs = <256>;
+ simple-audio-card,name = "pcm5102a";
+
+ simple-audio-card,dai-link@1 {
+ format = "i2s";
+ cpu {
+ sound-dai = <&i2s_8ch_0>;
+ };
+
+ codec {
+ sound-dai = <&pcm5102a>;
+ };
+ };
+ };
+
+ pcm5102a: pcm5102a {
+ #sound-dai-cells = <0>;
+ compatible = "ti,pcm5102a";
+ pcm510x,format = "i2s";
+ };
+
sdio_pwrseq: sdio-pwrseq {
compatible = "mmc-pwrseq-simple";
@ -78,18 +54,10 @@ index 111111111111..222222222222 100644
&cpu0 {
cpu-supply = <&vdd_core>;
};
@@ -242,6 +295,19 @@ &io_domains {
@@ -242,6 +295,11 @@ &io_domains {
status = "okay";
};
+&i2s_8ch_0 {
+ #sound-dai-cells = <0>;
+ assigned-clocks = <&cru SCLK_I2S0_8CH_RX>;
+ assigned-clock-parents = <&cru SCLK_I2S0_8CH_TX_MUX>;
+ rockchip,clk-trcm = <1>;
+ status = "okay";
+};
+
+&i2s_8ch_2 {
+ #sound-dai-cells = <0>;
+ status = "okay";

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,44 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Brent Roman <genosenosor@gmail.com>
Date: Sat, 5 Jul 2025 00:35:09 -0700
Subject: Restore rockchip_i2s_tdm default clk rates
sound/soc/rockchip/rockchip_i2s_tdm.c
Signed-off-by: Brent Roman <genosenosor@gmail.com>
---
sound/soc/rockchip/rockchip_i2s_tdm.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c
index d9a1fab7f..3b46c59ed 100644
--- a/sound/soc/rockchip/rockchip_i2s_tdm.c
+++ b/sound/soc/rockchip/rockchip_i2s_tdm.c
@@ -20,10 +20,11 @@
#include "rockchip_i2s_tdm.h"
#define DRV_NAME "rockchip-i2s-tdm"
+#define DEFAULT_MCLK_FS 256
#define CH_GRP_MAX 4 /* The max channel 8 / 2 */
#define MULTIPLEX_CH_MAX 10
#define TRCM_TXRX 0
#define TRCM_TX 1
@@ -663,10 +664,13 @@ static int rockchip_i2s_tdm_hw_params(struct snd_pcm_substream *substream,
} else {
mclk = i2s_tdm->mclk_rx;
mclk_rate = i2s_tdm->mclk_rx_freq;
}
+ /* set to default rate if set_sysclk was never called */
+ if (!mclk_rate)
+ mclk_rate = DEFAULT_MCLK_FS * params_rate(params);
err = clk_set_rate(mclk, mclk_rate);
if (err)
return err;
mclk_rate = clk_get_rate(mclk);
--
Created with Armbian build tools https://github.com/armbian/build