From patchwork Tue Aug 8 02:59:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Donglin Peng X-Patchwork-Id: 9888401 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 D7DDF601EB for ; Tue, 8 Aug 2017 14:22:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C78DB2892A for ; Tue, 8 Aug 2017 14:22:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B9E4928915; Tue, 8 Aug 2017 14:22:54 +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 F28F928915 for ; Tue, 8 Aug 2017 14:22:53 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 55F9F2673A7; Tue, 8 Aug 2017 16:22:22 +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 D1857267359; Tue, 8 Aug 2017 04:59:28 +0200 (CEST) Received: from mail-qk0-f194.google.com (mail-qk0-f194.google.com [209.85.220.194]) by alsa0.perex.cz (Postfix) with ESMTP id D49CB2664EB for ; Tue, 8 Aug 2017 04:59:25 +0200 (CEST) Received: by mail-qk0-f194.google.com with SMTP id d136so2157064qkg.3 for ; Mon, 07 Aug 2017 19:59:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=YDa/JmMjLTEX4qdEvctfRe3036voOXzPjbUd5mm6wPY=; b=qhaYFf7anUHHofhY1VzR9T97kNexT5n/URigzC01zKqda+iDdJLUIYU36ASsEnR79B niYXblIazABb+H7GO4WRG3/VxThYkjptIYr7UxKKwylnqwjR6JMYGiyNJxtVgv3xKp1Z 8A5CGju/F6SH5XVMPcbnAqjBf1/ds33SJ24srNfkBD+Qsx/XPVN2ITk4cpKqZPLISj9B d145Kq32zudlR/CarZjiPJWp8r5bv0msUMPmGmjEAf1e9MEX3DKFwvOd0tWXRdXpBt8J H9+/1SOddg9fKfbotynsfzLP/8BgMcB+p77t8BvB/vNt1E7YgADtSWNPeLH5Mty/UFYJ hyCQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=YDa/JmMjLTEX4qdEvctfRe3036voOXzPjbUd5mm6wPY=; b=fQFEuGC/ZzjFzelRH/7xOd1VWrT1vsG19yxW9dVgQDG55UntXyySO2VGUiKD97Kv9t PhHZ+7V+jh0YKTClp7QMJCZj6foF2Zd9TT1joZtYvX4DqsESyKWsF4SSRDhnA/H+O1j5 4ooEZl2n/xhQipsxiyQAtpQeje7TI4dEVbDKmBUfc+PibslL/5Y58aJxJPqDsEEWLbWr PanMjE/ZuVv7bUTDUlfOiIRiRZReuDxZyjhu+Celw9tEJnwDCg1DRAC4Dx9+xc6d3vKr Scnpn8Lv3m+52ndGo7BvT6lgQQ6puZuiLs6yiwPb81cCZlgf/+yN2jXixiFcYtznjkGd xQkA== X-Gm-Message-State: AHYfb5iVjd2fY+/x6gnCTWLjuGmTWTlMyVuw3vo0A64lJDW3Rh9EMLgv e91+QgxI7SxdKMWMgIXF/qVpTKp6fg== X-Received: by 10.55.77.194 with SMTP id a185mr3338154qkb.338.1502161163935; Mon, 07 Aug 2017 19:59:23 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.210.186 with HTTP; Mon, 7 Aug 2017 19:59:23 -0700 (PDT) In-Reply-To: <20170808025110.11351-1-pengdonglin137@163.com> References: <20170808025110.11351-1-pengdonglin137@163.com> From: Donglin Peng Date: Tue, 8 Aug 2017 10:59:23 +0800 Message-ID: To: broonie@kernel.org, liam.r.girdwood@linux.intel.com, Richard Fitzgerald , Pierre-Louis Bossart X-Mailman-Approved-At: Tue, 08 Aug 2017 16:22:18 +0200 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: [alsa-devel] [PATCH] ASoC: compress: Set reasonable compress id string 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 For dynamic compress rtd, the codec_dai may not have any actual meaning(like snd-soc-dummy-dai), so compress id can just use the value of dai_link->stream_name. But for others, its codec_dai has actual meaning, so compress id can include codec_dai name. Signed-off-by: pengdonglin --- sound/soc/soc-compress.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) if (codec_dai->driver->capture.channels_min) @@ -797,19 +794,18 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) else if (rtd->dai_link->dpcm_capture) be_pcm->streams[SNDRV_PCM_STRE AM_CAPTURE].substream->private_data = rtd; memcpy(compr->ops, &soc_compr_dyn_ops, sizeof(soc_compr_dyn_ops)); - } else + } else { + snprintf(new_name, sizeof(new_name), "%s %s-%d", + rtd->dai_link->stream_name, codec_dai->name, num); + memcpy(compr->ops, &soc_compr_ops, sizeof(soc_compr_ops)); + } /* Add copy callback for not memory mapped DSPs */ if (platform->driver->compr_ops && platform->driver->compr_ops->c opy) compr->ops->copy = soc_compr_copy; mutex_init(&compr->lock); - - snprintf(new_name, sizeof(new_name), "%s %s-%d", - rtd->dai_link->stream_name, - rtd->codec_dai->name, num); - ret = snd_compress_new(rtd->card->snd_card, num, direction, new_name, compr); if (ret < 0) { -- 2.11.0 diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index 206f36bf43e8..589d6412c9f0 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c @@ -737,9 +737,6 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) } /* check client and interface hw capabilities */ - snprintf(new_name, sizeof(new_name), "%s %s-%d", - rtd->dai_link->stream_name, codec_dai->name, num); - if (codec_dai->driver->playback.channels_min) playback = 1;