Skip to main content
Visitor II
September 7, 2020
Question

Using the CS41L51 audio chip while using SPDIF will cause the following errors.

  • September 7, 2020
  • 1 reply
  • 1532 views

0693W000003Qs8IQAS.png

My device tree configuration

 {
 spdif_out: spdif-out {
 #sound-dai-cells = <0>;
 compatible = "linux,spdif-dit";
 status = "okay";
 
 spdif_out_port: port {
 spdif_out_endpoint: endpoint {
 remote-endpoint = <&sai4a_endpoint>;
 };
 };
 };
 
 spdif_in: spdif-in {
 #sound-dai-cells = <0>;
 compatible = "linux,spdif-dir";
 status = "okay";
 
 spdif_in_port: port {
 spdif_in_endpoint: endpoint {
 remote-endpoint = <&spdifrx_endpoint>;
 };
 };
 };
 sound: sound {
 compatible = "audio-graph-card";
 label = "STM32MP1-DK";
 routing =
 "Playback" , "MCLK",
 "Capture" , "MCLK",
 "MICL" , "Mic Bias";
 dais = <&sai2a_port &sai2b_port &sai4a_port &spdifrx_port &i2s2_port>;
 status = "okay";
 };
};
&i2c4 {
 pinctrl-names = "default", "sleep";
 pinctrl-0 = <&i2c4_pins_a>;
 pinctrl-1 = <&i2c4_pins_sleep_a>;
 i2c-scl-rising-time-ns = <185>;
 i2c-scl-falling-time-ns = <20>;
 status = "okay";
 /delete-property/dmas;
 /delete-property/dma-names;
 cs42l51: cs42l51@4a {
 compatible = "cirrus,cs42l51";
 reg = <0x4a>;
 #sound-dai-cells = <0>;
 VL-supply = <&v3v3>;
 VD-supply = <&v1v8_audio>;
 VA-supply = <&v1v8_audio>;
 VAHP-supply = <&v1v8_audio>;
 reset-gpios = <&gpioz 7 GPIO_ACTIVE_LOW>;
 clocks = <&sai2a>;
 clock-names = "MCLK";
 status = "okay";
 
 cs42l51_port: port {
 #address-cells = <1>;
 #size-cells = <0>;
 
 cs42l51_tx_endpoint: endpoint@0 {
 reg = <0>;
 remote-endpoint = <&sai2a_endpoint>;
 frame-master;
 bitclock-master;
 };
 
 cs42l51_rx_endpoint: endpoint@1 {
 reg = <1>;
 remote-endpoint = <&sai2b_endpoint>;
 frame-master;
 bitclock-master;
 };
 };
 };
};
&sai2 {
 clocks = <&rcc SAI2>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
 clock-names = "pclk", "x8k", "x11k";
 pinctrl-names = "default", "sleep";
 pinctrl-0 = <&sai2a_pins_a>, <&sai2b_pins_b>;
 pinctrl-1 = <&sai2a_sleep_pins_a>, <&sai2b_sleep_pins_b>;
 status = "okay";
 
 sai2a: audio-controller@4400b004 {
 #clock-cells = <0>;
 dma-names = "tx";
 clocks = <&rcc SAI2_K>;
 clock-names = "sai_ck";
 status = "okay";
 
 sai2a_port: port {
 sai2a_endpoint: endpoint {
 remote-endpoint = <&cs42l51_tx_endpoint>;
 format = "i2s";
 mclk-fs = <256>;
 dai-tdm-slot-num = <2>;
 dai-tdm-slot-width = <32>;
 };
 };
 };
 
 sai2b: audio-controller@4400b024 {
 dma-names = "rx";
 st,sync = <&sai2a 2>;
 clocks = <&rcc SAI2_K>, <&sai2a>;
 clock-names = "sai_ck", "MCLK";
 status = "okay";
 
 sai2b_port: port {
 sai2b_endpoint: endpoint {
 remote-endpoint = <&cs42l51_rx_endpoint>;
 format = "i2s";
 mclk-fs = <256>;
 dai-tdm-slot-num = <2>;
 dai-tdm-slot-width = <32>;
 };
 };
 };
};
 
&sai4 {
 clocks = <&rcc SAI4>, <&rcc PLL3_Q>, <&rcc PLL3_R>;
 clock-names = "pclk", "x8k", "x11k";
 status = "okay";
 
 sai4a: audio-controller@50027004 {
 pinctrl-names = "default", "sleep";
 pinctrl-0 = <&sai4a_pins_a>;
 pinctrl-1 = <&sai4a_sleep_pins_a>;
 dma-names = "tx";
 clocks = <&rcc SAI4_K>;
 clock-names = "sai_ck";
 st,iec60958;
 status = "okay";
 
 sai4a_port: port {
 sai4a_endpoint: endpoint {
 remote-endpoint = <&spdif_out_endpoint>;
 };
 };
 };
};
&spdifrx {
 pinctrl-names = "default", "sleep";
 pinctrl-0 = <&spdifrx_pins_a>;
 pinctrl-1 = <&spdifrx_pins_a>;
 status = "okay";
 
 spdifrx_port: port {
 spdifrx_endpoint: endpoint {
 remote-endpoint = <&spdif_in_endpoint>;
 };
 };
};

With this device tree configuration, the following error occurs. Remove the node &sai4a_port in DASI, and audio can be used. How do I modify the node &sai4a_port

[  4.441723] asoc-audio-graph-card sound: ASoC: sink widget Playback overwritten

[  4.448991] asoc-audio-graph-card sound: ASoC: sink widget Capture overwritten

    This topic has been closed for replies.

    1 reply

    ST Employee
    September 8, 2020

    Hi @文�?� �?​ ,

    Here are 2 or 3 questions to help me to understand the problem:

    1) In your DT, cs42l51 is connected to i²C4 : could you please tell me on which board you are working on ?

    2) When you say that "audio can be used", does it mean that adding &sai4a_port entry from dais list breaks cs42l51 codec rx and tx and/or spdif_in ? Could you please elaborate on what works and what doesn't work, and what you want to do.

    BR,

    Christophe

    User.44Author
    Visitor II
    September 10, 2020

    Hi Christophe G

    1)Based on the STM32MP157-EV1 board to make a development board of our company, the CPU uses STM32MP157D, and the PMIC is removed.The audio is based on STM32MP157C-DK2

    2)Yes,&Sai4a_port will destroy the RX and TX of the CS42l51 encoder

    /***The audio will work normally in this way**/
    dais = <&sai2a_port &sai2b_port &spdifrx_port &i2s2_port>; 
    dais = <&sai4a_port &spdifrx_port &i2s2_port>;
     

    ​As long as CS42L51 and &sai4a_port are both in dasi, CS42L51 will report the following error

    [  4.441723] asoc-audio-graph-card sound: ASoC: sink widget Playback overwritten

    [  4.448991] asoc-audio-graph-card sound: ASoC: sink widget Capture overwritten

    I think &sai4a_port and CS42L51 can run normally

    ST Employee
    September 11, 2020

    Hi @文�?� �?​ ,

    We had this kind of error in the past with digital microphone DT entries : the problem was coming from dapm widget names and audio interfaces which were identicals.

    It has been fixed by adding a prefix :

    dmic1: dmic-1 {
     compatible = "dmic-codec";
     #sound-dai-cells = <1>;
    + sound-name-prefix = "dmic1";
     status = "okay";

    Hope it will help,

    BR,

    Christophe