From patchwork Fri May 22 00:13:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 192621 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 71A8DC433E0 for ; Fri, 22 May 2020 00:15:44 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id E931F2078B for ; Fri, 22 May 2020 00:15:43 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="Wc9QV8bj" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org E931F2078B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 1B0D41867; Fri, 22 May 2020 02:14:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 1B0D41867 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1590106542; bh=UKo60V4Nic9zM3g1FcQNENi+SRkEEHMWHyCi5JnnVqg=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Wc9QV8bjWIszpb8J0SDGJGGxGiZbFZNEkI5LVkmbKGJRBVUmLk6z8HkUUriwZWatI OXsDZLukL0xoY0lNLLtH877rFCyV4S0uA2udLy3B5IaDw3pG0XmYVTMlGnKJ5VDqVR CEjygky6FFgjms/7KF/nbZWhzSUoUUZYMKeMUidE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id C62B0F801F8; Fri, 22 May 2020 02:14:04 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 7839EF80258; Fri, 22 May 2020 02:14:03 +0200 (CEST) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 72D38F801F8 for ; Fri, 22 May 2020 02:13:56 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 72D38F801F8 Date: 22 May 2020 09:13:56 +0900 X-IronPort-AV: E=Sophos;i="5.73,419,1583161200"; d="scan'208";a="47714614" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 22 May 2020 09:13:56 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 10DE540061BC; Fri, 22 May 2020 09:13:56 +0900 (JST) Message-ID: <87imgo4yij.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v3 2/7] ASoC: soc-link: move soc_rtd_xxx() User-Agent: Wanderlust/2.15.9 Emacs/25.2 Mule/6.0 To: Mark Brown In-Reply-To: <87lflk4yk3.wl-kuninori.morimoto.gx@renesas.com> References: <87lflk4yk3.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" From: Kuninori Morimoto dai_link related function should be implemented at soc-link.c. This patch moves soc-pcm soc_rtd_xxx() to soc-link as snd_soc_link_xxx() Signed-off-by: Kuninori Morimoto --- include/sound/soc-link.h | 13 ++++++ sound/soc/soc-link.c | 65 +++++++++++++++++++++++++++++ sound/soc/soc-pcm.c | 88 ++++++---------------------------------- 3 files changed, 91 insertions(+), 75 deletions(-) diff --git a/include/sound/soc-link.h b/include/sound/soc-link.h index 7fc5cead5942..689aa93be78e 100644 --- a/include/sound/soc-link.h +++ b/include/sound/soc-link.h @@ -9,5 +9,18 @@ #define __SOC_LINK_H int snd_soc_link_init(struct snd_soc_pcm_runtime *rtd); +int snd_soc_link_startup(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream); +void snd_soc_link_shutdown(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream); +int snd_soc_link_prepare(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream); +int snd_soc_link_hw_params(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params); +void snd_soc_link_hw_free(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream); +int snd_soc_link_trigger(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream, int cmd); #endif /* __SOC_LINK_H */ diff --git a/sound/soc/soc-link.c b/sound/soc/soc-link.c index bba6f35af0ad..3cb5d1f52e85 100644 --- a/sound/soc/soc-link.c +++ b/sound/soc/soc-link.c @@ -35,3 +35,68 @@ int snd_soc_link_init(struct snd_soc_pcm_runtime *rtd) return soc_link_ret(rtd, ret); } + +int snd_soc_link_startup(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream) +{ + int ret = 0; + + if (rtd->dai_link->ops && + rtd->dai_link->ops->startup) + ret = rtd->dai_link->ops->startup(substream); + + return soc_link_ret(rtd, ret); +} + +void snd_soc_link_shutdown(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream) +{ + if (rtd->dai_link->ops && + rtd->dai_link->ops->shutdown) + rtd->dai_link->ops->shutdown(substream); +} + +int snd_soc_link_prepare(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream) +{ + int ret = 0; + + if (rtd->dai_link->ops && + rtd->dai_link->ops->prepare) + ret = rtd->dai_link->ops->prepare(substream); + + return soc_link_ret(rtd, ret); +} + +int snd_soc_link_hw_params(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream, + struct snd_pcm_hw_params *params) +{ + int ret = 0; + + if (rtd->dai_link->ops && + rtd->dai_link->ops->hw_params) + ret = rtd->dai_link->ops->hw_params(substream, params); + + return soc_link_ret(rtd, ret); +} + +void snd_soc_link_hw_free(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream) +{ + if (rtd->dai_link->ops && + rtd->dai_link->ops->hw_free) + rtd->dai_link->ops->hw_free(substream); +} + +int snd_soc_link_trigger(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_substream *substream, int cmd) +{ + int ret = 0; + + if (rtd->dai_link->ops && + rtd->dai_link->ops->trigger) + ret = rtd->dai_link->ops->trigger(substream, cmd); + + return soc_link_ret(rtd, ret); +} diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index b7899da4217e..f79e2305dcc9 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #define DPCM_MAX_BE_USERS 8 @@ -202,60 +203,6 @@ static inline void dpcm_remove_debugfs_state(struct snd_soc_dpcm *dpcm) } #endif -static int soc_rtd_startup(struct snd_soc_pcm_runtime *rtd, - struct snd_pcm_substream *substream) -{ - if (rtd->dai_link->ops && - rtd->dai_link->ops->startup) - return rtd->dai_link->ops->startup(substream); - return 0; -} - -static void soc_rtd_shutdown(struct snd_soc_pcm_runtime *rtd, - struct snd_pcm_substream *substream) -{ - if (rtd->dai_link->ops && - rtd->dai_link->ops->shutdown) - rtd->dai_link->ops->shutdown(substream); -} - -static int soc_rtd_prepare(struct snd_soc_pcm_runtime *rtd, - struct snd_pcm_substream *substream) -{ - if (rtd->dai_link->ops && - rtd->dai_link->ops->prepare) - return rtd->dai_link->ops->prepare(substream); - return 0; -} - -static int soc_rtd_hw_params(struct snd_soc_pcm_runtime *rtd, - struct snd_pcm_substream *substream, - struct snd_pcm_hw_params *params) -{ - if (rtd->dai_link->ops && - rtd->dai_link->ops->hw_params) - return rtd->dai_link->ops->hw_params(substream, params); - return 0; -} - -static void soc_rtd_hw_free(struct snd_soc_pcm_runtime *rtd, - struct snd_pcm_substream *substream) -{ - if (rtd->dai_link->ops && - rtd->dai_link->ops->hw_free) - rtd->dai_link->ops->hw_free(substream); -} - -static int soc_rtd_trigger(struct snd_soc_pcm_runtime *rtd, - struct snd_pcm_substream *substream, - int cmd) -{ - if (rtd->dai_link->ops && - rtd->dai_link->ops->trigger) - return rtd->dai_link->ops->trigger(substream, cmd); - return 0; -} - /** * snd_soc_runtime_action() - Increment/Decrement active count for * PCM runtime components @@ -736,7 +683,7 @@ static int soc_pcm_close(struct snd_pcm_substream *substream) for_each_rtd_dais(rtd, i, dai) snd_soc_dai_shutdown(dai, substream); - soc_rtd_shutdown(rtd, substream); + snd_soc_link_shutdown(rtd, substream); soc_pcm_components_close(substream); @@ -783,12 +730,9 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) if (ret < 0) goto component_err; - ret = soc_rtd_startup(rtd, substream); - if (ret < 0) { - pr_err("ASoC: %s startup failed: %d\n", - rtd->dai_link->name, ret); + ret = snd_soc_link_startup(substream); + if (ret < 0) goto rtd_startup_err; - } /* startup the audio subsystem */ for_each_rtd_dais(rtd, i, dai) { @@ -870,7 +814,7 @@ static int soc_pcm_open(struct snd_pcm_substream *substream) for_each_rtd_dais(rtd, i, dai) snd_soc_dai_shutdown(dai, substream); - soc_rtd_shutdown(rtd, substream); + snd_soc_link_shutdown(rtd, substream); rtd_startup_err: soc_pcm_components_close(substream); component_err: @@ -912,12 +856,9 @@ static int soc_pcm_prepare(struct snd_pcm_substream *substream) mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); - ret = soc_rtd_prepare(rtd, substream); - if (ret < 0) { - dev_err(rtd->card->dev, - "ASoC: machine prepare error: %d\n", ret); + ret = snd_soc_link_prepare(substream); + if (ret < 0) goto out; - } for_each_rtd_components(rtd, i, component) { ret = snd_soc_component_prepare(component, substream); @@ -1002,12 +943,9 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, if (ret) goto out; - ret = soc_rtd_hw_params(rtd, substream, params); - if (ret < 0) { - dev_err(rtd->card->dev, - "ASoC: machine hw_params failed: %d\n", ret); + ret = snd_soc_link_hw_params(substream, params); + if (ret < 0) goto out; - } for_each_rtd_codec_dais(rtd, i, codec_dai) { struct snd_pcm_hw_params codec_params; @@ -1117,7 +1055,7 @@ static int soc_pcm_hw_params(struct snd_pcm_substream *substream, codec_dai->rate = 0; } - soc_rtd_hw_free(rtd, substream); + snd_soc_link_hw_free(rtd, substream); mutex_unlock(&rtd->card->pcm_mutex); return ret; @@ -1149,7 +1087,7 @@ static int soc_pcm_hw_free(struct snd_pcm_substream *substream) } /* free any machine hw params */ - soc_rtd_hw_free(rtd, substream); + snd_soc_link_hw_free(rtd, substream); /* free any component resources */ soc_pcm_components_hw_free(substream, NULL); @@ -1172,7 +1110,7 @@ static int soc_pcm_trigger_start(struct snd_pcm_substream *substream, int cmd) struct snd_soc_component *component; int i, ret; - ret = soc_rtd_trigger(rtd, substream, cmd); + ret = snd_soc_link_trigger(rtd, substream, cmd); if (ret < 0) return ret; @@ -1201,7 +1139,7 @@ static int soc_pcm_trigger_stop(struct snd_pcm_substream *substream, int cmd) return ret; } - ret = soc_rtd_trigger(rtd, substream, cmd); + ret = snd_soc_link_trigger(rtd, substream, cmd); if (ret < 0) return ret; From patchwork Fri May 22 00:14:04 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 192620 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC0FEC433DF for ; Fri, 22 May 2020 00:16:41 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 554042072C for ; Fri, 22 May 2020 00:16:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="G00s6EJ7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 554042072C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id B1A991858; Fri, 22 May 2020 02:15:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B1A991858 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1590106599; bh=UpWQaqNzAlOK1JPvYT/qDpcViRgerZ8gzW7djz1Dw9I=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=G00s6EJ7ntS+Xft4oubAbY+5aUoLh/SX0lg5E2AswM+glwTjjrQPo73kor+WekJ5D 0cbz1XdybN7e/TENvXU7ehpRdugHn23wHZm8fwtza/Xvgu4oKrJv2tUqJbVLApf8Gs UEkWalDes48OOiVim6ddxcyXmg7ekCAMjXrGqwYc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AA116F802A0; Fri, 22 May 2020 02:14:14 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 50A38F802A7; Fri, 22 May 2020 02:14:13 +0200 (CEST) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id 5D4ADF80291 for ; Fri, 22 May 2020 02:14:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5D4ADF80291 Date: 22 May 2020 09:14:04 +0900 X-IronPort-AV: E=Sophos;i="5.73,419,1583161200"; d="scan'208";a="47501887" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 22 May 2020 09:14:04 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 44A73400C9E3; Fri, 22 May 2020 09:14:04 +0900 (JST) Message-ID: <87ftbs4yib.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v3 4/7] ASoC: soc-link: add snd_soc_link_be_hw_params_fixup() User-Agent: Wanderlust/2.15.9 Emacs/25.2 Mule/6.0 To: Mark Brown In-Reply-To: <87lflk4yk3.wl-kuninori.morimoto.gx@renesas.com> References: <87lflk4yk3.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" From: Kuninori Morimoto dai_link related function should be implemented at soc-link.c. This patch adds snd_soc_link_be_hw_params_fixup(). Signed-off-by: Kuninori Morimoto --- include/sound/soc-link.h | 3 +++ sound/soc/soc-core.c | 6 +++++- sound/soc/soc-dai.c | 9 ++++----- sound/soc/soc-link.c | 11 +++++++++++ sound/soc/soc-pcm.c | 13 +++---------- 5 files changed, 26 insertions(+), 16 deletions(-) diff --git a/include/sound/soc-link.h b/include/sound/soc-link.h index 2a81dca945cd..aae72f668de6 100644 --- a/include/sound/soc-link.h +++ b/include/sound/soc-link.h @@ -9,6 +9,9 @@ #define __SOC_LINK_H int snd_soc_link_init(struct snd_soc_pcm_runtime *rtd); +int snd_soc_link_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_hw_params *params); + int snd_soc_link_startup(struct snd_pcm_substream *substream); void snd_soc_link_shutdown(struct snd_pcm_substream *substream); int snd_soc_link_prepare(struct snd_pcm_substream *substream); diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 955e175643d7..e1b65059c0c4 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1656,7 +1656,11 @@ static void soc_check_tplg_fes(struct snd_soc_card *card) dai_link->dpcm_playback = 1; dai_link->dpcm_capture = 1; - /* override any BE fixups */ + /* + * override any BE fixups + * see + * snd_soc_link_be_hw_params_fixup() + */ dai_link->be_hw_params_fixup = component->driver->be_hw_params_fixup; diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index ce4e1fd1ab79..2c6ac3b0afa5 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -8,6 +8,7 @@ #include #include +#include #define soc_dai_ret(dai, ret) _soc_dai_ret(dai, __func__, ret) static inline int _soc_dai_ret(struct snd_soc_dai *dai, @@ -313,11 +314,9 @@ int snd_soc_dai_hw_params(struct snd_soc_dai *dai, int ret = 0; /* perform any topology hw_params fixups before DAI */ - if (rtd->dai_link->be_hw_params_fixup) { - ret = rtd->dai_link->be_hw_params_fixup(rtd, params); - if (ret < 0) - goto end; - } + ret = snd_soc_link_be_hw_params_fixup(rtd, params); + if (ret < 0) + goto end; if (dai->driver->ops && dai->driver->ops->hw_params) diff --git a/sound/soc/soc-link.c b/sound/soc/soc-link.c index 5ce3e209b1a8..113a4d1b2262 100644 --- a/sound/soc/soc-link.c +++ b/sound/soc/soc-link.c @@ -36,6 +36,17 @@ int snd_soc_link_init(struct snd_soc_pcm_runtime *rtd) return soc_link_ret(rtd, ret); } +int snd_soc_link_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, + struct snd_pcm_hw_params *params) +{ + int ret = 0; + + if (rtd->dai_link->be_hw_params_fixup) + ret = rtd->dai_link->be_hw_params_fixup(rtd, params); + + return soc_link_ret(rtd, ret); +} + int snd_soc_link_startup(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 0204a3ecfc8b..80dd3cf6200c 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -2079,16 +2079,9 @@ int dpcm_be_dai_hw_params(struct snd_soc_pcm_runtime *fe, int stream) sizeof(struct snd_pcm_hw_params)); /* perform any hw_params fixups */ - if (be->dai_link->be_hw_params_fixup) { - ret = be->dai_link->be_hw_params_fixup(be, - &dpcm->hw_params); - if (ret < 0) { - dev_err(be->dev, - "ASoC: hw_params BE fixup failed %d\n", - ret); - goto unwind; - } - } + ret = snd_soc_link_be_hw_params_fixup(be, &dpcm->hw_params); + if (ret < 0) + goto unwind; /* copy the fixed-up hw params for BE dai */ memcpy(&be->dpcm[stream].hw_params, &dpcm->hw_params, From patchwork Fri May 22 00:14:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 192619 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id BEBF6C433DF for ; Fri, 22 May 2020 00:18:05 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3C7282078B for ; Fri, 22 May 2020 00:18:05 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="M1sH2sgU" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3C7282078B Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=renesas.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=alsa-devel-bounces@alsa-project.org Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 907C71858; Fri, 22 May 2020 02:17:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 907C71858 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1590106683; bh=77X7rujsAMO7fcMKTBNXyKnLCUWDb32T6IzSDBIrLeo=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=M1sH2sgU4CaVf14a2egzhcCQD2r/9bwa8nEFTlH+LyO7EInuQ8DZ90Z9nVmlJ9wAc 7nSaiBE8aG4+yvknCmca93D90DWmtvYKWPWo21/bgdzL3+fOCS9IfDaNvZ6lxZgFDX ESHyRMu/rnVaaph6w5rdWsRsL/wXIyiDDeQBpUzY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 9F3FCF802C4; Fri, 22 May 2020 02:14:27 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id BE457F802DC; Fri, 22 May 2020 02:14:26 +0200 (CEST) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id F2443F802C4 for ; Fri, 22 May 2020 02:14:23 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz F2443F802C4 Date: 22 May 2020 09:14:23 +0900 X-IronPort-AV: E=Sophos;i="5.73,419,1583161200"; d="scan'208";a="47501914" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 22 May 2020 09:14:23 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 94E994142B69; Fri, 22 May 2020 09:14:23 +0900 (JST) Message-ID: <87blmg4yhs.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v3 7/7] ASoC: soc-link: add snd_soc_link_compr_set_params() User-Agent: Wanderlust/2.15.9 Emacs/25.2 Mule/6.0 To: Mark Brown In-Reply-To: <87lflk4yk3.wl-kuninori.morimoto.gx@renesas.com> References: <87lflk4yk3.wl-kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Cc: Linux-ALSA X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 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" From: Kuninori Morimoto dai_link related function should be implemented at soc-link.c. This patch adds snd_soc_link_compr_set_params(). Signed-off-by: Kuninori Morimoto --- include/sound/soc-link.h | 1 + sound/soc/soc-compress.c | 16 ++++++---------- sound/soc/soc-link.c | 13 +++++++++++++ 3 files changed, 20 insertions(+), 10 deletions(-) diff --git a/include/sound/soc-link.h b/include/sound/soc-link.h index 9ada62f8186f..3dd6e33e94ec 100644 --- a/include/sound/soc-link.h +++ b/include/sound/soc-link.h @@ -22,5 +22,6 @@ int snd_soc_link_trigger(struct snd_pcm_substream *substream, int cmd); int snd_soc_link_compr_startup(struct snd_compr_stream *cstream); void snd_soc_link_compr_shutdown(struct snd_compr_stream *cstream); +int snd_soc_link_compr_set_params(struct snd_compr_stream *cstream); #endif /* __SOC_LINK_H */ diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index 327bec052954..4984b6a2c370 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c @@ -439,11 +439,9 @@ static int soc_compr_set_params(struct snd_compr_stream *cstream, if (ret < 0) goto err; - if (rtd->dai_link->compr_ops && rtd->dai_link->compr_ops->set_params) { - ret = rtd->dai_link->compr_ops->set_params(cstream); - if (ret < 0) - goto err; - } + ret = snd_soc_link_compr_set_params(cstream); + if (ret < 0) + goto err; if (cstream->direction == SND_COMPRESS_PLAYBACK) snd_soc_dapm_stream_event(rtd, SNDRV_PCM_STREAM_PLAYBACK, @@ -507,11 +505,9 @@ static int soc_compr_set_params_fe(struct snd_compr_stream *cstream, if (ret < 0) goto out; - if (fe->dai_link->compr_ops && fe->dai_link->compr_ops->set_params) { - ret = fe->dai_link->compr_ops->set_params(cstream); - if (ret < 0) - goto out; - } + ret = snd_soc_link_compr_set_params(cstream); + if (ret < 0) + goto out; dpcm_dapm_stream_event(fe, stream, SND_SOC_DAPM_STREAM_START); fe->dpcm[stream].state = SND_SOC_DPCM_STATE_PREPARE; diff --git a/sound/soc/soc-link.c b/sound/soc/soc-link.c index 2cfe7f88b809..248e1be4e1eb 100644 --- a/sound/soc/soc-link.c +++ b/sound/soc/soc-link.c @@ -136,3 +136,16 @@ void snd_soc_link_compr_shutdown(struct snd_compr_stream *cstream) rtd->dai_link->compr_ops->shutdown(cstream); } EXPORT_SYMBOL_GPL(snd_soc_link_compr_shutdown); + +int snd_soc_link_compr_set_params(struct snd_compr_stream *cstream) +{ + struct snd_soc_pcm_runtime *rtd = cstream->private_data; + int ret = 0; + + if (rtd->dai_link->compr_ops && + rtd->dai_link->compr_ops->set_params) + ret = rtd->dai_link->compr_ops->set_params(cstream); + + return soc_link_ret(rtd, ret); +} +EXPORT_SYMBOL_GPL(snd_soc_link_compr_set_params);