From patchwork Tue Nov 12 10:33:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "S.J. Wang" X-Patchwork-Id: 13872068 Received: from AS8PR04CU009.outbound.protection.outlook.com (mail-westeuropeazon11011061.outbound.protection.outlook.com [52.101.70.61]) (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 949CC2141DC; Tue, 12 Nov 2024 10:34:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.70.61 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731407678; cv=fail; b=f8e57uI5BvHNPJhPD2rUMZCYP0kBlQxdYWKs+zyVZj5nA39LOvR8V9UJEesG2yecM7bAYIpLvIjmwd/6+gzbWBo8WNpIVWJ/152NyfGG4GikCsmA12OCUN1HG0RdjmqN+DxtjXJ9q9KZvmE1e3uG4U+B4jp+AjEAqWPzkZuZovg= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731407678; c=relaxed/simple; bh=qYZzVI0LlfJuMXguWOVx7jlkeVIN296ai7BfGvhMs2o=; h=From:To:Subject:Date:Message-Id:In-Reply-To:References: Content-Type:MIME-Version; b=oZ6P3G69K2Xe2BYp0yvNQWdozU7GpYuSTPbHzFtV2tjM7Rs22Wi46b/g1eS4oR4c7MogROhMf7i02Oa77EqPs47wOHMw1fX58J8mzaK/NGtO2LHv/vlVEe8TEixqtuFR+eWjAyaQeUeQ+71/m/0szPdHACVuN+9FA0A7iPBVVo8= 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=GYoDKxjc; arc=fail smtp.client-ip=52.101.70.61 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="GYoDKxjc" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=VYV3mG2VLV9HwA6TBwMiEZ3zmGuhKKP0ggEhPrmlRZcvsibqrR3Veyz/K+RydZ9O3wtwbbrXLVRELINShX8e1o+pNafY7MTx5R7VPOZ8EkmO5Lqe+0pW9+jgz2ZWxqKeNDBvr2g3LE6EtjIn1t97SMTq3Frakv6ZT92mPmUax2XI7tONLcdA1CKYHzrhiWqMA/cWlgFaZi001fqFuFzKshK0q6KBz0qRdreTdQtAV4MOQfL+Hr7ZEGsmzWZznIIbr7BKIQBJlgReY3VaPKsqaQ6uwi0001MdTG7vR5jJihjQCwIUKW8cWJpIhUABAbg2e9LZqCd9eqKLdyAVuTdzZQ== 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=HGhNcD2pEv3Npvaw52caKJ3pO8fKRAGmvSw/2HO3CVeXxuzunEaKCw/EKgY2n1MhBG92yEu+BrOoD5lmwpuc1M4kGYg6wz+SAMnJvH8u8wjEJrzF6taHGvOxCyCH+G8bm/zda7qIxcATQ0FDqxUoKGsBQMQwl7izzr8Q6nd3TxJ7NcRM+A+f9iB5RC/1FJEs7oftgtJvX43l1YcV5UEoQCAwxnh1XcsBLFsWEieQzr1pqxZPVvnskT1bCeifHSzSCBhypnVW5mNie9cMmsp3cpqkgI/nKQqRvONdGy7erF54iZi+6EnT38Qddu479xNnMkk15mBEy0RmrQgT+pt+nw== 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=GYoDKxjcEqnwWPdFLOYv3vO9inHVQ/uNtTCy4xz1szTbRo9P3dtJqDobcWHKeRZY1+IYUXO/qwFE5bdJ7zkTi4UTjc34/bFm6fCfvRNgbn34oHALRh4kScGwzy9OsakaBv5gaYMhWwLlMxwehNGm26dCsivxza00IGk1+Tkch7/xCFN9d5RnY1D+swYL4x5LnCXNHmmIX5iSTqQCFhAeMsnnTEPTzF4bfA74F1NAWn+2RhzXxi4o0R93+IrHiLO8uL+dzf24SKXNsJPR4rvsITfbuWqGgLJn93pAgPqq61/eyBO7UOvKzVyZ9FPfSkkUCK56P+Q6fmWwm/HkHfRWKQ== 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 VI0PR04MB10757.eurprd04.prod.outlook.com (2603:10a6:800:26a::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.8137.28; Tue, 12 Nov 2024 10:34:34 +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.8137.027; Tue, 12 Nov 2024 10:34:34 +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: [RESEND PATCH v5 1/6] ALSA: compress: Add output rate and output format support Date: Tue, 12 Nov 2024 18:33:59 +0800 Message-Id: <20241112103404.3565675-2-shengjiu.wang@nxp.com> X-Mailer: git-send-email 2.37.1 In-Reply-To: <20241112103404.3565675-1-shengjiu.wang@nxp.com> References: <20241112103404.3565675-1-shengjiu.wang@nxp.com> X-ClientProxiedBy: SI1PR02CA0008.apcprd02.prod.outlook.com (2603:1096:4:1f7::14) 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_|VI0PR04MB10757:EE_ X-MS-Office365-Filtering-Correlation-Id: 81c18824-73df-450e-5ed2-08dd03059938 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|1800799024|7416014|52116014|376014|38350700014|921020; X-Microsoft-Antispam-Message-Info: a2Fdhskm0F5iJ3I+o0BY9PbAA5vNa4x0BCJXvDk/BjBZcGZUqBqBysaUdsQoY/mta+0F2gqZN/UdAQfUiZ7eBLHwV9qP25hseeTs/gD6Ae/4t70O+6oI/t7B687K8xViVvKMtlw39Tmjfva9uxpVvYK4/XndAKQVpzlZE4eexQHCLnF+MVjahWgpJWL5KDNsRYg6c8ejA3J5uM4VBsQWlQl8tw+Il9lm4oE85UduP589QXj30hK9irXGe9E+DTyORyOclH/n2PQpQ1p8zz38YKiXe2ilL9fzQz1UdZtDDq2ywHTHwC5rNS78Z8Q0ZfawPvbCdwnLeD9cmscvyfq73Wsl5k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P: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)(1800799024)(7416014)(52116014)(376014)(38350700014)(921020);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: sZCO1fSPm+6ysDW+51Xg5l+PvclR95FzkA3lZPsTra1vIBqSMOzuuYXESUjQKnw3nlq56TzyC2WQJao3NB9bVJPjWTrFWvalA3KYrJBNFi4kb91xoHslyv4BQwc8XPcONkm4lDoS8qCn2wpG+BCRW1PTXOSFs3eYcXz19SfQEaKSYxYEwGxzy2HLkn60ZitAVcLodcMLdLMB278aHGGdKDfsxEAHeI501dQSZVBdNsGXDcttrtEnxWuPdaXlvN2/QIZJcu4j1mG82+flU2Qhs/eh/ApDwXPh654nI//Eb/tckKws2DiK0whd4D6bRU7KYrAN76uj73LCiYVkiUxlpRMmaB2H7yl5lP0ZzDvIFpzmedWOKB0NoGGLksNv548a5zD365gl3iCZY2YSlia0Mt3CKcNFu9cduOMOK6rte49kxwW4w8mNWv3UOR1sXuwV5xXp+QCDlAliUIWdMiiC5xFGlEyUu9ZPQiymhT7uerUbq51iBFUi37daFX9SHonPnNQiAjFl4uKZIm/iM4qjTCGQisSXiijKefKmEe5rv2w4DVmObVplibF39IzMMI8AvQjnSxbPSJS0TuQH+BmZGUmNS75Uh1myzabnrPV9bgQDOI/jWpyzt/NeKUGm9n7Ju8uTQkA3TNOrpCUnsCIo4SVET6ejyX+5sm/wKAgyDUoJCsjXOiKLB1FAs0g4ketS7D51WCW6vgxPfunEQB1d3b5G9QI0tX4oF/QSPLiltBB7FLMbY4UnBHKjLyzYosUpoP+hEiv4vMLyC6cR0EmhVgS1Wrqgv4OKRxf/bsl+cyTs4SlkwJpGfui5LdR7sCbtAJEMrAU18Uta2Ox89qnzhHeDielB44ciwbixh59eZOcgLRH5/MaGCgfF7g6m9cjkGgMYFeRGv3cS9q/m8GUfpoqb+hUNmpqMEWnCj9mRSjJ3o56Vv1dhQ2eudaA2oTMD7NHUnhrzQmQUeZ5kL89TTrxnYR9YyVzS6f4gIYixQhAh1PwiN5q7mU4XewVnpSYeAMI9wtWBVp/eKkOYi/MHjp9Q9DQJQ7wZIOALz/S2yxFRcQqBtpNuDcCsMUTvJTi1vkunodpvUwm6h0jiEIRJI7aPqeQTVvn/fdfELCtjmYuz6pUWAXXqOknsc9Vc8QOF4aP2lX2nHzkvBR8j/jMbv8db6prI9CoZYopawZiJpXOmKJQjxrOeNgnJm2psJIfiwICTNK2rIf5s32Noikeo7Ix6cTv89+6+rogEZywGc5v/tkzSop9SgZqJR3MfezTcfYiW+KWpEvGMe6jTVcVoKLkuxVwu1VSXb1lKByxVuGc1/e6RSI+fxc5Pe24Pt98ABuKLXI7z8s4kTTneZcoF+2nymojFvhgt/9tWheMG+2JA8HNsy1m++6aFHYr4V+69R49O0fx7blvBOfChOcKODVDjDMFGbsRJkCbdmUO1xv8MI1VMPKufmhPLoTMERQejd3k0nwavh5/hjljE4+RhfdZEfWounm+5CDEeAgkwk9wy4RJS6QEBdOx3LJZRVDoPmQZ7lWjT0NETX4kh7bBL294PgQCrON9ZZJFtWzcSgRDqsQgbTHISxHkq/g7sUsim X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81c18824-73df-450e-5ed2-08dd03059938 X-MS-Exchange-CrossTenant-AuthSource: AM0PR04MB7044.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 12 Nov 2024 10:34:34.4181 (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: J45rSL1gCiEW3h6QPe1WlZxv4clY9XjTcTQxn0H7BNt8HShd3yHdyQV0HMTlsDX8u9hwX09XGPTfD5lsMdiUkg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI0PR04MB10757 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