Re: [PATCH 1/3] arch/arm64: dts: ac2xx: make common the sound card

From: Jan Dakinevich
Date: Thu May 23 2024 - 05:26:31 EST




On 5/23/24 10:36, Neil Armstrong wrote:
> On 22/05/2024 00:21, Jan Dakinevich wrote:
>> The declaration of sound card and its dependencies is identical in all
>> consumers of 'meson-sm1-ac2xx.dtsi'.
>>
>> Signed-off-by: Jan Dakinevich <jan.dakinevich@xxxxxxxxxxxxxxxxx>
>> ---
>>   .../dts/amlogic/meson-sm1-a95xf3-air-gbit.dts | 87 -------------------
>>   .../boot/dts/amlogic/meson-sm1-a95xf3-air.dts | 87 -------------------
>>   .../boot/dts/amlogic/meson-sm1-ac2xx.dtsi     | 87 +++++++++++++++++++
>>   .../boot/dts/amlogic/meson-sm1-h96-max.dts    | 87 -------------------
>>   .../dts/amlogic/meson-sm1-x96-air-gbit.dts    | 87 -------------------
>>   .../boot/dts/amlogic/meson-sm1-x96-air.dts    | 87 -------------------
>>   6 files changed, 87 insertions(+), 435 deletions(-)
>>
>> diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-a95xf3-air-gbit.dts
>> b/arch/arm64/boot/dts/amlogic/meson-sm1-a95xf3-air-gbit.dts
>> index 9b2eb6e42651..90ae38c30592 100644
>> --- a/arch/arm64/boot/dts/amlogic/meson-sm1-a95xf3-air-gbit.dts
>> +++ b/arch/arm64/boot/dts/amlogic/meson-sm1-a95xf3-air-gbit.dts
>> @@ -7,73 +7,10 @@
>>   /dts-v1/;
>>     #include "meson-sm1-ac2xx.dtsi"
>> -#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
>>     / {
>>       compatible = "cyx,a95xf3-air-gbit", "amlogic,sm1";
>>       model = "Shenzhen CYX Industrial Co., Ltd A95XF3-AIR";
>> -
>> -    sound {
>> -        compatible = "amlogic,axg-sound-card";
>> -        model = "A95XF3-AIR";
>
> model should be board-specific, as for sound node because dev board
> variants can be different, so I don't thing moving sound to a common
> dtsi is a good thing.
>

Ok, I can redefine the model for each board.

>> -        audio-aux-devs = <&tdmout_b>;
>> -        audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
>> -                "TDMOUT_B IN 1", "FRDDR_B OUT 1",
>> -                "TDMOUT_B IN 2", "FRDDR_C OUT 1",
>> -                "TDM_B Playback", "TDMOUT_B OUT";
>> -
>> -        assigned-clocks = <&clkc CLKID_MPLL2>,
>> -                  <&clkc CLKID_MPLL0>,
>> -                  <&clkc CLKID_MPLL1>;
>> -        assigned-clock-parents = <0>, <0>, <0>;
>> -        assigned-clock-rates = <294912000>,
>> -                       <270950400>,
>> -                       <393216000>;
>> -
>> -        dai-link-0 {
>> -            sound-dai = <&frddr_a>;
>> -        };
>> -
>> -        dai-link-1 {
>> -            sound-dai = <&frddr_b>;
>> -        };
>> -
>> -        dai-link-2 {
>> -            sound-dai = <&frddr_c>;
>> -        };
>> -
>> -        /* 8ch hdmi interface */
>> -        dai-link-3 {
>> -            sound-dai = <&tdmif_b>;
>> -            dai-format = "i2s";
>> -            dai-tdm-slot-tx-mask-0 = <1 1>;
>> -            dai-tdm-slot-tx-mask-1 = <1 1>;
>> -            dai-tdm-slot-tx-mask-2 = <1 1>;
>> -            dai-tdm-slot-tx-mask-3 = <1 1>;
>> -            mclk-fs = <256>;
>> -
>> -            codec {
>> -                sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
>> -            };
>> -        };
>> -
>> -        /* hdmi glue */
>> -        dai-link-4 {
>> -            sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
>> -
>> -            codec {
>> -                sound-dai = <&hdmi_tx>;
>> -            };
>> -        };
>> -    };
>> -};
>> -
>> -&arb {
>> -    status = "okay";
>> -};
>> -
>> -&clkc_audio {
>> -    status = "okay";
>>   };
>>     &ethmac {
>> @@ -102,27 +39,3 @@ external_phy: ethernet-phy@0 {
>>           interrupts = <IRQID_GPIOZ_14 IRQ_TYPE_LEVEL_LOW>;
>>       };
>>   };
>> -
>> -&frddr_a {
>> -    status = "okay";
>> -};
>> -
>> -&frddr_b {
>> -    status = "okay";
>> -};
>> -
>> -&frddr_c {
>> -    status = "okay";
>> -};
>> -
>> -&tdmif_b {
>> -    status = "okay";
>> -};
>> -
>> -&tdmout_b {
>> -    status = "okay";
>> -};
>> -
>> -&tohdmitx {
>> -    status = "okay";
>> -};
>> diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-a95xf3-air.dts
>> b/arch/arm64/boot/dts/amlogic/meson-sm1-a95xf3-air.dts
>> index 6e34fd80ed71..c74ce9c246fa 100644
>> --- a/arch/arm64/boot/dts/amlogic/meson-sm1-a95xf3-air.dts
>> +++ b/arch/arm64/boot/dts/amlogic/meson-sm1-a95xf3-air.dts
>> @@ -7,73 +7,10 @@
>>   /dts-v1/;
>>     #include "meson-sm1-ac2xx.dtsi"
>> -#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
>>     / {
>>       compatible = "cyx,a95xf3-air", "amlogic,sm1";
>>       model = "Shenzhen CYX Industrial Co., Ltd A95XF3-AIR";
>> -
>> -    sound {
>> -        compatible = "amlogic,axg-sound-card";
>> -        model = "A95XF3-AIR";
>> -        audio-aux-devs = <&tdmout_b>;
>> -        audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
>> -                "TDMOUT_B IN 1", "FRDDR_B OUT 1",
>> -                "TDMOUT_B IN 2", "FRDDR_C OUT 1",
>> -                "TDM_B Playback", "TDMOUT_B OUT";
>> -
>> -        assigned-clocks = <&clkc CLKID_MPLL2>,
>> -                  <&clkc CLKID_MPLL0>,
>> -                  <&clkc CLKID_MPLL1>;
>> -        assigned-clock-parents = <0>, <0>, <0>;
>> -        assigned-clock-rates = <294912000>,
>> -                       <270950400>,
>> -                       <393216000>;
>> -
>> -        dai-link-0 {
>> -            sound-dai = <&frddr_a>;
>> -        };
>> -
>> -        dai-link-1 {
>> -            sound-dai = <&frddr_b>;
>> -        };
>> -
>> -        dai-link-2 {
>> -            sound-dai = <&frddr_c>;
>> -        };
>> -
>> -        /* 8ch hdmi interface */
>> -        dai-link-3 {
>> -            sound-dai = <&tdmif_b>;
>> -            dai-format = "i2s";
>> -            dai-tdm-slot-tx-mask-0 = <1 1>;
>> -            dai-tdm-slot-tx-mask-1 = <1 1>;
>> -            dai-tdm-slot-tx-mask-2 = <1 1>;
>> -            dai-tdm-slot-tx-mask-3 = <1 1>;
>> -            mclk-fs = <256>;
>> -
>> -            codec {
>> -                sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
>> -            };
>> -        };
>> -
>> -        /* hdmi glue */
>> -        dai-link-4 {
>> -            sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
>> -
>> -            codec {
>> -                sound-dai = <&hdmi_tx>;
>> -            };
>> -        };
>> -    };
>> -};
>> -
>> -&arb {
>> -    status = "okay";
>> -};
>> -
>> -&clkc_audio {
>> -    status = "okay";
>>   };
>>     &ethmac {
>> @@ -81,27 +18,3 @@ &ethmac {
>>       phy-handle = <&internal_ephy>;
>>       phy-mode = "rmii";
>>   };
>> -
>> -&frddr_a {
>> -    status = "okay";
>> -};
>> -
>> -&frddr_b {
>> -    status = "okay";
>> -};
>> -
>> -&frddr_c {
>> -    status = "okay";
>> -};
>> -
>> -&tdmif_b {
>> -    status = "okay";
>> -};
>> -
>> -&tdmout_b {
>> -    status = "okay";
>> -};
>> -
>> -&tohdmitx {
>> -    status = "okay";
>> -};
>> diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-ac2xx.dtsi
>> b/arch/arm64/boot/dts/amlogic/meson-sm1-ac2xx.dtsi
>> index d1fa8b8bf795..7b20a8ff3dfb 100644
>> --- a/arch/arm64/boot/dts/amlogic/meson-sm1-ac2xx.dtsi
>> +++ b/arch/arm64/boot/dts/amlogic/meson-sm1-ac2xx.dtsi
>> @@ -12,6 +12,7 @@
>>   #include <dt-bindings/gpio/gpio.h>
>>   #include <dt-bindings/gpio/meson-g12a-gpio.h>
>>   #include <dt-bindings/input/input.h>
>> +#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
>>     / {
>>       aliases {
>> @@ -127,6 +128,60 @@ wifi32k: wifi32k {
>>           clock-frequency = <32768>;
>>           pwms = <&pwm_ef 0 30518 0>; /* PWM_E at 32.768KHz */
>>       };
>> +
>> +    sound {
>> +        compatible = "amlogic,axg-sound-card";
>> +        model = "AC2XX";
>> +        audio-aux-devs = <&tdmout_b>;
>> +        audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
>> +                "TDMOUT_B IN 1", "FRDDR_B OUT 1",
>> +                "TDMOUT_B IN 2", "FRDDR_C OUT 1",
>> +                "TDM_B Playback", "TDMOUT_B OUT";
>> +
>> +        assigned-clocks = <&clkc CLKID_MPLL2>,
>> +                  <&clkc CLKID_MPLL0>,
>> +                  <&clkc CLKID_MPLL1>;
>> +        assigned-clock-parents = <0>, <0>, <0>;
>> +        assigned-clock-rates = <294912000>,
>> +                       <270950400>,
>> +                       <393216000>;
>> +
>> +        dai-link-0 {
>> +            sound-dai = <&frddr_a>;
>> +        };
>> +
>> +        dai-link-1 {
>> +            sound-dai = <&frddr_b>;
>> +        };
>> +
>> +        dai-link-2 {
>> +            sound-dai = <&frddr_c>;
>> +        };
>> +
>> +        /* 8ch hdmi interface */
>> +        dai-link-3 {
>> +            sound-dai = <&tdmif_b>;
>> +            dai-format = "i2s";
>> +            dai-tdm-slot-tx-mask-0 = <1 1>;
>> +            dai-tdm-slot-tx-mask-1 = <1 1>;
>> +            dai-tdm-slot-tx-mask-2 = <1 1>;
>> +            dai-tdm-slot-tx-mask-3 = <1 1>;
>> +            mclk-fs = <256>;
>> +
>> +            codec {
>> +                sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
>> +            };
>> +        };
>> +
>> +        /* hdmi glue */
>> +        dai-link-4 {
>> +            sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
>> +
>> +            codec {
>> +                sound-dai = <&hdmi_tx>;
>> +            };
>> +        };
>> +    };
>>   };
>>     &cec_AO {
>> @@ -298,3 +353,35 @@ &usb {
>>       status = "okay";
>>       dr_mode = "otg";
>>   };
>> +
>> +&clkc_audio {
>> +    status = "okay";
>> +};
>> +
>> +&arb {
>> +    status = "okay";
>> +};
>> +
>> +&frddr_a {
>> +    status = "okay";
>> +};
>> +
>> +&frddr_b {
>> +    status = "okay";
>> +};
>> +
>> +&frddr_c {
>> +    status = "okay";
>> +};
>> +
>> +&tdmif_b {
>> +    status = "okay";
>> +};
>> +
>> +&tdmout_b {
>> +    status = "okay";
>> +};
>> +
>> +&tohdmitx {
>> +    status = "okay";
>> +};
>> diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-h96-max.dts
>> b/arch/arm64/boot/dts/amlogic/meson-sm1-h96-max.dts
>> index e6e9410d40cb..a4800488b161 100644
>> --- a/arch/arm64/boot/dts/amlogic/meson-sm1-h96-max.dts
>> +++ b/arch/arm64/boot/dts/amlogic/meson-sm1-h96-max.dts
>> @@ -7,73 +7,10 @@
>>   /dts-v1/;
>>     #include "meson-sm1-ac2xx.dtsi"
>> -#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
>>     / {
>>       compatible = "haochuangyi,h96-max", "amlogic,sm1";
>>       model = "Shenzhen Haochuangyi Technology Co., Ltd H96 Max";
>> -
>> -    sound {
>> -        compatible = "amlogic,axg-sound-card";
>> -        model = "H96-MAX";
>> -        audio-aux-devs = <&tdmout_b>;
>> -        audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
>> -                "TDMOUT_B IN 1", "FRDDR_B OUT 1",
>> -                "TDMOUT_B IN 2", "FRDDR_C OUT 1",
>> -                "TDM_B Playback", "TDMOUT_B OUT";
>> -
>> -        assigned-clocks = <&clkc CLKID_MPLL2>,
>> -                  <&clkc CLKID_MPLL0>,
>> -                  <&clkc CLKID_MPLL1>;
>> -        assigned-clock-parents = <0>, <0>, <0>;
>> -        assigned-clock-rates = <294912000>,
>> -                       <270950400>,
>> -                       <393216000>;
>> -
>> -        dai-link-0 {
>> -            sound-dai = <&frddr_a>;
>> -        };
>> -
>> -        dai-link-1 {
>> -            sound-dai = <&frddr_b>;
>> -        };
>> -
>> -        dai-link-2 {
>> -            sound-dai = <&frddr_c>;
>> -        };
>> -
>> -        /* 8ch hdmi interface */
>> -        dai-link-3 {
>> -            sound-dai = <&tdmif_b>;
>> -            dai-format = "i2s";
>> -            dai-tdm-slot-tx-mask-0 = <1 1>;
>> -            dai-tdm-slot-tx-mask-1 = <1 1>;
>> -            dai-tdm-slot-tx-mask-2 = <1 1>;
>> -            dai-tdm-slot-tx-mask-3 = <1 1>;
>> -            mclk-fs = <256>;
>> -
>> -            codec {
>> -                sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
>> -            };
>> -        };
>> -
>> -        /* hdmi glue */
>> -        dai-link-4 {
>> -            sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
>> -
>> -            codec {
>> -                sound-dai = <&hdmi_tx>;
>> -            };
>> -        };
>> -    };
>> -};
>> -
>> -&arb {
>> -    status = "okay";
>> -};
>> -
>> -&clkc_audio {
>> -    status = "okay";
>>   };
>>     &ethmac {
>> @@ -103,30 +40,6 @@ external_phy: ethernet-phy@0 {
>>       };
>>   };
>>   -&frddr_a {
>> -    status = "okay";
>> -};
>> -
>> -&frddr_b {
>> -    status = "okay";
>> -};
>> -
>> -&frddr_c {
>> -    status = "okay";
>> -};
>> -
>> -&tdmif_b {
>> -    status = "okay";
>> -};
>> -
>> -&tdmout_b {
>> -    status = "okay";
>> -};
>> -
>> -&tohdmitx {
>> -    status = "okay";
>> -};
>> -
>>   &uart_A {
>>       status = "okay";
>>   diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-x96-air-gbit.dts
>> b/arch/arm64/boot/dts/amlogic/meson-sm1-x96-air-gbit.dts
>> index fc9b961133cd..dbd8625285b6 100644
>> --- a/arch/arm64/boot/dts/amlogic/meson-sm1-x96-air-gbit.dts
>> +++ b/arch/arm64/boot/dts/amlogic/meson-sm1-x96-air-gbit.dts
>> @@ -7,73 +7,10 @@
>>   /dts-v1/;
>>     #include "meson-sm1-ac2xx.dtsi"
>> -#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
>>     / {
>>       compatible = "amediatech,x96-air-gbit", "amlogic,sm1";
>>       model = "Shenzhen Amediatech Technology Co., Ltd X96 Air";
>> -
>> -    sound {
>> -        compatible = "amlogic,axg-sound-card";
>> -        model = "X96-AIR";
>> -        audio-aux-devs = <&tdmout_b>;
>> -        audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
>> -                "TDMOUT_B IN 1", "FRDDR_B OUT 1",
>> -                "TDMOUT_B IN 2", "FRDDR_C OUT 1",
>> -                "TDM_B Playback", "TDMOUT_B OUT";
>> -
>> -        assigned-clocks = <&clkc CLKID_MPLL2>,
>> -                  <&clkc CLKID_MPLL0>,
>> -                  <&clkc CLKID_MPLL1>;
>> -        assigned-clock-parents = <0>, <0>, <0>;
>> -        assigned-clock-rates = <294912000>,
>> -                       <270950400>,
>> -                       <393216000>;
>> -
>> -        dai-link-0 {
>> -            sound-dai = <&frddr_a>;
>> -        };
>> -
>> -        dai-link-1 {
>> -            sound-dai = <&frddr_b>;
>> -        };
>> -
>> -        dai-link-2 {
>> -            sound-dai = <&frddr_c>;
>> -        };
>> -
>> -        /* 8ch hdmi interface */
>> -        dai-link-3 {
>> -            sound-dai = <&tdmif_b>;
>> -            dai-format = "i2s";
>> -            dai-tdm-slot-tx-mask-0 = <1 1>;
>> -            dai-tdm-slot-tx-mask-1 = <1 1>;
>> -            dai-tdm-slot-tx-mask-2 = <1 1>;
>> -            dai-tdm-slot-tx-mask-3 = <1 1>;
>> -            mclk-fs = <256>;
>> -
>> -            codec {
>> -                sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
>> -            };
>> -        };
>> -
>> -        /* hdmi glue */
>> -        dai-link-4 {
>> -            sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
>> -
>> -            codec {
>> -                sound-dai = <&hdmi_tx>;
>> -            };
>> -        };
>> -    };
>> -};
>> -
>> -&arb {
>> -    status = "okay";
>> -};
>> -
>> -&clkc_audio {
>> -    status = "okay";
>>   };
>>     &ethmac {
>> @@ -103,30 +40,6 @@ external_phy: ethernet-phy@0 {
>>       };
>>   };
>>   -&frddr_a {
>> -    status = "okay";
>> -};
>> -
>> -&frddr_b {
>> -    status = "okay";
>> -};
>> -
>> -&frddr_c {
>> -    status = "okay";
>> -};
>> -
>>   &ir {
>>       linux,rc-map-name = "rc-x96max";
>>   };
>> -
>> -&tdmif_b {
>> -    status = "okay";
>> -};
>> -
>> -&tdmout_b {
>> -    status = "okay";
>> -};
>> -
>> -&tohdmitx {
>> -    status = "okay";
>> -};
>> diff --git a/arch/arm64/boot/dts/amlogic/meson-sm1-x96-air.dts
>> b/arch/arm64/boot/dts/amlogic/meson-sm1-x96-air.dts
>> index 9ea969255b4f..3b2df25ca630 100644
>> --- a/arch/arm64/boot/dts/amlogic/meson-sm1-x96-air.dts
>> +++ b/arch/arm64/boot/dts/amlogic/meson-sm1-x96-air.dts
>> @@ -7,73 +7,10 @@
>>   /dts-v1/;
>>     #include "meson-sm1-ac2xx.dtsi"
>> -#include <dt-bindings/sound/meson-g12a-tohdmitx.h>
>>     / {
>>       compatible = "amediatech,x96-air", "amlogic,sm1";
>>       model = "Shenzhen Amediatech Technology Co., Ltd X96 Air";
>> -
>> -    sound {
>> -        compatible = "amlogic,axg-sound-card";
>> -        model = "X96-AIR";
>> -        audio-aux-devs = <&tdmout_b>;
>> -        audio-routing = "TDMOUT_B IN 0", "FRDDR_A OUT 1",
>> -                "TDMOUT_B IN 1", "FRDDR_B OUT 1",
>> -                "TDMOUT_B IN 2", "FRDDR_C OUT 1",
>> -                "TDM_B Playback", "TDMOUT_B OUT";
>> -
>> -        assigned-clocks = <&clkc CLKID_MPLL2>,
>> -                  <&clkc CLKID_MPLL0>,
>> -                  <&clkc CLKID_MPLL1>;
>> -        assigned-clock-parents = <0>, <0>, <0>;
>> -        assigned-clock-rates = <294912000>,
>> -                       <270950400>,
>> -                       <393216000>;
>> -
>> -        dai-link-0 {
>> -            sound-dai = <&frddr_a>;
>> -        };
>> -
>> -        dai-link-1 {
>> -            sound-dai = <&frddr_b>;
>> -        };
>> -
>> -        dai-link-2 {
>> -            sound-dai = <&frddr_c>;
>> -        };
>> -
>> -        /* 8ch hdmi interface */
>> -        dai-link-3 {
>> -            sound-dai = <&tdmif_b>;
>> -            dai-format = "i2s";
>> -            dai-tdm-slot-tx-mask-0 = <1 1>;
>> -            dai-tdm-slot-tx-mask-1 = <1 1>;
>> -            dai-tdm-slot-tx-mask-2 = <1 1>;
>> -            dai-tdm-slot-tx-mask-3 = <1 1>;
>> -            mclk-fs = <256>;
>> -
>> -            codec {
>> -                sound-dai = <&tohdmitx TOHDMITX_I2S_IN_B>;
>> -            };
>> -        };
>> -
>> -        /* hdmi glue */
>> -        dai-link-4 {
>> -            sound-dai = <&tohdmitx TOHDMITX_I2S_OUT>;
>> -
>> -            codec {
>> -                sound-dai = <&hdmi_tx>;
>> -            };
>> -        };
>> -    };
>> -};
>> -
>> -&arb {
>> -    status = "okay";
>> -};
>> -
>> -&clkc_audio {
>> -    status = "okay";
>>   };
>>     &ethmac {
>> @@ -81,31 +18,7 @@ &ethmac {
>>       phy-handle = <&internal_ephy>;
>>       phy-mode = "rmii";
>>   };
>> -
>> -&frddr_a {
>> -    status = "okay";
>> -};
>> -
>> -&frddr_b {
>> -    status = "okay";
>> -};
>> -
>> -&frddr_c {
>> -    status = "okay";
>> -};
>> -
>>   &ir {
>>       linux,rc-map-name = "rc-beelink-gs1";
>>   };
>>   -&tdmif_b {
>> -    status = "okay";
>> -};
>> -
>> -&tdmout_b {
>> -    status = "okay";
>> -};
>> -
>> -&tohdmitx {
>> -    status = "okay";
>> -};
>

--
Best regards
Jan Dakinevich