From patchwork Fri Sep 6 09:43:51 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengjiu Wang X-Patchwork-Id: 826461 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 53FB7CE7AFD for ; Fri, 6 Sep 2024 10:06:11 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 03869E0D; Fri, 6 Sep 2024 12:06:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 03869E0D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1725617170; bh=oprBiJbOmM57+uomUsT/aqt1I09KfLq1/0x4hDMsuHY=; h=From:To:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=G2inICueSQrf+GIFp4qxnMe3Cgm/a0Zw51kgr9atgzC3DxHF53VkI/mRw8Z56hpEk CYY7vh/uRBYo4UbLvZ6IB/1EO9kfRAvwJTExFDVYRYuNkEUq0CCG2bM12WqO8TLU8w O1gs1hmWy00tNMojECOkdS4Ya1/8JFVP0++r9Jj8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id E3D8BF805B2; Fri, 6 Sep 2024 12:05:37 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 513A1F805B5; Fri, 6 Sep 2024 12:05:37 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id D6D34F8016C; Fri, 6 Sep 2024 12:05:33 +0200 (CEST) Received: from inva021.nxp.com (inva021.nxp.com [92.121.34.21]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 11963F80107 for ; Fri, 6 Sep 2024 12:05:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 11963F80107 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 3AF792018C6; Fri, 6 Sep 2024 12:05:31 +0200 (CEST) Received: from aprdc01srsp001v.ap-rdc01.nxp.com (aprdc01srsp001v.ap-rdc01.nxp.com [165.114.16.16]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 017362018CB; Fri, 6 Sep 2024 12:05:31 +0200 (CEST) Received: from localhost.localdomain (shlinux2.ap.freescale.net [10.192.224.44]) by aprdc01srsp001v.ap-rdc01.nxp.com (Postfix) with ESMTP id 309F1183AC0A; Fri, 6 Sep 2024 18:05:25 +0800 (+08) From: Shengjiu Wang To: vkoul@kernel.org, perex@perex.cz, tiwai@suse.com, alsa-devel@alsa-project.org, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, shengjiu.wang@gmail.com, Xiubo.Lee@gmail.com, festevam@gmail.com, nicoleotsuka@gmail.com, lgirdwood@gmail.com, broonie@kernel.org, linuxppc-dev@lists.ozlabs.org Subject: [RFC PATCH v3 0/6] ASoC: fsl: add memory to memory function for ASRC Date: Fri, 6 Sep 2024 17:43:51 +0800 Message-Id: <1725615837-24872-1-git-send-email-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.7.4 X-Virus-Scanned: ClamAV using ClamSMTP Message-ID-Hash: V4GJPMYUM3CMMHTFJM2ZPA7AWNRTRHDX X-Message-ID-Hash: V4GJPMYUM3CMMHTFJM2ZPA7AWNRTRHDX X-MailFrom: shengjiu.wang@nxp.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: This function is base on the accelerator implementation for compress API: https://patchwork.kernel.org/project/alsa-devel/patch/20240731083843.59911-1-perex@perex.cz/ Audio signal processing also has the requirement for memory to memory similar as Video. This asrc memory to memory (memory ->asrc->memory) case is a non real time use case. User fills the input buffer to the asrc module, after conversion, then asrc sends back the output buffer to user. So it is not a traditional ALSA playback and capture case. Because we had implemented the "memory -> asrc ->i2s device-> codec" use case in ALSA. Now the "memory->asrc->memory" needs to reuse the code in asrc driver, so the patch 1 and patch 2 is for refining the code to make it can be shared by the "memory->asrc->memory" driver. Other change is to add memory to memory support for two kinds of i.MX ASRC modules. changes in v3: - use Jaroslav's suggestion for header file compress_params.h (PATCH 01) - remove the ASRC_OUTPUT_FORMAT/ASRC_OUTPUT_RATE definition - remove ASRC_RATIO_MOD in this version because it uses .set_metadata() Will wait Jaroslav's update or other better method in the future. - Address some comments from Pierre. changes in v2: - Remove the changes in compress API - drop the SNDRV_COMPRESS_SRC_RATIO_MOD - drop the SND_AUDIOCODEC_SRC and struct snd_dec_src - define private metadata key value ASRC_OUTPUT_FORMAT/ASRC_OUTPUT_RATE/ASRC_RATIO_MOD Shengjiu Wang (6): ALSA: compress: Add output rate and output format support ASoC: fsl_asrc: define functions for memory to memory usage ASoC: fsl_easrc: define functions for memory to memory usage ASoC: fsl_asrc_m2m: Add memory to memory function ASoC: fsl_asrc: register m2m platform device ASoC: fsl_easrc: register m2m platform device include/uapi/sound/compress_params.h | 23 +- sound/soc/fsl/Kconfig | 1 + sound/soc/fsl/Makefile | 2 +- sound/soc/fsl/fsl_asrc.c | 179 ++++++- sound/soc/fsl/fsl_asrc.h | 2 + sound/soc/fsl/fsl_asrc_common.h | 70 +++ sound/soc/fsl/fsl_asrc_m2m.c | 727 +++++++++++++++++++++++++++ sound/soc/fsl/fsl_easrc.c | 261 +++++++++- sound/soc/fsl/fsl_easrc.h | 4 + 9 files changed, 1260 insertions(+), 9 deletions(-) create mode 100644 sound/soc/fsl/fsl_asrc_m2m.c