From patchwork Thu Apr 23 23:14:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 192910 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 2BB1CC55193 for ; Thu, 23 Apr 2020 23:16:10 +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 AD34B20784 for ; Thu, 23 Apr 2020 23:16:09 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="LKbN7Tzx" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AD34B20784 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 C8DA4169F; Fri, 24 Apr 2020 01:15:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C8DA4169F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1587683767; bh=jUSOLFBRtEgMbIwlvLHF+AxgBdvWTa66XO66znUKvfA=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=LKbN7TzxJrVhhwbDjxfrE1JBW7pvz4v6fDqgjG6DNFKmm59Nc+58qTN/DP9ZLv8y0 aeTuiMMErQr05jod2OunSK+PAzjLu/zDiyKUoYbhcvpBWa/9xJsxBKWQPJQqozxY38 fvalG0NU4JeIs9ofXHrHHjSEL9qNgYvj3eGiGEAA= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id EBC7CF80212; Fri, 24 Apr 2020 01:14:48 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 78264F80228; Fri, 24 Apr 2020 01:14:47 +0200 (CEST) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 791C7F801ED for ; Fri, 24 Apr 2020 01:14:39 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 791C7F801ED Date: 24 Apr 2020 08:14:38 +0900 X-IronPort-AV: E=Sophos;i="5.73,309,1583161200"; d="scan'208";a="45558017" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 24 Apr 2020 08:14:38 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 3DEF54111667; Fri, 24 Apr 2020 08:14:38 +0900 (JST) Message-ID: <871rodu74x.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 01/17] ASoC: soc-dai: add soc_dai_err() User-Agent: Wanderlust/2.15.9 Emacs/25.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") To: Mark Brown In-Reply-To: <87368tu75n.wl-kuninori.morimoto.gx@renesas.com> References: <87368tu75n.wl-kuninori.morimoto.gx@renesas.com> 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 At soc-dai.c, it is good idea to indicate error function and its component name if there was error. This patch adds soc_dai_err() for it. Signed-off-by: Kuninori Morimoto --- v1 -> v2 - no change sound/soc/soc-dai.c | 155 +++++++++++++++++++++++++++----------------- 1 file changed, 96 insertions(+), 59 deletions(-) diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index 31c41559034b..d591b3bd8b99 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -9,6 +9,24 @@ #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, + const char *func, int ret) +{ + switch (ret) { + case -EPROBE_DEFER: + case -ENOTSUPP: + case 0: + break; + default: + dev_err(dai->dev, + "ASoC: error at %s on %s: %d\n", + func, dai->name, ret); + } + + return ret; +} + /** * snd_soc_dai_set_sysclk - configure DAI system or master clock. * @dai: DAI @@ -21,11 +39,15 @@ int snd_soc_dai_set_sysclk(struct snd_soc_dai *dai, int clk_id, unsigned int freq, int dir) { + int ret; + if (dai->driver->ops->set_sysclk) - return dai->driver->ops->set_sysclk(dai, clk_id, freq, dir); + ret = dai->driver->ops->set_sysclk(dai, clk_id, freq, dir); + else + ret = snd_soc_component_set_sysclk(dai->component, clk_id, 0, + freq, dir); - return snd_soc_component_set_sysclk(dai->component, clk_id, 0, - freq, dir); + return soc_dai_ret(dai, ret); } EXPORT_SYMBOL_GPL(snd_soc_dai_set_sysclk); @@ -42,10 +64,12 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_sysclk); int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai, int div_id, int div) { + int ret = -EINVAL; + if (dai->driver->ops->set_clkdiv) - return dai->driver->ops->set_clkdiv(dai, div_id, div); - else - return -EINVAL; + ret = dai->driver->ops->set_clkdiv(dai, div_id, div); + + return soc_dai_ret(dai, ret); } EXPORT_SYMBOL_GPL(snd_soc_dai_set_clkdiv); @@ -62,12 +86,16 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_clkdiv); int snd_soc_dai_set_pll(struct snd_soc_dai *dai, int pll_id, int source, unsigned int freq_in, unsigned int freq_out) { + int ret; + if (dai->driver->ops->set_pll) - return dai->driver->ops->set_pll(dai, pll_id, source, - freq_in, freq_out); + ret = dai->driver->ops->set_pll(dai, pll_id, source, + freq_in, freq_out); + else + ret = snd_soc_component_set_pll(dai->component, pll_id, source, + freq_in, freq_out); - return snd_soc_component_set_pll(dai->component, pll_id, source, - freq_in, freq_out); + return soc_dai_ret(dai, ret); } EXPORT_SYMBOL_GPL(snd_soc_dai_set_pll); @@ -80,10 +108,12 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_pll); */ int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio) { + int ret = -EINVAL; + if (dai->driver->ops->set_bclk_ratio) - return dai->driver->ops->set_bclk_ratio(dai, ratio); - else - return -EINVAL; + ret = dai->driver->ops->set_bclk_ratio(dai, ratio); + + return soc_dai_ret(dai, ret); } EXPORT_SYMBOL_GPL(snd_soc_dai_set_bclk_ratio); @@ -96,9 +126,12 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_bclk_ratio); */ int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) { - if (dai->driver->ops->set_fmt == NULL) - return -ENOTSUPP; - return dai->driver->ops->set_fmt(dai, fmt); + int ret = -ENOTSUPP; + + if (dai->driver->ops->set_fmt) + ret = dai->driver->ops->set_fmt(dai, fmt); + + return soc_dai_ret(dai, ret); } EXPORT_SYMBOL_GPL(snd_soc_dai_set_fmt); @@ -153,6 +186,8 @@ int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width) { + int ret = -ENOTSUPP; + if (dai->driver->ops->xlate_tdm_slot_mask) dai->driver->ops->xlate_tdm_slot_mask(slots, &tx_mask, &rx_mask); @@ -163,10 +198,9 @@ int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai, dai->rx_mask = rx_mask; if (dai->driver->ops->set_tdm_slot) - return dai->driver->ops->set_tdm_slot(dai, tx_mask, rx_mask, + ret = dai->driver->ops->set_tdm_slot(dai, tx_mask, rx_mask, slots, slot_width); - else - return -ENOTSUPP; + return soc_dai_ret(dai, ret); } EXPORT_SYMBOL_GPL(snd_soc_dai_set_tdm_slot); @@ -186,11 +220,12 @@ int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai, unsigned int tx_num, unsigned int *tx_slot, unsigned int rx_num, unsigned int *rx_slot) { + int ret = -ENOTSUPP; + if (dai->driver->ops->set_channel_map) - return dai->driver->ops->set_channel_map(dai, tx_num, tx_slot, - rx_num, rx_slot); - else - return -ENOTSUPP; + ret = dai->driver->ops->set_channel_map(dai, tx_num, tx_slot, + rx_num, rx_slot); + return soc_dai_ret(dai, ret); } EXPORT_SYMBOL_GPL(snd_soc_dai_set_channel_map); @@ -208,11 +243,12 @@ int snd_soc_dai_get_channel_map(struct snd_soc_dai *dai, unsigned int *tx_num, unsigned int *tx_slot, unsigned int *rx_num, unsigned int *rx_slot) { + int ret = -ENOTSUPP; + if (dai->driver->ops->get_channel_map) - return dai->driver->ops->get_channel_map(dai, tx_num, tx_slot, - rx_num, rx_slot); - else - return -ENOTSUPP; + ret = dai->driver->ops->get_channel_map(dai, tx_num, tx_slot, + rx_num, rx_slot); + return soc_dai_ret(dai, ret); } EXPORT_SYMBOL_GPL(snd_soc_dai_get_channel_map); @@ -225,10 +261,12 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_get_channel_map); */ int snd_soc_dai_set_tristate(struct snd_soc_dai *dai, int tristate) { + int ret = -EINVAL; + if (dai->driver->ops->set_tristate) - return dai->driver->ops->set_tristate(dai, tristate); - else - return -EINVAL; + ret = dai->driver->ops->set_tristate(dai, tristate); + + return soc_dai_ret(dai, ret); } EXPORT_SYMBOL_GPL(snd_soc_dai_set_tristate); @@ -243,13 +281,15 @@ EXPORT_SYMBOL_GPL(snd_soc_dai_set_tristate); int snd_soc_dai_digital_mute(struct snd_soc_dai *dai, int mute, int direction) { + int ret = -ENOTSUPP; + if (dai->driver->ops->mute_stream) - return dai->driver->ops->mute_stream(dai, mute, direction); + ret = dai->driver->ops->mute_stream(dai, mute, direction); else if (direction == SNDRV_PCM_STREAM_PLAYBACK && dai->driver->ops->digital_mute) - return dai->driver->ops->digital_mute(dai, mute); - else - return -ENOTSUPP; + ret = dai->driver->ops->digital_mute(dai, mute); + + return soc_dai_ret(dai, ret); } EXPORT_SYMBOL_GPL(snd_soc_dai_digital_mute); @@ -258,29 +298,19 @@ int snd_soc_dai_hw_params(struct snd_soc_dai *dai, struct snd_pcm_hw_params *params) { struct snd_soc_pcm_runtime *rtd = substream->private_data; - int ret; + 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) { - dev_err(rtd->dev, - "ASoC: hw_params topology fixup failed %d\n", - ret); - return ret; - } + if (ret < 0) + goto end; } - if (dai->driver->ops->hw_params) { + if (dai->driver->ops->hw_params) ret = dai->driver->ops->hw_params(substream, params, dai); - if (ret < 0) { - dev_err(dai->dev, "ASoC: can't set %s hw params: %d\n", - dai->name, ret); - return ret; - } - } - - return 0; +end: + return soc_dai_ret(dai, ret); } void snd_soc_dai_hw_free(struct snd_soc_dai *dai, @@ -298,7 +328,7 @@ int snd_soc_dai_startup(struct snd_soc_dai *dai, if (dai->driver->ops->startup) ret = dai->driver->ops->startup(substream, dai); - return ret; + return soc_dai_ret(dai, ret); } void snd_soc_dai_shutdown(struct snd_soc_dai *dai, @@ -316,7 +346,7 @@ int snd_soc_dai_prepare(struct snd_soc_dai *dai, if (dai->driver->ops->prepare) ret = dai->driver->ops->prepare(substream, dai); - return ret; + return soc_dai_ret(dai, ret); } int snd_soc_dai_trigger(struct snd_soc_dai *dai, @@ -340,7 +370,7 @@ int snd_soc_dai_bespoke_trigger(struct snd_soc_dai *dai, if (dai->driver->ops->bespoke_trigger) ret = dai->driver->ops->bespoke_trigger(substream, cmd, dai); - return ret; + return soc_dai_ret(dai, ret); } snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai, @@ -356,24 +386,31 @@ snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai, int snd_soc_dai_probe(struct snd_soc_dai *dai) { + int ret = 0; + if (dai->driver->probe) - return dai->driver->probe(dai); - return 0; + ret = dai->driver->probe(dai); + + return soc_dai_ret(dai, ret); } int snd_soc_dai_remove(struct snd_soc_dai *dai) { + int ret = 0; + if (dai->driver->remove) - return dai->driver->remove(dai); - return 0; + ret = dai->driver->remove(dai); + + return soc_dai_ret(dai, ret); } int snd_soc_dai_compress_new(struct snd_soc_dai *dai, struct snd_soc_pcm_runtime *rtd, int num) { + int ret = -ENOTSUPP; if (dai->driver->compress_new) - return dai->driver->compress_new(rtd, num); - return -ENOTSUPP; + ret = dai->driver->compress_new(rtd, num); + return soc_dai_ret(dai, ret); } /* From patchwork Thu Apr 23 23:14:48 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 192909 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 9A332C54FCB for ; Thu, 23 Apr 2020 23:17:24 +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 269302077D for ; Thu, 23 Apr 2020 23:17:24 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="StW30rZJ" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 269302077D 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 6383B1690; Fri, 24 Apr 2020 01:16:32 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6383B1690 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1587683842; bh=tp1W1cT60FCSG6E6vdxXTKwbCzdbre0YBwaSQYEoJx4=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=StW30rZJoPgi1SJI6hYXi+yNwpvTWdjLTOFrWxpuHXmYu24BxaKkbJTOVLn0WR7Iz gUM1XqUUIZhf5gSaMoVJRpP857lV+n4QO/9KnynDyahT3hyP5PFWEoxorRwyy7/V9q yFgnKuBmWK58unny0D/QiWaKMsQU7tDzteY0jZ+g= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 8A433F80290; Fri, 24 Apr 2020 01:14:55 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B45E2F8028B; Fri, 24 Apr 2020 01:14:52 +0200 (CEST) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id C7356F80279 for ; Fri, 24 Apr 2020 01:14:49 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C7356F80279 Date: 24 Apr 2020 08:14:48 +0900 X-IronPort-AV: E=Sophos;i="5.73,309,1583161200"; d="scan'208";a="45558025" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 24 Apr 2020 08:14:48 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id ADDF4400C4F5; Fri, 24 Apr 2020 08:14:48 +0900 (JST) Message-ID: <87y2qlssk7.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 03/17] ASoC: soc-dai: add snd_soc_pcm_dai_new() User-Agent: Wanderlust/2.15.9 Emacs/25.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") To: Mark Brown In-Reply-To: <87368tu75n.wl-kuninori.morimoto.gx@renesas.com> References: <87368tu75n.wl-kuninori.morimoto.gx@renesas.com> 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 We have 2 type of component functions snd_soc_dai_xxx() is focusing to dai itself, snd_soc_pcm_dai_xxx() is focusing to rtd related dai. Now we can update soc_dai_pcm_new() to snd_soc_pcm_dai_new(). This patch do it. Signed-off-by: Kuninori Morimoto --- v1 -> v2 - no change include/sound/soc-dai.h | 2 ++ sound/soc/soc-core.c | 23 +---------------------- sound/soc/soc-dai.c | 16 ++++++++++++++++ 3 files changed, 19 insertions(+), 22 deletions(-) diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index b33abe93b905..fd7e203315e6 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -170,6 +170,8 @@ int snd_soc_dai_compress_new(struct snd_soc_dai *dai, struct snd_soc_pcm_runtime *rtd, int num); bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream); +int snd_soc_pcm_dai_new(struct snd_soc_pcm_runtime *rtd); + struct snd_soc_dai_ops { /* * DAI clocking configuration, all optional. diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 6778eeffb48f..76167fa264af 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1036,27 +1036,6 @@ int snd_soc_add_pcm_runtime(struct snd_soc_card *card, } EXPORT_SYMBOL_GPL(snd_soc_add_pcm_runtime); -static int soc_dai_pcm_new(struct snd_soc_pcm_runtime *rtd) -{ - struct snd_soc_dai *dai; - int i, ret = 0; - - for_each_rtd_dais(rtd, i, dai) { - struct snd_soc_dai_driver *drv = dai->driver; - - if (drv->pcm_new) - ret = drv->pcm_new(rtd, dai); - if (ret < 0) { - dev_err(dai->dev, - "ASoC: Failed to bind %s with pcm device\n", - dai->name); - return ret; - } - } - - return 0; -} - static int soc_init_pcm_runtime(struct snd_soc_card *card, struct snd_soc_pcm_runtime *rtd) { @@ -1121,7 +1100,7 @@ static int soc_init_pcm_runtime(struct snd_soc_card *card, return ret; } - return soc_dai_pcm_new(rtd); + return snd_soc_pcm_dai_new(rtd); } static void soc_set_name_prefix(struct snd_soc_card *card, diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index 93e03c9ec164..1b45e6e114ad 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -445,3 +445,19 @@ bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int dir) /* If the codec specifies any channels at all, it supports the stream */ return stream->channels_min; } + +int snd_soc_pcm_dai_new(struct snd_soc_pcm_runtime *rtd) +{ + struct snd_soc_dai *dai; + int i, ret = 0; + + for_each_rtd_dais(rtd, i, dai) { + if (dai->driver->pcm_new) { + ret = dai->driver->pcm_new(rtd, dai); + if (ret < 0) + return soc_dai_ret(dai, ret); + } + } + + return 0; +} From patchwork Thu Apr 23 23:15: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: 192908 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 7F76EC55186 for ; Thu, 23 Apr 2020 23:18:38 +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 10B8820780 for ; Thu, 23 Apr 2020 23:18:38 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="l37y/AI2" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 10B8820780 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 7079816AF; Fri, 24 Apr 2020 01:17:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 7079816AF DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1587683916; bh=L3hHTLOLGBwmt7ymEWKi/4hwbzf7P2U/Cl8c/YLiQzU=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=l37y/AI2Fooo4UzClJ3kwAfbyTViQH6MzPD3Ir45pzYn+CvsiFo23oqGPkqVJLSpJ UAUakAi/qMiGVBAsch5hEdU5weB9Q/dzRUWOX9VGNLCbkcvO5lV1jq79lXC7QC6JC4 7vfA/ewOkmdjinIgRs1L9bGSpSogbiEPl0eGj1HE= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id AED85F802BD; Fri, 24 Apr 2020 01:15:09 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8478CF802BE; Fri, 24 Apr 2020 01:15:08 +0200 (CEST) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 5853AF802BC for ; Fri, 24 Apr 2020 01:15:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5853AF802BC Date: 24 Apr 2020 08:15:04 +0900 X-IronPort-AV: E=Sophos;i="5.73,309,1583161200"; d="scan'208";a="45558043" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 24 Apr 2020 08:15:04 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 41A5B400C4F2; Fri, 24 Apr 2020 08:15:04 +0900 (JST) Message-ID: <87v9lpssjr.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 05/17] ASoC: soc-dai: add snd_soc_pcm_dai_trigger() User-Agent: Wanderlust/2.15.9 Emacs/25.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") To: Mark Brown In-Reply-To: <87368tu75n.wl-kuninori.morimoto.gx@renesas.com> References: <87368tu75n.wl-kuninori.morimoto.gx@renesas.com> 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 We have 2 type of component functions snd_soc_dai_xxx() is focusing to dai itself, snd_soc_pcm_dai_xxx() is focusing to rtd related dai. Now we can update snd_soc_dai_trigger() to snd_soc_pcm_dai_trigger(). This patch do it. Signed-off-by: Kuninori Morimoto --- v1 -> v2 - directly return without using ret return snd_soc_pcm_dai_trigger() include/sound/soc-dai.h | 3 +-- sound/soc/soc-dai.c | 32 +++++++++++++++++++------------- sound/soc/soc-pcm.c | 18 ++++-------------- 3 files changed, 24 insertions(+), 29 deletions(-) diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 1b25318b6325..3da850b4aefe 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -154,8 +154,6 @@ int snd_soc_dai_startup(struct snd_soc_dai *dai, struct snd_pcm_substream *substream); void snd_soc_dai_shutdown(struct snd_soc_dai *dai, struct snd_pcm_substream *substream); -int snd_soc_dai_trigger(struct snd_soc_dai *dai, - struct snd_pcm_substream *substream, int cmd); int snd_soc_dai_bespoke_trigger(struct snd_soc_dai *dai, struct snd_pcm_substream *substream, int cmd); snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai, @@ -170,6 +168,7 @@ bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream); int snd_soc_pcm_dai_new(struct snd_soc_pcm_runtime *rtd); int snd_soc_pcm_dai_prepare(struct snd_pcm_substream *substream); +int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream, int cmd); struct snd_soc_dai_ops { /* diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index 1a9cfdcfc736..29587d7e75ca 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -354,19 +354,6 @@ void snd_soc_dai_shutdown(struct snd_soc_dai *dai, dai->driver->ops->shutdown(substream, dai); } -int snd_soc_dai_trigger(struct snd_soc_dai *dai, - struct snd_pcm_substream *substream, - int cmd) -{ - int ret = 0; - - if (dai->driver->ops && - dai->driver->ops->trigger) - ret = dai->driver->ops->trigger(substream, cmd, dai); - - return ret; -} - int snd_soc_dai_bespoke_trigger(struct snd_soc_dai *dai, struct snd_pcm_substream *substream, int cmd) @@ -467,3 +454,22 @@ int snd_soc_pcm_dai_prepare(struct snd_pcm_substream *substream) return 0; } + +int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream, + int cmd) +{ + struct snd_soc_pcm_runtime *rtd = substream->private_data; + struct snd_soc_dai *dai; + int i, ret; + + for_each_rtd_dais(rtd, i, dai) { + if (dai->driver->ops && + dai->driver->ops->trigger) { + ret = dai->driver->ops->trigger(substream, cmd, dai); + if (ret < 0) + return soc_dai_ret(dai, ret); + } + } + + return 0; +} diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index f7b3dca1d152..e56500212c0c 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -1192,7 +1192,6 @@ static int soc_pcm_trigger_start(struct snd_pcm_substream *substream, int cmd) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_component *component; - struct snd_soc_dai *dai; int i, ret; ret = soc_rtd_trigger(rtd, substream, cmd); @@ -1205,27 +1204,18 @@ static int soc_pcm_trigger_start(struct snd_pcm_substream *substream, int cmd) return ret; } - for_each_rtd_dais(rtd, i, dai) { - ret = snd_soc_dai_trigger(dai, substream, cmd); - if (ret < 0) - return ret; - } - - return 0; + return snd_soc_pcm_dai_trigger(substream, cmd); } static int soc_pcm_trigger_stop(struct snd_pcm_substream *substream, int cmd) { struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_component *component; - struct snd_soc_dai *dai; int i, ret; - for_each_rtd_dais(rtd, i, dai) { - ret = snd_soc_dai_trigger(dai, substream, cmd); - if (ret < 0) - return ret; - } + ret = snd_soc_pcm_dai_trigger(substream, cmd); + if (ret < 0) + return ret; for_each_rtd_components(rtd, i, component) { ret = snd_soc_component_trigger(component, substream, cmd); From patchwork Thu Apr 23 23:15:15 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 192907 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 C2B3BC55186 for ; Thu, 23 Apr 2020 23:19:39 +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 51DF921556 for ; Thu, 23 Apr 2020 23:19:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="TSo8GIng" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 51DF921556 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 B07B51692; Fri, 24 Apr 2020 01:18:47 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B07B51692 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1587683977; bh=Y7cw4UEaLzo9FqFBNB7D8Mwflf5QfgHpmXr+6MSSmLk=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=TSo8GIngZIJx+51A7t6sCwd3A8pvJcFE1ulLvfB/ahsZquiyjNOCIyrfKGIfxy1k2 GV5NLq+I/xrkGW1NJpssChywRX4Xjxn2NVCfBS2qPkkAi7A7+DXz3W+wzmaetY2c+i PvOOUHctCUEEy+KoZHd/iVT9jkPjhPUUZXt/oduY= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id DC873F802C2; Fri, 24 Apr 2020 01:15:23 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 933F3F802DD; Fri, 24 Apr 2020 01:15:22 +0200 (CEST) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id B4020F802C2 for ; Fri, 24 Apr 2020 01:15:15 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz B4020F802C2 Date: 24 Apr 2020 08:15:15 +0900 X-IronPort-AV: E=Sophos;i="5.73,309,1583161200"; d="scan'208";a="45344834" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 24 Apr 2020 08:15:15 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 577CB4111CD2; Fri, 24 Apr 2020 08:15:15 +0900 (JST) Message-ID: <87sggtssjg.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 07/17] ASoC: soc-dai: add snd_soc_pcm_dai_probe() User-Agent: Wanderlust/2.15.9 Emacs/25.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") To: Mark Brown In-Reply-To: <87368tu75n.wl-kuninori.morimoto.gx@renesas.com> References: <87368tu75n.wl-kuninori.morimoto.gx@renesas.com> 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 We have 2 type of component functions snd_soc_dai_xxx() is focusing to dai itself, snd_soc_pcm_dai_xxx() is focusing to rtd related dai. Now we can update snd_soc_dai_probe() to snd_soc_pcm_dai_probe(). This patch do it. Signed-off-by: Kuninori Morimoto --- v1 -> v2 - no change include/sound/soc-dai.h | 2 +- sound/soc/soc-core.c | 33 +++++---------------------------- sound/soc/soc-dai.c | 32 ++++++++++++++++++++++---------- 3 files changed, 28 insertions(+), 39 deletions(-) diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index a0c7ac112b86..bdb79df637af 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -158,12 +158,12 @@ snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai, struct snd_pcm_substream *substream); void snd_soc_dai_suspend(struct snd_soc_dai *dai); void snd_soc_dai_resume(struct snd_soc_dai *dai); -int snd_soc_dai_probe(struct snd_soc_dai *dai); int snd_soc_dai_remove(struct snd_soc_dai *dai); int snd_soc_dai_compress_new(struct snd_soc_dai *dai, struct snd_soc_pcm_runtime *rtd, int num); bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream); +int snd_soc_pcm_dai_probe(struct snd_soc_pcm_runtime *rtd, int order); int snd_soc_pcm_dai_new(struct snd_soc_pcm_runtime *rtd); int snd_soc_pcm_dai_prepare(struct snd_pcm_substream *substream); int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream, int cmd); diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 76167fa264af..8cafca4e1405 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1273,26 +1273,6 @@ static void soc_remove_dai(struct snd_soc_dai *dai, int order) dai->probed = 0; } -static int soc_probe_dai(struct snd_soc_dai *dai, int order) -{ - int ret; - - if (dai->probed || - dai->driver->probe_order != order) - return 0; - - ret = snd_soc_dai_probe(dai); - if (ret < 0) { - dev_err(dai->dev, "ASoC: failed to probe DAI %s: %d\n", - dai->name, ret); - return ret; - } - - dai->probed = 1; - - return 0; -} - static void soc_remove_link_dais(struct snd_soc_card *card) { int i; @@ -1311,9 +1291,8 @@ static void soc_remove_link_dais(struct snd_soc_card *card) static int soc_probe_link_dais(struct snd_soc_card *card) { - struct snd_soc_dai *dai; struct snd_soc_pcm_runtime *rtd; - int i, order, ret; + int order, ret; for_each_comp_order(order) { for_each_card_rtds(card, rtd) { @@ -1322,12 +1301,10 @@ static int soc_probe_link_dais(struct snd_soc_card *card) "ASoC: probe %s dai link %d late %d\n", card->name, rtd->num, order); - /* probe the CPU DAI */ - for_each_rtd_dais(rtd, i, dai) { - ret = soc_probe_dai(dai, order); - if (ret) - return ret; - } + /* probe all rtd connected DAIs in good order */ + ret = snd_soc_pcm_dai_probe(rtd, order); + if (ret) + return ret; } } diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index 226c51b9089c..48f5eb5ef387 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -366,16 +366,6 @@ snd_pcm_sframes_t snd_soc_dai_delay(struct snd_soc_dai *dai, return delay; } -int snd_soc_dai_probe(struct snd_soc_dai *dai) -{ - int ret = 0; - - if (dai->driver->probe) - ret = dai->driver->probe(dai); - - return soc_dai_ret(dai, ret); -} - int snd_soc_dai_remove(struct snd_soc_dai *dai) { int ret = 0; @@ -408,6 +398,28 @@ bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int dir) return stream->channels_min; } +int snd_soc_pcm_dai_probe(struct snd_soc_pcm_runtime *rtd, int order) +{ + struct snd_soc_dai *dai; + int i; + + for_each_rtd_dais(rtd, i, dai) { + if (dai->driver->probe_order != order) + continue; + + if (dai->driver->probe) { + int ret = dai->driver->probe(dai); + + if (ret < 0) + return soc_dai_ret(dai, ret); + } + + dai->probed = 1; + } + + return 0; +} + int snd_soc_pcm_dai_new(struct snd_soc_pcm_runtime *rtd) { struct snd_soc_dai *dai; From patchwork Thu Apr 23 23:15:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 192906 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 9F483C54FCB for ; Thu, 23 Apr 2020 23:21: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 2C20E20780 for ; Thu, 23 Apr 2020 23:21: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="QywfWXpk" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 2C20E20780 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 92396169B; Fri, 24 Apr 2020 01:20:13 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 92396169B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1587684063; bh=k8UmGuIfpDuoCCZ7Q1CUFl7AtR6wxf0EH6ALi00Sf1Q=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=QywfWXpk/FmrwldNPR62beYTn4OWWChYOVIECSEeIZvX2hJ6PhxS44fkI7Qeqkhyt d7w1U7+hFUaZBi9u0I7SgqPeK0Ac2Vag4mrmlhQMNQDXnPCPWMeJwAu4GfwthGedVr RJ2wpPRRfXLqEY4FE4Q63X6KsgpBGhlAQ4HKHzU0= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 75520F802F8; Fri, 24 Apr 2020 01:15:30 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B4486F802F8; Fri, 24 Apr 2020 01:15:28 +0200 (CEST) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 4FDE7F802E2 for ; Fri, 24 Apr 2020 01:15:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4FDE7F802E2 Date: 24 Apr 2020 08:15:24 +0900 X-IronPort-AV: E=Sophos;i="5.73,309,1583161200"; d="scan'208";a="45558065" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 24 Apr 2020 08:15:24 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 36AF14111CD2; Fri, 24 Apr 2020 08:15:24 +0900 (JST) Message-ID: <87pnbxssj7.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 09/17] ASoC: soc-dai: add snd_soc_dai_compr_start() User-Agent: Wanderlust/2.15.9 Emacs/25.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") To: Mark Brown In-Reply-To: <87368tu75n.wl-kuninori.morimoto.gx@renesas.com> References: <87368tu75n.wl-kuninori.morimoto.gx@renesas.com> 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 related function should be implemented at soc-dai.c. This patch adds snd_soc_dai_compr_start(). Signed-off-by: Kuninori Morimoto --- v1 -> v2 - no change include/sound/soc-dai.h | 3 +++ sound/soc/soc-compress.c | 24 ++++++------------------ sound/soc/soc-dai.c | 13 +++++++++++++ 3 files changed, 22 insertions(+), 18 deletions(-) diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index cf7d09f210bc..deb99b1469b4 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -170,6 +170,9 @@ int snd_soc_pcm_dai_trigger(struct snd_pcm_substream *substream, int cmd); int snd_soc_pcm_dai_bespoke_trigger(struct snd_pcm_substream *substream, int cmd); +int snd_soc_dai_compr_startup(struct snd_soc_dai *dai, + struct snd_compr_stream *cstream); + struct snd_soc_dai_ops { /* * DAI clocking configuration, all optional. diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index ceaf976db0bb..4065e7b4138d 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c @@ -87,15 +87,9 @@ static int soc_compr_open(struct snd_compr_stream *cstream) mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); - if (cpu_dai->driver->cops && cpu_dai->driver->cops->startup) { - ret = cpu_dai->driver->cops->startup(cstream, cpu_dai); - if (ret < 0) { - dev_err(cpu_dai->dev, - "Compress ASoC: can't open interface %s: %d\n", - cpu_dai->name, ret); - goto out; - } - } + ret = snd_soc_dai_compr_startup(cpu_dai, cstream); + if (ret < 0) + goto out; ret = soc_compr_components_open(cstream, &component); if (ret < 0) @@ -178,15 +172,9 @@ static int soc_compr_open_fe(struct snd_compr_stream *cstream) goto out; } - if (cpu_dai->driver->cops && cpu_dai->driver->cops->startup) { - ret = cpu_dai->driver->cops->startup(cstream, cpu_dai); - if (ret < 0) { - dev_err(cpu_dai->dev, - "Compress ASoC: can't open interface %s: %d\n", - cpu_dai->name, ret); - goto out; - } - } + ret = snd_soc_dai_compr_startup(cpu_dai, cstream); + if (ret < 0) + goto out; ret = soc_compr_components_open(cstream, &component); if (ret < 0) diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index 2bc452fe02ff..5c88f80b781d 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -504,3 +504,16 @@ int snd_soc_pcm_dai_bespoke_trigger(struct snd_pcm_substream *substream, return 0; } + +int snd_soc_dai_compr_startup(struct snd_soc_dai *dai, + struct snd_compr_stream *cstream) +{ + int ret = 0; + + if (dai->driver->cops && + dai->driver->cops->startup) + ret = dai->driver->cops->startup(cstream, dai); + + return soc_dai_ret(dai, ret); +} +EXPORT_SYMBOL_GPL(snd_soc_dai_compr_startup); From patchwork Thu Apr 23 23:15:32 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 192905 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 1E745C54FCB for ; Thu, 23 Apr 2020 23:22:02 +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 A38742077D for ; Thu, 23 Apr 2020 23:22:01 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="ZnFqTXe/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org A38742077D 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 0B7F4169E; Fri, 24 Apr 2020 01:21:10 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0B7F4169E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1587684120; bh=hS219eUvBXvsJuKD1YI4YXhg6A3ejzSs/oowiWn20sk=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=ZnFqTXe/3UpoBhRGQGjNODZ1Ao1VprkLFE5BUc3eqb/byfFu8S2XsX6qEMTVOqCkw VBYbpk41CyK2Y1TM8zcef66gyoGQiWYi8/3VLh7hDUo4pu+grWleOmE8sy+1g5Rfa3 /kwipugQV4LRjwulFnmR5zuPDr+9kybTk8ACnqqc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 662DFF802FF; Fri, 24 Apr 2020 01:15:37 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 99D82F80305; Fri, 24 Apr 2020 01:15:36 +0200 (CEST) Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by alsa1.perex.cz (Postfix) with ESMTP id DDE57F80303 for ; Fri, 24 Apr 2020 01:15:33 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DDE57F80303 Date: 24 Apr 2020 08:15:32 +0900 X-IronPort-AV: E=Sophos;i="5.73,309,1583161200"; d="scan'208";a="45344849" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 24 Apr 2020 08:15:32 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id C6E9E400C4F2; Fri, 24 Apr 2020 08:15:32 +0900 (JST) Message-ID: <87mu71ssiz.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 11/17] ASoC: soc-dai: add snd_soc_dai_compr_trigger() User-Agent: Wanderlust/2.15.9 Emacs/25.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") To: Mark Brown In-Reply-To: <87368tu75n.wl-kuninori.morimoto.gx@renesas.com> References: <87368tu75n.wl-kuninori.morimoto.gx@renesas.com> 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 related function should be implemented at soc-dai.c. This patch adds snd_soc_dai_compr_trigger(). Signed-off-by: Kuninori Morimoto --- v1 -> v2 - no change include/sound/soc-dai.h | 2 ++ sound/soc/soc-compress.c | 13 ++++++------- sound/soc/soc-dai.c | 13 +++++++++++++ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index abf4ad25ce68..ae04575ed8bc 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -174,6 +174,8 @@ int snd_soc_dai_compr_startup(struct snd_soc_dai *dai, struct snd_compr_stream *cstream); void snd_soc_dai_compr_shutdown(struct snd_soc_dai *dai, struct snd_compr_stream *cstream); +int snd_soc_dai_compr_trigger(struct snd_soc_dai *dai, + struct snd_compr_stream *cstream, int cmd); struct snd_soc_dai_ops { /* diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index 945d1d15e1d2..7b4afe1d871b 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c @@ -338,8 +338,9 @@ static int soc_compr_trigger(struct snd_compr_stream *cstream, int cmd) if (ret < 0) goto out; - if (cpu_dai->driver->cops && cpu_dai->driver->cops->trigger) - cpu_dai->driver->cops->trigger(cstream, cmd, cpu_dai); + ret = snd_soc_dai_compr_trigger(cpu_dai, cstream, cmd); + if (ret < 0) + goto out; switch (cmd) { case SNDRV_PCM_TRIGGER_START: @@ -372,11 +373,9 @@ static int soc_compr_trigger_fe(struct snd_compr_stream *cstream, int cmd) mutex_lock_nested(&fe->card->mutex, SND_SOC_CARD_CLASS_RUNTIME); - if (cpu_dai->driver->cops && cpu_dai->driver->cops->trigger) { - ret = cpu_dai->driver->cops->trigger(cstream, cmd, cpu_dai); - if (ret < 0) - goto out; - } + ret = snd_soc_dai_compr_trigger(cpu_dai, cstream, cmd); + if (ret < 0) + goto out; ret = soc_compr_components_trigger(cstream, cmd); if (ret < 0) diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index d5cb8b0853a7..844b52528174 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -526,3 +526,16 @@ void snd_soc_dai_compr_shutdown(struct snd_soc_dai *dai, dai->driver->cops->shutdown(cstream, dai); } EXPORT_SYMBOL_GPL(snd_soc_dai_compr_shutdown); + +int snd_soc_dai_compr_trigger(struct snd_soc_dai *dai, + struct snd_compr_stream *cstream, int cmd) +{ + int ret = 0; + + if (dai->driver->cops && + dai->driver->cops->trigger) + ret = dai->driver->cops->trigger(cstream, cmd, dai); + + return soc_dai_ret(dai, ret); +} +EXPORT_SYMBOL_GPL(snd_soc_dai_compr_trigger); From patchwork Thu Apr 23 23:15: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: 192904 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 994B9C54FCB for ; Thu, 23 Apr 2020 23:23:06 +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 228ED20784 for ; Thu, 23 Apr 2020 23:23:06 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="YDV+1bD5" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 228ED20784 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 81D90169B; Fri, 24 Apr 2020 01:22:14 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 81D90169B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1587684184; bh=YDjttSrD8Wl65rrYVByJXLTQdrtCPaXTV1HTfuSCP6s=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=YDV+1bD56xnk8o8SsvvAmhRmDqn6HPTnS61m05zGU2mHID3KKB6jvazlisozgYVKR YAE9U0zWiMPUKQK36L9r3lbJ2BD9MAsaKskUBZvLebTEHDCMpSvcZPPgoCzsR09IzB AspkJ3iNsByN+utX3637kIVe45DTa4iO6Nx/lHwM= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 36261F80315; Fri, 24 Apr 2020 01:15:51 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 72844F80322; Fri, 24 Apr 2020 01:15:48 +0200 (CEST) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id F25B0F80315 for ; Fri, 24 Apr 2020 01:15:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz F25B0F80315 Date: 24 Apr 2020 08:15:40 +0900 X-IronPort-AV: E=Sophos;i="5.73,309,1583161200"; d="scan'208";a="45558079" Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 24 Apr 2020 08:15:40 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id D4FE4400C4F5; Fri, 24 Apr 2020 08:15:40 +0900 (JST) Message-ID: <87k125ssir.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 13/17] ASoC: soc-dai: add snd_soc_dai_compr_get_params() User-Agent: Wanderlust/2.15.9 Emacs/25.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") To: Mark Brown In-Reply-To: <87368tu75n.wl-kuninori.morimoto.gx@renesas.com> References: <87368tu75n.wl-kuninori.morimoto.gx@renesas.com> 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 related function should be implemented at soc-dai.c. This patch adds snd_soc_dai_compr_get_params(). Signed-off-by: Kuninori Morimoto --- v1 -> v2 - no change include/sound/soc-dai.h | 3 +++ sound/soc/soc-compress.c | 8 +++----- sound/soc/soc-dai.c | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 1a2ef3002b6a..ba48dc9d0a73 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -179,6 +179,9 @@ int snd_soc_dai_compr_trigger(struct snd_soc_dai *dai, int snd_soc_dai_compr_set_params(struct snd_soc_dai *dai, struct snd_compr_stream *cstream, struct snd_compr_params *params); +int snd_soc_dai_compr_get_params(struct snd_soc_dai *dai, + struct snd_compr_stream *cstream, + struct snd_codec *params); struct snd_soc_dai_ops { /* diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index 6d2a896b3dbc..031f7d95b112 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c @@ -544,11 +544,9 @@ static int soc_compr_get_params(struct snd_compr_stream *cstream, mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); - if (cpu_dai->driver->cops && cpu_dai->driver->cops->get_params) { - ret = cpu_dai->driver->cops->get_params(cstream, params, cpu_dai); - if (ret < 0) - goto err; - } + ret = snd_soc_dai_compr_get_params(cpu_dai, cstream, params); + if (ret < 0) + goto err; for_each_rtd_components(rtd, i, component) { if (!component->driver->compress_ops || diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index 44e754f03947..c06e510855f2 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -553,3 +553,17 @@ int snd_soc_dai_compr_set_params(struct snd_soc_dai *dai, return soc_dai_ret(dai, ret); } EXPORT_SYMBOL_GPL(snd_soc_dai_compr_set_params); + +int snd_soc_dai_compr_get_params(struct snd_soc_dai *dai, + struct snd_compr_stream *cstream, + struct snd_codec *params) +{ + int ret = 0; + + if (dai->driver->cops && + dai->driver->cops->get_params) + ret = dai->driver->cops->get_params(cstream, params, dai); + + return soc_dai_ret(dai, ret); +} +EXPORT_SYMBOL_GPL(snd_soc_dai_compr_get_params); From patchwork Thu Apr 23 23:15:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 192903 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 B6918C55186 for ; Thu, 23 Apr 2020 23:24:28 +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 461B42087E for ; Thu, 23 Apr 2020 23:24:28 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="idVxXC7L" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 461B42087E 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 A5489169B; Fri, 24 Apr 2020 01:23:36 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A5489169B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1587684266; bh=VIGUfkp36m6WNT5BbxKqxvdbPhnRWdNVN8M/CL9c5l0=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=idVxXC7LLRgXF9U+TzwwmhRVyp2e2nYIozJj2wijXMTJo+yA+KIzCuEzIVS2FN16w QCl3Z92IxsaidVTK2zXlXG3+aAeURP9LJ6XvTAmiuarVN7zlcguk/JjFtKYt4NsuqY EZkrotRMYTF1vaDgdfc/pBhzfNh/g0oDs68ztGkQ= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 32C4DF80339; Fri, 24 Apr 2020 01:15:56 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A9B01F80329; Fri, 24 Apr 2020 01:15:53 +0200 (CEST) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 9B66BF80323 for ; Fri, 24 Apr 2020 01:15:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9B66BF80323 Date: 24 Apr 2020 08:15:49 +0900 X-IronPort-AV: E=Sophos;i="5.73,309,1583161200"; d="scan'208";a="45558089" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 24 Apr 2020 08:15:49 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 7EDAE4111CD2; Fri, 24 Apr 2020 08:15:49 +0900 (JST) Message-ID: <87h7x9ssii.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 15/17] ASoC: soc-dai: add snd_soc_dai_compr_pointer() User-Agent: Wanderlust/2.15.9 Emacs/25.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") To: Mark Brown In-Reply-To: <87368tu75n.wl-kuninori.morimoto.gx@renesas.com> References: <87368tu75n.wl-kuninori.morimoto.gx@renesas.com> 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 related function should be implemented at soc-dai.c. This patch adds snd_soc_dai_compr_pointer(). Signed-off-by: Kuninori Morimoto --- v1 -> v2 - no change include/sound/soc-dai.h | 3 +++ sound/soc/soc-compress.c | 7 ++++--- sound/soc/soc-dai.c | 14 ++++++++++++++ 3 files changed, 21 insertions(+), 3 deletions(-) diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index 16dc9248f7f0..8101ec030e63 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -185,6 +185,9 @@ int snd_soc_dai_compr_get_params(struct snd_soc_dai *dai, int snd_soc_dai_compr_ack(struct snd_soc_dai *dai, struct snd_compr_stream *cstream, size_t bytes); +int snd_soc_dai_compr_pointer(struct snd_soc_dai *dai, + struct snd_compr_stream *cstream, + struct snd_compr_tstamp *tstamp); struct snd_soc_dai_ops { /* diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index d4b016d99e5d..062a8c521876 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c @@ -648,8 +648,9 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream, mutex_lock_nested(&rtd->card->pcm_mutex, rtd->card->pcm_subclass); - if (cpu_dai->driver->cops && cpu_dai->driver->cops->pointer) - cpu_dai->driver->cops->pointer(cstream, tstamp, cpu_dai); + ret = snd_soc_dai_compr_pointer(cpu_dai, cstream, tstamp); + if (ret < 0) + goto out; for_each_rtd_components(rtd, i, component) { if (!component->driver->compress_ops || @@ -660,7 +661,7 @@ static int soc_compr_pointer(struct snd_compr_stream *cstream, component, cstream, tstamp); break; } - +out: mutex_unlock(&rtd->card->pcm_mutex); return ret; } diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index bf52ecb26c0e..89fcf194c45e 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -581,3 +581,17 @@ int snd_soc_dai_compr_ack(struct snd_soc_dai *dai, return soc_dai_ret(dai, ret); } EXPORT_SYMBOL_GPL(snd_soc_dai_compr_ack); + +int snd_soc_dai_compr_pointer(struct snd_soc_dai *dai, + struct snd_compr_stream *cstream, + struct snd_compr_tstamp *tstamp) +{ + int ret = 0; + + if (dai->driver->cops && + dai->driver->cops->pointer) + ret = dai->driver->cops->pointer(cstream, tstamp, dai); + + return soc_dai_ret(dai, ret); +} +EXPORT_SYMBOL_GPL(snd_soc_dai_compr_pointer); From patchwork Thu Apr 23 23:15:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 192902 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 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 1F47DC55186 for ; Thu, 23 Apr 2020 23:25:27 +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 9E65F20784 for ; Thu, 23 Apr 2020 23:25:26 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=alsa-project.org header.i=@alsa-project.org header.b="Y/OIvGq/" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9E65F20784 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 EFF4C1699; Fri, 24 Apr 2020 01:24:34 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz EFF4C1699 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1587684325; bh=iT50qu++IxiQ32+Za2V7Wl/wSOEFtY8RmfJvW3WxFY8=; h=Date:From:Subject:To:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=Y/OIvGq/30MSGJdANS2GcTy+1oiY1rRZC4Ejf7r6ajqdabZsfJYJcWarL2Fi9cDLV ebPQ7XHyem7dIq1V8brQJmTn0STXqzIOYIWVPI1kU34MvtK89GVmxXR4PV2w348rme JrobldfnCa5VhJeRe0v6ydymIAXkErfX/fQ12m6A= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id ABC51F80343; Fri, 24 Apr 2020 01:16:04 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1458BF80343; Fri, 24 Apr 2020 01:16:03 +0200 (CEST) Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by alsa1.perex.cz (Postfix) with ESMTP id 76C0CF80336 for ; Fri, 24 Apr 2020 01:15:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 76C0CF80336 Date: 24 Apr 2020 08:15:59 +0900 X-IronPort-AV: E=Sophos;i="5.73,309,1583161200"; d="scan'208";a="45558102" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie5.idc.renesas.com with ESMTP; 24 Apr 2020 08:15:59 +0900 Received: from mercury.renesas.com (unknown [10.166.252.133]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id 17F964111CD2; Fri, 24 Apr 2020 08:15:59 +0900 (JST) Message-ID: <87eesdssi8.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 17/17] ASoC: soc-dai: add snd_soc_dai_compr_get_metadata() User-Agent: Wanderlust/2.15.9 Emacs/25.2 Mule/6.0 MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") To: Mark Brown In-Reply-To: <87368tu75n.wl-kuninori.morimoto.gx@renesas.com> References: <87368tu75n.wl-kuninori.morimoto.gx@renesas.com> 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 related function should be implemented at soc-dai.c. This patch adds snd_soc_dai_compr_get_metadata(). Signed-off-by: Kuninori Morimoto --- v1 -> v2 - no change include/sound/soc-dai.h | 3 +++ sound/soc/soc-compress.c | 8 +++----- sound/soc/soc-dai.c | 14 ++++++++++++++ 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index d21a2a33b7bc..2a0a5af1c1ae 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -191,6 +191,9 @@ int snd_soc_dai_compr_pointer(struct snd_soc_dai *dai, int snd_soc_dai_compr_set_metadata(struct snd_soc_dai *dai, struct snd_compr_stream *cstream, struct snd_compr_metadata *metadata); +int snd_soc_dai_compr_get_metadata(struct snd_soc_dai *dai, + struct snd_compr_stream *cstream, + struct snd_compr_metadata *metadata); struct snd_soc_dai_ops { /* diff --git a/sound/soc/soc-compress.c b/sound/soc/soc-compress.c index 01f10204efdc..1dd043e1e407 100644 --- a/sound/soc/soc-compress.c +++ b/sound/soc/soc-compress.c @@ -723,11 +723,9 @@ static int soc_compr_get_metadata(struct snd_compr_stream *cstream, struct snd_soc_dai *cpu_dai = asoc_rtd_to_cpu(rtd, 0); int i, ret; - if (cpu_dai->driver->cops && cpu_dai->driver->cops->get_metadata) { - ret = cpu_dai->driver->cops->get_metadata(cstream, metadata, cpu_dai); - if (ret < 0) - return ret; - } + ret = snd_soc_dai_compr_get_metadata(cpu_dai, cstream, metadata); + if (ret < 0) + return ret; for_each_rtd_components(rtd, i, component) { if (!component->driver->compress_ops || diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index 88990792fe49..8e5fe012aa1d 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -609,3 +609,17 @@ int snd_soc_dai_compr_set_metadata(struct snd_soc_dai *dai, return soc_dai_ret(dai, ret); } EXPORT_SYMBOL_GPL(snd_soc_dai_compr_set_metadata); + +int snd_soc_dai_compr_get_metadata(struct snd_soc_dai *dai, + struct snd_compr_stream *cstream, + struct snd_compr_metadata *metadata) +{ + int ret = 0; + + if (dai->driver->cops && + dai->driver->cops->get_metadata) + ret = dai->driver->cops->get_metadata(cstream, metadata, dai); + + return soc_dai_ret(dai, ret); +} +EXPORT_SYMBOL_GPL(snd_soc_dai_compr_get_metadata);