From patchwork Thu Dec 12 07:45:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shengjiu Wang X-Patchwork-Id: 13904770 Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2075.outbound.protection.outlook.com [40.107.20.75]) (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 2E9F4185B72; Thu, 12 Dec 2024 07:45:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.75 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733989554; cv=fail; b=sW7ZgUiNYVP6eqhdVrmj3/HlwZsQ7Fwgo8wpGSDrcHxTZRmnXtFc3R3B6e4S6+swWBAQnjl6ypLKOVUy5ZjAVZOaySD7fNQ6WWN92ytTD6KROjwg6oolV1dGqwOEG7qU9f79b72/oLEJWRTHvc5qVr0D+mZsbsKsPzJJ9nzGd0A= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1733989554; c=relaxed/simple; bh=eaglozq8t0d4nlGcs6Y+qsEJTgvkUm23HBBmMfaan/Y=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=bUVifrogEAt6YcloavuIXHAtkY0hfl+QlNJE8hrnL15Sv/3RcKZPj/vcEdYDDTA8qD9sRuY0AH7d71GLeRYfO641GNnoMfEolkZdnxYdCqKbaD4nIhvJ/9rgerd6dIbfJrgzmk7u9JvCk0+By5Ya6/2hLYcafYkkJRyJ7uTff2E= 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=ZcStINzc; arc=fail smtp.client-ip=40.107.20.75 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="ZcStINzc" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=DE49PC8EEE5TWaJjIZc/DIov4DtY8fJ2kE5gzM+rHOJyurYL4Kv/zdK5o+bdwu9Ng2sNJ+qJfTCVys3HO0xHsqWy6fBKzMKJLzcSL20ZklYlYdflyeMD0QDmOXnOSfRunuyg2ZFBYiM72axhBtXldPWgc1JWxlZzDrRPdUk1Z2fxxCx5UdzjRMXjTd2DKeBggq8ZSdEdedh1x+3Tjnd9/bNPeKwVsd1Sh3C1gRSLPr2ro81ubCef/5gLRIPEN8cqTwaDPyLl6nCRkPHJFg63Y5/w7NuLMsUJGZzyPfZ5JHw/+qHen9efjGVWsMsDmN6uQ0kpvW9tl7+6KdBES20qCw== 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=9sWeVsIaATm7hVEpA/2OiVm3+pET2HYag/XaD38+9/8=; b=QpHj48hqXBLpdufMVPj1BD/bSw9vRaDhCXIRTWeG6hYParXQBaaLlFRR8umwMTizPFKAW8fc/G5eoxb+kLxKzFEXElK2kwbHSVu7QFshDFtW8iDP4kvq3XMOWTzvpprQvQUEFsU+vwFDUXiEBilWJjMA/G0vX3B7+31Lk4bDOum7S2VwKR2r39aLAFbXPHg8PGV9gp6ZPMbO7omm5f9o66ecC9z7KPTmsPnADAGD0e4Q7TkqQm7CO144PPfrHqU0GR5ZDtr+lQ3MlFu5rn+rQSxVuzWj8QOkDY7PqKzXuYbRuOAwwA4Vs2b1LMtlZCzRrUnZwngjkUiQEDceNCPaUQ== 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=9sWeVsIaATm7hVEpA/2OiVm3+pET2HYag/XaD38+9/8=; b=ZcStINzcOOCiRFMMx0ulV1yG5bLr0mZTgLjKwXcTjKJwvFtKl8yaaKXq2fOhqPbDX6uNP1qKymdBUwINH70EoWTRXUFfvhFEBAk8DNzymk8egChVFtjk4e7dkVIL0mlkuzrMZQ4teBouSZnUtcc9pZDFJpa0DLtlmYjok0ZukuDfTE+GwwRR10wVriBzjlnmjTy0lwDBeuj3+tIGdSCcI42HA/ULMFFa5iUD78TnSmKIpkpa1vhyaH9TgnPxOOHvo9yKoQIFtzPWMmusKclAq1E0iDLTyN3g0le9ZdrQyoupR0TcK0o1vCwIe57L//0aXFbqsf4Fo1V9FF0Kl8ESyA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from VI1PR04MB7055.eurprd04.prod.outlook.com (2603:10a6:800:123::21) by DBAPR04MB7256.eurprd04.prod.outlook.com (2603:10a6:10:1a3::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8251.16; Thu, 12 Dec 2024 07:45:49 +0000 Received: from VI1PR04MB7055.eurprd04.prod.outlook.com ([fe80::d6ab:1538:d868:bf8]) by VI1PR04MB7055.eurprd04.prod.outlook.com ([fe80::d6ab:1538:d868:bf8%7]) with mapi id 15.20.8251.008; Thu, 12 Dec 2024 07:45:49 +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 v7 1/6] ALSA: compress: Add output rate and output format support Date: Thu, 12 Dec 2024 15:45:04 +0800 Message-Id: <20241212074509.3445859-2-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20241212074509.3445859-1-shengjiu.wang@nxp.com> References: <20241212074509.3445859-1-shengjiu.wang@nxp.com> X-ClientProxiedBy: SI2PR02CA0053.apcprd02.prod.outlook.com (2603:1096:4:196::16) To VI1PR04MB7055.eurprd04.prod.outlook.com (2603:10a6:800:123::21) 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: VI1PR04MB7055:EE_|DBAPR04MB7256:EE_ X-MS-Office365-Filtering-Correlation-Id: 907e659e-7271-4a4f-866b-08dd1a80feda X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|1800799024|376014|52116014|366016|7416014|921020|7053199007|38350700014; X-Microsoft-Antispam-Message-Info: 9jkJKlJe1rysRsl4oGmvfLbjNiByny+P5lb6JJtG3qfa2TBMXgPQVLOgHyUcYbdrGr955mEMtFfjOX9O2sVb+oT5MTrSab6dOM+4xBCVM3bN+ICYi8z64HLfBTAjIJZp2AfYen60sLe0M6+LckUQvz16wveXZjsbljcTsb4Oqs+FSyx/8XxVcwMRoRCWw7wRWRn19Jr22uvWe/4OgOAWpoWKTnJe+kz3BGsZXJeeJXPmnKhB+Y/ZlUK6GDVCXGOJAr11Dxhm1D3dgfLLHjvVs3hB38NCFCXa91UOECVn+OVxb0R/oHUO0r8N5Bx7o7DNFLGrVp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dv/l27F5SnpAfGBBJwhhTd+Eo08v4hGD3vnPP4r2e3r1AeUxijWYuX6/Y= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VI1PR04MB7055.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(1800799024)(376014)(52116014)(366016)(7416014)(921020)(7053199007)(38350700014);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: C9ynaNiTja/6nQTJQmkmwZLXjZnhpEoiVxG1MFCI5WDq1w2g7WlUTB1VpWSeFemLDGrdDQejHAkMrOYO1QvA/0dywdQB1AJ1LaNStS+pM3BLgUEZqyQrxI9ALOIvU6/a80Pr0WP/xljFy06KnWsBrkZvbPPP7MN1J4OzJh9tv+x9HDF2KKAVWcfWy267UF523YBBwc5weUwycZtYNtQWFNi83Ghzd31bBb102S3hqA4XBWsehMX9/NkY4jU9SLxtI7rBusH/8oKpjY5RA+jb8HpkmK+BiYU2U3gRRZDSIiX60F82szFCXYUODu+EeO9M7ZHfqWtsbfPP8lE0KZnLHgcUeNdvPhxZ96M9NA6FF5W+r/W1ECbJy5E9WHMQqWke20WVqJxG+mtNIT2m9zyXS5GBMQLxs4da+N7L7RIkOGPaPTkAef1v5sxGomRcJDmYrnkJ05craiHD4U48Sde18jhP5SQfy9ZdB+NSz3jKPsxqG7YboMt7Xlq98HnwLbJqioFkb6ojz4OSDdvfrEEk6lRT3+8yHg3h0+xtOxBWGtW9YrYmGxsiJc6Bb/zB73O7i/3Z2QtbzuIH/IVYikfrPs6QxBDU+MYGPefh48gF12tcgAvmBiU3gjI0YLkt5NsQEQ3TpWbL9Ud420d6Fec6W/JMAd3hCG5fUn7eyD9bM58mJaaZVDnbt94LTqxSCK8xD6zwkj7R5cHPqE+ZIDSZWEairi3gUYhgdDZMApK+SpN0UmWNwApMrZR3JgT/0FH+x8QilvaIPWqrknGKEZiBAIAqBFpYWv/4nPhclyllEIEA72eOQmJW4a3sejUr/06wh2qawGIMpYAusRUNIRiuVflleSAHuth9cmHwoV3Vt8aP4NIr5LwsvtSumxJaaaOalF8uqujJ8dLv79Vq61gG4SN9QnmARGowo7+q7609LhNnCk1FRVuz43JhiHlvl6Q7jbKPo6OhRfYhjqSLE/PZNN7QAYYg8JXKVIvs3vrcK1Ue7sglQ3vMSbX7RSDaZ2rGfjgZbhVqf6s6hJCt5iiuDKzT4cxI3Isd1b5KMiznYNpGO65u43vAOeNghqn23uYsYGmpsHEOAGxmLZsRxSy8O4GMOH3eWYWaDKaNL4Tb+0+F2N3QTAlXoDpWhcw5AP8dcoWrQaZfmWgpVdZiDGDW2ih1d065Lsml5T2XhaOEWyGP3RjJwSJlSrmSrsJe2EgMX3QzZWmZCeSeMfNZVKxa+eDn+LufH07spbXU4NLJq/KrEKfj9J+bJ/7RKq9LNJlZIZ/FAO7m+4OKczxN+UpduW2xHfsHAKmb1unGDtHJJYesXfPYq0YRcPVSpZa29VfWGyvntVHalFJg1thxlnsyL0M6VKRa/xLv5pbPYcvdvgpa+/2eD17I25GSHj0gNEBX9HbAqHV/dKq/H2uuwjCwemfuprdSVBzd79TIHjDhfOs3yNS+1OagX+v15IAfui9qk7mrS11c0lSL6opEkK7f9dLOl7m4dQO/pRr8hAa48ohSAXjS+D0b+J8vt7owDbByC8ZDjNYG42z8Dc2GAF/uos+sn0zARWkn0t8xpxrwPAlhLVvpbBSbM7MxP3pUiVQn X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 907e659e-7271-4a4f-866b-08dd1a80feda X-MS-Exchange-CrossTenant-AuthSource: VI1PR04MB7055.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Dec 2024 07:45:49.2826 (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: zq7pepo/ltlCMBzm+qLCVLICoNiXWUBckZUl3uRwz69CWu6Bvo4djJ1bjNdcreWrCXy0w9P7EJathnTBY9n2Vw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBAPR04MB7256 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 Acked-by: Vinod Koul --- 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