diff mbox series

arm64: dts: rockchip: add rk3566 audio nodes

Message ID 20230109203232.45192-1-f.kardame@manjaro.org (mailing list archive)
State New, archived
Headers show
Series arm64: dts: rockchip: add rk3566 audio nodes | expand

Commit Message

Furkan Kardame Jan. 9, 2023, 8:32 p.m. UTC
This patch adds simple audio card nodes
Enabled i2s0_8ch as it is needed for hdmi audio
Added i2s1_8ch as it is needed for 3.5mm audio jack

Signed-off-by: Furkan Kardame <f.kardame@manjaro.org>
---
 .../arm64/boot/dts/rockchip/rk3566-roc-pc.dts | 60 ++++++++++++++++++-
 1 file changed, 58 insertions(+), 2 deletions(-)

Comments

Heiko Stübner Jan. 10, 2023, 2:04 p.m. UTC | #1
On Mon, 9 Jan 2023 23:32:33 +0300, Furkan Kardame wrote:
> This patch adds simple audio card nodes
> Enabled i2s0_8ch as it is needed for hdmi audio
> Added i2s1_8ch as it is needed for 3.5mm audio jack
> 
> 

Applied - with remarks below!

[1/1] arm64: dts: rockchip: add rk3566 audio nodes
      commit: 9ce61898b3075892b01792fd3a44507b7e459c6f


The core i2s@fe410000 node should _not_ go into a board devicetree.
Thankfully an identical node for the i2s controller was already
added to the core rk356x dt, so I've just dropped the one from
your patch.


Best regards,
Chen-Yu Tsai Jan. 10, 2023, 2:08 p.m. UTC | #2
On Tue, Jan 10, 2023 at 10:05 PM Heiko Stuebner <heiko@sntech.de> wrote:
>
> On Mon, 9 Jan 2023 23:32:33 +0300, Furkan Kardame wrote:
> > This patch adds simple audio card nodes
> > Enabled i2s0_8ch as it is needed for hdmi audio
> > Added i2s1_8ch as it is needed for 3.5mm audio jack
> >
> >
>
> Applied - with remarks below!
>
> [1/1] arm64: dts: rockchip: add rk3566 audio nodes
>       commit: 9ce61898b3075892b01792fd3a44507b7e459c6f
>
>
> The core i2s@fe410000 node should _not_ go into a board devicetree.
> Thankfully an identical node for the i2s controller was already
> added to the core rk356x dt, so I've just dropped the one from
> your patch.

Shouldn't hdmi_sound also be enabled? Otherwise i2s0_8ch is enabled
for nothing.

ChenYu
Heiko Stübner Jan. 10, 2023, 2:10 p.m. UTC | #3
Am Dienstag, 10. Januar 2023, 15:08:50 CET schrieb Chen-Yu Tsai:
> On Tue, Jan 10, 2023 at 10:05 PM Heiko Stuebner <heiko@sntech.de> wrote:
> >
> > On Mon, 9 Jan 2023 23:32:33 +0300, Furkan Kardame wrote:
> > > This patch adds simple audio card nodes
> > > Enabled i2s0_8ch as it is needed for hdmi audio
> > > Added i2s1_8ch as it is needed for 3.5mm audio jack
> > >
> > >
> >
> > Applied - with remarks below!
> >
> > [1/1] arm64: dts: rockchip: add rk3566 audio nodes
> >       commit: 9ce61898b3075892b01792fd3a44507b7e459c6f
> >
> >
> > The core i2s@fe410000 node should _not_ go into a board devicetree.
> > Thankfully an identical node for the i2s controller was already
> > added to the core rk356x dt, so I've just dropped the one from
> > your patch.
> 
> Shouldn't hdmi_sound also be enabled? Otherwise i2s0_8ch is enabled
> for nothing.

Furkan, care to send a patch for that?
Furkan Kardame Jan. 10, 2023, 4:57 p.m. UTC | #4
On Tuesday 10 January 2023 17:10:26 (+03:00), Heiko Stübner wrote:

> Am Dienstag, 10. Januar 2023, 15:08:50 CET schrieb Chen-Yu Tsai:
> > On Tue, Jan 10, 2023 at 10:05 PM Heiko Stuebner <heiko@sntech.de> wrote:
> > >
> > > On Mon, 9 Jan 2023 23:32:33 +0300, Furkan Kardame wrote:
> > > > This patch adds simple audio card nodes
> > > > Enabled i2s0_8ch as it is needed for hdmi audio
> > > > Added i2s1_8ch as it is needed for 3.5mm audio jack
> > > >
> > > >
> > >
> > > Applied - with remarks below!
> > >
> > > [1/1] arm64: dts: rockchip: add rk3566 audio nodes
> > >       commit: 9ce61898b3075892b01792fd3a44507b7e459c6f
> > >
> > >
> > > The core i2s@fe410000 node should _not_ go into a board devicetree.
> > > Thankfully an identical node for the i2s controller was already
> > > added to the core rk356x dt, so I've just dropped the one from
> > > your patch.
> > 
> > Shouldn't hdmi_sound also be enabled? Otherwise i2s0_8ch is enabled
> > for nothing.
> 
> Furkan, care to send a patch for that?
> 
> 
> 
> 


Sorry missed hdmi_audio, will add it to the patch.
I remember why i2s@fe410000 was added to the device tree.
It uses limited pinctrl-0 than the ones in rk356x.dtsi

I will fix these 2 points and send v2 soon.
Heiko Stübner Jan. 10, 2023, 5:43 p.m. UTC | #5
Hi,

Am Dienstag, 10. Januar 2023, 17:57:18 CET schrieb Furkan Kardame:
> On Tuesday 10 January 2023 17:10:26 (+03:00), Heiko Stübner wrote:
> 
> > Am Dienstag, 10. Januar 2023, 15:08:50 CET schrieb Chen-Yu Tsai:
> > > On Tue, Jan 10, 2023 at 10:05 PM Heiko Stuebner <heiko@sntech.de> wrote:
> > > >
> > > > On Mon, 9 Jan 2023 23:32:33 +0300, Furkan Kardame wrote:
> > > > > This patch adds simple audio card nodes
> > > > > Enabled i2s0_8ch as it is needed for hdmi audio
> > > > > Added i2s1_8ch as it is needed for 3.5mm audio jack
> > > > >
> > > > >
> > > >
> > > > Applied - with remarks below!
> > > >
> > > > [1/1] arm64: dts: rockchip: add rk3566 audio nodes
> > > >       commit: 9ce61898b3075892b01792fd3a44507b7e459c6f
> > > >
> > > >
> > > > The core i2s@fe410000 node should _not_ go into a board devicetree.
> > > > Thankfully an identical node for the i2s controller was already
> > > > added to the core rk356x dt, so I've just dropped the one from
> > > > your patch.
> > > 
> > > Shouldn't hdmi_sound also be enabled? Otherwise i2s0_8ch is enabled
> > > for nothing.
> > 
> > Furkan, care to send a patch for that?
> > 
> > 
> > 
> > 
> 
> 
> Sorry missed hdmi_audio, will add it to the patch.
> I remember why i2s@fe410000 was added to the device tree.
> It uses limited pinctrl-0 than the ones in rk356x.dtsi
> 
> I will fix these 2 points and send v2 soon.

please send a follow-up patch instead

Your patch is already in my branch for 6.3 [0], so changes should be done
with a patch building on top of that.

A node should never be in a board-dts, so if you need to i.e. replace
a pinctrl setting, do this in a &i2s_* { ... }; setting
Though I may be wrong but the pinctrl settings did look the same between
your patch and the one in rk356x.dtsi.


[0] https://git.kernel.org/pub/scm/linux/kernel/git/mmind/linux-rockchip.git/log/?h=v6.3-armsoc/dts64
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/rockchip/rk3566-roc-pc.dts b/arch/arm64/boot/dts/rockchip/rk3566-roc-pc.dts
index 61c7a3ad7..793d07f0c 100644
--- a/arch/arm64/boot/dts/rockchip/rk3566-roc-pc.dts
+++ b/arch/arm64/boot/dts/rockchip/rk3566-roc-pc.dts
@@ -39,6 +39,28 @@  hdmi_con_in: endpoint {
 		};
 	};
 
+	i2s1_8ch: i2s@fe410000 {
+		compatible = "rockchip,rk3568-i2s-tdm";
+		reg = <0x0 0xfe410000 0x0 0x1000>;
+		interrupts = <GIC_SPI 53 IRQ_TYPE_LEVEL_HIGH>;
+		assigned-clocks = <&cru CLK_I2S1_8CH_TX_SRC>, <&cru CLK_I2S1_8CH_RX_SRC>;
+		assigned-clock-rates = <1188000000>, <1188000000>;
+		clocks = <&cru MCLK_I2S1_8CH_TX>, <&cru MCLK_I2S1_8CH_RX>,
+			 <&cru HCLK_I2S1_8CH>;
+		clock-names = "mclk_tx", "mclk_rx", "hclk";
+		dmas = <&dmac1 3>, <&dmac1 2>;
+		dma-names = "rx", "tx";
+		resets = <&cru SRST_M_I2S1_8CH_TX>, <&cru SRST_M_I2S1_8CH_RX>;
+		reset-names = "tx-m", "rx-m";
+		rockchip,grf = <&grf>;
+		pinctrl-names = "default";
+		pinctrl-0 = <&i2s1m0_sclktx &i2s1m0_sclkrx
+			     &i2s1m0_lrcktx &i2s1m0_lrckrx
+			     &i2s1m0_sdi0   &i2s1m0_sdo0>;
+		#sound-dai-cells = <0>;
+		status = "disabled";
+	};
+
 	leds {
 		compatible = "gpio-leds";
 
@@ -53,6 +75,22 @@  led-user {
 		};
 	};
 
+	rk809-sound {
+		compatible = "simple-audio-card";
+		simple-audio-card,format = "i2s";
+		simple-audio-card,name = "STATION-M2-FRONT";
+		simple-audio-card,mclk-fs = <256>;
+		status = "okay";
+
+		simple-audio-card,cpu {
+			sound-dai = <&i2s1_8ch>;
+		};
+
+		simple-audio-card,codec {
+			sound-dai = <&rk809>;
+		};
+	};
+
 	sdio_pwrseq: sdio-pwrseq {
 		status = "okay";
 		compatible = "mmc-pwrseq-simple";
@@ -226,9 +264,13 @@  rk809: pmic@20 {
 		interrupt-parent = <&gpio0>;
 		interrupts = <RK_PA7 IRQ_TYPE_LEVEL_LOW>;
 		clock-output-names = "rk808-clkout1", "rk808-clkout2";
-
+		assigned-clocks = <&cru I2S1_MCLKOUT_TX>;
+		assigned-clock-parents = <&cru CLK_I2S1_8CH_TX>;
+		clock-names = "mclk";
+		clocks = <&cru I2S1_MCLKOUT_TX>;
+		pinctrl-0 = <&pmic_int>, <&i2s1m0_mclk>;
+		#sound-dai-cells = <0>;
 		pinctrl-names = "default";
-		pinctrl-0 = <&pmic_int>;
 		rockchip,system-power-controller;
 		wakeup-source;
 		#clock-cells = <1>;
@@ -435,6 +477,11 @@  vcc3v3_sd: SWITCH_REG2 {
 				regulator-boot-on;
 			};
 		};
+
+		codec {
+			mic-in-differential;
+		};
+
 	};
 };
 
@@ -452,6 +499,15 @@  &i2c3 {
 	status = "okay";
 };
 
+&i2s0_8ch {
+	status = "okay";
+};
+
+&i2s1_8ch {
+	rockchip,trcm-sync-tx-only;
+	status = "okay";
+};
+
 &mdio1 {
 	rgmii_phy1: ethernet-phy@0 {
 		compatible = "ethernet-phy-ieee802.3-c22";