diff mbox series

arm64: dts: meson-sm1: add spdifin spdifout nodes

Message ID 20211215030236.340841-1-art@khadas.com (mailing list archive)
State New, archived
Headers show
Series arm64: dts: meson-sm1: add spdifin spdifout nodes | expand

Commit Message

Artem Lapkin Dec. 15, 2021, 3:02 a.m. UTC
Add spdifin spdifout nodes for Amlogic SM1 SoCs.

Signed-off-by: Artem Lapkin <art@khadas.com>
---

SPDIF IN and SPDIF OUT both tested and works fine for VIM3L (meson-sm1)
same as for VIM3 (meson-g12)

SPDIF in and SPDIF OUT both pins available via GPIO header (SPDIF_OUT PIN
13 spdif_ao_out_pins and SPDIF_IN PIN 35 - same PWM_F spdif_in_h_pins)

https://lore.kernel.org/linux-arm-kernel/1jtuhwvqxa.fsf@starbuckisacylon.baylibre.com/t/

ALSA spdifin test example
=========================

# arecord -fS16_LE -r48000 -c2 -Dplug:spdifin

# cat .asoundrc
pcm.spdifin {
type iec958
slave {
pcm "hw:0,1"
format IEC958_SUBFRAME_LE
}
}

DT sound card configs for testing
=================================

&spdifout {
    pinctrl-0 = <&spdif_ao_out_pins>;
    pinctrl-names = "default";
    status = "okay";
};

&spdifin {
    pinctrl-0 = <&spdif_in_h_pins>;
    pinctrl-names = "default";
    status = "okay";
};

...
    spdif_dit: audio-codec-1 {
	#sound-dai-cells = <0>;
	compatible = "linux,spdif-dit";
	status = "okay";
	sound-name-prefix = "DIT";
    };

    spdif_dir: audio-codec-2 {
	#sound-dai-cells = <0>;
	compatible = "linux,spdif-dir";
	status = "okay";
	sound-name-prefix = "DIR";
    };
...
	audio-routing = ...
		"TODDR_B IN 3", "SPDIFIN Capture",
		"SPDIFOUT IN 0", "FRDDR_A OUT 3";

...
	dai-link-10 {
	    sound-dai = <&spdifout>;

	    codec-0 {
		sound-dai = <&spdif_dit>;
	    };
	};

	/* spdif or toslink interface */
	dai-link-11 {
	    sound-dai = <&spdifin>;

	    codec-0 {
		sound-dai = <&spdif_dir>;
	    };
	};
...

---
 arch/arm64/boot/dts/amlogic/meson-sm1.dtsi | 27 ++++++++++++++++++++++
 1 file changed, 27 insertions(+)

Comments

