diff options
author | Takashi Iwai <tiwai@suse.de> | 2016-11-11 11:34:57 -0500 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2016-11-11 11:34:57 -0500 |
commit | 76228a2b541daebcc8f6d5d7dd65bdea90d173f1 (patch) | |
tree | f1df9b7b63b39282d52cafc5988513853ce465e9 /Documentation/sound | |
parent | 40433cd34e280bd1a56f54a3898e86863814c824 (diff) | |
parent | 452a256898e7ca88115aa02d3851e67994ce3e19 (diff) |
Merge branch 'topic/doc' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into topic/restize-docs
Diffstat (limited to 'Documentation/sound')
-rw-r--r-- | Documentation/sound/alsa/soc/codec_to_codec.txt | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/Documentation/sound/alsa/soc/codec_to_codec.txt b/Documentation/sound/alsa/soc/codec_to_codec.txt new file mode 100644 index 000000000000..704a6483652c --- /dev/null +++ b/Documentation/sound/alsa/soc/codec_to_codec.txt | |||
@@ -0,0 +1,103 @@ | |||
1 | Creating codec to codec dai link for ALSA dapm | ||
2 | =================================================== | ||
3 | |||
4 | Mostly the flow of audio is always from CPU to codec so your system | ||
5 | will look as below: | ||
6 | |||
7 | --------- --------- | ||
8 | | | dai | | | ||
9 | CPU -------> codec | ||
10 | | | | | | ||
11 | --------- --------- | ||
12 | |||
13 | In case your system looks as below: | ||
14 | --------- | ||
15 | | | | ||
16 | codec-2 | ||
17 | | | | ||
18 | --------- | ||
19 | | | ||
20 | dai-2 | ||
21 | | | ||
22 | ---------- --------- | ||
23 | | | dai-1 | | | ||
24 | CPU -------> codec-1 | ||
25 | | | | | | ||
26 | ---------- --------- | ||
27 | | | ||
28 | dai-3 | ||
29 | | | ||
30 | --------- | ||
31 | | | | ||
32 | codec-3 | ||
33 | | | | ||
34 | --------- | ||
35 | |||
36 | Suppose codec-2 is a bluetooth chip and codec-3 is connected to | ||
37 | a speaker and you have a below scenario: | ||
38 | codec-2 will receive the audio data and the user wants to play that | ||
39 | audio through codec-3 without involving the CPU.This | ||
40 | aforementioned case is the ideal case when codec to codec | ||
41 | connection should be used. | ||
42 | |||
43 | Your dai_link should appear as below in your machine | ||
44 | file: | ||
45 | |||
46 | /* | ||
47 | * this pcm stream only supports 24 bit, 2 channel and | ||
48 | * 48k sampling rate. | ||
49 | */ | ||
50 | static const struct snd_soc_pcm_stream dsp_codec_params = { | ||
51 | .formats = SNDRV_PCM_FMTBIT_S24_LE, | ||
52 | .rate_min = 48000, | ||
53 | .rate_max = 48000, | ||
54 | .channels_min = 2, | ||
55 | .channels_max = 2, | ||
56 | }; | ||
57 | |||
58 | { | ||
59 | .name = "CPU-DSP", | ||
60 | .stream_name = "CPU-DSP", | ||
61 | .cpu_dai_name = "samsung-i2s.0", | ||
62 | .codec_name = "codec-2, | ||
63 | .codec_dai_name = "codec-2-dai_name", | ||
64 | .platform_name = "samsung-i2s.0", | ||
65 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ||
66 | | SND_SOC_DAIFMT_CBM_CFM, | ||
67 | .ignore_suspend = 1, | ||
68 | .params = &dsp_codec_params, | ||
69 | }, | ||
70 | { | ||
71 | .name = "DSP-CODEC", | ||
72 | .stream_name = "DSP-CODEC", | ||
73 | .cpu_dai_name = "wm0010-sdi2", | ||
74 | .codec_name = "codec-3, | ||
75 | .codec_dai_name = "codec-3-dai_name", | ||
76 | .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | ||
77 | | SND_SOC_DAIFMT_CBM_CFM, | ||
78 | .ignore_suspend = 1, | ||
79 | .params = &dsp_codec_params, | ||
80 | }, | ||
81 | |||
82 | Above code snippet is motivated from sound/soc/samsung/speyside.c. | ||
83 | |||
84 | Note the "params" callback which lets the dapm know that this | ||
85 | dai_link is a codec to codec connection. | ||
86 | |||
87 | In dapm core a route is created between cpu_dai playback widget | ||
88 | and codec_dai capture widget for playback path and vice-versa is | ||
89 | true for capture path. In order for this aforementioned route to get | ||
90 | triggered, DAPM needs to find a valid endpoint which could be either | ||
91 | a sink or source widget corresponding to playback and capture path | ||
92 | respectively. | ||
93 | |||
94 | In order to trigger this dai_link widget, a thin codec driver for | ||
95 | the speaker amp can be created as demonstrated in wm8727.c file, it | ||
96 | sets appropriate constraints for the device even if it needs no control. | ||
97 | |||
98 | Make sure to name your corresponding cpu and codec playback and capture | ||
99 | dai names ending with "Playback" and "Capture" respectively as dapm core | ||
100 | will link and power those dais based on the name. | ||
101 | |||
102 | Note that in current device tree there is no way to mark a dai_link | ||
103 | as codec to codec. However, it may change in future. | ||