From patchwork Wed Aug 16 14:47:53 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Donglin Peng X-Patchwork-Id: 9903935 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 26EE860231 for ; Wed, 16 Aug 2017 14:48:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17704289EA for ; Wed, 16 Aug 2017 14:48:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0C17A28A0F; Wed, 16 Aug 2017 14:48:13 +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 BF88F289EA for ; Wed, 16 Aug 2017 14:48:11 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id A8CD4266ED5; Wed, 16 Aug 2017 16:48:07 +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 6A815266EDD; Wed, 16 Aug 2017 16:48:06 +0200 (CEST) Received: from mail-pf0-f195.google.com (mail-pf0-f195.google.com [209.85.192.195]) by alsa0.perex.cz (Postfix) with ESMTP id 24A7F266B1C for ; Wed, 16 Aug 2017 16:48:00 +0200 (CEST) Received: by mail-pf0-f195.google.com with SMTP id t83so1555900pfj.3 for ; Wed, 16 Aug 2017 07:48:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=U27b7KW7bYKaLxCEVP8gFgTuPT4C38GVb10EJSRTiFY=; b=eY712hfuVW3WuGQqplVJtJ1G6rCbbz47xRzC+DsHnEtjlo1J5xyPxPU5fFxAYojVe9 cH4BxpmOQ09/lvNNXi5itYsSiZHPxDH7Tr7TVMKrlb7bppykBLWCj9Z7HokzgCJvU+4U /dz8DSxK1QwePdWbaG2RWcI4u6P99Sq2SVytzNWEa/ePwsiFnSpAOkZ4QWbbCf5Ln6Vf l7YaZrG18B+N5AjIIDjt/JjpuoM1wai4C1yCJZq4+uKUBqfpbYNpemXxPKliNwJ2JyT9 tzG8n7QnXwdtFMFo555po8Rya2j+5mq7JE6sz7nMb9oX0Yyc+2M4JYkHItkKzPpGYfF/ eYFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=U27b7KW7bYKaLxCEVP8gFgTuPT4C38GVb10EJSRTiFY=; b=thkA7kx2L+HvFlI+qhJKmlVIr0+V1Wk/ofFfs29qmGHtGjVPe3TOqLf52X0qm+cI2U 1mZYp80Ngi14Os7ByN/KZKVoC6qCJIUCpwaK4NlkicnLhdI/W60EE846o45fkXgZbsJf MXamPjMAh9c5yUSm7G05dIchQTK2xGZcthd5ZLALsqmdMdw1MiuVngnbdXMB6zXwJmCB EjdEBsAJ+ZusG6VlW0N1lX0KnW3P7QDsdZ/JnP8ev+zdizhxBkuADgK+QL1Ukv2Y5Qke awUQ1ij+GSWKJr06/Blqp8KRI2P5/RR25N+DQUKSINq8KU8UXNlvp1HyDfvp0KgmeKnQ yGxw== X-Gm-Message-State: AHYfb5htVEpxw6PmLX4Vcq+IeaO2P4svxoQ/je5XI9kOUSOE7UI7yEJM xGUsV1+jFe7Ivw== X-Received: by 10.84.229.136 with SMTP id c8mr2222854plk.27.1502894879198; Wed, 16 Aug 2017 07:47:59 -0700 (PDT) Received: from localhost ([114.240.120.141]) by smtp.gmail.com with ESMTPSA id u67sm3246588pfd.164.2017.08.16.07.47.57 (version=TLS1_2 cipher=AES128-SHA bits=128/128); Wed, 16 Aug 2017 07:47:58 -0700 (PDT) From: Peng Donglin To: broonie@kernel.org, liam.r.girdwood@linux.intel.com, rf@opensource.wolfsonmicro.com, pierre-louis.bossart@linux.intel.com, vinod.koul@intel.com Date: Wed, 16 Aug 2017 22:47:53 +0800 Message-Id: <1502894873-15063-1-git-send-email-dolinux.peng@gmail.com> X-Mailer: git-send-email 1.9.1 Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Peng Donglin 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: , MIME-Version: 1.0 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: Peng Donglin --- sound/soc/soc-compress.c | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index 206f36b..b6a0714 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; if (codec_dai->driver->capture.channels_min) @@ -758,7 +755,7 @@ int snd_soc_new_compress(struct snd_soc_pcm_runtime *rtd, int num) return -EINVAL; } - if(playback) + if (playback) direction = SND_COMPRESS_PLAYBACK; else direction = SND_COMPRESS_CAPTURE; @@ -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_STREAM_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->copy) 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) {