From patchwork Wed Dec 4 05:33:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengjiu Wang X-Patchwork-Id: 13893234 Received: from EUR02-VI1-obe.outbound.protection.outlook.com (mail-vi1eur02on2065.outbound.protection.outlook.com [40.107.241.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3CBB6183CC7; Wed, 4 Dec 2024 05:34:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.241.65 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733290464; cv=fail; b=AVB9g01tieIaovt75wTLEdFNQ1ufXx0E/qeJcUqQtkjWHL5/I1ekpOQ3/hGppRR3V2bSrOAWPzvRpmDlOAIIwn577xDpxHrWPTC5B0DtHC/OmuyFXlQstnf9IqYowuejgLIeCOYPvTKLOHFsK1T69zfgKqKFQDrabeHRBBmX9Lo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733290464; c=relaxed/simple; bh=qYZzVI0LlfJuMXguWOVx7jlkeVIN296ai7BfGvhMs2o=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=EvYg8tVcvws0058muZyo4oAxMq36rQgoSNQh4c+Re9Ye8Ynu6dfF7iCe5QTAexAuKoNSRSN+a5s+ucDI2QZWfYdzsnyMYF8vaBw7Bi4hCOFOaUKa3n2pcGAPT6HOxBiyeGnk1z5bh9d65DqCQZ/B+t/nWwM6ab2NaR+MPZRQTjc= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com; spf=pass smtp.mailfrom=nxp.com; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b=jP/kh9nu; arc=fail smtp.client-ip=40.107.241.65 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=nxp.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=nxp.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=nxp.com header.i=@nxp.com header.b="jP/kh9nu" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=F9KILMB0al4/D3kgexKkEaFYWiLMPiguKSvfACg/FLUpbYdEpwbccU/zLEwP+XazKflTqFxoDH1PPzhm2TV9CLW02w7DphtgBR2b89wNfes786Wh4BAWEbDpU177rCHWvecT57H/gUJH8/fGXwK0blWCopVipIln5t4JdowJgDlf77HTrLtqugBADYjWtG+t0DbUwbE75DbRY5ynSlM0+XPyCBwzJ15I7j3o1NN5BuG+wNbED8cTK77WIiFL9NPjFTOO9avd/P5Pcr4u3cHrGz2/dbyWLJ8BbXX56ftnCumsH4PCGLJO8Yu25JYy2ypEr9g5Kes9UE/gMoaHTNCwnQ== 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=AjqYSBEF+harWuyMeHZEqZwNJnm1Hy5T0NuzIdWBwpY=; b=IEM7ji+JEUGagAh1VN8ZXgA1mwZGNc8r2P6+z7Qu/tCAUMdX3CIuRkfqnrzHHBot+ZJDyN1qqnIGke/oUTeXShobCUf7kstJ6KNKaZjkgTgMaRE2zdxgoUjD2F8auefVxDSEjX79XxGgz3PFWj9JJOJUllJr2Su/JM/ZDUuQvYH3nnq/5fykRxcS6pGyE0bpkue9XAANR50xycBcSOSVxyu7AVxRBUikzJqTZJIW/NVV5XEJHqpfddV3imXSWVN75a+IA1oGruErAJ/egqjAGb5hjJNdFdJCUdS/R41l5E1jLwTRi3v2b43gLtnl8lszgMRzv6aa2BkZJBcQkuL30Q== 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=AjqYSBEF+harWuyMeHZEqZwNJnm1Hy5T0NuzIdWBwpY=; b=jP/kh9nub7rCx1B8G0XbBV9fqwNO+rht0nZ8CLZ12qXI+V+jrv0q7P1QzzK3TpTqBgryco33nDRwGDBDiWVKhToUswuFF1T+lDNsqE0SwdoWmmDnVO9BVEV/VqK8/uck7xUzKNSF5auEhy30KV8IcAYELSIDQBkty8K7NVezae8IsbXJqJLzezrpsD+6+AvtsEMkC56N0X25lrQF0/V3IZVtQjtmh7R18AeYRjiBhl2S0niD2OE0G7LARcX8YOVtDFDlvRvExhFLuQf5gV9E1PWDonvNzr3wTITP2czGIyDemjkjsizFjN1eU5fqa2PQ7hlAz9pbFIz81Cm/ihH7HQ== 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:20 +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:20 +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 1/6] ALSA: compress: Add output rate and output format support Date: Wed, 4 Dec 2024 13:33:41 +0800 Message-Id: <20241204053346.1865723-2-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20241204053346.1865723-1-shengjiu.wang@nxp.com> References: <20241204053346.1865723-1-shengjiu.wang@nxp.com> X-ClientProxiedBy: SI1PR02CA0039.apcprd02.prod.outlook.com (2603:1096:4:1f6::9) To AM0PR04MB7044.eurprd04.prod.outlook.com (2603:10a6:208:191::20) Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM0PR04MB7044:EE_|GV1PR04MB10125:EE_ X-MS-Office365-Filtering-Correlation-Id: 950fd5e2-f904-48f4-4283-08dd14254d9b 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: h69UwH6ua4v2khmkl1vFRu2SK+3YHxK1Haj2W2HuHwEMDhpF6cTxitDn/cMEeAX8SWgMwVTApKb82QUxjgIPKGTAdvTxkLf5VYMN4mil8ry66Ykl+2VJkqggzLjQyEddfY4goP3zmYRadnkaB2uKGaCLj9Izr04CgYkBYyR7IKAEkY9ODq3Lwhf8Bmb3KfjxE7ZIe3XnQdbBsKixrFQSUKF7qJ/QQ69Zd4ujZCmV7n7nsRgux7LfiuHM2Y8CfmvELD+iyh3w7O0UJNiuCrY95nosxG4B34wKqrRImzNQVMJufvf06mhv6Lqyz3HfQNc2leePc0hYFZ0H1IFlZnHAdkxuj2VjQiQWWBT8+B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= 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: st/eiY35kp1WjXx9q8KdMljVrgH+x2TEayXNB9QMRjOKM6cIdwE/hVi25bqAfhtXETjaByZaCKAB2rntk4Wn5RQb3mYpNurIrhJQUkwJvnnNhu0EiGJErrpOjHwHFxg4qN3apNojbLQa45WL/ekyTwt33zYxo/WtD9hAsbfem0BBHhPCR4rigKctfcooVzqQGTSp9u2PB5ojUNukX2IbkRdeqBTCwKpbHLKRY2c/8gNQ43WGocG/Oa5DtJluZzqcDYScGy3TgBM0dMOFihsca0m31vU0YfeCqw/vOZ1t65jQblSsOaY5drsCR/EBoSEKPWvYt+JpcIBsCYSEmToCSmAorVVSzBCxjiRBg01qmcSnuIRh63n5iaR29Prknll/X03jdBb79D1zG0igVPCIyjD1nVuLbr5oDI+ptj7Xi/qIn5qt0T78FWqc8PVm6fmE5G0OHPfeBmyWsMZf4QGehqM7qI+TUddPl+FKe1whcd4jsNoSUMz+bcL8jsixJKWjwQtIMrA18zAv8dXZ17P4LyLiZPBwA3pyZfogcjITWKxg/t8QBtNtB+tIMI2Ioi9iyBY4atRDFHzPQvu+HFOVS1+AG46NOeTomQOlfAqD8yqYWkeAWxDin5LPeUFB4X3ybb8eZHgFFHiOwXYZsA1PbHDhhouSYf3nD2WIzF3zdaJQc9Wxl9w2oQraO3ci3PIPv+dURJ7DNlwn4x3i9Wwf+COrClGwGW5PCBlO4zAvQcqdH2itTq7a5jlehiv6O7uOv+lLmgVv/ONi5/Zb5HdqxPXXIq2JODbfcOhFYnapWJ6wpxxo0jkeXnkTgSSDqekrVc6hcF5rKn5uqgHFw2rGJmnbd0G5Iy6l3o6ufEnCpwIgUrc8fUvucquAlS9FVIjw34hXn5A2Hbs4uOD1P6As8isCtahD9MQyehH2frdfbERAnc/kp1dnraZen6d7FxU3/3y+geA48VzqwC9H2SoikD2iYjv3yb5kwjYXRHfvjFNTQxsN3hHgHpkB6zyyZPqeUmB4ijPXyn5EpEo8rGtVODLeKDS0AmTVYrIS83cLDb4g2APDz6BMiy+K+mZHanO0cAheOXpvJafOcp76pEnA0walFN8M1ScIE/l9yLn/9GNi709eJCXXnMNbr1Ob6dGjPMl7kDSOhv7OAAE+B5rlI9LF9pkLPUBeZY5AxQfK+94vYZwNFXwiqe1TRyZg5n6iVfioQBB3bwVT8ed8Axw5zkJQhh/NISINBFkkQqubhD9a0PXgO2yK85gAhSn5qMd/pIF+G5sunyEQVZOGek9rpild2MmWz6/QNEKrpTp42Yuxv6pETcXgTs8TE4GFFSZyj7DHNNx7izmrtdzhjwfwZA9QpHfGxIci+EEbrRXIxbnNefKT/gNQU1eXwgysMcN+LnENHf8/REjnK7UT2oy+rejMpK2Y3pNsjknbhYkbACpeFF6PUOVh+yBgL3fejnrYsEQ0n5HGTnt+krfeIJ/Z8CKmtbsBAUUl/DzLuT04/SOLiS7tL2KIsAo5FsVS2r0OMXUbHQl+kkcrupUYprnDE3YdcZyzfhE9WVslxdzS9q4K8sJwX1scOmIjt8hkVRzv X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 950fd5e2-f904-48f4-4283-08dd14254d9b 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:20.7219 (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: yvsIYZTZfY9YjWM5wLHFhVIPGEWDpRe5fURSL4jSnsCszT5SwypJe5PM5CovdY7q11wHKIGS+/Dt6YlzGjq1mQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV1PR04MB10125 Add 'pcm_format' for struct snd_codec, add 'pcm_formats' for struct snd_codec_desc, these are used for accelerator usage. Current accelerator example is sample rate converter (SRC). Define struct snd_codec_desc_src for descript minmum and maxmum sample rates. And add 'src_d' in union snd_codec_options structure. These are mainly used for capbility query. Signed-off-by: Jaroslav Kysela Signed-off-by: Shengjiu Wang Acked-by: Jaroslav Kysela --- include/uapi/sound/compress_params.h | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/include/uapi/sound/compress_params.h b/include/uapi/sound/compress_params.h index ddc77322d571..bc7648a30746 100644 --- a/include/uapi/sound/compress_params.h +++ b/include/uapi/sound/compress_params.h @@ -334,6 +334,14 @@ union snd_codec_options { struct snd_dec_wma wma_d; struct snd_dec_alac alac_d; struct snd_dec_ape ape_d; + struct { + __u32 out_sample_rate; + } src_d; +} __attribute__((packed, aligned(4))); + +struct snd_codec_desc_src { + __u32 out_sample_rate_min; + __u32 out_sample_rate_max; } __attribute__((packed, aligned(4))); /** struct snd_codec_desc - description of codec capabilities @@ -347,6 +355,9 @@ union snd_codec_options { * @modes: Supported modes. See SND_AUDIOMODE defines * @formats: Supported formats. See SND_AUDIOSTREAMFORMAT defines * @min_buffer: Minimum buffer size handled by codec implementation + * @pcm_formats: Output (for decoders) or input (for encoders) + * PCM formats (required to accel mode, 0 for other modes) + * @u_space: union space (for codec dependent data) * @reserved: reserved for future use * * This structure provides a scalar value for profiles, modes and stream @@ -370,7 +381,12 @@ struct snd_codec_desc { __u32 modes; __u32 formats; __u32 min_buffer; - __u32 reserved[15]; + __u32 pcm_formats; + union { + __u32 u_space[6]; + struct snd_codec_desc_src src; + } __attribute__((packed, aligned(4))); + __u32 reserved[8]; } __attribute__((packed, aligned(4))); /** struct snd_codec @@ -395,6 +411,8 @@ struct snd_codec_desc { * @align: Block alignment in bytes of an audio sample. * Only required for PCM or IEC formats. * @options: encoder-specific settings + * @pcm_format: Output (for decoders) or input (for encoders) + * PCM formats (required to accel mode, 0 for other modes) * @reserved: reserved for future use */ @@ -411,7 +429,8 @@ struct snd_codec { __u32 format; __u32 align; union snd_codec_options options; - __u32 reserved[3]; + __u32 pcm_format; + __u32 reserved[2]; } __attribute__((packed, aligned(4))); #endif