From patchwork Wed Aug 21 02:13:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 821349 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 44010C3DA4A for ; Wed, 21 Aug 2024 02:14:38 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 264C83E8; Wed, 21 Aug 2024 04:14:27 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 264C83E8 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1724206477; bh=421EwowFWCESv7SeL/veGmYK5+K6Q3kb6NTFpXPf9pQ=; h=To:Cc:In-Reply-To:References:From:Subject:Date:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ezWP91wb324XNaM51gUhA+JiO3qDlNZCX4MoHmD19OHHC0vYr+UuZESuxJ8tn0cua i1pLxOZtO850Ex/A8KKu+VHjdmb+gBqAivop6Yil7BQA6hOeE28AHs8fBikoFC7PAB YptvDyI8CafPdIWLf3eVDqX7eO6IEy1H2Ps6wufM= Received: by alsa1.perex.cz (Postfix, from userid 50401) id A4F38F8025E; Wed, 21 Aug 2024 04:14:18 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 0CEF7F805D4; Wed, 21 Aug 2024 04:14:18 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5FD1FF805A1; Wed, 21 Aug 2024 04:14:14 +0200 (CEST) Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazlp170100001.outbound.protection.outlook.com [IPv6:2a01:111:f403:c405::1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 8C771F80494 for ; Wed, 21 Aug 2024 04:14:04 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 8C771F80494 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=renesas.com header.i=@renesas.com header.a=rsa-sha256 header.s=selector1 header.b=YUNMbWIo ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=QiZujAjBVQqEfHZVnWpPQ9djSyYzQ3ifE+ZKMuNaNDgW45tmposeNME2K/9T7U8ezOorHPaH/zZ3efvHmnXo/7gA0fSjVB7M4mu8cCAzJH6iQaxxQZcE363gswBVbyj77GN5jnKwbBrk++YV2drdsdImBx3yX9qTHFP8FGbr0ucm/J07lPccqyVf0CoW5KCx0YGN7ptdfQ60MjLvSc6eTPXv40k6iJnv/S+Tt+f6Y4lADIpW8cRtBiq0Nxjc/9lETkE87KhMnveXPJDDhJ+9bwddqZb6BGz0eG4fd5mNGXGLT1691vwiJsHz2BkFkFoawiJZV5weETTPRVhJrE/CTA== 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=+8WCPmBGkF9yuYE69O7efUftlIN6rr/4FN4tu1IBsWU=; b=HRzJxqyCFA4MgSQUuC+qoVrMn9kpVSkE/qDArBjpbH+RcxPwLaysfvi6TjFL6LJgiH837fXAzVQnXqgO5oOmClyuDR3hYqqCguiStQnVWKIy99zDqUHayQnQ7frPAiHw3yxq+oHZDLuV2tsyFR7tcrP6ReHYjhFly5NmWBIJxuOMP/vAcAnUtvEDM547hzuUwiowDDpCgr73FRvNUt2tRH9i6LZppS/kx96hAtJWEav8p9JWKNys7iwffLcDZ6G6YuJ0/ymjKnQdwSUA5MfGa+CPLT4/X58bMaqiyWPttJpGC4RRLY/NNfEaUBwx1OY4VBNDWmxjdycZR2PKCQA45g== 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=+8WCPmBGkF9yuYE69O7efUftlIN6rr/4FN4tu1IBsWU=; b=YUNMbWIoOsrZVxTSQJ61E0Oigoo7y3ZFS4PzPiBQuQtphwm2UL9t0D3ai/TyVIh7FAXnTV9VYnL1b/Nl5M9QjUNiFKGyiSIp3oxYYtZaYAmzoPfqqhH63eoT1I7yu1BAynnO4e6CiIyEoksG4Cdo9/yBZHS15Lq2u/kyjlWILOI= 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 TY3PR01MB11873.jpnprd01.prod.outlook.com (2603:1096:400:404::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7875.21; Wed, 21 Aug 2024 02:13:57 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%5]) with mapi id 15.20.7875.016; Wed, 21 Aug 2024 02:13:57 +0000 Message-ID: <87seuyaahn.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 Cc: alsa-devel@alsa-project.org, linux-sound@vger.kernel.org In-Reply-To: <87ttfeaaif.wl-kuninori.morimoto.gx@renesas.com> References: <87ttfeaaif.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v8 1/4] ASoC: soc-pcm: Indicate warning if dpcm_playback/capture were used for availability limition User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 Date: Wed, 21 Aug 2024 02:13:56 +0000 X-ClientProxiedBy: TYCP286CA0041.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:29d::16) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TY3PR01MB11873:EE_ X-MS-Office365-Filtering-Correlation-Id: ce083682-d9a0-4d77-b43d-08dcc186e997 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:13230040|7416014|376014|52116014|366016|1800799024|921020|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DvMrB7+pbGM02ks9n9MT23n042FNUatMJBxwRWoNW6pb5hB5eNYJSMa5yqF6tBbDOI3WoT48p+DZ0WT9qO2iBiFaa2Tl1QHho82dFLjKyJbHom3t0b1cGmja8/3eJVZvWJCergQkSmLjRSQg2sq+Qn37VCOcBkuTZ53k/8Z8Op+Vkx+DA9r1evGyPMDicO08piBOWKz8AtCUNmBfyF1wQ57Md1b1MH6sOy42o5URht8jZOVeb8jPr2FjqbMqf9iPGQ3CddeEpscDFvmWSWZNt93PSX+mfhMATJNKnr+H+i5TNM5W3ZqXuxDpYhiDtgsyHASHHv5GnDSdpy0N0SuyrloabmXFPLTo2otzcXRdrkF14y076haC4AkozEmJB91tViSJdzDeG52belFA= 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:(13230040)(7416014)(376014)(52116014)(366016)(1800799024)(921020)(38350700014); DIR:OUT; SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: hb16sh5tG7yG594OCm5IygtOMgYlrjBKJXbI6kX5dy4UJMMTT3LfG8NDLSBB3yPIYICVUU38MEI+cLNQfEhKIGMMJPb8N+g4ch5BzitAE9V+7e05TQ7BTCaqmnQt3J3QwG8/PqG8SKazJ8t7fAOmJx8G+N/RXZSDrsuAELtjxwSlFJKBfclereWEHHezo/sy8Yu+Kv5bqwNuTE3znjmgpT2btyMsD3lFIOexV8IY1Gg25GDb6SEsAtmIOZ/x9LXiigHTy4NqFGL7h8rH5DPENWfsqNdfcvtD1485aGlbaB03ffixw+oqdQ6Urj94E4YWZYfFEFoV9cmwxSvutKJQR5iQMyMX6USjJTx0Xkx17WKKOyf8NAWFKEj0Q06WAr40UMC+LFlnZgWtxb5JWsH15prDBlrdkwjcAb4nBoUA2y+/TOdtaxe7YruT/lYHk7SC7NEBhd8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ECjoLzcL4+QYSrKoJaSDW0pewwi/JZONSW6ZXNafN29ikZ+lXh+W80Xa/LRuOi2Lb2kgG9Ttd34cBzuXLlvmT3oGaSlI6K2GdNN1HjOhb08= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: ce083682-d9a0-4d77-b43d-08dcc186e997 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Aug 2024 02:13:56.9676 (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: oB44KLqjXWuCQdyXo4BUPZ5ptaPJGl2TdD6eJfWHYnop0b+REPqQ4AxJpq8UgcZlCBDyH69hZCqVEzF2j2GFHOVPYpoodf9qpLoBkqUcovLcoP3GTbWU1cCNbIGzUuRk X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY3PR01MB11873 Message-ID-Hash: 7WTGV5TLXOPG6FTK36OUGYU2NNTDKEDU X-Message-ID-Hash: 7WTGV5TLXOPG6FTK36OUGYU2NNTDKEDU X-MailFrom: kuninori.morimoto.gx@renesas.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 e844f6afc5b5..81ef380b2e06 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 f79abcf36105..f4a012e633b3 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -2745,6 +2745,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; @@ -2755,43 +2756,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 limitation + */ + 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 */