From patchwork Sun May 19 23:31:07 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13667969 Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on2054.outbound.protection.outlook.com [40.107.114.54]) (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 5237F3D60 for ; Sun, 19 May 2024 23:31:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.114.54 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716161473; cv=fail; b=SdoTA0tqMsyHhvG2KOFuIxvzbEFWheiGhwAkHIxJnd+p6iBRzvTssjPZbgtQEfSwRfoTj/5Jr74BM6AWXFxGG1qlr0EdEiPt2XQODCfnarTBekRly9lxukOV6hN4JsVzby5xMZpy37DqGORI1FmectXTpF/QjcsroJ0oc70Y5yE= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716161473; c=relaxed/simple; bh=KjYBOFXP3wzZqHbA2okIY86U55SER0DQJw+2vC8sLEo=; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type: Date:MIME-Version; b=f6CBAB+d0TUBbwjtg/hsj2nDPWCthBhXArjVgX4RLIRfLZ0wMo/y4WFjyccx8p1S04EquiDpiCmsB9lJXHklglTV2jGUyyekQbk4IUOJdI9f29l/bES99vqo/lhaDk62rEcQDQ1TX66pbu57GN1OchbWU4qsF9tTpFRnqMiaZjk= 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=MwZOfkKP; arc=fail smtp.client-ip=40.107.114.54 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="MwZOfkKP" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OF7grW9eG2xFS+gBAs4BKmte/lp+8TP5TLeguXRIvDx8W1zkCjGQhutqWY2LHSDj24BSF6508WLgOLa2URWWITAC7G784vv+5kfnnge0la7WcGJ9NwQb5hLBSnODnYO+5N8gPtjXxF536l2BiY/6G7oYPGlv9M9+I5Ovm2A3dfik36Lah9Sb/JLvDeNg/A58dqpsbHGHUBYSwJF7Qz0vouar17ou7AwTl8ickjYx2mVMCQ9lMW+jg8ll9A/p5gqvGAzumtunfAHDAl9qaswkYOjOYyHtX3MGLDS6dFJL4uoItwcwf/I/iJ+qQDqqTzM5sR+gjZEowhw/R5EOwIfh1g== 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=nd4sNPbb6DSYIUfpycVWGmzJC4L67KJQJEpfIBV7B/c=; b=LI9ety7Q4loeiiBu/fFb9hTUmlt52ujp2X9ciBwGqBlwaE8EerNF5oxZqmOMxyrqTNZF+b1QYxVh0hpL5gG33DGkdlHRVMZisZZ3SmV4I6Fk3zIejB4vKjlBE2fowRy4At82c11oMiGlRJNcPWFoIZDKHV00NyKCLpO6BF0pH6aXrVClYnwsWVqBRstA+jCID8qYd7LNYf2R3rS2HJAqCINbraYwtskTcWFgLYrxOyWxYz+gXao5Vi9/3MY/bAcdQJTBqIIWmw3OVdtgppGTZwmYDtkseHnsZSmz3muRfpz2IfB73Ev4pB2fIvhEaEVnMgnZshNRrRjsQcS2/EQkcg== 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=nd4sNPbb6DSYIUfpycVWGmzJC4L67KJQJEpfIBV7B/c=; b=MwZOfkKP5CrQAb/ac4Nn/X7m82KDtAAoh3rqt0gpYpN5LwmEqHZaEGSxxHDoWLzQnWJA912LXDp5PHLIqINEF4Vr27+A7ojTM6fUGQIlU6nAsfJMtDIXQ/M+xlf4p86dcksJ6/k/Jp8bQf4CJOqZfMlyRPF6O1JkguUQQaMCgBw= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by OSZPR01MB8402.jpnprd01.prod.outlook.com (2603:1096:604:16d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.35; Sun, 19 May 2024 23:31:08 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::2f40:537b:2694:7b76]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::2f40:537b:2694:7b76%7]) with mapi id 15.20.7587.030; Sun, 19 May 2024 23:31:08 +0000 Message-ID: <87le45e5vo.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v3 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 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: <87msole5wc.wl-kuninori.morimoto.gx@renesas.com> References: <87msole5wc.wl-kuninori.morimoto.gx@renesas.com> Date: Sun, 19 May 2024 23:31:07 +0000 X-ClientProxiedBy: TY2PR0101CA0009.apcprd01.prod.exchangelabs.com (2603:1096:404:92::21) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) 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: TYCPR01MB10914:EE_|OSZPR01MB8402:EE_ X-MS-Office365-Filtering-Correlation-Id: 01440fc5-2631-45e6-cd70-08dc785bc281 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|366007|376005|7416005|52116005|1800799015|921011|38350700005; X-Microsoft-Antispam-Message-Info: VWpyCHLnNAjyhbSTuMDIk2dCvuR8DTEPKAnhtvAtwsT8/xyDT28HPvHcjvPHWBfZCKEkiDRoIeoB9mmlk1+3pq05Keklr7IjEx6iDHdPq8zw0Df28/NIHJ8VQrNx1kaSBK3u/9fHZxocHQtKElPknbWN8abM88OYOPMv7N8mFNnSvj3xv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JGQsbfyY3V9v8hYL+ghVRNdr6biSUmdpNzRcZwT+bVfwq+e6p0cFrnXvBiu2ge0At04Yf5xYG30F5ULiFO4TThWY= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYCPR01MB10914.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(376005)(7416005)(52116005)(1800799015)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OtxeH6PGyAAEm8VIkhM20XW/EJOFugNRVcKU43ZpBAoSxxhzYG2GOeEe0cWD98wA3h1XE+OJzUUXIhW+upP4v5jPqe3YSEPcB2GKvTLZeYnYXpfT64ZhXqhw9BbytsIlvv3oc0zuoq1/KQaWpu22TRAQr8W+d0BwCaIwHc5FjyEpYqF/hZsf+iOMDZ6uz9tQaT6BRTcYy2eBlEVSmzD4HEGOHVGPGmUtIQoVSCdaDc1MFl+/8aktrO/7xFa5d3wXW7rmE1qFEPkEJmkJLEeiDYghBXjsHqDay09WkSxR0RgqxDehCcQj34pwf9qeyto8YJylgoL81FDnYAh/P6kUxFT5HXmxpOJcvTxN2NchB9O2QtlGZMKwb7RYLmaAldfM9Mpm+JtFR7Hdb4SSqNWaDhPjo78Postxvjbx6yZGKX3NjLc/HAB425CDIM8UwAGduUZByPuMBhIl1UAapOwzAJDCri3Oak3dBN9PUeqniMaS3jsn5lg9PzmRlfyYNB2Y1D3IqLEmWpoRkrGgf64ylGT/TTzoTYZrxoWzoJ5LQk+gAKVFu6MXy4SeLAcTs27ILsYO5gtuDsqchtSJdE4HLr0iwEQZlTaqQyZXRaThrq1XSZT0zce5TWz/+P+dDmkK+CrOW3vLUI/idRqPRSgMM+zLzCNg9k6lHKJq7++iLwWEMlHbK+qaRnb9zcTHof7RnGEWe+S2cmnMSgcrVc8gXQ5lKTfHFSv5PCyZGAKCM98hk8Akvf9IbbKFSINRJC2HfaADu+jkb+vBte04PYGO4+r1qrDZZl/Ey2ic7vFBXSUZtns01KDjiyG7ntIRF18nu3mpwB9VWIHWiKUmwK6dot8bKuxDvYbqX4vHXS0DFtRVk9VIwVdK5UqDyR8nDadvHGwUo5HvVQui9q321hO+ZLimqMEz4Lmh2Ltm5l31buFB2rPdu+wlF9GWZdnkjdM+2vmERW6TezN051xFbP2+vkTsk1OySSjOXSnJp701fo2jm83i9JpY2SiLYBgMg7t3DVAtjUURHwunah06RauEeavbYj6Ljx78MJk3GKecI1YXfSYk+8IpAM35+07OOMb4LmEiAiW8nNLw0NOBT+rnWIEF0I7yjn/2Jmixvfrl7ewhJ+bVcoQ1EcbJzoZqfEf0fSn2Bi/7qRIwlCvcb6p7e/f26nHLBI4tGCCCUYYqu6OU77+8GlnqGO0SCiByiQFV14ARR6dNl4Av9gEo3XLBVFKCFKHQPI9t9nkhUVf7a2z+EQcpRTbQeObI70Fs0uZca9DwGib07JxlBcQmCpqDvhyebRIJqUEJdju0/PZXs4Qi2lQ8I37UYMyNtkuC3OTwsI92bhE0EOR5oUQGE6JRnvOmNHcKfraWNGaCQDhIHCeGmklGLhtHcjPh7vdc9kzbjBuvP5XTi3bcFrktFa/MshuCyEmQ7IUOjt5hRvU2fXr0jO5WrF6IFc2V/9+wBW9EL53ns2AHae3/itvmCczPhOLtOZYxmSoCvu2Gxl/VHHj2T0c04PCE5EGx2VD0AY8cuSY/u03atN+6+mnx+b/07oS26fMuoV5fn+qVROb/+yfcIYuQXm1zv4j9fEeBiMoNTxdM9H5mZSOFrqxiil5K5zsvx0z28zHLQ1NIRGHroy8= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 01440fc5-2631-45e6-cd70-08dc785bc281 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2024 23:31:08.1324 (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: OtxFMfhaq1q76f130j4i9OPKKjJfVqy2VxYh46FrbjfeFpQtz0ZU+o3NBQS6J6BQhU3m4LOqHlHsXcC3OoCX1mZnoQkqTQIKKv6xcRE3D4wBFkEHSU4fgSJBP5kFE6Bc X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSZPR01MB8402 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 Tested-by: Jerome Brunet --- 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 33671437ee896..2a3da1d913776 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 711b2f49ed88d..c4d80cad59829 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 Sun May 19 23:31:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13667972 Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on2086.outbound.protection.outlook.com [40.107.114.86]) (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 B67AA1DA4C for ; Sun, 19 May 2024 23:31:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.114.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716161479; cv=fail; b=pw6QjCv8mdBpRSGoaJdi2PJAI2X9/tTzC5/7Qr5l2bj+uzSbKOxswMWwPEWPWprfneYigAe2vq8oiB3Jf9bOQscCRrgDZ5EO2qLTtyyM49fxHlO+BA5LI6LN1fhn3lRtf+Cj6rxrQPdgAGAU90EnOYuPql+pUBqsdwnJL+sKXLs= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716161479; c=relaxed/simple; bh=HkaBqKoPlMRX/KjF6QtW/3H8GT5Ld2DmN4kB0Jo97PI=; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type: Date:MIME-Version; b=tik5W26+dSDwK6AL3a613AezVb+3Nrpu/rjwLKd/CDpwZ1KT4qC39EJUVOjtBN5yO4niAWTMhyaQmuwEec6AbivQtX2PSGjQoxcqgA40j82rDruI9hAV95gVouvkD37nr2HoypT69aU+qpTzmUJsmik2wb1RQOYhrUnfcfWTA+A= 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=KtmzNmH8; arc=fail smtp.client-ip=40.107.114.86 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="KtmzNmH8" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=lvRrep/r7ARwxc0KrTRUlPZeZ3FtL9ZmmooaTxd2VDceZy1bX+ivARhA1lps32+zLN4CqrVB/rV94v/ISMG+DZzbBY35FTjvRDhv22IHVNK6ni6a4gv+g5LnnvFHrxp7lDrdfcIONXHzSkI+uFX5SiVE/pZ6bfiHcrgdccrch4pvkfmQx3xWE+OUzt2wNr42Nm3Xd/NFOm1YIDK/YyffQSWE9oMzoSHgvqmTVlov9wWFLga57+VSfb38L52UzauQV1U9m4Bcag1FkgZizHsC8gaqLe/dADlNWrWVLWZg2FTrB1qF8lV9pbEYMLJwLy8+8kRUyVB6WjKHo1n0m50RgQ== 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=m7AgUIykPXjg0Q73SRI/y2w7LZjgJYCPqa0werj05l0=; b=Z7eO1rZ30Fr/CMRUwDaeAmvRxUv3obRh0NnGsAKClXkUXPy75OXlYnoF3buNJrk3uT7uibjdYEt/CiWGhD+HeOQDDUxp1Xp+C9EnwIF3lP5b46L0GyfvtRwdZJIGFYknlCqVjip91zitlYheXZNCY/Y3Mz5wRuZt/3dJhH5v2OQNm99cTv70HnVRgjZmcJ/mH3NaDjrKeQc1BhzOX1dGjOUoOruRA1Ad40IXP1BNfT+3cSJvNlOr1eYvAxh86EI9AO+Q2GzSBNlY9bwcIIjJ7pi9+jfYEnK8aNItGWBK7/GeOYs3WUQRWxeuOVulMZQ0bfrQ9ZYIp5boNTSqSBFa5g== 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=m7AgUIykPXjg0Q73SRI/y2w7LZjgJYCPqa0werj05l0=; b=KtmzNmH81Sz18by9xIwIbNjr86Sog7+eNs0At12UNIKTK5gmNNye7dZSIZnsCHQDpiCpBouLWY9dILTOj3AAceaCaukploMkB9pHNA+aWb1mktb9CUi0oDJpcKomrVJwqJrj+dDo4+Jbhx7k78i5ndOy7Cqll6bQLQVrX8X2Rro= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by OSZPR01MB8402.jpnprd01.prod.outlook.com (2603:1096:604:16d::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.35; Sun, 19 May 2024 23:31:15 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::2f40:537b:2694:7b76]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::2f40:537b:2694:7b76%7]) with mapi id 15.20.7587.030; Sun, 19 May 2024 23:31:15 +0000 Message-ID: <87jzjpe5vh.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v3 2/3] ASoC: soc-pcm: Indicate warning if CPU / Codec availability mismatch User-Agent: Wanderlust/2.15.9 Emacs/27.1 Mule/6.0 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: <87msole5wc.wl-kuninori.morimoto.gx@renesas.com> References: <87msole5wc.wl-kuninori.morimoto.gx@renesas.com> Date: Sun, 19 May 2024 23:31:14 +0000 X-ClientProxiedBy: TY2PR0101CA0001.apcprd01.prod.exchangelabs.com (2603:1096:404:92::13) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) 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: TYCPR01MB10914:EE_|OSZPR01MB8402:EE_ X-MS-Office365-Filtering-Correlation-Id: 41227fe9-917a-48cc-ed88-08dc785bc6b3 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|366007|376005|7416005|52116005|1800799015|921011|38350700005; X-Microsoft-Antispam-Message-Info: /pC4efv+SHQHvV0+PQe0A1foqeZ+NxNXLCmmOKiiwDSKNEt8S415vHloJ6Y36MCgUl2yofBQWf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DzG4CiWT5qNw3cUNM7Qd/qAa82QL8f7weE6WxvQuF/K854i5qOy6IiYiL9EN7mhnPT/oCCuQrh1+P2PMDTl5F/zA8Q5FgQpNGPN7WAR2ACGdID5ZMs4wYef4qik6MYxAxIhjFJzrNxYoK5HD7xcOKaa4mIYNWo3W4Mx3ov2SsiVJj1y3a27RFiIElyCuLSyowS7t6Dv0nzhGLhY56TmG/uH6cJA== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYCPR01MB10914.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(376005)(7416005)(52116005)(1800799015)(921011)(38350700005);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: uQ/BjpEmLF12i62/LpN6CyC8YV58Dx+/hEP0i/EPbifMEXbz2tVJK1eNYdOM0mX9jKZ882rCJpvtFNdo/Ub16cCxmz/+xk8Kqp0PJ6p3bJ0IbGK6QbvNQc8lN3Tp+ejOjyY0D12DeNFSFz2368nDMgODl3Qx+s1BUwkhz9dJujhi+27ijxQg6aeF/+xCvEQeS8vJbfP0PGwUJ3nSKTGOYTQx9nGRyXz1Wx8TVtLDfoR2zPJTmhO2weeiLM2VT2y0NaQ/c2xWu3m6RW/2sLmA+RXotJFdsYn2QHFTQVUMxRKMIbcFinjGwGKqiawwqRyS0bke3FklKOYyxiragU8QW0eXlWeMuXMNoLLiATVXWD8qIxUUm2Cr6Qv9VkudThU5i90IbAixKFo+ygkN2+AVNfV1JxEEwNIAXEgDXLZKWBKKzBuq7yxpSEWTgEQIO55aDE8a2NzD2MGQha5diZNdP20JkGPENNZKorzDEGvUNQlmudQdDaJg4Q47yUwhRshLXptuGeDR2cN+t+rhiDYYRO35SI1zG2nIHA2bK1tO0sKQEzecT+TUSAetDhDc70Z7s4HEAcpqp5QCmntZ25K2NB5sIATJ1GHG2fhU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-Network-Message-Id: 41227fe9-917a-48cc-ed88-08dc785bc6b3 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2024 23:31:15.2222 (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: k21CUA2r8xfJSN406WmPi8PH8MszoV0WCemwQ48GanFLfWkOiiT5tY1LFjqX6MYhBra1MX7Tz4Xm5gj9HV5ntW5FZQG1JkJbFXaT4IrF8zlod79qrBt4jfF6t1deM+GK X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSZPR01MB8402 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 Tested-by: Jerome Brunet --- 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 c4d80cad59829..71db7379e08aa 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 requests 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 requests 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 Sun May 19 23:31:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13667973 Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01on2080.outbound.protection.outlook.com [40.107.113.80]) (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 4C02C44C97 for ; Sun, 19 May 2024 23:31:34 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.113.80 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716161497; cv=fail; b=X/1vZsPJa8rYMBB9rMbpCh5HIxYJBwIX01U0AjN6z9UGLrTBKAV5ddCNOBX+n2aKpF/zO3HOBc7oAAXyHj8YUq5o0dq0QlPjmrlHs6u+FSeRh+lADxIBr/ljB4ZfrAbjQTMlphmurDrdocT2U0hzrsn+f5i0xtloiJg42t2VniA= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716161497; c=relaxed/simple; bh=7Nh/wrV3XQQgh00CKl7TAyPgEp7mylvlQL9DIJCMcGc=; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type: Date:MIME-Version; b=k2Jah8FtH58UFhpRgyEqxtes6zUlPe9dWWjuFm6z8vdUrYleqMOH9cOLlot5ep1A38z3CvTk5gLOOjj145XauUIAUvOUOOniiteCoWjkA7EIhleYuq6i4yduM764GRSUgnbH+jJ+Fx2pLtImySQQnb0EA1M/dhL2tVxpV60KSOA= 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=PIII86tf; arc=fail smtp.client-ip=40.107.113.80 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="PIII86tf" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=nowdTQqOVCGmqVlm+lrjQ1sTSG8k0w+/mQzB+GPi3FtxbwaYBPYVx51/pqOaWAyoNHRbfqqd5u6ja2Egrbt34CsqGYFPaUw6Fcj6mR8oUNEsra4bhacm2hUbTYMyEOYnCc1jxeVWf8By1Ws2QtBjZB+5ud4wNJ9tE58oyWlYhZmNXChCrzmXyK1GFrY+/EWVv8inhgLf0wJ6WvAzKTMOKXLm471JneSv6FNYvq5zyyZLSe7z9Wm0pjjcjTeg6gwa4ETXjeALNylLUhf3bkVqxg9AhDRXciD9rzH+f4qG8FkaqtZAVbAeKflERHmHf38CmlYPmMQ9gTAuG+9DJMz7kw== 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=GuTY/2mGZUKiPIGdpfwbZQeD+M1Z/e0ZSUcdiLfdP2c=; b=nWqoDncgejZZnyXnTd63gCs0E/blhgvSRbqRF8E4H06KLy8azzxW8Y3G17IsZdBAlYHJQgn5VgSHIL95bSV032pp5Tn7FSJuLegQwAd2p6qriGRkK3yEpDnOAfaCbhJ3SH9D7WB4BQTZXCQTY6lQGmm32Nwc+e0tPTDP+NEhJ1E1gpH0mQrxbBXt7157Y5tbmlBb2U09XclmECCPLZnyR3GGNSMWFmCIVTd5ow/Sgi0Wh8evNB19WlfaUJuE1x3fqxEDal/AAEb3SoLVhXolC3UGIJV+bTUI/KycpvfkvE2QUU6eLQthp5SRu4QDq0WTrn1b+bPun6vBaR1/8xnzqg== 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=GuTY/2mGZUKiPIGdpfwbZQeD+M1Z/e0ZSUcdiLfdP2c=; b=PIII86tf1QhfYGEdAQBIr6IWwupVK4jhoZvfSgkb/IzbFqaWAowO+ovhdudWErJga09Qtu1oaDTxArrVbKACoZhDR5kDI1dhtb1noLI26SFUW+/IjlGW3PBhdyIus+NtXcpwLMtWTiAyGiRokwjta7arnxI/2lRNqQP3CUzmdeM= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by TYCPR01MB6913.jpnprd01.prod.outlook.com (2603:1096:400:b8::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.35; Sun, 19 May 2024 23:31:30 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::2f40:537b:2694:7b76]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::2f40:537b:2694:7b76%7]) with mapi id 15.20.7587.030; Sun, 19 May 2024 23:31:30 +0000 Message-ID: <87ikz9e5v1.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v3 3/3] ASoC: remove snd_soc_dai_link_set_capabilities() User-Agent: Wanderlust/2.15.9 Emacs/27.1 Mule/6.0 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: <87msole5wc.wl-kuninori.morimoto.gx@renesas.com> References: <87msole5wc.wl-kuninori.morimoto.gx@renesas.com> Date: Sun, 19 May 2024 23:31:30 +0000 X-ClientProxiedBy: TYCP286CA0072.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:31a::20) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) 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: TYCPR01MB10914:EE_|TYCPR01MB6913:EE_ X-MS-Office365-Filtering-Correlation-Id: 23d5706b-029d-43d1-877c-08dc785bd006 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|366007|7416005|1800799015|52116005|376005|38350700005|921011; X-Microsoft-Antispam-Message-Info: wUP2AplxvdwCG3oImKpXnDq4xeGRZaivgGxIRKxYoXHwrwkPMGGU5FJnFL6H2WLgXBxqO5R+TmWwegG4SPrrUbPAog0PVCK+yzzDAqRYjQI8k7CDAmGP8aOeu0W6/S+eQM2cyununAZbiL/rUBxq2kp1HVhiMBi7szDlFsZwTxf49fY89YEfWcViICM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/PSQ6xit3I+VFIgUd4kAKnUXwvGXpRG1J5EW+rmkoS56/PKLKjB3GcR+zIVHEiNefJ0MmwN4NZhIaRxDJNuwmnSXT16SfIfc21vrY4/IbUa9ge76Doxg= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:TYCPR01MB10914.jpnprd01.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366007)(7416005)(1800799015)(52116005)(376005)(38350700005)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: VJ7JXB2DG+533Nh0CQX/IHX76qynWfLHOlzqxkAbybi9blV1/WLeq7WvT6QlSwylIAyX32q7CgUmy0klE+Qweg/Z0Axg819dZEL5h4Hox9IMxdB1plFBxcDp7Rn1rXTPTHiT3QJvgfzW+7ogl7i9fRA1v9wgU+nrXcDKk4whc45ziK1QffNwAMIuO+akg2ddJFbbtJaUaoNSpnICbgqK1IV2Y1lDY+w7Tj0gFTU8W5WkHuN+kK6tXE4T7agcxkn3F4JGyY2eqn9a+xkALMbe67Ps6KIEUpKw+MWurxQRY28lpxtJnmZH5jUVsIffw/Yh2ZZ76LU6CYKFShS+1RSbO5ppKe++KNfBilNemp42esbB8f31y8ZQmVlMJE++e3g9Rp7zWdc/xsoqNLQyOgnNYzgS2WbjThr+K+uDBNmwCWPxSaSW93eUmntd8rVIZWTQTOFDH0Lm1H3ee6kIzBbmC7kZoWweau9oXsd3msqZxmgQLvGwMb2Z9TX/DDRIXdCIIhZTS4fHzF6lfrBNy74XqL0kIyoTBQ8Ms4Nj9AnEvQjD4qahUgT2NyN73tQxrD7pilxFkYQ3NOyj+5wCJ0CoWggKNW90iJM3K3Kc0sBzr2z6R2uKA1bvjtayMpOn9/FwS7iXaU70KoFo/PBR8rtul0V1WpY7RZcAnfRGokp2k6swW8qRtl3/QT0BuAFAfAao3OSTr505Jn/Wpc8mypJ6AhdJ++RsFQeg+VD1djZ92op0q6tOpNV8xWHellyaxFvp3mrHxiiSGtennvMywH5/emVo73NFxsGxOsm1qD9pqhaBA7Ia8rG9w0qI5VjWEfk83u7MESGNeBbHlnUHKUZ95dekpCnMOl0GIYJkJU0PJqUBnG5ha4lHadAxfDaq1LSyc4Au+pVc93bq9Hzla4wCYaieQ3gOHz1yNXttDb4LQnw6WgQr6hDbR21Z2jncy1pKiWZJ3ZXpnax8j5z5Xvh977mGmjnTkr0Z1oLQ/80Ns9a+Oe+57rWQYMrIkkqrV7JRie1fIn2Hx6f3EB7CG+62tQyhdf12RfH+mzv7fLeAwwQyvsTE1dHDlMNO4XXvkBmhbD6a8iyhq61n3jjtUbAPkLyyfFKaLTs/xqpF9h5VlPmSYyEQ9B4qXGGkjroAZVqI89RrVFOdmlu5zicy9P9FQE6F3zO4IXoUqoERuIZTLw8pQu4vVTzr1UvQHLVW6VRFt87OY/HGDSRWT5INMR6DRd/0AX0CCdd3P0XIEww90I6TahqK/mlKTtBETbzLj2twtCOcOIla/ScCfVZRaZXgRzwL01R3u/haT4XMYZDi1z+ZDEAeR5V+A0Bk0KeOlIFtJM2GIA7g/w847iB5gPxbL93tgFEG+kyUWKjn1W3XZCzD9o0fWUkNgc77HLWMWP9rZzoQiFUDErkzfvSeodfr8Yqn6rBII6wr1VN7CjtqkQBMDfxvelueTzrPyWnX40saJa6GDJmykBGUDKyAm/tynmXmVPfEqkf9O3LanBz9jmU0QmK4bcL7diX8TRmfuvv1WDGodV+kId/FNHSeYucWdZwnZ1CABYIqrOF8ZgqQJ30NL43kNWhjjPPUXTBykwvAdzGnGfNT+Y+f8IgHKp0Y7nL+8pU+iR1yLFdJaRC/5hA= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 23d5706b-029d-43d1-877c-08dc785bd006 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 19 May 2024 23:31:30.8011 (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: DvZAqLtR37U9WUbceq76qpboJwBUvgSiOzAlHkkbPj1OM95xQpZ2t82pB1AeQDHiHqixvIKKCavZn5VSXcsD/wUTzHIDXknmF1lri6gBwFDOFJv5o21qKh1sbb2NUD5C X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB6913 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 Tested-by: Jerome Brunet --- 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 adcd8719d3435..69ba1a628eabc 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 0e18ccabe28c3..98b37dd2b9013 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 83e3ba773fbd6..714ce1f4a061b 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 81e84095107ed..6aeb578891f68 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 9c79ff6a568f0..5e66812ffadfe 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 8c5605c1e34e8..09aa36e94c85b 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 f1539e542638d..7edca3e49c8f0 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 3d02aa3844f29..11cbcb588336c 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 fefe394dce72d..f8e46bec6f807 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) {