From patchwork Mon Oct 24 04:03:53 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anish Kumar X-Patchwork-Id: 9391339 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 51CB46077A for ; Mon, 24 Oct 2016 04:06:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3E0C6289FB for ; Mon, 24 Oct 2016 04:06:40 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3050828C17; Mon, 24 Oct 2016 04:06:40 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.3 required=2.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED,FREEMAIL_FROM,RCVD_IN_DNSWL_NONE,RCVD_IN_SORBS_SPAM, T_DKIM_INVALID autolearn=no version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 45094289FB for ; Mon, 24 Oct 2016 04:06:38 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id F37A326681E; Mon, 24 Oct 2016 06:06:35 +0200 (CEST) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 144F926673A; Mon, 24 Oct 2016 06:04:11 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id D04362667A5; Mon, 24 Oct 2016 06:04:01 +0200 (CEST) Received: from mail-ua0-f194.google.com (mail-ua0-f194.google.com [209.85.217.194]) by alsa0.perex.cz (Postfix) with ESMTP id B503F2666F4 for ; Mon, 24 Oct 2016 06:03:55 +0200 (CEST) Received: by mail-ua0-f194.google.com with SMTP id 90so83156uan.3 for ; Sun, 23 Oct 2016 21:03:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=Gl33Sb79Boll+QLrAgBRitE7FYlE5/o1Xcwzz2c8fpQ=; b=dKxei0l4ihtgVGpzPve+OB8qlyWyq4Cp/Lkqn/59xVzLcxD8aO5bJXalMwrVUdpKac R8rcyhqo9ASzZmC7EmEk/tmAfJBBzFWy4syQIfQi8uGV0tosweqTFnkiEgCkTLFhj/+O QmC2GXvlnGsIK64yzRuxkZqOqujxHvd4kn/3NKj6ptzZXY5yrds5HFz6PI0eWLfPPRBV Zj242JsqfR0ErY7yC9nlk/zGVqOWHbnfjWp3kqlZT2O5ZxEOEDgJF6ZdDXejAVpHlRKY fjgS/ZissNE1bs/IgoU2Tdn6lpKYXS/nkC/KI/kn8t/s916Hf1vYkJsKx7URbs1jcqR4 NF+g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=Gl33Sb79Boll+QLrAgBRitE7FYlE5/o1Xcwzz2c8fpQ=; b=lz6tFrPc6lmCj9DzjYVkiWAQZ8cUiBQmuJIKcuMwdp+zY8GufHVUij9Tt1pe/s9B01 kLAfLmV7TUtC5MWrKcAH8faipgdxn+P4zEYZN8WmY0goZFNKVFFL9qiMzyHUsCWfyc+k zYUM3e0aurxZ0HIP8nJ0Jq1vXMGyzmnWkH1GGKzd1/4F1DgBrZQ3u2Yf4LaCAI5rq1u/ h6mR3jiRd3LhUghRkUTkEXrrj6/B+A4wY73rErB5tCNF++mCep7S8sFCn4CDMTl+TqoU F5Cp0sI1/haJWavD+0TMhsgm//S2Gq2v3N4H86W33awcMF55AciPZ4ImzVpm9XKzq0IH bfjg== X-Gm-Message-State: ABUngvclQXKrZ50X5wbqgRyuuuRGA8jm8l9htaNodC/FhmexICmeI725ADH2BAtoQscmScl1eG7TlVmRJw2ROw== X-Received: by 10.176.4.53 with SMTP id 50mr6725114uav.81.1477281833944; Sun, 23 Oct 2016 21:03:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.103.121.216 with HTTP; Sun, 23 Oct 2016 21:03:53 -0700 (PDT) In-Reply-To: <20161020094407.GL3207@localhost.localdomain> References: <20161020094407.GL3207@localhost.localdomain> From: anish kumar Date: Sun, 23 Oct 2016 21:03:53 -0700 Message-ID: To: Charles Keepax Cc: Liam Girdwood , Linux-ALSA , "broonie@kernel.org" , tiwai@suse.com Subject: [alsa-devel] [PATCH] Codec to codec dai link description X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP Signed-off-by: anish kumar Acked-by: Charles Keepax --- Documentation/sound/alsa/soc/codec_to_codec.txt | 103 ++++++++++++++++++++++++ 1 file changed, 103 insertions(+) create mode 100644 Documentation/sound/alsa/soc/codec_to_codec.txt 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 0000000..61c9cae --- /dev/null +++ b/Documentation/sound/alsa/soc/codec_to_codec.txt @@ -0,0 +1,103 @@ +Creating codec to codec dai link for ALSA dapm +=================================================== + +Mostly the flow of audio is always from CPU to codec so your system +will look as below: + + --------- --------- +| | dai | | + CPU -------> codec +| | | | + --------- --------- + +In case your system looks as below: + --------- + | | + codec-2 + | | + --------- + | + dai-2 + | + ---------- --------- +| | dai-1 | | + CPU -------> codec-1 +| | | | + ---------- --------- + | + dai-3 + | + --------- + | | + codec-3 + | | + --------- + +Suppose codec-2 is a bluetooth chip and codec-3 is connected to +a speaker and you have a below scenario: +codec-2 will receive the audio data and the user wants to play that +audio through codec-3 without involving the CPU.This +aforementioned case is the ideal case when codec to codec +connection should be used. + +Your dai_link should appear as below in your machine +file: + +/* + * this pcm stream only supports 24 bit, 2 channel and + * 48k sampling rate. + */ +static const struct snd_soc_pcm_stream dsp_codec_params = { + .formats = SNDRV_PCM_FMTBIT_S24_LE, + .rate_min = 48000, + .rate_max = 48000, + .channels_min = 2, + .channels_max = 2, +}; + +{ + .name = "CPU-DSP", + .stream_name = "CPU-DSP", + .cpu_dai_name = "samsung-i2s.0", + .codec_name = "codec-2, + .codec_dai_name = "codec-2-dai_name", + .platform_name = "samsung-i2s.0", + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF + | SND_SOC_DAIFMT_CBM_CFM, + .ignore_suspend = 1, + .params = &dsp_codec_params, +}, +{ + .name = "DSP-CODEC", + .stream_name = "DSP-CODEC", + .cpu_dai_name = "wm0010-sdi2", + .codec_name = "codec-3, + .codec_dai_name = "codec-3-dai_name", + .dai_fmt = SND_SOC_DAIFMT_I2S | SND_SOC_DAIFMT_NB_NF + | SND_SOC_DAIFMT_CBM_CFM, + .ignore_suspend = 1, + .params = &dsp_codec_params, +}, + +Above code snippet is motivated from sound/soc/samsung/speyside.c. + +Note the "params" callback which lets the dapm know that this +dai_link is a codec to codec connection. + +In dapm core a route is created between cpu_dai playback widget +and codec_dai capture widget for playback path and vice-versa is +true for capture path. In order for this aforementioned route to get +triggered, DAPM needs to find a valid endpoint which could be either +a sink or source widget corresponding to playback and capture path +respectively. + +In order to trigger this dai_link widget, a thin codec driver for +the speaker amp can be created as demonstrated in wm8727.c file, it +sets appropriate constraints for the device even if it needs no control. + +Make sure to name your corresponding cpu and codec playback and capture +dai names ending with "Playback" and "Capture" respectively as dapm core +will link and power those dais based on the name. + +Note that in current device tree there is no way to mark a dai_link +as codec to codec. However, it may change in future.