From patchwork Wed Dec 4 05:33:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengjiu Wang X-Patchwork-Id: 847351 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 8132DE7716D for ; Wed, 4 Dec 2024 05:35:27 +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 8A2F8F51; Wed, 4 Dec 2024 06:35:14 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 8A2F8F51 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1733290524; bh=KMIul9Cn3g9KtMsUjvC+bK/PpNnEw8ZLa24rpFgBFso=; h=From:To:Subject:Date:List-Id:List-Archive:List-Help:List-Owner: List-Post:List-Subscribe:List-Unsubscribe:From; b=A+YVULOGfmHT8kywuJEvCcSiaOdqDZnMQvp6MBiBa6jjRNZdIo4gwCBdcZdqSGIqR vEZ3806O211vlEPlvmh7o405syrX5inSFT66RnFtlMGVQ6LE1XiDdC7tXy8pn1jBcs cs+n2uQKvATRl9tLAdl63TSiFuO5UdPixF4GT/hQ= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 27D9CF805CB; Wed, 4 Dec 2024 06:34:49 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id D73BCF805AC; Wed, 4 Dec 2024 06:34:48 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 3A8D8F8032D; Wed, 4 Dec 2024 06:34:35 +0100 (CET) Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2072.outbound.protection.outlook.com [40.107.20.72]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-384) server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id AF7BAF800E9 for ; Wed, 4 Dec 2024 06:34:32 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AF7BAF800E9 Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key, unprotected) header.d=nxp.com header.i=@nxp.com header.a=rsa-sha256 header.s=selector1 header.b=g+//8kOH ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=k48+VmI/jRwKcjQqVShEib5KhzwH7k4GpHp2tNUC2NC4kiAv1QR+svgoT9CCTld8uj9FMWfUi3irEGTKoqQ4SYNObac/CF8styx/2cU3+ziy8PVdUeyK7MRNJL0vR+808XVkv0o+EnD/6iY18S6ATPnDxjhpmujz32oNJa0jaBXLHVl6vH6eGd7WkHkt26hNRNqLMV5fNdSFlFdg2jizyOWITNO/v0r2EP2kTqACe9518XPvmO9BsRMMyLISn6gP5WE1u0tY7NAjP/CSQfBgZcdw+lnA5ZPAmB8LEXma1mppBzN8hvu+lmM2uvg9sb3DrKpyHT5n3rmwdxCt1rWr/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=8YyfDaq0FJyGSNVYxtX8WQCfTWhOPFrKKDVZIE93Ruw=; b=ETve6cUzp7rr51KHMXjmFy3CPqzJQhvqgzkZSmFYHZQUwH/WUvlu9XUCq33GHG0XdYxL+c4S/tuXkkcFOKRKCJ39df6gZYvcAwabAFA7h6bYg1TsLWsdsOQCR1dS9c6hA73OYBPpxI+Cm+4s/2r8NzCYHJtv59oj0NSVAynGojPiXJD+nSl617s1sQLG00VvkEG+C5T05atYW4lJflehBLy+MK15KBXvKZDUDVoJ5qVNpbaxjRjIewkxxHkNPcGiuqplrn4ljrQqUkjc3BHH7us/e7UTnSgkk1/PnqCvDFjHYg49uD/urUYqKAgm3byJKECboY8HBep32XcurGR3LQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8YyfDaq0FJyGSNVYxtX8WQCfTWhOPFrKKDVZIE93Ruw=; b=g+//8kOHB/0zQFHO8hTiq5jzphGLZ8KBWhFul7+1IAs0QGqFTVUCcWEtOk4TbH6jRVXD1Rp5Yc6CnGvViuCMo8GTFb7krO2fvtihGntaoE3NNzfvKTIhm75yKGT1Jn6vAKwuhhepkbKLrWJNxi2mvyHQ1zafEDAHrwYqixHNKBUvfOZ++6CXbMkPBk4/0sJcSbktsJWLyPwQHXogcIDXX7RbsG4fMYB/Cp4CYp0XPAJyVeq5X2XI7Kdtxngn0HRk0gcNF6yQe6+hw8e77y3Q2U73liRK+8o1Fu1cfJdlmfkwFyWGP+NaYp/3D7d17bqcv7Gyos4Vuej1WDulBNM0XA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM0PR04MB7044.eurprd04.prod.outlook.com (2603:10a6:208:191::20) by GV1PR04MB10125.eurprd04.prod.outlook.com (2603:10a6:150:1ac::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8230.11; Wed, 4 Dec 2024 05:34:16 +0000 Received: from AM0PR04MB7044.eurprd04.prod.outlook.com ([fe80::7be0:296:768c:e891]) by AM0PR04MB7044.eurprd04.prod.outlook.com ([fe80::7be0:296:768c:e891%6]) with mapi id 15.20.8230.008; Wed, 4 Dec 2024 05:34:16 +0000 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: [PATCH v5 RESEND 0/6] ASoC: fsl: add memory to memory function for ASRC Date: Wed, 4 Dec 2024 13:33:40 +0800 Message-Id: <20241204053346.1865723-1-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.37.1 X-ClientProxiedBy: SI1PR02CA0039.apcprd02.prod.outlook.com (2603:1096:4:1f6::9) To AM0PR04MB7044.eurprd04.prod.outlook.com (2603:10a6:208:191::20) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB7044:EE_|GV1PR04MB10125:EE_ X-MS-Office365-Filtering-Correlation-Id: ef48e3e2-d79f-4cef-a64f-08dd14254af7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230040|366016|7416014|376014|52116014|1800799024|921020|38350700014; X-Microsoft-Antispam-Message-Info: DzxOsPw7o5U34IYPwxm0Vjv9QsRnpXQn55cnem+m1+RZd0jU+CPR54eZdgH+z3fbGQSK/jWE43Q0mRp8eGDijNgsyoOZSt9Nk/GNkr5Qyjd3xOW1rM0r0BCxVLQDF00vAw1ZIL747tV1FWwQKxK++IxYwn+UPctpXoODQVjUT1nPZXkhEBUG+E+H9EK0f7RKvi8d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GWACojAXFb4GzHeDVkSi5YU0kaP7PgdP8LnGHMyAi1YCUP2JlKZ+RxkH2qhYxNytWS7YbCi4UsrEuKY5sHj+Te5ggYxc7TR4zPY7/OfLt/Cv5M3HLYDvu7hHJbEbsTQW19gTTqwYFO1ctmm2uEUDTrLf0/OkoKF6M0yvbArETypw9gk= X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:AM0PR04MB7044.eurprd04.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230040)(366016)(7416014)(376014)(52116014)(1800799024)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VXr8uuKpKWLBgN67qFZ5cWhe9b51dYrFS6N2fCYOiIgW52PnzVZIvi0vsf8BQYJ/Bp8BJUl7D3o1qlOniyd9/BY0SeCrz5I0lC+9L1sOQ9InPY8wLvoI7qUjRS96/6FUaA5UgVwtCTvo+IdykvUXK2to7zwIiYaPE9Nmlz92RHSv3Am0kzBDCdpvau4hIAFulKxrxiyMu4sIlebM4Ri/Avzkf/oznPNbl8r4ckofF4CBXuTQ6hqnO/NjERttCVh9qr7tYZ3KYr4YMVbzawoiKRqxTLWkfAtXOVde0ON0qyJ0hAwIn/JP/DNem2LFYLJQRjoMoRCI5Ynnb3VFmmiBf969Atl+732w8Ccz9m2ngm+7QNGD9LENu+31cP3pr+G1eI69ixBpQZfdGkhzMRVmY7pRsBL+mhrJ2xAdnADwM9da9cIp0ynckZEmLAkeOFNLTvx6slE9Hi36cC95FuVhef3CdiJ0+dlWhSLdTXTZiPfk3mKlwqRC2WNAmD4pABfr3QtDjrASaTolC9L3+5+X5ZWt3SuKty2ix9EMnbb9O5uRyvzz0UI/1e6+OS0eldaCEPF7dcK2jasZwims0zlvICW2CuzDospQkvzFIFvGWudjkDczXiMqEntd4aVY3G97dXRSSSykC8L4P5Z/Hm/hUjr+PnU4hxxG17sXCNGhBsey5PJrCqr/J4zRCXZYBqpErXxmzUOG1+7W/hDIxdDcOXoFV4J683Gk/BiGoyPwma1eHbAJkO700SNLfXO+jdpRJdK6fW0y0ZnfO2ahMa31MStzQTu6AEPp6hYPJIicEvTtKAWsUTxu63oBwlD12hDeaPbTwoI+DdIEStjHYFHC29jNrEhOmMmlo5j9UPCYxxCrd6Of1RFb4Ih3T6n78eUzzvb3iPQ6pEVXslwaPuySE0bZ5aTBe7Z5ewzscMKOGNwEAQbGgWxNCTX+50wsubO3Ql/9CpyqnFZZoLNXXVyhUjRyRW8HjrefSr67uOWhqNE5Yd2UGy9WzliGT5jrJ+0HIawbJZ/zhYnfRM4xommGehHeMwC6yM1qsBJRhLgHnAHriEX1GSJBpFUz3FXPC+p3mmNqmP4vgfyl0Gj1d/CbGBqLUWCof5C3/X8WSb9VreDzCLaLxbH1TT38qO8pZPBt3lTt74ltRZG68MhQLUXqNLksCpzVfhN2iIOEXrnasVpHQjkZGdT04yPT/Kw7ViRzJgnw2+3ZAIFcEcOXA1fJ7AyWy2hl6BJ1q2/uoB4GnodxPP+ADfuGjlVtMwGIQQXCKo9/zzCfB8IJPw+QIZ1pqMexO/7KQbLABBv6m+mjxneYVtDKVnrLTL9i1/9wIOk8XUxu0LaIWGaZjrnU/ZhDGGf+ny7mDifKb6Lf/z5+KFdn8IxvP8gE4TP0+yOd4CjUVkTNL5WjvPs3rhpLCnCl+nIsqhvK1nrMrGYDwaaDqj1DvQdymeE27i+xFPuvp79cje3fcTfT5ThsDhEbbVMixDAGkTp75IdDwSFznvrsKqDfKeK2PdPxCBTOafVmDhLY+ZWhMpvcS0PID0AOSMgqrzFSDuqbIpktyEV6iwNd2732E/BE5cfAo9h5c8BauViX X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: ef48e3e2-d79f-4cef-a64f-08dd14254af7 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB7044.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Dec 2024 05:34:16.2865 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 5pGuD3MAUQ+2ulGTuMdeGXOgw4f37+9HaczvpN4OecGcx6DR5uhST0I2E8FyPHzIzDfnPM9cANAtcpjgXixWYw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB10125 Message-ID-Hash: YQAH2ECMDTXLORRB7ORRSMQ6TRLKCHPC X-Message-ID-Hash: YQAH2ECMDTXLORRB7ORRSMQ6TRLKCHPC 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/20241002093904.1809799-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 v5: - Drop Jaroslav Kysela's patch as it has been merged. - Add Jaroslav Kysela's Acked-by tag, received in v3. changes in v4: - remove the RFC tag, no comments receive in v3 - Add Jaroslav Kysela's patch in this patch set. because it may be better for reviewing in a full patch set. - Fix the list_for_each_entry_reverse to list_for_each_entry_safe_reverse - Fix some coding style issues in Jaroslav Kysela's patch 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