cancel
Showing results for 
Search instead for 
Did you mean: 

what is the "routing" for the Sound card identified as STM32MP15DK in ALSA ?

Bshen.2
Associate II

sound {

compatible = "audio-graph-card";

label = "STM32MP15-DK"; /* Sound card identified as STM32MP15DK in ALSA */

routing =

"Playback" , "MCLK",

"Capture" , "MCLK",

"MICL" , "Mic Bias";

dais = <&sai2a_port &sai2b_port &i2s2_port>;

status = "okay";

};

​

​

Hi!! Is this correct. Can you please help me to understanding what does the source and sink means in this. How to make a routing.

1 ACCEPTED SOLUTION

Accepted Solutions
ArnaudP
Senior

The DAPM concept is not a basic concept. To understand the routing you need to understand the DAPM concept.

The DAPM widgets are kind of node of a audio routing graph, powered up when you start a playback or a record and power down 5 second after the audio stream is closed.

DAPM widgets can be defined in :

  • ASoC card
  • CPU DAI driver ( e.g. SAI, I2S)
  • audio codec driver( e.g cs42l51 driver)

you can list the DAPM widgets in board console:

root@stm32mp1:~# ls /sys/kernel/debug/asoc/STM32MP15-DK/*/dapm
/sys/kernel/debug/asoc/STM32MP15-DK/4000b000.audio-controller/dapm:
bias_level  capture  playback
 
/sys/kernel/debug/asoc/STM32MP15-DK/4400b004.audio-controller/dapm:
bias_level
 
/sys/kernel/debug/asoc/STM32MP15-DK/4400b024.audio-controller/dapm:
bias_level
 
/sys/kernel/debug/asoc/STM32MP15-DK/cs42l51.0-004a/dapm:
AIN1L  AIN2L  Capture  HPL  Left ADC  Left PGA  MICL  Mic Bias         Mic Preamp Right  PGA-ADC Mux Right  Right ADC  Right PGA
AIN1R  AIN2R  DAC Mux  HPR  Left DAC  MCLK      MICR  Mic Preamp Left  PGA-ADC Mux Left  Playback           Right DAC  bias_level
 
/sys/kernel/debug/asoc/STM32MP15-DK/dma:4000b000.audio-controller/dapm:
bias_level
 
/sys/kernel/debug/asoc/STM32MP15-DK/dma:4400b004.audio-controller/dapm:
bias_level
 
/sys/kernel/debug/asoc/STM32MP15-DK/dma:4400b024.audio-controller/dapm:
bias_level
 
/sys/kernel/debug/asoc/STM32MP15-DK/hdmi-audio-codec.1.auto/dapm:
I2S Playback  TX  bias_level

The routing consists in interconecting the widget to create a route to enable everything needed for the playback or record

  • a part of the route is done in the codec driver
  • a part of the route is done in the card ( e.g to connect the codec with the CPU DAI)
  • a part of the route is described in device tree
routing =
        "Playback" , "MCLK",   /* connect the cs42l51 "MCLK" widget to the 4400b004.audio-controller "playback" widget to enable MCLK on playback */
        "Capture" , "MCLK",   /* connect the cs42l51 "MCLK" widget to the 4400b004.audio-controller "playback" widget to enable MCLK on record */
         "MICL" , "Mic Bias";   /* connect the cs42l51 "Mic Bias" widget to the cs42l51  "MICL" widget to enable micbias when microphone input is active */

Extra documentation on DAPM: https://events.static.linuxfound.org/sites/events/files/slides/dapm.pdf ( there is video associated, but seems no more available)

View solution in original post

6 REPLIES 6
ArnaudP
Senior

Hello,

The routing is linked to the ASoC DAPM concept.

Bshen.2
Associate II

OK, thank you for your answer, but this part still doesn't tell me where ST gets "playback", "MCLK".And the attribute "widgets" mentioned in it does not appear in the file of ST.

ArnaudP
Senior

The DAPM concept is not a basic concept. To understand the routing you need to understand the DAPM concept.

