From patchwork Mon Jun 1 01:36:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 11581117 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 98EE990 for ; Mon, 1 Jun 2020 01:43:16 +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 302AB20659 for ; Mon, 1 Jun 2020 01:43:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="cr61lmPn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 302AB20659 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 B570216CA; Mon, 1 Jun 2020 03:42:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B570216CA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1590975794; bh=+vB/3uy6jm5Inu/2Z470DLcsKMbbyGg0FvIO7vii4vU=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=cr61lmPnlc//UuKN/Zgem0n2XVpjbZYLV6H7cdwUGYrkhPNIIbFqi2BYNtBeVwvzJ NdgOp8cnjcZkUnE/J1HUchfGw8gt6KqABAQkeM3SZLhfcsu+Hdhc5pZNHLGeuRpFfi OccFqtpBu/PSLSM0IjTlTUu2q9toUU5aBosa6cMw= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 6E15FF80308; Mon, 1 Jun 2020 03:36:47 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa1.perex.cz (Postfix, from userid 50401) id A5465F80304; Mon, 1 Jun 2020 03:36:45 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on alsa1.perex.cz X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED autolearn=disabled version=3.4.0 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id 1907CF800B8 for ; Mon, 1 Jun 2020 03:36:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1907CF800B8 Date: 01 Jun 2020 10:36:40 +0900 X-IronPort-AV: E=Sophos;i="5.73,458,1583161200"; d="scan'208";a="48274605" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 01 Jun 2020 10:36:40 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 8FBA9414CAC4; Mon, 1 Jun 2020 10:36:40 +0900 (JST) Message-ID: <87tuzvy3br.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 11/24] ASoC: soc-component: add snd_soc_component_compr_trigger() User-Agent: Wanderlust/2.15.9 Emacs/25.2 Mule/6.0 To: Mark Brown In-Reply-To: <87a71nzhy2.wl-kuninori.morimoto.gx@renesas.com> References: <87a71nzhy2.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 component related function should be implemented at soc-component.c. This patch moves soc-compress soc_compr_components_trigger() to soc-component as snd_soc_component_compr_trigger(). Signed-off-by: Kuninori Morimoto --- include/sound/soc-component.h | 1 + sound/soc/soc-component.c | 20 ++++++++++++++++++++ sound/soc/soc-compress.c | 27 +++------------------------ 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h index 090ea500d11d..e09cd7627ce9 100644 --- a/include/sound/soc-component.h +++ b/include/sound/soc-component.h @@ -440,6 +440,7 @@ int snd_soc_component_compr_open(struct snd_compr_stream *cstream, struct snd_soc_component **last); void snd_soc_component_compr_free(struct snd_compr_stream *cstream, struct snd_soc_component *last); +int snd_soc_component_compr_trigger(struct snd_compr_stream *cstream, int cmd); int snd_soc_pcm_component_pointer(struct snd_pcm_substream *substream); int snd_soc_pcm_component_ioctl(struct snd_pcm_substream *substream, diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c index 375319142305..99f3ecfef4ab 100644 --- a/sound/soc/soc-component.c +++ b/sound/soc/soc-component.c @@ -425,6 +425,26 @@ void snd_soc_component_compr_free(struct snd_compr_stream *cstream, } EXPORT_SYMBOL_GPL(snd_soc_component_compr_free); +int snd_soc_component_compr_trigger(struct snd_compr_stream *cstream, int cmd) +{ + struct snd_soc_pcm_runtime *rtd = cstream->private_data; + struct snd_soc_component *component; + int i, ret; + + for_each_rtd_components(rtd, i, component) { + if (component->driver->compress_ops && + component->driver->compress_ops->trigger) { + ret = component->driver->compress_ops->trigger( + component, cstream, cmd); + if (ret < 0) + return soc_component_ret(component, ret); + } + } + + return 0; +} +EXPORT_SYMBOL_GPL(snd_soc_component_compr_trigger); + int snd_soc_pcm_component_pointer(struct snd_pcm_substream *substream) { struct snd_soc_pcm_runtime *rtd = substream->private_data; diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index c164b93c8a0e..7a989d0bb369 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c @@ -244,27 +244,6 @@ static int soc_compr_free_fe(struct snd_compr_stream *cstream) return 0; } -static int soc_compr_components_trigger(struct snd_compr_stream *cstream, - int cmd) -{ - struct snd_soc_pcm_runtime *rtd = cstream->private_data; - struct snd_soc_component *component; - int i, ret; - - for_each_rtd_components(rtd, i, component) { - if (!component->driver->compress_ops || - !component->driver->compress_ops->trigger) - continue; - - ret = component->driver->compress_ops->trigger( - component, cstream, cmd); - if (ret < 0) - return ret; - } - - return 0; -} - static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd) { struct snd_soc_pcm_runtime *rtd = cstream->private_data; @@ -274,7 +253,7 @@ static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd) mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); - ret = soc_compr_components_trigger(cstream, cmd); + ret = snd_soc_component_compr_trigger(cstream, cmd); if (ret < 0) goto out; @@ -304,7 +283,7 @@ static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd) if (cmd == SND_COMPR_TRIGGER_PARTIAL_DRAIN || cmd == SND_COMPR_TRIGGER_DRAIN) - return soc_compr_components_trigger(cstream, cmd); + return snd_soc_component_compr_trigger(cstream, cmd); if (cstream->direction == SND_COMPRESS_PLAYBACK) stream = SNDRV_PCM_STREAM_PLAYBACK; @@ -317,7 +296,7 @@ static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd) if (ret < 0) goto out; - ret = soc_compr_components_trigger(cstream, cmd); + ret = snd_soc_component_compr_trigger(cstream, cmd); if (ret < 0) goto out;