Neil Armstrong Jan. 3, 2022, 3:18 p.m. UTC | #1
On 15/12/2021 04:02, Artem Lapkin wrote:
> Add spdifin spdifout nodes for Amlogic SM1 SoCs.
> 
> Signed-off-by: Artem Lapkin <art@khadas.com>
> ---
> 
> SPDIF IN and SPDIF OUT both tested and works fine for VIM3L (meson-sm1)
> same as for VIM3 (meson-g12)
> 
> SPDIF in and SPDIF OUT both pins available via GPIO header (SPDIF_OUT PIN
> 13 spdif_ao_out_pins and SPDIF_IN PIN 35 - same PWM_F spdif_in_h_pins)
> 
> https://lore.kernel.org/linux-arm-kernel/1jtuhwvqxa.fsf@starbuckisacylon.baylibre.com/t/
> 
> ALSA spdifin test example
> =========================
> 
> # arecord -fS16_LE -r48000 -c2 -Dplug:spdifin
> 
> # cat .asoundrc
> pcm.spdifin {
> type iec958
> slave {
> pcm "hw:0,1"
> format IEC958_SUBFRAME_LE
> }
> }
> 
> DT sound card configs for testing
> =================================
> 
> &spdifout {
>     pinctrl-0 = <&spdif_ao_out_pins>;
>     pinctrl-names = "default";
>     status = "okay";
> };
> 
> &spdifin {
>     pinctrl-0 = <&spdif_in_h_pins>;
>     pinctrl-names = "default";
>     status = "okay";
> };
> 
> ...
>     spdif_dit: audio-codec-1 {
> 	#sound-dai-cells = <0>;
> 	compatible = "linux,spdif-dit";
> 	status = "okay";
> 	sound-name-prefix = "DIT";
>     };
> 
>     spdif_dir: audio-codec-2 {
> 	#sound-dai-cells = <0>;
> 	compatible = "linux,spdif-dir";
> 	status = "okay";
> 	sound-name-prefix = "DIR";
>     };
> ...
> 	audio-routing = ...
> 		"TODDR_B IN 3", "SPDIFIN Capture",
> 		"SPDIFOUT IN 0", "FRDDR_A OUT 3";
> 
> ...
> 	dai-link-10 {
> 	    sound-dai = <&spdifout>;
> 
> 	    codec-0 {
> 		sound-dai = <&spdif_dit>;
> 	    };
> 	};
> 
> 	/* spdif or toslink interface */
> 	dai-link-11 {
> 	    sound-dai = <&spdifin>;
> 
> 	    codec-0 {
> 		sound-dai = <&spdif_dir>;
> 	    };
> 	};
> ...
> 
> ---
>  arch/arm64/boot/dts/amlogic/meson-sm1.dtsi | 27 ++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
> 
> diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
> index 3d8b1f4f2001..1e0adf259d61 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
> +++ b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
> @@ -356,6 +356,33 @@ tdmin_lb: audio-controller@3c0 {
>  			status = "disabled";
>  		};
>  
> +		spdifin: audio-controller@400 {
> +			compatible = "amlogic,g12a-spdifin",
> +			"amlogic,axg-spdifin";
> +			reg = <0x0 0x400 0x0 0x30>;
> +			#sound-dai-cells = <0>;
> +			sound-name-prefix = "SPDIFIN";
> +			interrupts = <GIC_SPI 151 IRQ_TYPE_EDGE_RISING>;
> +			clocks = <&clkc_audio AUD_CLKID_SPDIFIN>,
> +			<&clkc_audio AUD_CLKID_SPDIFIN_CLK>;
> +			clock-names = "pclk", "refclk";
> +			resets = <&clkc_audio AUD_RESET_SPDIFIN>;
> +			status = "disabled";
> +		};
> +
> +		spdifout: audio-controller@480 {
> +			compatible = "amlogic,g12a-spdifout",
> +			"amlogic,axg-spdifout";
> +			reg = <0x0 0x480 0x0 0x50>;
> +			#sound-dai-cells = <0>;
> +			sound-name-prefix = "SPDIFOUT";
> +			clocks = <&clkc_audio AUD_CLKID_SPDIFOUT>,
> +			<&clkc_audio AUD_CLKID_SPDIFOUT_CLK>;
> +			clock-names = "pclk", "mclk";
> +			resets = <&clkc_audio AUD_RESET_SPDIFOUT>;
> +			status = "disabled";
> +		};
> +
>  		tdmout_a: audio-controller@500 {
>  			compatible = "amlogic,sm1-tdmout";
>  			reg = <0x0 0x500 0x0 0x40>;
> 

Reviewed-by: Neil Armstrong <narmstrong@baylibre.com>

Thanks,
Neil
Jerome Brunet Jan. 3, 2022, 3:35 p.m. UTC | #2
On Wed 15 Dec 2021 at 11:02, Artem Lapkin <email2tema@gmail.com> wrote:

> Add spdifin spdifout nodes for Amlogic SM1 SoCs.
             ^ add (same in the title)

>
> Signed-off-by: Artem Lapkin <art@khadas.com>
> ---
>
> SPDIF IN and SPDIF OUT both tested and works fine for VIM3L (meson-sm1)
> same as for VIM3 (meson-g12)
>
> SPDIF in and SPDIF OUT both pins available via GPIO header (SPDIF_OUT PIN
> 13 spdif_ao_out_pins and SPDIF_IN PIN 35 - same PWM_F spdif_in_h_pins)
>
> https://lore.kernel.org/linux-arm-kernel/1jtuhwvqxa.fsf@starbuckisacylon.baylibre.com/t/
>
> ALSA spdifin test example
> =========================
>
> # arecord -fS16_LE -r48000 -c2 -Dplug:spdifin
>
> # cat .asoundrc
> pcm.spdifin {
> type iec958
> slave {
> pcm "hw:0,1"
> format IEC958_SUBFRAME_LE
> }
> }
>
> DT sound card configs for testing
> =================================
>
> &spdifout {
>     pinctrl-0 = <&spdif_ao_out_pins>;
>     pinctrl-names = "default";
>     status = "okay";
> };
>
> &spdifin {
>     pinctrl-0 = <&spdif_in_h_pins>;
>     pinctrl-names = "default";
>     status = "okay";
> };
>
> ...
>     spdif_dit: audio-codec-1 {
> 	#sound-dai-cells = <0>;
> 	compatible = "linux,spdif-dit";
> 	status = "okay";
> 	sound-name-prefix = "DIT";
>     };
>
>     spdif_dir: audio-codec-2 {
> 	#sound-dai-cells = <0>;
> 	compatible = "linux,spdif-dir";
> 	status = "okay";
> 	sound-name-prefix = "DIR";
>     };
> ...
> 	audio-routing = ...
> 		"TODDR_B IN 3", "SPDIFIN Capture",
> 		"SPDIFOUT IN 0", "FRDDR_A OUT 3";
>
> ...
> 	dai-link-10 {
> 	    sound-dai = <&spdifout>;
>
> 	    codec-0 {
> 		sound-dai = <&spdif_dit>;
> 	    };
> 	};
>
> 	/* spdif or toslink interface */
> 	dai-link-11 {
> 	    sound-dai = <&spdifin>;
>
> 	    codec-0 {
> 		sound-dai = <&spdif_dir>;
> 	    };
> 	};
> ...
>
> ---
>  arch/arm64/boot/dts/amlogic/meson-sm1.dtsi | 27 ++++++++++++++++++++++
>  1 file changed, 27 insertions(+)
>
> diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
> index 3d8b1f4f2001..1e0adf259d61 100644
> --- a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
> +++ b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
> @@ -356,6 +356,33 @@ tdmin_lb: audio-controller@3c0 {
>  			status = "disabled";
>  		};
>  
> +		spdifin: audio-controller@400 {
> +			compatible = "amlogic,g12a-spdifin",
> +			"amlogic,axg-spdifin";
> +			reg = <0x0 0x400 0x0 0x30>;
> +			#sound-dai-cells = <0>;
> +			sound-name-prefix = "SPDIFIN";
> +			interrupts = <GIC_SPI 151 IRQ_TYPE_EDGE_RISING>;
> +			clocks = <&clkc_audio AUD_CLKID_SPDIFIN>,
> +			<&clkc_audio AUD_CLKID_SPDIFIN_CLK>;
> +			clock-names = "pclk", "refclk";
> +			resets = <&clkc_audio AUD_RESET_SPDIFIN>;
> +			status = "disabled";
> +		};
> +
> +		spdifout: audio-controller@480 {

Node should still be named spdifout_a, even if the spdifout_b is not added yet

> +			compatible = "amlogic,g12a-spdifout",
> +			"amlogic,axg-spdifout";
> +			reg = <0x0 0x480 0x0 0x50>;
> +			#sound-dai-cells = <0>;
> +			sound-name-prefix = "SPDIFOUT";

Same here

> +			clocks = <&clkc_audio AUD_CLKID_SPDIFOUT>,
> +			<&clkc_audio AUD_CLKID_SPDIFOUT_CLK>;
> +			clock-names = "pclk", "mclk";
> +			resets = <&clkc_audio AUD_RESET_SPDIFOUT>;
> +			status = "disabled";
> +		};
> +
>  		tdmout_a: audio-controller@500 {
>  			compatible = "amlogic,sm1-tdmout";
>  			reg = <0x0 0x500 0x0 0x40>;
Neil Armstrong Jan. 12, 2022, 8:28 a.m. UTC | #3
Hi,

On Wed, 15 Dec 2021 11:02:36 +0800, Artem Lapkin wrote:
> Add spdifin spdifout nodes for Amlogic SM1 SoCs.
> 
> 

Thanks, Applied to https://git.kernel.org/pub/scm/linux/kernel/git/amlogic/linux.git (v5.18/dt64)

[1/1] arm64: dts: meson-sm1: add spdifin spdifout nodes
      https://git.kernel.org/amlogic/c/86f2159468d55aca1793c1f0f3d95213501b32f3
Neil Armstrong Jan. 12, 2022, 8:57 a.m. UTC | #4
On 03/01/2022 16:35, Jerome Brunet wrote:
> 
> On Wed 15 Dec 2021 at 11:02, Artem Lapkin <email2tema@gmail.com> wrote:
> 
>> Add spdifin spdifout nodes for Amlogic SM1 SoCs.
>              ^ add (same in the title)
> 
>>
>> Signed-off-by: Artem Lapkin <art@khadas.com>
>> ---
>>
>> SPDIF IN and SPDIF OUT both tested and works fine for VIM3L (meson-sm1)
>> same as for VIM3 (meson-g12)
>>
>> SPDIF in and SPDIF OUT both pins available via GPIO header (SPDIF_OUT PIN
>> 13 spdif_ao_out_pins and SPDIF_IN PIN 35 - same PWM_F spdif_in_h_pins)
>>
>> https://lore.kernel.org/linux-arm-kernel/1jtuhwvqxa.fsf@starbuckisacylon.baylibre.com/t/
>>
>> ALSA spdifin test example
>> =========================
>>
>> # arecord -fS16_LE -r48000 -c2 -Dplug:spdifin
>>
>> # cat .asoundrc
>> pcm.spdifin {
>> type iec958
>> slave {
>> pcm "hw:0,1"
>> format IEC958_SUBFRAME_LE
>> }
>> }
>>
>> DT sound card configs for testing
>> =================================
>>
>> &spdifout {
>>     pinctrl-0 = <&spdif_ao_out_pins>;
>>     pinctrl-names = "default";
>>     status = "okay";
>> };
>>
>> &spdifin {
>>     pinctrl-0 = <&spdif_in_h_pins>;
>>     pinctrl-names = "default";
>>     status = "okay";
>> };
>>
>> ...
>>     spdif_dit: audio-codec-1 {
>> 	#sound-dai-cells = <0>;
>> 	compatible = "linux,spdif-dit";
>> 	status = "okay";
>> 	sound-name-prefix = "DIT";
>>     };
>>
>>     spdif_dir: audio-codec-2 {
>> 	#sound-dai-cells = <0>;
>> 	compatible = "linux,spdif-dir";
>> 	status = "okay";
>> 	sound-name-prefix = "DIR";
>>     };
>> ...
>> 	audio-routing = ...
>> 		"TODDR_B IN 3", "SPDIFIN Capture",
>> 		"SPDIFOUT IN 0", "FRDDR_A OUT 3";
>>
>> ...
>> 	dai-link-10 {
>> 	    sound-dai = <&spdifout>;
>>
>> 	    codec-0 {
>> 		sound-dai = <&spdif_dit>;
>> 	    };
>> 	};
>>
>> 	/* spdif or toslink interface */
>> 	dai-link-11 {
>> 	    sound-dai = <&spdifin>;
>>
>> 	    codec-0 {
>> 		sound-dai = <&spdif_dir>;
>> 	    };
>> 	};
>> ...
>>
>> ---
>>  arch/arm64/boot/dts/amlogic/meson-sm1.dtsi | 27 ++++++++++++++++++++++
>>  1 file changed, 27 insertions(+)
>>
>> diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
>> index 3d8b1f4f2001..1e0adf259d61 100644
>> --- a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
>> +++ b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
>> @@ -356,6 +356,33 @@ tdmin_lb: audio-controller@3c0 {
>>  			status = "disabled";
>>  		};
>>  
>> +		spdifin: audio-controller@400 {
>> +			compatible = "amlogic,g12a-spdifin",
>> +			"amlogic,axg-spdifin";
>> +			reg = <0x0 0x400 0x0 0x30>;
>> +			#sound-dai-cells = <0>;
>> +			sound-name-prefix = "SPDIFIN";
>> +			interrupts = <GIC_SPI 151 IRQ_TYPE_EDGE_RISING>;
>> +			clocks = <&clkc_audio AUD_CLKID_SPDIFIN>,
>> +			<&clkc_audio AUD_CLKID_SPDIFIN_CLK>;
>> +			clock-names = "pclk", "refclk";
>> +			resets = <&clkc_audio AUD_RESET_SPDIFIN>;
>> +			status = "disabled";
>> +		};
>> +
>> +		spdifout: audio-controller@480 {
> 
> Node should still be named spdifout_a, even if the spdifout_b is not added yet
> 
>> +			compatible = "amlogic,g12a-spdifout",
>> +			"amlogic,axg-spdifout";
>> +			reg = <0x0 0x480 0x0 0x50>;
>> +			#sound-dai-cells = <0>;
>> +			sound-name-prefix = "SPDIFOUT";
> 
> Same here
> 
>> +			clocks = <&clkc_audio AUD_CLKID_SPDIFOUT>,
>> +			<&clkc_audio AUD_CLKID_SPDIFOUT_CLK>;
>> +			clock-names = "pclk", "mclk";
>> +			resets = <&clkc_audio AUD_RESET_SPDIFOUT>;
>> +			status = "disabled";
>> +		};
>> +
>>  		tdmout_a: audio-controller@500 {
>>  			compatible = "amlogic,sm1-tdmout";
>>  			reg = <0x0 0x500 0x0 0x40>;
> 

All these fixed while applying, no need to send a new version.

Neil
diff mbox series

Patch

diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
index 3d8b1f4f2001..1e0adf259d61 100644
--- a/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
+++ b/arch/arm64/boot/dts/amlogic/meson-sm1.dtsi
@@ -356,6 +356,33 @@  tdmin_lb: audio-controller@3c0 {
 			status = "disabled";
 		};
 
+		spdifin: audio-controller@400 {
+			compatible = "amlogic,g12a-spdifin",
+			"amlogic,axg-spdifin";
+			reg = <0x0 0x400 0x0 0x30>;
+			#sound-dai-cells = <0>;
+			sound-name-prefix = "SPDIFIN";
+			interrupts = <GIC_SPI 151 IRQ_TYPE_EDGE_RISING>;
+			clocks = <&clkc_audio AUD_CLKID_SPDIFIN>,
+			<&clkc_audio AUD_CLKID_SPDIFIN_CLK>;
+			clock-names = "pclk", "refclk";
+			resets = <&clkc_audio AUD_RESET_SPDIFIN>;
+			status = "disabled";
+		};
+
+		spdifout: audio-controller@480 {
+			compatible = "amlogic,g12a-spdifout",
+			"amlogic,axg-spdifout";
+			reg = <0x0 0x480 0x0 0x50>;
+			#sound-dai-cells = <0>;
+			sound-name-prefix = "SPDIFOUT";
+			clocks = <&clkc_audio AUD_CLKID_SPDIFOUT>,
+			<&clkc_audio AUD_CLKID_SPDIFOUT_CLK>;
+			clock-names = "pclk", "mclk";
+			resets = <&clkc_audio AUD_RESET_SPDIFOUT>;
+			status = "disabled";
+		};
+
 		tdmout_a: audio-controller@500 {
 			compatible = "amlogic,sm1-tdmout";
 			reg = <0x0 0x500 0x0 0x40>;