1 ==============================================
2 Creating codec to codec dai link for ALSA dapm
3 ==============================================
5 Mostly the flow of audio is always from CPU to codec so your system
15 In case your system looks as below:
40 Suppose codec-2 is a bluetooth chip and codec-3 is connected to
41 a speaker and you have a below scenario:
42 codec-2 will receive the audio data and the user wants to play that
43 audio through codec-3 without involving the CPU.This
44 aforementioned case is the ideal case when codec to codec
45 connection should be used.
47 Your dai_link should appear as below in your machine
52 * this pcm stream only supports 24 bit, 2 channel and
55 static const struct snd_soc_pcm_stream dsp_codec_params = {
56 .formats = SNDRV_PCM_FMTBIT_S24_LE,
65 .stream_name = "CPU-DSP",
66 .cpu_dai_name = "samsung-i2s.0",
67 .codec_name = "codec-2,
68 .codec_dai_name = "codec-2-dai_name",
69 .platform_name = "samsung-i2s.0",
70 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
71 | SND_SOC_DAIFMT_CBM_CFM,
73 .params = &dsp_codec_params,
77 .stream_name = "DSP-CODEC",
78 .cpu_dai_name = "wm0010-sdi2",
79 .codec_name = "codec-3,
80 .codec_dai_name = "codec-3-dai_name",
81 .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF
82 | SND_SOC_DAIFMT_CBM_CFM,
84 .params = &dsp_codec_params,
87 Above code snippet is motivated from sound/soc/samsung/speyside.c.
89 Note the "params" callback which lets the dapm know that this
90 dai_link is a codec to codec connection.
92 In dapm core a route is created between cpu_dai playback widget
93 and codec_dai capture widget for playback path and vice-versa is
94 true for capture path. In order for this aforementioned route to get
95 triggered, DAPM needs to find a valid endpoint which could be either
96 a sink or source widget corresponding to playback and capture path
99 In order to trigger this dai_link widget, a thin codec driver for
100 the speaker amp can be created as demonstrated in wm8727.c file, it
101 sets appropriate constraints for the device even if it needs no control.
103 Make sure to name your corresponding cpu and codec playback and capture
104 dai names ending with "Playback" and "Capture" respectively as dapm core
105 will link and power those dais based on the name.
107 Note that in current device tree there is no way to mark a dai_link
108 as codec to codec. However, it may change in future.