From patchwork Tue Aug 8 03:31:21 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Donglin Peng X-Patchwork-Id: 9888403 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 AB87D601EB for ; Tue, 8 Aug 2017 14:23:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9D56928918 for ; Tue, 8 Aug 2017 14:23:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 922AD289BF; Tue, 8 Aug 2017 14:23:12 +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 F340228918 for ; Tue, 8 Aug 2017 14:23:11 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id E14C02673B9; 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 E4AA626736B; Tue, 8 Aug 2017 05:31:26 +0200 (CEST) Received: from mail-qk0-f195.google.com (mail-qk0-f195.google.com [209.85.220.195]) by alsa0.perex.cz (Postfix) with ESMTP id D6FE4267352 for ; Tue, 8 Aug 2017 05:31:22 +0200 (CEST) Received: by mail-qk0-f195.google.com with SMTP id d136so2197879qkg.3 for ; Mon, 07 Aug 2017 20:31:22 -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=0RrExDyvNqDJv+hMiibHvlLiUvjfFSgkf4PE95H2YVE=; b=KCUqtz+Xlfmh/KHzCPxO8I1z/kwA/Cp7gdv5Y0HzqSskWp1+ANutxPSSnc/F8yWVIs 2+4LoKKg6J+vtDVdkAIFeY5rPTVZhdd3oGGHUXC3guOtS5GI337VJcsi3c08IPj/Oou7 X7HFMCWRthSDzsk7Ona6wfLtqyUVMv3oCgdkVvP2edRw6WdaY0OVZXg4Yo+RuiqvAo3S Qq/kTuOZpSBgjcIPsLDkpqkanYcdVXAaI2/aWlmcLauUzt/iUI7IRXxN++wbCcxdTeyW xkmCFOS6QBLycSONCxOmBYFTq2skN9Xi1ZV15ommh1UW/Z107sbzbvYsfhTKGTYRIbnK EhPQ== 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=0RrExDyvNqDJv+hMiibHvlLiUvjfFSgkf4PE95H2YVE=; b=pG4vbpLAAsMNDuNUfL8xp2zZTjz/uMkzEHulWo5vRlSQJ9HKCMQNtv2WfglbBC2XHt 07NBlumBkakbAa9brfMvCTfufVUfDz+GQpUM4aOwawaRgGOdg591iii2gEkbLuYI66zV oj1YLj6Ic4F8/VhoW287LPncPNxpnEHoBnwHuqXYIWUSoEfzPDw44R/hyxl4McVh+xO0 TZh4gKPx2SY1b1CHRGeMl7GLvH1tb+wH0RMZHr6kLjCRroATPSiAlK5G2da6m76UUt6G bxmSPxM/ORczaLSLDHPxvMYu+tBpSa4oce91v378Aj3FDklFV9x7L3zaXdklxivz8sFb K1JA== X-Gm-Message-State: AHYfb5jiHaJOLS50Z0WWOdbHdbi3BBigDR37ACKM9fdwPpcP/C2Bqk97 DsCkuM0OW02no0PLqBlkZuI/cVENhQ== X-Received: by 10.55.43.160 with SMTP id r32mr3469362qkr.47.1502163081798; Mon, 07 Aug 2017 20:31:21 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.210.186 with HTTP; Mon, 7 Aug 2017 20:31:21 -0700 (PDT) In-Reply-To: <20170808032829.11859-1-pengdonglin137@163.com> References: <20170808032829.11859-1-pengdonglin137@163.com> From: Donglin Peng Date: Tue, 8 Aug 2017 11:31:21 +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 v2] 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 | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) 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_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..b6a071461b10 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;