~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/Documentation/sound/soc/codec-to-codec.rst

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /Documentation/sound/soc/codec-to-codec.rst (Version linux-6.12-rc7) and /Documentation/sound/soc/codec-to-codec.rst (Version linux-5.13.19)


  1 ==============================================      1 ==============================================
  2 Creating codec to codec dai link for ALSA dapm      2 Creating codec to codec dai link for ALSA dapm
  3 ==============================================      3 ==============================================
  4                                                     4 
  5 Mostly the flow of audio is always from CPU to      5 Mostly the flow of audio is always from CPU to codec so your system
  6 will look as below:                                 6 will look as below:
  7 ::                                                  7 ::
  8                                                     8 
  9    ---------          ---------                     9    ---------          ---------
 10   |         |  dai   |         |                   10   |         |  dai   |         |
 11       CPU    ------->    codec                     11       CPU    ------->    codec
 12   |         |        |         |                   12   |         |        |         |
 13    ---------          ---------                    13    ---------          ---------
 14                                                    14 
 15 In case your system looks as below:                15 In case your system looks as below:
 16 ::                                                 16 ::
 17                                                    17 
 18                        ---------                   18                        ---------
 19                       |         |                  19                       |         |
 20                         codec-2                    20                         codec-2
 21                       |         |                  21                       |         |
 22                       ---------                    22                       ---------
 23                            |                       23                            |
 24                          dai-2                     24                          dai-2
 25                            |                       25                            |
 26    ----------          ---------                   26    ----------          ---------
 27   |          |  dai-1 |         |                  27   |          |  dai-1 |         |
 28       CPU     ------->  codec-1                    28       CPU     ------->  codec-1
 29   |          |        |         |                  29   |          |        |         |
 30    ----------          ---------                   30    ----------          ---------
 31                            |                       31                            |
 32                          dai-3                     32                          dai-3
 33                            |                       33                            |
 34                        ---------                   34                        ---------
 35                       |         |                  35                       |         |
 36                         codec-3                    36                         codec-3
 37                       |         |                  37                       |         |
 38                        ---------                   38                        ---------
 39                                                    39 
 40 Suppose codec-2 is a bluetooth chip and codec-     40 Suppose codec-2 is a bluetooth chip and codec-3 is connected to
 41 a speaker and you have a below scenario:           41 a speaker and you have a below scenario:
 42 codec-2 will receive the audio data and the us     42 codec-2 will receive the audio data and the user wants to play that
 43 audio through codec-3 without involving the CP     43 audio through codec-3 without involving the CPU.This
 44 aforementioned case is the ideal case when cod     44 aforementioned case is the ideal case when codec to codec
 45 connection should be used.                         45 connection should be used.
 46                                                    46 
 47 Your dai_link should appear as below in your m     47 Your dai_link should appear as below in your machine
 48 file:                                              48 file:
 49 ::                                                 49 ::
 50                                                    50 
 51  /*                                                51  /*
 52   * this pcm stream only supports 24 bit, 2 ch     52   * this pcm stream only supports 24 bit, 2 channel and
 53   * 48k sampling rate.                             53   * 48k sampling rate.
 54   */                                               54   */
 55  static const struct snd_soc_pcm_stream dsp_co     55  static const struct snd_soc_pcm_stream dsp_codec_params = {
 56         .formats = SNDRV_PCM_FMTBIT_S24_LE,        56         .formats = SNDRV_PCM_FMTBIT_S24_LE,
 57         .rate_min = 48000,                         57         .rate_min = 48000,
 58         .rate_max = 48000,                         58         .rate_max = 48000,
 59         .channels_min = 2,                         59         .channels_min = 2,
 60         .channels_max = 2,                         60         .channels_max = 2,
 61  };                                                61  };
 62                                                    62 
 63  {                                                 63  {
 64     .name = "CPU-DSP",                             64     .name = "CPU-DSP",
 65     .stream_name = "CPU-DSP",                      65     .stream_name = "CPU-DSP",
 66     .cpu_dai_name = "samsung-i2s.0",               66     .cpu_dai_name = "samsung-i2s.0",
 67     .codec_name = "codec-2,                        67     .codec_name = "codec-2,
 68     .codec_dai_name = "codec-2-dai_name",          68     .codec_dai_name = "codec-2-dai_name",
 69     .platform_name = "samsung-i2s.0",              69     .platform_name = "samsung-i2s.0",
 70     .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DA     70     .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
 71             | SND_SOC_DAIFMT_CBM_CFM,              71             | SND_SOC_DAIFMT_CBM_CFM,
 72     .ignore_suspend = 1,                           72     .ignore_suspend = 1,
 73     .c2c_params = &dsp_codec_params,           !!  73     .params = &dsp_codec_params,
 74     .num_c2c_params = 1,                       << 
 75  },                                                74  },
 76  {                                                 75  {
 77     .name = "DSP-CODEC",                           76     .name = "DSP-CODEC",
 78     .stream_name = "DSP-CODEC",                    77     .stream_name = "DSP-CODEC",
 79     .cpu_dai_name = "wm0010-sdi2",                 78     .cpu_dai_name = "wm0010-sdi2",
 80     .codec_name = "codec-3,                        79     .codec_name = "codec-3,
 81     .codec_dai_name = "codec-3-dai_name",          80     .codec_dai_name = "codec-3-dai_name",
 82     .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DA     81     .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
 83             | SND_SOC_DAIFMT_CBM_CFM,              82             | SND_SOC_DAIFMT_CBM_CFM,
 84     .ignore_suspend = 1,                           83     .ignore_suspend = 1,
 85     .c2c_params = &dsp_codec_params,           !!  84     .params = &dsp_codec_params,
 86     .num_c2c_params = 1,                       << 
 87  },                                                85  },
 88                                                    86 
 89 Above code snippet is motivated from sound/soc     87 Above code snippet is motivated from sound/soc/samsung/speyside.c.
 90                                                    88 
 91 Note the "c2c_params" callback which lets the  !!  89 Note the "params" callback which lets the dapm know that this
 92 dai_link is a codec to codec connection.           90 dai_link is a codec to codec connection.
 93                                                    91 
 94 In dapm core a route is created between cpu_da     92 In dapm core a route is created between cpu_dai playback widget
 95 and codec_dai capture widget for playback path     93 and codec_dai capture widget for playback path and vice-versa is
 96 true for capture path. In order for this afore     94 true for capture path. In order for this aforementioned route to get
 97 triggered, DAPM needs to find a valid endpoint     95 triggered, DAPM needs to find a valid endpoint which could be either
 98 a sink or source widget corresponding to playb     96 a sink or source widget corresponding to playback and capture path
 99 respectively.                                      97 respectively.