The DAPM widgets are kind of node of a audio routing graph, powered up when you start a playback or a record and power down 5 second after the audio stream is closed.

DAPM widgets can be defined in :

  • ASoC card
  • CPU DAI driver ( e.g. SAI, I2S)
  • audio codec driver( e.g cs42l51 driver)

you can list the DAPM widgets in board console:

root@stm32mp1:~# ls /sys/kernel/debug/asoc/STM32MP15-DK/*/dapm
/sys/kernel/debug/asoc/STM32MP15-DK/4000b000.audio-controller/dapm:
bias_level  capture  playback
 
/sys/kernel/debug/asoc/STM32MP15-DK/4400b004.audio-controller/dapm:
bias_level
 
/sys/kernel/debug/asoc/STM32MP15-DK/4400b024.audio-controller/dapm:
bias_level
 
/sys/kernel/debug/asoc/STM32MP15-DK/cs42l51.0-004a/dapm:
AIN1L  AIN2L  Capture  HPL  Left ADC  Left PGA  MICL  Mic Bias         Mic Preamp Right  PGA-ADC Mux Right  Right ADC  Right PGA
AIN1R  AIN2R  DAC Mux  HPR  Left DAC  MCLK      MICR  Mic Preamp Left  PGA-ADC Mux Left  Playback           Right DAC  bias_level
 
/sys/kernel/debug/asoc/STM32MP15-DK/dma:4000b000.audio-controller/dapm:
bias_level
 
/sys/kernel/debug/asoc/STM32MP15-DK/dma:4400b004.audio-controller/dapm:
bias_level
 
/sys/kernel/debug/asoc/STM32MP15-DK/dma:4400b024.audio-controller/dapm:
bias_level
 
/sys/kernel/debug/asoc/STM32MP15-DK/hdmi-audio-codec.1.auto/dapm:
I2S Playback  TX  bias_level

The routing consists in interconecting the widget to create a route to enable everything needed for the playback or record

  • a part of the route is done in the codec driver
  • a part of the route is done in the card ( e.g to connect the codec with the CPU DAI)
  • a part of the route is described in device tree
routing =
        "Playback" , "MCLK",   /* connect the cs42l51 "MCLK" widget to the 4400b004.audio-controller "playback" widget to enable MCLK on playback */
        "Capture" , "MCLK",   /* connect the cs42l51 "MCLK" widget to the 4400b004.audio-controller "playback" widget to enable MCLK on record */
         "MICL" , "Mic Bias";   /* connect the cs42l51 "Mic Bias" widget to the cs42l51  "MICL" widget to enable micbias when microphone input is active */

Extra documentation on DAPM: https://events.static.linuxfound.org/sites/events/files/slides/dapm.pdf ( there is video associated, but seems no more available)

Bshen.2
Associate II

Thank you very much for your reply. These materials are very helpful for me to understand the functions of this part, but I still have a question. This part of the "routing" attribute is prepared for cs42151, but there is also an HDMI audio in the node. How does it work? I don't see the "routing" attribute in the sii9022 document. This node just shows there, but there is nothing except configured I2s.Which makes me very confused.

As mentioned a part of the route is done in the codec driver. This is the case for the HDMI.

https://elixir.bootlin.com/linux/v5.10.79/source/sound/soc/codecs/hdmi-codec.c#L663

to observe connections you can print the content of the DAPM degub files, before and during playback.

root@stm32mp1:~# cat /sys/kernel/debug/asoc/STM32MP15-DK/hdmi-audio-codec.1.auto/dapm/I2S\ Playback 
I2S Playback: Off  in 0 out 1
 stream I2S Playback inactive
 out  "static" "TX"
 in  "static" "playback"
root@stm32mp1:~# cat /sys/kernel/debug/asoc/STM32MP15-DK/hdmi-audio-codec.1.auto/dapm/TX 
TX: Off  in 0 out 1
 in  "static" "I2S Playback"

Bshen.2
Associate II

Thank you again for your help, which is very helpful for me to understand the audio part.:grinning_face: