[alsa-devel] DPCM: BE to BE cpu DAIs question
Hi, Our platform use ASoC structure. Currently, we want to refactor our driver to use DPCM structure. I followed the documentation of DPCM, but have some trouble implementing hostless BE to BE dai links.
My question is: 1. Is there any code example for this(hostless BE to BE)? Since I didn't see any existing code on linux kernel. 2. From documentation, i have to assgin a snd_soc_pcm_stream for BE dais. It seems that the BE<->BE dai links can only support one spec (format/rates/ch). Or am i getting it wrong, does it support dynamically change of the spec?
Thanks in advanced!
-------------------------------------------------------------------------------------- I have tried some implementations, but failed. My linux version is 3.18.
Illustration, PCM -----------------> BE1 ↑ -------< BE2
Code snippet,
static const struct snd_soc_dapm_route machine_routes[] = { {BE1_PLAYBACK_CPU_DAI_STNAME, NULL, FE_STNAME}, {BE1_PLAYBACK_CPU_DAI_STNAME, NULL, BE2_CAPTURE_CPU_DAI_STNAME}, };
static const struct snd_soc_pcm_stream dai_params = { .formats = SNDRV_PCM_FMTBIT_S32_LE, .rate_min = 48000, .rate_max = 48000, .channels_min = 2, .channels_max = 2, };
static struct snd_soc_dai_link mt_soc_dai_common[] = { { .name = FE_PCM, .stream_name = FE_STNAME, .cpu_dai_name = FE_CPUDAINAME, // cannot use dummy!!!! .platform_name = FE_PCMNAME, .codec_name = "snd-soc-dummy", .codec_dai_name = "snd-soc-dummy-dai", .init = mt_soc_audio_init3, .ops = &kc_snd_soc_ops, .dynamic = 1, .dpcm_playback = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, }, /* BE DAIs */ { .name = "BE2", .cpu_dai_name = BE2_PLAYBACK_CPU_DAI, //"snd-soc-dummy-dai", .platform_name = "snd-soc-dummy", .codec_name = "snd-soc-dummy", .codec_dai_name = "snd-soc-dummy-dai", .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS, .no_pcm = 1, .dpcm_playback = 1, .dpcm_capture = 1, .ignore_suspend = 1, .ignore_pmdown_time = 1, .params = &dai_params, }, { .name = BE1_PLAYBACK, .cpu_dai_name = BE1_PLAYBACK_CPU_DAI, .platform_name = "snd-soc-dummy", .codec_name = "snd-soc-dummy", .codec_dai_name = "snd-soc-dummy-dai", .no_pcm = 1, .dpcm_playback = 1, .dpcm_capture = 1, .ignore_suspend = 1, .ignore_pmdown_time = 1, .params = &dai_params, },
1. when only routes PCM-->BE1, If i add .params in BE1 soc dai link, when i start PCM, it will crash. and get "Unable to handle kernel NULL pointer dereference at virtual address 000000d0" Seems to crash in dpcm_be_dai_startup() If i removed .params, it will not crash, and play normally.
2. when only with BE2--> BE1, BE2 is never trigger, where did i get wrong?
Thanks.
************* Email Confidentiality Notice ******************** The information contained in this e-mail message (including any attachments) may be confidential, proprietary, privileged, or otherwise exempt from disclosure under applicable laws. It is intended to be conveyed only to the designated recipient(s). Any use, dissemination, distribution, printing, retaining or copying of this e-mail (including its attachments) by unintended recipient(s) is strictly prohibited and may be unlawful. If you are not an intended recipient of this e-mail, or believe that you have received this e-mail in error, please notify the sender immediately (by replying to this e-mail), delete any and all copies of this e-mail (including any attachments) from your system, and do not disclose the content of this e-mail to any other person. Thank you!
On Fri, 2015-06-26 at 10:16 +0800, srv_kaichieh.chaung wrote:
Hi, Our platform use ASoC structure. Currently, we want to refactor our driver to use DPCM structure. I followed the documentation of DPCM, but have some trouble implementing hostless BE to BE dai links.
My question is:
- Is there any code example for this(hostless BE to BE)?
Since I didn't see any existing code on linux kernel.
I think Vinod has some example code, I dont know if it's upstream yet but it's part of the Skylake driver. The hostless BE to BE link is really just a codec <-> codec link defined in the DAPM graph. Iirc, there are examples of codec <->codec style links upstream in the Samsung directory.
- From documentation, i have to assgin a snd_soc_pcm_stream for BE
dais. It seems that the BE<->BE dai links can only support one spec (format/rates/ch). Or am i getting it wrong, does it support dynamically change of the spec?
The BE link can run at any rate/format you need depending on your use case. It can dynamically change too between use cases. The fixup callback is used to change the BE config, so it can check any requirements every time it is called and configure the BE accordingly.
Thanks in advanced!
I have tried some implementations, but failed. My linux version is 3.18.
Illustration, PCM -----------------> BE1 ↑ -------< BE2
Code snippet,
static const struct snd_soc_dapm_route machine_routes[] = { {BE1_PLAYBACK_CPU_DAI_STNAME, NULL, FE_STNAME}, {BE1_PLAYBACK_CPU_DAI_STNAME, NULL, BE2_CAPTURE_CPU_DAI_STNAME}, };
static const struct snd_soc_pcm_stream dai_params = { .formats = SNDRV_PCM_FMTBIT_S32_LE, .rate_min = 48000, .rate_max = 48000, .channels_min = 2, .channels_max = 2, };
static struct snd_soc_dai_link mt_soc_dai_common[] = { { .name = FE_PCM, .stream_name = FE_STNAME, .cpu_dai_name = FE_CPUDAINAME, // cannot use dummy!!!! .platform_name = FE_PCMNAME, .codec_name = "snd-soc-dummy", .codec_dai_name = "snd-soc-dummy-dai", .init = mt_soc_audio_init3, .ops = &kc_snd_soc_ops, .dynamic = 1, .dpcm_playback = 1, .trigger = {SND_SOC_DPCM_TRIGGER_POST, SND_SOC_DPCM_TRIGGER_POST}, }, /* BE DAIs */ { .name = "BE2", .cpu_dai_name = BE2_PLAYBACK_CPU_DAI, //"snd-soc-dummy-dai", .platform_name = "snd-soc-dummy", .codec_name = "snd-soc-dummy", .codec_dai_name = "snd-soc-dummy-dai", .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF | SND_SOC_DAIFMT_CBS_CFS, .no_pcm = 1, .dpcm_playback = 1, .dpcm_capture = 1, .ignore_suspend = 1, .ignore_pmdown_time = 1, .params = &dai_params, }, { .name = BE1_PLAYBACK, .cpu_dai_name = BE1_PLAYBACK_CPU_DAI, .platform_name = "snd-soc-dummy", .codec_name = "snd-soc-dummy", .codec_dai_name = "snd-soc-dummy-dai", .no_pcm = 1, .dpcm_playback = 1, .dpcm_capture = 1, .ignore_suspend = 1, .ignore_pmdown_time = 1, .params = &dai_params, },
- when only routes PCM-->BE1, If i add .params in BE1 soc dai link, when i start PCM, it will
crash. and get "Unable to handle kernel NULL pointer dereference at virtual address 000000d0" Seems to crash in dpcm_be_dai_startup()
It should not crash. Can you update to the latest kernel and send the oops message if it still crashes.
If i removed .params, it will not crash, and play normally.
- when only with BE2--> BE1, BE2 is never trigger, where did i get wrong?
You need to add the "codec <-> codec" style link here. The code above only supports
PCM <---+---> BE1 | +---> BE2
but BE1/2 cannot initiate the link (they can be seen as slaves) unless BE1/2 are also linked via codec<->codec style (and are driven by DAPM to initiate the link).
Liam
Thanks.
************* Email Confidentiality Notice ******************** The information contained in this e-mail message (including any attachments) may be confidential, proprietary, privileged, or otherwise exempt from disclosure under applicable laws. It is intended to be conveyed only to the designated recipient(s). Any use, dissemination, distribution, printing, retaining or copying of this e-mail (including its attachments) by unintended recipient(s) is strictly prohibited and may be unlawful. If you are not an intended recipient of this e-mail, or believe that you have received this e-mail in error, please notify the sender immediately (by replying to this e-mail), delete any and all copies of this e-mail (including any attachments) from your system, and do not disclose the content of this e-mail to any other person. Thank you!
participants (2)
-
Liam Girdwood
-
srv_kaichieh.chaung