100                                                    98 
101 In order to trigger this dai_link widget, a th     99 In order to trigger this dai_link widget, a thin codec driver for
102 the speaker amp can be created as demonstrated    100 the speaker amp can be created as demonstrated in wm8727.c file, it
103 sets appropriate constraints for the device ev    101 sets appropriate constraints for the device even if it needs no control.
104                                                   102 
105 Make sure to name your corresponding cpu and c    103 Make sure to name your corresponding cpu and codec playback and capture
106 dai names ending with "Playback" and "Capture"    104 dai names ending with "Playback" and "Capture" respectively as dapm core
107 will link and power those dais based on the na    105 will link and power those dais based on the name.
108                                                   106 
109 A dai_link in a "simple-audio-card" will autom    107 A dai_link in a "simple-audio-card" will automatically be detected as
110 codec to codec when all DAIs on the link belon    108 codec to codec when all DAIs on the link belong to codec components.
111 The dai_link will be initialized with the subs    109 The dai_link will be initialized with the subset of stream parameters
112 (channels, format, sample rate) supported by a    110 (channels, format, sample rate) supported by all DAIs on the link. Since
113 there is no way to provide these parameters in    111 there is no way to provide these parameters in the device tree, this is
114 mostly useful for communication with simple fi    112 mostly useful for communication with simple fixed-function codecs, such
115 as a Bluetooth controller or cellular modem.      113 as a Bluetooth controller or cellular modem.
                                                      

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php