diff mbox series

[1/3] arm64: dts: rockchip: add ES8316 codec for Rock Pi4

Message ID 20210617044955.598994-1-knaerzche@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/3] arm64: dts: rockchip: add ES8316 codec for Rock Pi4 | expand

Commit Message

Alex Bee June 17, 2021, 4:49 a.m. UTC
Rock Pi4 boards have the codec connected to i2s0 and it is accessible
via i2c1 address 0x11.
Add an audio-graph-card it.

Signed-off-by: Alex Bee <knaerzche@gmail.com>
---
 .../boot/dts/rockchip/rk3399-rock-pi-4.dtsi   | 28 +++++++++++++++++++
 1 file changed, 28 insertions(+)

Comments

Johan Jonker June 18, 2021, 9:54 a.m. UTC | #1
Hi Alex,

On 6/17/21 6:49 AM, Alex Bee wrote:
> Rock Pi4 boards have the codec connected to i2s0 and it is accessible
> via i2c1 address 0x11.
> Add an audio-graph-card it.
> 
> Signed-off-by: Alex Bee <knaerzche@gmail.com>
> ---
>  .../boot/dts/rockchip/rk3399-rock-pi-4.dtsi   | 28 +++++++++++++++++++
>  1 file changed, 28 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi
> index 7d0a7c697703..e5c1083174ff 100644
> --- a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi
> +++ b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi
> @@ -36,6 +36,12 @@ sdio_pwrseq: sdio-pwrseq {
>  		reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
>  	};
>  
> +	sound {
> +		compatible = "audio-graph-card";

> +		label = "rockchip,rk3399";

See previous discussion:

https://lore.kernel.org/linux-rockchip/e5ab2c62-ad00-4cdf-8b0a-24fda59c980b@gmail.com/

It seems that aplay/linux? adds "-1" to it and removes the comma and
"-", so we get:

hdmisound
rockchiprk3399
rockchiprk339_1

Shouldn't we label it with something that reflect the function/output.
Shouldn't we standardize to SPDIF, HDMI and Analog similar to rk3318/rk3328?
Make a shorter label without spaces or special chars, so that chars
don't get removed?

Proposal:

Analog
HDMI
ES8316 <---
SPDIF


Possible example solutions:

[PATCH] arm64: dts: rockchip: more user friendly name of sound nodes
https://lore.kernel.org/lkml/20210110151913.3615326-1-katsuhiro@katsuster.net/

===

Johan

> +		dais = <&i2s0_p0>;
> +	};
> +
>  	vcc12v_dcin: dc-12v {
>  		compatible = "regulator-fixed";
>  		regulator-name = "vcc12v_dcin";
> @@ -422,6 +428,20 @@ &i2c1 {
>  	i2c-scl-rising-time-ns = <300>;
>  	i2c-scl-falling-time-ns = <15>;
>  	status = "okay";
> +
> +	es8316: codec@11 {
> +		compatible = "everest,es8316";
> +		reg = <0x11>;
> +		clocks = <&cru SCLK_I2S_8CH_OUT>;
> +		clock-names = "mclk";
> +		#sound-dai-cells = <0>;
> +
> +		port {
> +			es8316_p0_0: endpoint {
> +				remote-endpoint = <&i2s0_p0_0>;
> +			};
> +		};
> +	};
>  };
>  
>  &i2c3 {
> @@ -441,6 +461,14 @@ &i2s0 {
>  	rockchip,capture-channels = <2>;
>  	rockchip,playback-channels = <2>;
>  	status = "okay";
> +
> +	i2s0_p0: port {
> +		i2s0_p0_0: endpoint {
> +			dai-format = "i2s";
> +			mclk-fs = <256>;
> +			remote-endpoint = <&es8316_p0_0>;
> +		};
> +	};
>  };
>  
>  &i2s1 {
>
Alex Bee June 18, 2021, 4:14 p.m. UTC | #2
Hi Johan,

Am 18.06.21 um 11:54 schrieb Johan Jonker:
> Hi Alex,
>
> On 6/17/21 6:49 AM, Alex Bee wrote:
>> Rock Pi4 boards have the codec connected to i2s0 and it is accessible
>> via i2c1 address 0x11.
>> Add an audio-graph-card it.
>>
>> Signed-off-by: Alex Bee <knaerzche@gmail.com>
>> ---
>>   .../boot/dts/rockchip/rk3399-rock-pi-4.dtsi   | 28 +++++++++++++++++++
>>   1 file changed, 28 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi
>> index 7d0a7c697703..e5c1083174ff 100644
>> --- a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi
>> +++ b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi
>> @@ -36,6 +36,12 @@ sdio_pwrseq: sdio-pwrseq {
>>   		reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
>>   	};
>>   
>> +	sound {
>> +		compatible = "audio-graph-card";
>> +		label = "rockchip,rk3399";
> See previous discussion:
>
> https://lore.kernel.org/linux-rockchip/e5ab2c62-ad00-4cdf-8b0a-24fda59c980b@gmail.com/
>
> It seems that aplay/linux? adds "-1" to it and removes the comma and
> "-", so we get:
>
> hdmisound
> rockchiprk3399
> rockchiprk339_1
>
> Shouldn't we label it with something that reflect the function/output.
> Shouldn't we standardize to SPDIF, HDMI and Analog similar to rk3318/rk3328?
> Make a shorter label without spaces or special chars, so that chars
> don't get removed?
>
> Proposal:
>
> Analog
> HDMI
> ES8316 <---
> SPDIF

OK - thanks for that, I wasn't aware.

I'll go for "Analog", since that seems to be the accepted solution for 
RockPro64 board and I think we should keep it the same across boards (on 
distro side it can get annoying if you need a couple of alsa configs 
with the same contents, just because audio card names are different).

Alex.

>
>
> Possible example solutions:
>
> [PATCH] arm64: dts: rockchip: more user friendly name of sound nodes
> https://lore.kernel.org/lkml/20210110151913.3615326-1-katsuhiro@katsuster.net/
>
> ===
>
> Johan
>
>> +		dais = <&i2s0_p0>;
>> +	};
>> +
>>   	vcc12v_dcin: dc-12v {
>>   		compatible = "regulator-fixed";
>>   		regulator-name = "vcc12v_dcin";
>> @@ -422,6 +428,20 @@ &i2c1 {
>>   	i2c-scl-rising-time-ns = <300>;
>>   	i2c-scl-falling-time-ns = <15>;
>>   	status = "okay";
>> +
>> +	es8316: codec@11 {
>> +		compatible = "everest,es8316";
>> +		reg = <0x11>;
>> +		clocks = <&cru SCLK_I2S_8CH_OUT>;
>> +		clock-names = "mclk";
>> +		#sound-dai-cells = <0>;
>> +
>> +		port {
>> +			es8316_p0_0: endpoint {
>> +				remote-endpoint = <&i2s0_p0_0>;
>> +			};
>> +		};
>> +	};
>>   };
>>   
>>   &i2c3 {
>> @@ -441,6 +461,14 @@ &i2s0 {
>>   	rockchip,capture-channels = <2>;
>>   	rockchip,playback-channels = <2>;
>>   	status = "okay";
>> +
>> +	i2s0_p0: port {
>> +		i2s0_p0_0: endpoint {
>> +			dai-format = "i2s";
>> +			mclk-fs = <256>;
>> +			remote-endpoint = <&es8316_p0_0>;
>> +		};
>> +	};
>>   };
>>   
>>   &i2s1 {
>>
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi
index 7d0a7c697703..e5c1083174ff 100644
--- a/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi
+++ b/arch/arm64/boot/dts/rockchip/rk3399-rock-pi-4.dtsi
@@ -36,6 +36,12 @@  sdio_pwrseq: sdio-pwrseq {
 		reset-gpios = <&gpio0 RK_PB2 GPIO_ACTIVE_LOW>;
 	};
 
+	sound {
+		compatible = "audio-graph-card";
+		label = "rockchip,rk3399";
+		dais = <&i2s0_p0>;
+	};
+
 	vcc12v_dcin: dc-12v {
 		compatible = "regulator-fixed";
 		regulator-name = "vcc12v_dcin";
@@ -422,6 +428,20 @@  &i2c1 {
 	i2c-scl-rising-time-ns = <300>;
 	i2c-scl-falling-time-ns = <15>;
 	status = "okay";
+
+	es8316: codec@11 {
+		compatible = "everest,es8316";
+		reg = <0x11>;
+		clocks = <&cru SCLK_I2S_8CH_OUT>;
+		clock-names = "mclk";
+		#sound-dai-cells = <0>;
+
+		port {
+			es8316_p0_0: endpoint {
+				remote-endpoint = <&i2s0_p0_0>;
+			};
+		};
+	};
 };
 
 &i2c3 {
@@ -441,6 +461,14 @@  &i2s0 {
 	rockchip,capture-channels = <2>;
 	rockchip,playback-channels = <2>;
 	status = "okay";
+
+	i2s0_p0: port {
+		i2s0_p0_0: endpoint {
+			dai-format = "i2s";
+			mclk-fs = <256>;
+			remote-endpoint = <&es8316_p0_0>;
+		};
+	};
 };
 
 &i2s1 {