From patchwork Mon May 13 00:31:41 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13662943 Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11010000.outbound.protection.outlook.com [52.101.229.0]) (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 CA4DE33F9 for ; Mon, 13 May 2024 00:31:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.229.0 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715560307; cv=fail; b=uylzN6tHELEtxAPsiKY2LcYKMcbUGxuSN2y/mmiqhlVveg7bBoYupyAhcm+Ozg7R9BL0+IDwit13sAyId7OylyifkcWWgRM7NPsTsLXtG/NgMh3jy6Nqai/lZsDzD/3idU+hZRKGSwrzclFm2L+kpbLnKOf1G0JkGZWFzOW4X78= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715560307; c=relaxed/simple; bh=UlHQyGTEM25XSr3p5+bW3CoQw0OnSzjELwKTZ0swvc4=; h=Message-ID:To:In-Reply-To:References:From:Subject:Content-Type: Date:MIME-Version; b=RD4CcI3NDu3W3LwNQXsYaf1Bn3JXr9ZzDQsv4O5CydQw6UqgWX2404ICdi7c/VPsVjWIzN1BC7GpqbTcHr5sRruMmWnFAd+QW+eFDgz49aVfFkqrRNF2Qa+80A2PkeQvkwwkslrvPZ6JEzVDuV8ID2vK0g2yB3TrzZrpXkWR8sw= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b=V4dYuym4; arc=fail smtp.client-ip=52.101.229.0 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b="V4dYuym4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WrQzMKbsrx/aKYTYwiIR8x4oCANS2ueTEw35j0K84w5QoZ6CohgNnFIAXr1nCqwYJaaEf8GpUq8/vOs88uKYfwcO9RMYwi0VEmMYoFYDR4zlIIbKWCLh/F6n4KHhr38oP9y3HWaXKiYg6CqpPPaZ0bQqZI//Osi/q4DR7cYMlpJr70AkysqbvpX9MnmZy3BOCQA17GhH8pK2WOxaIN+ZQXr4rPn97lj/WX0LCE+7Z4b84KjmHZvQ0C9kfRnbDy6v87Wf6xWcxYFwesRs5hYjZjr5ZnTLShxs2/8BeZbWrmNDKz7bXEeIdrckHUEgyqWZGpearoAC6zk9bnChH2rm6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=Wor7/TYJgKI18gNii8iNrsHIxBN6Y8ysM4fkY0I5Z34=; b=DQxUvRJFmsviBsNO6mNpVXeH2FMgBOvcStp7w4cF3vHiZ282VK+PQjqC2npFHBgaacfeRh4PKRPgwB6psdYs1Wz0iPb9AIniqFAn2e0glCFJoDWSKo5gMPb3wuSp77Y68YO6TXvlIJgTPI6jK526nnuiQe0daB6Aa8hToSpIWPZmFUwwXNHX3d7Dr9GvQUSBd7iCaqv7z/l/RZ3vXukv4ZHFOkJvPqbERwgFlKxcyiYnMQY+QpcfI5N2am9sBf/6M8bO/AD6M3XKtcl8uy1Q+Cdai+rJqUEehahY/rJGKWtlWECiq9kbDpo5V0iDqWfGfI9G4cyj7fRfUgWRNeFmFw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Wor7/TYJgKI18gNii8iNrsHIxBN6Y8ysM4fkY0I5Z34=; b=V4dYuym4NjwJWIF9LKAIK45SXcC0jIt72TBo+v1PNqgzKadPZWvTpWpNiGjyNngA0za2cX8qrEgLrAqGRWUPo5ALuU9uHRb7O1DZGslkYcFkjRMF/QaQ0nvnaPw9Wpd05jEZzCIEixAQhA6xrB9o5mLLGvn68UlTShwvemQxfW4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TY3PR01MB10906.jpnprd01.prod.outlook.com (2603:1096:400:3af::14) by OS3PR01MB7383.jpnprd01.prod.outlook.com (2603:1096:604:14a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Mon, 13 May 2024 00:31:42 +0000 Received: from TY3PR01MB10906.jpnprd01.prod.outlook.com ([fe80::592:9b7b:ef57:2dd8]) by TY3PR01MB10906.jpnprd01.prod.outlook.com ([fe80::592:9b7b:ef57:2dd8%4]) with mapi id 15.20.7544.052; Mon, 13 May 2024 00:31:42 +0000 Message-ID: <87msouzh5e.wl-kuninori.morimoto.gx@renesas.com> To: =?iso-8859-2?q?=22Amadeusz_S=B3awi=F1ski=22?= , Alexandre Belloni , Alper Nebi Yasak , AngeloGioacchino Del Regno , Banajit Goswami , Bard Liao , Brent Lu , Cezary Rojewski , Charles Keepax , Claudiu Beznea , Cristian Ciocaltea , Daniel Baluta , Hans de Goede , Jaroslav Kysela , Jerome Brunet , Jiawei Wang , Jonathan Corbet , Kai Vehmanen , Kevin Hilman , Liam Girdwood , Mark Brown , Maso Huang , Matthias Brugger , Neil Armstrong , Nicolas Ferre , Peter Ujfalusi , Pierre-Louis Bossart , Ranjani Sridharan , Sascha Hauer , Shawn Guo , Shengjiu Wang , Srinivas Kandagatla , Sylwester Nawrocki , Takashi Iwai , Vinod Koul , Xiubo Li , alsa-devel@alsa-project.org, imx@lists.linux.dev, linux-doc@vger.kernel.org, linux-sound@vger.kernel.org In-Reply-To: <87o79azh65.wl-kuninori.morimoto.gx@renesas.com> References: <87o79azh65.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 1/3] ASoC: soc-pcm: Indicate warning if dpcm_playback/capture were used for availability limition User-Agent: Wanderlust/2.15.9 Emacs/27.1 Mule/6.0 Date: Mon, 13 May 2024 00:31:41 +0000 X-ClientProxiedBy: TY2PR01CA0012.jpnprd01.prod.outlook.com (2603:1096:404:a::24) To TY3PR01MB10906.jpnprd01.prod.outlook.com (2603:1096:400:3af::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TY3PR01MB10906:EE_|OS3PR01MB7383:EE_ X-MS-Office365-Filtering-Correlation-Id: ead90118-5c88-4a12-4f62-08dc72e40f9e X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|7416005|52116005|366007|1800799015|921011|38350700005; X-Microsoft-Antispam-Message-Info: MBZc40RiqLbvQ7qn5T2LJl/nD+/w8nr3Tw7/Gaf0PwTNBouP5H2iprlneELnGN/7g2rYQByj9XtzjQMPqOtlmWkSa/rAZh5t4+3JjzuwzOAciDTdS4oDFDHc7aM0HYz679TetQ6BoPQul9pGthN1O9NeIAxTKQ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HJ13PdQPKZPsI9NDFDOEGDNB9POF/oMZ1ecbyXGAx1lnczu1PXjHvT8l9aHF48Qxuwn8TGUY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TY3PR01MB10906.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(7416005)(52116005)(366007)(1800799015)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: H2ygjSpWRV5kzSBkE38BxWsPfWQgnxSALgAKRFVnRs6nz3s8RQI8F5ikobwQuPZLKxWhQPM/b2E51OOS+NJA+ZuS93YSYYCpXHYPSsJ2dvcuuFe5Frxo9+7v5wYrkd3fnjgi8veiHJ6xZ0n/EG55vE3heNF1VawbCEqMrCC1zLLp1KPB1cpPjtzC8R2SujdRYcxxcrDTXPQLMnZ9ltiBZm7TEaKikab0G0CRLYvDR4MXV+WDUne+14Bajfdykr5tusPxk4I+lQWvwapUhvvUtnBcde8ndOfE+bzJPmgMq2edm9hQaWGr8Lflp4CJ/aKlmGGYEQBRyZU0UhFX/Z1shCP1FMUppGbTHujmk8rTOmd8TF/kw8mi8Ik0VKWEEJlRn7r8JUQLvKDTzyw5dOUhZN5nwlPQ9FEC5QR+kELR0uzOU3dO/R6uiXu01GByaMHwcicGB9mdlhMlhDli0xqLuSc4XFYxbRXPxWldH2vP1WMQYD141F9pzwMAvWJn8xGA494RNQURdGpHw88LYGJQKp1vgFkjSBMDSySpVI9CoCJL1883nciSVg4UENxklbhlORwX6W/E3dq8yr2L7lX1sxB0EbG2+UlbHBp4vj/4EKceMmHKYRWaUgodKj9ISkxHDoDAcWGxy4ddP5PLiiLnH0hjEyomZp+vJ2mo40HqU/Dp1YsUHEs+Nj6U0WIVaZsbVrGgrU16jMBTYwnyQs5McrB628JyV9fanB7XeFngRfk2asxyyNYR5fQOS1HEPLh+8+s847EGZp5d0MouCfbmt9Lbwr+3xHUlkD+Vbib5mue8TU63O2nkOlj/dI9X+4ao90wSy3uxoVvlcxcXj2W7wNH+EfCpQT+RK+oFDT7yrltYd7NSYQQjQnEL2Mgr0Lwzds5rxxI9z7ygVsAWtHbX20YhWUdhbqPQpaX4PDchjJQthetaERp/Liqj845VXWh1mLKVMhI9/UzP7s2bxDTjI0Z8Rrwh/U7gNwJiNfe0JLXbxabfFsBmHqS4EMMNE0ERWn/WAqXSNE5XmvytncTYbx+mjjW02dNdqWYlOXf4eHRGge5IwNw8z0I8YEIE4eriMCGd0J/ztpfgJiCXp/Z/mryJJDP7Orf6kd8BOI3KrRGc9xg7RNHSFsFyJv0QlGNmqxtLVuWx9cdv/wfa8bpTZ8XpvIM1FJebANdQuiMgy4Me3FrqXCNVei4PUCsTVIU/qlciy0EGil2wH+DqAoXbDlr444VGLOERr2TWP3oLk+Kae8fU+RuwOWEb81TY0HKqn4o+N1kBw60hfwgEFUQWewBZ0JxMraEztgNrmbpbPfKBVFvQJAmDWxNGmm1JeSZDffO0Fsj4L3IkqhuhOL0ZOV0zHacnL8Idiu+soem2EYk6K6xr7XRW+o48oReNNnrdBa6SulJon7RZd9l3sO4+QR0S3iqwwc4wNzv9T6w4UEv8E6Pyt+Ov1kdmrbqQRnmZYtpg6mhdaAsMd5E+t/RYSJOFoAzfC3sQG9wtQbUDcqn4yUN5SKpRKg1lmLJLJDBtsVFBV93esRqwSdnBNl6ByD9teLbcNAyMHLyYQbuIP9fBIOyD0nN4EkayuQa9SoA7sWHKmeMYVIaYtM1AVLnqqcz8PDbDz6eziBHoVXD1ELw= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: ead90118-5c88-4a12-4f62-08dc72e40f9e X-MS-Exchange-CrossTenant-AuthSource: TY3PR01MB10906.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2024 00:31:42.0678 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KIK+byGFdr54IC8Y7wiRtWmpusDHVN0asR20qXxUMF93kklelOvHq7z3rU/EKvVtk4ogGpOh0651rN6fVXTPMIDsMfLxp3xYL1kB9lfTYooW/d4uK2UWjO2hBLW2Q5jb X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB7383 I have been wondering why DPCM needs special flag (= dpcm_playback/capture) to use it. Below is the history why it was added to ASoC. (A) In beginning, there was no dpcm_xxx flag on ASoC. It checks channels_min for DPCM, same as current non-DPCM. Let's name it as "validation check" here. if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm) { if (cpu_dai->driver->playback.channels_min) playback = 1; if (cpu_dai->driver->capture.channels_min) capture = 1; (B) commit 1e9de42f4324 ("ASoC: dpcm: Explicitly set BE DAI link supported stream directions") force to use dpcm_xxx flag on DPCM. According to this commit log, this is because "Some BE dummy DAI doesn't set channels_min for playback/capture". But we don't know which DAI is it, and not know why it can't/don't have channels_min. Let's name it as "no_chan_DAI" here. According to the code and git-log, it is used as DCPM-BE and is CPU DAI. I think the correct solution was set channels_min on "no_chan_DAI" side, not update ASoC framework side. But everything is under smoke today. if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm) { playback = rtd->dai_link->dpcm_playback; capture = rtd->dai_link->dpcm_capture; (C) commit 9b5db059366a ("ASoC: soc-pcm: dpcm: Only allow playback/capture if supported") checks channels_min (= validation check) again. Because DPCM availability was handled by dpcm_xxx flag at that time, but some Sound Card set it even though it wasn't available. Clearly there's a contradiction here. I think correct solution was update Sound Card side instead of ASoC framework. Sound Card side will be updated to handle this issue later (commit 25612477d20b ("ASoC: soc-dai: set dai_link dpcm_ flags with a helper")) if (rtd->dai_link->dynamic || rtd->dai_link->no_pcm) { ... playback = rtd->dai_link->dpcm_playback && snd_soc_dai_stream_valid(cpu_dai, ...); capture = rtd->dai_link->dpcm_capture && snd_soc_dai_stream_valid(cpu_dai, ...); This (C) patch should have broken "no_chan_DAI" which doesn't have channels_min, but there was no such report during this 4 years. Possibilities case are as follows - No one is using "no_chan_DAI" - "no_chan_DAI" is no longer exist : was removed ? - "no_chan_DAI" is no longer exist : has channels_min ? Because of these history, this dpcm_xxx is unneeded flag today. But because we have been used it for 10 years since (B), it may have been used differently. For example some DAI available both playback/capture, but it set dpcm_playback flag only, in this case dpcm_xxx flag is used as availability limitation. We can use playback_only flag instead in this case, but it is very difficult to find such DAI today. Let's add grace time to remove dpcm_playback/capture flag. This patch don't use dpcm_xxx flag anymore, and indicates warning to use xxx_only flag if both playback/capture were available but using only one of dpcm_xxx flag, and not using xxx_only flag. Link: https://lore.kernel.org/r/87edaym2cg.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Kuninori Morimoto --- include/sound/soc.h | 1 + sound/soc/soc-pcm.c | 65 ++++++++++++++++++++++++++------------------- 2 files changed, 38 insertions(+), 28 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 33671437ee89..2a3da1d91377 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -815,6 +815,7 @@ struct snd_soc_dai_link { /* This DAI link can route to other DAI links at runtime (Frontend)*/ unsigned int dynamic:1; + /* REMOVE ME */ /* DPCM capture and Playback support */ unsigned int dpcm_capture:1; unsigned int dpcm_playback:1; diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 711b2f49ed88..c4d80cad5982 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -2795,6 +2795,7 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, { struct snd_soc_dai_link *dai_link = rtd->dai_link; struct snd_soc_dai *cpu_dai; + struct snd_soc_dai_link_ch_map *ch_maps; int has_playback = 0; int has_capture = 0; int i; @@ -2805,43 +2806,51 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, } if (dai_link->dynamic || dai_link->no_pcm) { - int stream; - if (dai_link->dpcm_playback) { - stream = SNDRV_PCM_STREAM_PLAYBACK; + for_each_rtd_ch_maps(rtd, i, ch_maps) { + cpu_dai = snd_soc_rtd_to_cpu(rtd, ch_maps->cpu); - for_each_rtd_cpu_dais(rtd, i, cpu_dai) { - if (snd_soc_dai_stream_valid(cpu_dai, stream)) { - has_playback = 1; - break; - } - } - if (!has_playback) { - dev_err(rtd->card->dev, - "No CPU DAIs support playback for stream %s\n", - dai_link->stream_name); - return -EINVAL; - } + if (snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_PLAYBACK)) + has_playback = 1; + + if (snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_CAPTURE)) + has_capture = 1; } - if (dai_link->dpcm_capture) { - stream = SNDRV_PCM_STREAM_CAPTURE; - for_each_rtd_cpu_dais(rtd, i, cpu_dai) { - if (snd_soc_dai_stream_valid(cpu_dai, stream)) { - has_capture = 1; - break; - } + /* + * REMOVE ME + * + * dpcm_xxx flag will be removed soon, Indicates warning if dpcm_xxx flag was used + * as availability limition + */ + if (has_playback && has_capture) { + if ( dai_link->dpcm_playback && + !dai_link->dpcm_capture && + !dai_link->playback_only) { + dev_warn(rtd->card->dev, + "both playback/capture are available," + " but not using playback_only flag (%s)\n", + dai_link->stream_name); + dev_warn(rtd->card->dev, + "dpcm_playback/capture are no longer needed," + " please use playback/capture_only instead\n"); + has_capture = 0; } - if (!has_capture) { - dev_err(rtd->card->dev, - "No CPU DAIs support capture for stream %s\n", - dai_link->stream_name); - return -EINVAL; + if (!dai_link->dpcm_playback && + dai_link->dpcm_capture && + !dai_link->capture_only) { + dev_warn(rtd->card->dev, + "both playback/capture are available," + " but not using capture_only flag (%s)\n", + dai_link->stream_name); + dev_warn(rtd->card->dev, + "dpcm_playback/capture are no longer needed," + " please use playback/capture_only instead\n"); + has_playback = 0; } } } else { - struct snd_soc_dai_link_ch_map *ch_maps; struct snd_soc_dai *codec_dai; /* Adapt stream for codec2codec links */ From patchwork Mon May 13 00:31:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13662944 Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11010000.outbound.protection.outlook.com [52.101.229.0]) (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 365BA7484 for ; Mon, 13 May 2024 00:31:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.229.0 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715560317; cv=fail; b=cFeJgEOiCH68aLxCZH1P0cTPvthoGgixsL4Ocrmk5GWh08MDL9KXG/irGh0uRma3TMD3AONbYfC50MIwOLlOGLp0FLnRF1nAn1DjAY96lm3v0dFG8VghkHfinIv8gxQfpsO++94STbXRnWoXV763N4EHFe3Ek0QvcUKU5VxCCH0= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715560317; c=relaxed/simple; bh=LpEgflAnaRpE4Ou+VTtJmDUg1kREtmzu8AUQFFn+8ks=; h=Message-ID:To:In-Reply-To:References:From:Subject:Content-Type: Date:MIME-Version; b=L4CG218W02QUpYitQ3jtjZnoFR744Oznl+jgitobSCA0LqKqww2PZViWx7gPgrnq0iYdOdcxgv042rIHvsiMbzPzj1E47PtmuTOCmcuK10EPdksptuXXiIxTNDjtHF9+s1SWPkYIIJrsOhiBz+2cI1XAnO1LS8lDeg8m8Svs4JY= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b=D7P6XUJx; arc=fail smtp.client-ip=52.101.229.0 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b="D7P6XUJx" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=b//KgNpYaCSclrhrLVDUcST1F4Mt9rptDZUrO0PavInZR5Pasr1KfhFOApX9NcRq0a6IrSskPCr4yv9KREfOCrfYQsaxYRR8HlDXEY2da1wnaJJmv/xNY/9axyIgk8g0WwVtf/8VSFCq0L+H8WUtCj9J1ratWXAj5zicBR7s8UL8pO6EEENq5SoCX/Ss/nbohKeN6Wx6Hv4VCaNMfxjOp7rdoLYl7UD9wNZWxmv30r5BGgQYBdBiqA7kvyFLLwXbXotqneWOqZqMLhaUNsXedESTU6gZ8P53quWipw7eMpLMJQ0k/koA3ofCaEDx91w8nSAJlDuaX7pl5lv9SQeWyQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=N891GCPkFOK6Q9TdgM4xmubqMKrzaFgOQMTodNvQuvs=; b=nWVOPNesCc/BwtK1UhAK06jHit/N1WWmryBHgstY7Sl2iQMLSb+VUlTwnipFvkg2Y2LlbP3T8upSychV04W+t1b3OC6z2Hn7AtvU83blw84bPC3PLs33628vZBEkAPR6HnqbhyKV4p2ZFU2mkn4hoVWyhdAEv/8IlMZa+Od8ZYw70d/dDPUosjaKmzCyX92J0iNWlgbvIAlbc+xn3y9xwrQ8XKWNyUKjqKr0zh//KpFJRR+yHhABmr/Fgddv9g8GdJX9GYZhsFA7H7D71smCEm8Aj9K0/OQLU9EurTcte2bnyHGt5/ZpmEfprqlkvFvEOew7T1eQCiKsfaiKE4IL8w== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=N891GCPkFOK6Q9TdgM4xmubqMKrzaFgOQMTodNvQuvs=; b=D7P6XUJxdq/970h3pqbx4nNnC7m6iUWrjo3ByFKe0oFhYYuUWaF3iw0rOhwaqtfMfHxI3ZPbEzcFfYI2Yixu6/3TcFM++BjKDNK2MarIflhzUrTA9+Cofqn3BuqKRUzS8dCBsINiOeq8ODeF/ThYgHZumF0tEIdIWPBCC7d1gog= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TY3PR01MB10906.jpnprd01.prod.outlook.com (2603:1096:400:3af::14) by OS3PR01MB7383.jpnprd01.prod.outlook.com (2603:1096:604:14a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Mon, 13 May 2024 00:31:52 +0000 Received: from TY3PR01MB10906.jpnprd01.prod.outlook.com ([fe80::592:9b7b:ef57:2dd8]) by TY3PR01MB10906.jpnprd01.prod.outlook.com ([fe80::592:9b7b:ef57:2dd8%4]) with mapi id 15.20.7544.052; Mon, 13 May 2024 00:31:52 +0000 Message-ID: <87le4ezh53.wl-kuninori.morimoto.gx@renesas.com> To: =?iso-8859-2?q?=22Amadeusz_S=B3awi=F1ski=22?= , Alexandre Belloni , Alper Nebi Yasak , AngeloGioacchino Del Regno , Banajit Goswami , Bard Liao , Brent Lu , Cezary Rojewski , Charles Keepax , Claudiu Beznea , Cristian Ciocaltea , Daniel Baluta , Hans de Goede , Jaroslav Kysela , Jerome Brunet , Jiawei Wang , Jonathan Corbet , Kai Vehmanen , Kevin Hilman , Liam Girdwood , Mark Brown , Maso Huang , Matthias Brugger , Neil Armstrong , Nicolas Ferre , Peter Ujfalusi , Pierre-Louis Bossart , Ranjani Sridharan , Sascha Hauer , Shawn Guo , Shengjiu Wang , Srinivas Kandagatla , Sylwester Nawrocki , Takashi Iwai , Vinod Koul , Xiubo Li , alsa-devel@alsa-project.org, imx@lists.linux.dev, linux-doc@vger.kernel.org, linux-sound@vger.kernel.org In-Reply-To: <87o79azh65.wl-kuninori.morimoto.gx@renesas.com> References: <87o79azh65.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 2/3] ASoC: soc-pcm: Indicate warning if CPU / Codec availability mismatch User-Agent: Wanderlust/2.15.9 Emacs/27.1 Mule/6.0 Date: Mon, 13 May 2024 00:31:52 +0000 X-ClientProxiedBy: TYCPR01CA0164.jpnprd01.prod.outlook.com (2603:1096:400:2b1::19) To TY3PR01MB10906.jpnprd01.prod.outlook.com (2603:1096:400:3af::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TY3PR01MB10906:EE_|OS3PR01MB7383:EE_ X-MS-Office365-Filtering-Correlation-Id: 662768c2-0b69-44b1-6f0f-08dc72e415de X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|7416005|52116005|366007|1800799015|921011|38350700005; X-Microsoft-Antispam-Message-Info: HVcToIRM7Yr4ByKjWaLSPjxPaqqlo5qYDS3ZnM+Tq7+TfEmaCuvfFjngHWOC3meHaLNrLbhtIwA2ToF6XutYCcohtUTooKgjnljATIsng061q34mKdgRdLk7GxWN94Rxp5DR1/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wWwlkvvPBpi4XrpmZhFi1tOm5URFAu3LehnWFr0zu2W5EAy1eajMR9mJcs44CfdRr54LncI93uydYxVOvuS/DpJBNfn5/JXckXWB/IJaIcCR5GuOvK4GTGDiiy7ikUxb4n7OfyHCRHvm2f2W7w7V5On69U4fw== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TY3PR01MB10906.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(7416005)(52116005)(366007)(1800799015)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: ul5/+qExd20JVhzC9FU/8M63tteuJHVRSuuro4wAardI8xz/Nq2OhuCaivzuhSyxPs7fTcS/OGqRLYnCnGil/VhsHtXwWRamflvGoIXSy2ikil6CRGj2XbXGCCJ/XzWUlOQDnayK+oiqsgd4/AX2b/zgaEmqOxlp8ct2wqX0icD8VJiEWtuuDxdcAOqc/zJDJO2TkAzaKH47liJ2fm1mBrKACYIsJ/pHu2WbQSw5mnAgG0HzPBNe+P65y4rInGzkh+fjxgZUq+78laH3FBvHLSI5q1UcgE6GSRUqGCCyRTyV7CCMY2nr6b3kRhJZMeQU1dbQbN00xnaYk2bqIjesr5PTss7rNSHXvgqMhpADJDdey3Wa9Bw+B3mhEJzN54LuBhltRsmGf158VfHKQWVArU+JCqEUEnpk3FK24z0uJod2Etf+uH9/ZGZbGrOP/obXaDGY9woOYbvVV/b5Nn9XvK0excPJdjT/6gyPF6X+fqyr5HvV0Wwf0nxQq9WNDSgb4NG1hdKPDcVWzu5RByYmw1gb5w6AzI6z/Hgnpfm/jRrQviEAjcLiKWDxAf+or8/oF27s4Bo9xnOmJB2bObFPAX8ZuWT9cWRmAHu3y3avX4jzfgzhSZOfWF4EI7tdKmx1kh3T29Br85nPxisJFN0DVzNNYGwwpNob1B1/MAIwsLOgeVrBJJLvtopRpQBqGtCkakHIG9ZsXnMKZpN0Eu+j3vWmW3j/x0r6uuD4SlmbceNm7QizmhmitqEVWajJIVrCc2+QQmosszQPtvckbAiXXC8D2RdWGIuOmuUkFLSvspjNlZ8vTVXDEiqe6OrrdTgTaEU/ojJw59POFVGH1rz6Zdg6k5t8qCd/c3sTLOs41pp1+qrELTuQl90MrcLiIBbY8v74RD/Zoy4qwc4JVY0i416DignhUDNRtuNw8ve33Gt+iZoUBIa+R0+WIF1UtT5hfns+ksCZx7zEQDsXY1gPlPAIngN9wjBOHaeCKdDeTyEPhh2eGu+foHwzUaduh/8JHwN6cW3qpEgHuEBAlYShA6zYtpCNrZaHhb7M/lvROYxAz09D/Z8F05KjqXqmy+Wlfbg5YdqwAD+c1nJX/I6IUuhU7do6+94+Z0fVp6CciG8xEIrZ+GNP054qYCA3/Fy1rNUr10aHwh6j5CzcmlYfosq8EDHwWHTvxTrc0hb50WXflbIS7l46FewTK0PLBRsi87HKCgjyhGHYApqKSLScFaWZRAOpWDVktoxCw3QV7lKdu7xiW8B01t5reYEhIw8ccJnERin6+O1i1OaJ4WowWsLfPElGz+2/QZdvSVj5kwUAtXAfe1pa52TUzEyOT5I1yxSYx5PiSXZn+L9VTQyFQi22qTlVVLDU7K5YsRXSS/jo/mDasj7daBkpItPH/L0ceOLyhCjvR8tHoKQJ6gjEOyvUZL6B87FdeitlTYTmTon9hNRIx7/DhzieGSWWo7Pu3ouDPWoAzk/WpOaSmWEyd3HbQQHiU/Z8EjoN2SnEOBriUpWtB/6IybBpUXYhoQleOXmqQlIkRmagmtCcomtEhuW3IUgnYmEZOjh1fd0yavAW8jUPcZuiC3DByVrLlcexQeZFZRcDI6zsz4DX6i7OOJkr+4EULvbmohnCiL8nejY= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 662768c2-0b69-44b1-6f0f-08dc72e415de X-MS-Exchange-CrossTenant-AuthSource: TY3PR01MB10906.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2024 00:31:52.5537 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: 1U4dx8MfQ7tg62QFFBRb9+9t02SMg8s+cH5wzDIJiYKvqYbEngFyfCTKTagKEPXrzPlEn8Lk63UFb98NLWsiYNKMym2Z3Q9RkikbywyjpZ4YKdY3dTpailaWGLBMqQCV X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB7383 Current DCPM is checking CPU side availability only, but it should also check Codec availability. But because of long DPCM operation history, it is possible that the some Codec driver check have been bypassed. It should be error, but let's add grace time to update driver. This patch indicates warning in above case. Each applicable driver need to update during this grace time. Signed-off-by: Kuninori Morimoto --- sound/soc/soc-pcm.c | 45 +++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 43 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index c4d80cad5982..5729912ceff9 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -2795,6 +2795,7 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, { struct snd_soc_dai_link *dai_link = rtd->dai_link; struct snd_soc_dai *cpu_dai; + struct snd_soc_dai *codec_dai; struct snd_soc_dai_link_ch_map *ch_maps; int has_playback = 0; int has_capture = 0; @@ -2806,15 +2807,25 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, } if (dai_link->dynamic || dai_link->no_pcm) { + int has_playback_both = 0; + int has_capture_both = 0; for_each_rtd_ch_maps(rtd, i, ch_maps) { cpu_dai = snd_soc_rtd_to_cpu(rtd, ch_maps->cpu); + codec_dai = snd_soc_rtd_to_codec(rtd, ch_maps->codec); if (snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_PLAYBACK)) has_playback = 1; if (snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_CAPTURE)) has_capture = 1; + + if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_PLAYBACK) && + snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_PLAYBACK)) + has_playback_both = 1; + if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_CAPTURE) && + snd_soc_dai_stream_valid(cpu_dai, SNDRV_PCM_STREAM_CAPTURE)) + has_capture_both = 1; } /* @@ -2850,9 +2861,39 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, has_playback = 0; } } - } else { - struct snd_soc_dai *codec_dai; + /* + * REMOVE ME + * + * Current DPCM is checking CPU side only, but both CPU and Codec should be + * checked. Indicate warning if there was CPU / Codec mismatch. + * To keep compatibility, warning only for now. + */ + if ((dai_link->dpcm_playback || dai_link->playback_only) && + !has_playback_both) + dev_warn(rtd->card->dev, + "System reuqsts playback, but not available (%s)." + " Please update Codec driver\n", + dai_link->stream_name); + if ((dai_link->dpcm_capture || dai_link->capture_only) && + !has_capture_both) + dev_warn(rtd->card->dev, + "System reuqsts capture, but not available (%s)." + " Please update Codec driver\n", + dai_link->stream_name); + + /* + * REMOVE ME + * + * In case of there was no dpcm_xxx flag, and CPU / Codec mismatch, + * follow new style + */ + if (!dai_link->dpcm_playback && has_playback) + has_playback = has_playback_both; + if (!dai_link->dpcm_capture && has_capture) + has_capture = has_capture_both; + + } else { /* Adapt stream for codec2codec links */ int cpu_capture = snd_soc_get_stream_cpu(dai_link, SNDRV_PCM_STREAM_CAPTURE); int cpu_playback = snd_soc_get_stream_cpu(dai_link, SNDRV_PCM_STREAM_PLAYBACK); From patchwork Mon May 13 00:31:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13662945 Received: from TYVP286CU001.outbound.protection.outlook.com (mail-japaneastazon11010001.outbound.protection.outlook.com [52.101.229.1]) (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 BF3F933CA for ; Mon, 13 May 2024 00:32:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=52.101.229.1 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715560323; cv=fail; b=bNPAQ407DxmbenCWsDkjenQ8XC1+ro1ndq/iCzFBEmTd1pZQPpcel1zBthzk6rAwzcvX0H+j4cF9QjVPY0UerU4XPxE1/2Qm3m9Sl2c+ChzJcEa48RXeGnXOHnd1qJTHt2zxjXFwCrntdkw+X27iw7N2zFwne1b6X7w243g07Jo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715560323; c=relaxed/simple; bh=JaEfXBWlGHqdYwZ2dANrrSieJSCowt5IpkWOna4hHjI=; h=Message-ID:To:In-Reply-To:References:From:Subject:Content-Type: Date:MIME-Version; b=XN0uITKo7LwN3dPTD+1P9Hr2Iallemcra0n00VguRTZXYl61ncBExAI6E0Fs51k5r6eUMR2bZ4xwnVabOvxGGN1ewisnb48V7RWfh94etpB7MeKSI8K8PQnpzMolPvqw6YXpihYag5TXjPk/dWwFJdsYLoZUCStu3vRPcYObKFs= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com; spf=pass smtp.mailfrom=renesas.com; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b=e2anJud4; arc=fail smtp.client-ip=52.101.229.1 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=renesas.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=renesas.com header.i=@renesas.com header.b="e2anJud4" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OBOIX0R0wj7wlBSdc90D0S3PDXElDy8zvsCjPbvbT/25OVbluqq8hbfUYOVdsy5AQdScYBWhaS9cn0Z0LDOIr7yafgrdFGu+V9k+UoULztxkvHl48Xe/fYQhhCsb+ajFzOWR4arJoI2Kn+Y3Yx3mPi0xghjY4GdKR3uN/UvwMdndxhU62OReyAF89MNCHrgxd01T+mTYVrYJetuQ4GjKyqmHgsVKq8X58laQW3sAI+vy51YMUfpbj5lWFpjEZKwciPTMWN3tGZmjHW+ehPqcvyeH7IhFg/HLIH365BRlVkZss1hPsIDOFlEZLclvoyUrGmWEDqgrEx0uKayKhvbOfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; 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=sLaTQRJ6+dc0X4MaTimYuQOcrzydhxcK4moSLomERV0=; b=K3wEkaGAF2lIAu3zCHsYMeFcInPGDvIo/Qk8fo2tQ0bkfEy320phrdwakc+M848wSW/xX3Uyg1ec+JRQGdvfXIwlLb+xYaHQcr1LNMEq/bUsnX0BFF5spLCl5B1YfaSGlx0abn5e3aGC+ffjDhhWrhWCIVdDON5bPZyO8zBFtnZVOYHnYHSu6SQqzF6rdgfi+X1onwbfQ+GkRHJY0To12/yS/sBUVxGhDqCMjDsTUg0V8HtIAOyQBmGfbpoJaXhk9DT9O9jvZj1GWroRkL0/VdYwEjsFtXDtpjb6Lmfe678Hf4FNYf3HLSlqH10LYRcAiw517Vlt+XGRK7kmRT5eYA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=sLaTQRJ6+dc0X4MaTimYuQOcrzydhxcK4moSLomERV0=; b=e2anJud4Symb7i37ogByAP5LaoF8SpCBiE3heUXB34Vn848mojLQKqINS1XLC6YXFCXIhyKc/517fkH/K/inf1MK2BuFfNESZo739x9TsopsmieVzMo97WiPcaXoBuwdkDFqOFN8cBFnj2k9kJaLOSb4FJfSW/a5i0a92628iQg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TY3PR01MB10906.jpnprd01.prod.outlook.com (2603:1096:400:3af::14) by OS3PR01MB7383.jpnprd01.prod.outlook.com (2603:1096:604:14a::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.55; Mon, 13 May 2024 00:31:59 +0000 Received: from TY3PR01MB10906.jpnprd01.prod.outlook.com ([fe80::592:9b7b:ef57:2dd8]) by TY3PR01MB10906.jpnprd01.prod.outlook.com ([fe80::592:9b7b:ef57:2dd8%4]) with mapi id 15.20.7544.052; Mon, 13 May 2024 00:31:59 +0000 Message-ID: <87jzjyzh4x.wl-kuninori.morimoto.gx@renesas.com> To: =?iso-8859-2?q?=22Amadeusz_S=B3awi=F1ski=22?= , Alexandre Belloni , Alper Nebi Yasak , AngeloGioacchino Del Regno , Banajit Goswami , Bard Liao , Brent Lu , Cezary Rojewski , Charles Keepax , Claudiu Beznea , Cristian Ciocaltea , Daniel Baluta , Hans de Goede , Jaroslav Kysela , Jerome Brunet , Jiawei Wang , Jonathan Corbet , Kai Vehmanen , Kevin Hilman , Liam Girdwood , Mark Brown , Maso Huang , Matthias Brugger , Neil Armstrong , Nicolas Ferre , Peter Ujfalusi , Pierre-Louis Bossart , Ranjani Sridharan , Sascha Hauer , Shawn Guo , Shengjiu Wang , Srinivas Kandagatla , Sylwester Nawrocki , Takashi Iwai , Vinod Koul , Xiubo Li , alsa-devel@alsa-project.org, imx@lists.linux.dev, linux-doc@vger.kernel.org, linux-sound@vger.kernel.org In-Reply-To: <87o79azh65.wl-kuninori.morimoto.gx@renesas.com> References: <87o79azh65.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 3/3] ASoC: remove snd_soc_dai_link_set_capabilities() User-Agent: Wanderlust/2.15.9 Emacs/27.1 Mule/6.0 Date: Mon, 13 May 2024 00:31:58 +0000 X-ClientProxiedBy: TYCP286CA0268.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:455::13) To TY3PR01MB10906.jpnprd01.prod.outlook.com (2603:1096:400:3af::14) Precedence: bulk X-Mailing-List: imx@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TY3PR01MB10906:EE_|OS3PR01MB7383:EE_ X-MS-Office365-Filtering-Correlation-Id: fd458956-3188-4c24-95a5-08dc72e419b4 X-LD-Processed: 53d82571-da19-47e4-9cb4-625a166a4a2a,ExtAddr X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|376005|7416005|52116005|366007|1800799015|921011|38350700005; X-Microsoft-Antispam-Message-Info: u6RqsysoMxKMHYn7tmiMwRX0L7OTJ9iRKiA+QJAKNI7VKd1iwGTwEBPztnm6xByzXyR3ngHZasLtMYIGMsI3wJiumIPeYE+iSSjglkWf5TkJqQsH75jh5s9bnvwW9qQ99EWEUdwoN7I2uHViBvv/6FASK001fji8hbox08E1MLaMlk1wCJUN5ODy6Fde7mfdBoqRgbvxDhVCUdbwdIPD/PKmSjlkuQ407qL7I4jqZdeqhlqrBLnBlvhbGx7fP37+n+wmVFe8AaoejJkYnDGiGroTJFz/M02t0P4wj9MDpSPUzOUGzRvyZmsBJGmyiLX8+EM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IP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TY3PR01MB10906.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(376005)(7416005)(52116005)(366007)(1800799015)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: zyb0S1gpcAC1904wZATM2cNyeICpq5Euj92sYV36JU2bqahsMWTh7sADUrqdjvllL3/gUg7dB5lGTN0gEtNbwRN4bLSdDW/8gCRfhAVx9db0oJ0f5p21Oj6lbJSfoyHeFmkSO9aCjkz+yKTO1hbXhAYcc1xoWUwElDfOkVWhvoC1gORbxbkv5zPIFwtrnHt4xfHEm18lPbCqQ3OwMAsN6FqLH5MafXoGmAyNAD6dX2EO6/4LujdbxGdZA7XbtjzZN9o7ubn4oGGWWkTQhgEBF7whs7kJOq5L3iSF9qHcgkSav7smeAT08n+y/NbuwX9ibA9PDvJNe7Yp+fPIMY6Z5JVCYTV7QjrCs9wI7Cc4jmU8W8DQ0UAsN/ljyvAM/g+5KDoSyAalE07Lodb9nRlRBSOe+yFpyX4/BPWs1Pa+5bg/E60zIJUvVZKcJ2H5WmYzylsfvY1QhwHOnm1CpE3Ersg7ToJLShw8KxT1duCx7zj6AR/pk6IRzm4BCrfvrcNw55wctVyDT32VgQdrc67R9w5NPwh1jbCAyx1J3WsQkrmoRtJkjT9sH5UIJIoGQaMs9t7tC+LM8553IeplpB4wEiJuCBKVmT2yOA1fU6zYNt9/0wgIgwCmYvjWftfNsl0RE8sAFtQZ+7E9qzPlJ8L9jciIzZHGpNFaUPE2sSFdZQync899YOq5+qTcFpw11JB0ParOrWdnVxQpcJXyVTjc62m1DGG3YTUTzfj0A8el4qnC54q40BR1lUaBvDhhFwFsem3oNpCMhJ1LQ2tE4E6kLwIiTla3TdRn6o3Ai16KIDw97yU+K5HSuLqUTzknoUAqQKgLz/SmTnsXhj2UOGh+liYqOEPrELkpF1GNcWCWeDkiNYBJ5innKMvRWFudGG6e7AL16X3atlPsmGa4ohsev8f1JZ0aARCQVbyYotaTlMywtxCugUdVTcYAEOgcNkLZmeaa+3X4yw7s+knvk38vjdcksE+1yG9Ta7IcCdWbhBqS3X6pJpjnfiYwmWxlBHGnwMZvGmHCRHVhiU9XhcdyfBgIwE1K7GtX3dvidjYjqvy3/VwJ/HZ7aI/VE/4q2mU6SdrQyuK4lHTXic9IELpulVkp9+xK0UFH7OA7D21bGuQYeP9WIzpVOZkNiPZYVSS+TsAVdCO4IcZFRjkVCYSGB3A5ZEQmuST93+fF4ZYXFdefO5UFfcqmBgD9g35py0pOLpJHjow5Dn191JFaWazMXNFuVIdHW5I76LX31zoRj5RDldvv20K4UwCiOup6DrMmAiuxJUYknUidOVI5BqtH6T/rOdGgHhn7pW7VvA4oL8Psp3z751+n77fzhA8ld2ulEA6p+kcWFawdSI1RoDWAGepmq0A2IFl96mTVz7jgbcUIgrKWLlNShDnyRXo89/hRWxGxlbh82TE/p6OBO5f6kaHh2LEN4R9Ny+xR/oZ7Jo2Combdgpuz57kOB9EOa+w4QC8g+b3z4MrfwM8wMHMpU1BR4osZk+SC6qjsTBQGIZM0pDSU4/URRkdIcO0LN/d6e7NY2OPXyQ+CbecLSVeZQtFNfSpodcdK7PJxUEM9/eHyYFMo0sZIPtVat0DJwQ+zWsu6VHjnMdpPwkQPQjvqn20sXLe/ZlmOyESupHPweyI= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: fd458956-3188-4c24-95a5-08dc72e419b4 X-MS-Exchange-CrossTenant-AuthSource: TY3PR01MB10906.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 13 May 2024 00:31:58.9850 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: O+PE7Jdma49i/dqnEUD/rUrF4n2pAjMI/nBZNNdHocZ54mLlMZKIb3C6gysRuJUUsrQ/McFrU20OpKZpvE/vh8RyPTIvc7nMRIQRgDB5SGexXJr4E82CIvCL1DZA4Wkk X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB7383 dpcm_xxx flags are no longer needed. We need to use xxx_only flags instead if needed, but snd_soc_dai_link_set_capabilities() user adds dpcm_xxx if playback/catpure were available. Thus converting dpcm_xxx to xxx_only is not needed. Just remove it. Signed-off-by: Kuninori Morimoto --- include/sound/soc-dai.h | 1 - sound/soc/fsl/imx-card.c | 3 --- sound/soc/generic/audio-graph-card.c | 2 -- sound/soc/generic/audio-graph-card2.c | 2 -- sound/soc/generic/simple-card.c | 2 -- sound/soc/meson/axg-card.c | 1 - sound/soc/meson/gx-card.c | 1 - sound/soc/qcom/common.c | 1 - sound/soc/soc-dai.c | 38 --------------------------- 9 files changed, 51 deletions(-) diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h index adcd8719d343..69ba1a628eab 100644 --- a/include/sound/soc-dai.h +++ b/include/sound/soc-dai.h @@ -219,7 +219,6 @@ void snd_soc_dai_resume(struct snd_soc_dai *dai); int snd_soc_dai_compress_new(struct snd_soc_dai *dai, struct snd_soc_pcm_runtime *rtd, int num); bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int stream); -void snd_soc_dai_link_set_capabilities(struct snd_soc_dai_link *dai_link); void snd_soc_dai_action(struct snd_soc_dai *dai, int stream, int action); static inline void snd_soc_dai_activate(struct snd_soc_dai *dai, diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c index cb8723965f2f..9c7e24cebd7b 100644 --- a/sound/soc/fsl/imx-card.c +++ b/sound/soc/fsl/imx-card.c @@ -650,9 +650,6 @@ static int imx_card_parse_of(struct imx_card_data *data) link->ops = &imx_aif_ops; } - if (link->no_pcm || link->dynamic) - snd_soc_dai_link_set_capabilities(link); - /* Get dai fmt */ ret = simple_util_parse_daifmt(dev, np, codec, NULL, &link->dai_fmt); diff --git a/sound/soc/generic/audio-graph-card.c b/sound/soc/generic/audio-graph-card.c index 83e3ba773fbd..714ce1f4a061 100644 --- a/sound/soc/generic/audio-graph-card.c +++ b/sound/soc/generic/audio-graph-card.c @@ -246,8 +246,6 @@ static int graph_dai_link_of_dpcm(struct simple_util_priv *priv, graph_parse_convert(dev, ep, &dai_props->adata); - snd_soc_dai_link_set_capabilities(dai_link); - ret = graph_link_init(priv, cpu_ep, codec_ep, li, dai_name); li->link++; diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index 62606e20be9a..0d2ac4c9ba3d 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -925,8 +925,6 @@ int audio_graph2_link_dpcm(struct simple_util_priv *priv, graph_parse_convert(ep, dai_props); /* at node of */ graph_parse_convert(rep, dai_props); /* at node of */ - snd_soc_dai_link_set_capabilities(dai_link); - graph_link_init(priv, rport, li, is_cpu); err: of_node_put(ep); diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 9c79ff6a568f..5e66812ffadf 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -276,8 +276,6 @@ static int simple_dai_link_of_dpcm(struct simple_util_priv *priv, simple_parse_convert(dev, np, &dai_props->adata); - snd_soc_dai_link_set_capabilities(dai_link); - ret = simple_link_init(priv, node, codec, li, prefix, dai_name); out_put_node: diff --git a/sound/soc/meson/axg-card.c b/sound/soc/meson/axg-card.c index 8c5605c1e34e..09aa36e94c85 100644 --- a/sound/soc/meson/axg-card.c +++ b/sound/soc/meson/axg-card.c @@ -339,7 +339,6 @@ static int axg_card_add_link(struct snd_soc_card *card, struct device_node *np, dai_link->num_c2c_params = 1; } else { dai_link->no_pcm = 1; - snd_soc_dai_link_set_capabilities(dai_link); if (axg_card_cpu_is_tdm_iface(dai_link->cpus->of_node)) ret = axg_card_parse_tdm(card, np, index); } diff --git a/sound/soc/meson/gx-card.c b/sound/soc/meson/gx-card.c index f1539e542638..7edca3e49c8f 100644 --- a/sound/soc/meson/gx-card.c +++ b/sound/soc/meson/gx-card.c @@ -107,7 +107,6 @@ static int gx_card_add_link(struct snd_soc_card *card, struct device_node *np, dai_link->num_c2c_params = 1; } else { dai_link->no_pcm = 1; - snd_soc_dai_link_set_capabilities(dai_link); /* Check if the cpu is the i2s encoder and parse i2s data */ if (gx_card_cpu_identify(dai_link->cpus, "I2S Encoder")) ret = gx_card_parse_i2s(card, np, index); diff --git a/sound/soc/qcom/common.c b/sound/soc/qcom/common.c index 747041fa7866..24862002e82b 100644 --- a/sound/soc/qcom/common.c +++ b/sound/soc/qcom/common.c @@ -145,7 +145,6 @@ int qcom_snd_parse_of(struct snd_soc_card *card) if (platform || !codec) { /* DPCM */ - snd_soc_dai_link_set_capabilities(link); link->ignore_suspend = 1; link->nonatomic = 1; } diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c index fefe394dce72..f8e46bec6f80 100644 --- a/sound/soc/soc-dai.c +++ b/sound/soc/soc-dai.c @@ -479,44 +479,6 @@ bool snd_soc_dai_stream_valid(struct snd_soc_dai *dai, int dir) return stream->channels_min; } -/* - * snd_soc_dai_link_set_capabilities() - set dai_link properties based on its DAIs - */ -void snd_soc_dai_link_set_capabilities(struct snd_soc_dai_link *dai_link) -{ - bool supported[SNDRV_PCM_STREAM_LAST + 1]; - int direction; - - for_each_pcm_streams(direction) { - struct snd_soc_dai_link_component *cpu; - struct snd_soc_dai_link_component *codec; - struct snd_soc_dai *dai; - bool supported_cpu = false; - bool supported_codec = false; - int i; - - for_each_link_cpus(dai_link, i, cpu) { - dai = snd_soc_find_dai_with_mutex(cpu); - if (dai && snd_soc_dai_stream_valid(dai, direction)) { - supported_cpu = true; - break; - } - } - for_each_link_codecs(dai_link, i, codec) { - dai = snd_soc_find_dai_with_mutex(codec); - if (dai && snd_soc_dai_stream_valid(dai, direction)) { - supported_codec = true; - break; - } - } - supported[direction] = supported_cpu && supported_codec; - } - - dai_link->dpcm_playback = supported[SNDRV_PCM_STREAM_PLAYBACK]; - dai_link->dpcm_capture = supported[SNDRV_PCM_STREAM_CAPTURE]; -} -EXPORT_SYMBOL_GPL(snd_soc_dai_link_set_capabilities); - void snd_soc_dai_action(struct snd_soc_dai *dai, int stream, int action) {