From patchwork Tue May 7 04:33:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13656213 Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01on2066.outbound.protection.outlook.com [40.107.113.66]) (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 0CC3A1849 for ; Tue, 7 May 2024 04:33:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.113.66 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715056411; cv=fail; b=qx8j+K0w4KFng2u4Ra7ZDpzJDUKe1Zf5zv0ugxilIP2/IaSkekBzhCxPyHAM4QxMiz7KI8R58OLB1gc0tV79JAfvfOZRXBZw2uwsxH9ReuJKmKKdDijb0ro2l/LszpslnLzyNVgAu5Kw+cYbKRTK+WFO+xvtlp2vTu8EYQ+tAMo= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715056411; c=relaxed/simple; bh=UlHQyGTEM25XSr3p5+bW3CoQw0OnSzjELwKTZ0swvc4=; h=Message-ID:To:In-Reply-To:References:From:Subject:Content-Type: Date:MIME-Version; b=pz4tou2GNkEf7LED137GUFgTAqBBGzlQoJ7ZAKx9isHtLGvFoMfwa1YJsjyCdHA4wwpvbSVJPTLuM4b2DKbrc8oL0PCRkIhPNdchlwWuRfyYLypjfKeI6Ba564XIyGQX7ObYF0N0/N85kVJThiKR8yJdzbWG8zUEzZsd+wKeu0w= 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=KVWQ5hSO; arc=fail smtp.client-ip=40.107.113.66 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="KVWQ5hSO" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=n5aitSraDX0vuE743TxNqfsXlo8Q4RCO5HzMNo0k49UGVYm6hqkw8c7Asvvf13uNCu1ptnJNPqmeLcKYIGpW7Voye1khwy1JXGa4kILyFHCL71pgXAcSdXfqIql4aVYMhxX53PselmFpNKJkCCZAppYfeTvh225MZuH30AZLYNqxU/tx9Ord9+yHZSHd+nt3QZCO0fDG2uVuP2tM7CeYn0tbhBb+6vLulRD7xFMwIWbXAeej5VAgNHLcQe7FXHPXaFteQo/dzks5OmFmlsBOjs4QmZSxJ61XvWlH9nMWmRQ8uQtcB+WNuLS06n2FBpvrxnCIu5eV4CpIWJastUV1aQ== 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=Gg4hRucnB5OzQHB+bt04ZDQEzn+T08yD1mFCsrwf8oFx/tmELRHjA1V51Uvj+qAKqFUqtqlB0PhBvV7XEHOTKbv82DNzM6uOcJcDgb4CoWzj1Rvwd3fOafAnTjL1lWlb80uBvVPJFpAwte/He/SS2onq+kWBWHLFThIOcW/1HZirLBP5YSTEVp6PQJclHEW8BtUQCFJcrnKFnUM5mrtKhe8YwMu0DoSA45J/deiSwFSms0NloeU2Y2HQyS5Pq5Uod9UbrEl7rYl0boeY5jPbuTJCud36wYJZu+KAjnYnKKkxUsurDPdrb1wRBcCML7X6guexFAecHoQ8lkgLGW1DZA== 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=KVWQ5hSOdUVVPDiFC9qS067r4U8JPD1jDpftDeIDW8jNCcKiJ3NGf0StIl6L3GAFM4OgtQykFpUZZpU2Dlc+s7HBHL616STpRk34PAyTpV8ZRJ4gM5qGyP6i+qfNa8cTCfhKb6s8bYbQEB5o2fVVJvSbjm4zgqkb480DFWAbgH8= 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 TYBPR01MB5421.jpnprd01.prod.outlook.com (2603:1096:404:802e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Tue, 7 May 2024 04:33:22 +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.7544.041; Tue, 7 May 2024 04:33:22 +0000 Message-ID: <87v83qdywf.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-sound@vger.kernel.org In-Reply-To: <87wmo6dyxg.wl-kuninori.morimoto.gx@renesas.com> References: <87wmo6dyxg.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 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: Tue, 7 May 2024 04:33:20 +0000 X-ClientProxiedBy: TYCP286CA0082.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:2b3::6) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYBPR01MB5421:EE_ X-MS-Office365-Filtering-Correlation-Id: 2196bebc-2ddb-404a-3ca5-08dc6e4ed410 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|1800799015|52116005|38350700005|921011; X-Microsoft-Antispam-Message-Info: 0obCyuvmGrKez9uKZhKVM0pbhVzXzbALSQwHvuAtTz0l5CFOkssMPKTNL+x15Q6406hU1b0BxXmx3FPE/rtAiepm8EO1oxUqp+zC2Jn4zHy8aOWIPq5P6puyiCcLZAMbLYy6PeWndGcixjChpKtHKe2esQt5Zhfna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ZBRBaz7AZXIE66uWi1kHF8HHCbaOYJ3dTngG4KhaKqGSsPQ2l9ASS1ywDzI8ZCWdmjKM= 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)(1800799015)(52116005)(38350700005)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yrVxrtxSSf5VZJLpuVmXahSv9e7PCPZPi9sGKsRAX4Yt5UN8xI0uzP/oXvEd+lXrg5R8q4T5nPiKmI3rZbsMeB/izdm6LRWOVMoobj79zOUqMYWR0dMl21mgGfbZ6Azy5ZlwdJ2CfZHeisXM3+Rqqq2+kU8mF1mN+tVyLtOHYC8YBEyMZSoFPNfJT1DcQs+qhPTM+uF0DJPhw8dGHARNgXcj98lgcQ1TbGOYUCQYmPe+mc3pVLtjGk4VdDteX7gQ+LIbLRyQUn2erQtr/ObdqqOG3hHNUnO+PENmWgWv+MxvAYTqn5DriLWa2SzzSniru8S0LCbXGNPVNCqXoWNPubO/Qjq2zPPUf7kHJB5bqV5kWWU1CllSiLsEk32DT7st1ea0d3x1DJ/osFXngC8L7HHF2gvJja71aO3F4paRApEfRfJVBHh1RRL6zKfen8bpdq1gcNkrOtCHzaaaZOhF54FBgyDyZ/JhPLOdVB744eb8NPWRNjFMMfcu+oDXVLsxEJJOMswuurpTtxShtQcdA/vyG4vPWytjRpUM2LsbehrEWP9uqhLNcrwvA1nl4wY52JyvzPWi/3Ig6wh6oJzbF+IOCnrftHE9yGqTlQwCSR/G037Qth9gqv945/NCxz7s7m+cSi6jSo15bVXpm4qhfMXan5OG6PSM5BCyQK4AwyVupOvYAGLuHJz061GqfHmw17XhZKMQU9evYVnQ0mt/YCEOG4fInaga4tWinVXkczZk2R7EbozmWz/y5Cfy+JWFi2u0D9AeQDML9tzRMx2Qz509HYGX9Areg14F6BZiMmEOjx1fLfRLxOHTKrbWpPuQeENdhmCbwqg6QIAM4cEqSQUdmkU4c4tLc6TkIPttaWtMrm7AD/1a0bVsVn2p3FUDq4A1ztcdNtbHjK9XAreTz9PTRXtPIpLRxArHW7w/JngHA/lkh/zWEH/wR6K4EQv4qDviL4KmOER5MV6q/HU6S7GDrECYcPpZGO5b5acB58l9TDv/NoPUaUbD1hB0V7ZucfC9BXtocoBMNKK6llON7wdCeIts1QO8ppBrPv63e+YbiN/l0AKA5IQAWlR5IbePm5akFds4S5V70+7l8Y+9gnl5yFZ7MeKQpXxwkFT7c5LB40XQYKEsMFNIyzM056M6pUdSVm+rqJndq+PaBDG5UmRdtoXTyLhZNiK+UpdOHW4bJzr35vBi0UBC7UBaq2NAGMvy0DhAJk1ggt9GAvf7l/LXeSxePBrhA5U4Kw3k5x/RCrJc0QW+zZc+lRlc/aeIT+3lCru3jDGeLL+J8JbQvHy3wp3+l0+5CpalgB8fUWeQ3DovzK7vPrruuPxligfjE+u1S/dfROeJbKfxwFbAwh+OS151HHPdfeL9ly5da+pnQluhkltEToY95/+n/sCwJitirOWyeRdjbEX3oG+CFcfAUC3AeQL32iZ62V/fql/W/nXBQHvsS5JGi67yK38F9HhdzwE08J6gnrlzjWMGYW2a8//tJwJ0Jyy7WfVshquEjSmZrB/9409r65ayrvY1gi0yI6PVW43uOP0N7XH9Nuhs6zJPpLPGfxOyvZupHtvE2qffGukA09dTwq2DoON7+tpXolj4tZnQ3o3GjlGVQsHm6qGJUdqe7SO6JvEuo0A= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2196bebc-2ddb-404a-3ca5-08dc6e4ed410 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2024 04:33:22.5304 (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: og7fFRVmzzH201DyYsWNaJEjHj31PjGlkKva235VGunE3vkYE7eiZMFgAwnXlJi5wcX4bLdMEO6XafnEfHHED5bDqmYnCSMEA2a88xR6nznPVLTlLJv0QyjWTKGxClTr X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYBPR01MB5421 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 Tue May 7 04:33:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13656214 Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01on2055.outbound.protection.outlook.com [40.107.113.55]) (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 1A82B1849 for ; Tue, 7 May 2024 04:33:37 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.113.55 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715056420; cv=fail; b=HRUcSsAc1veEErwTcpGfiFyAw+UP3xSLwApbB/U/aFCyhXgRb/gZPgc9Z8EWkbBrPary0Xk4U0zhXCpVW40vnIDQKiTYMf8u9qT8VJFzM+AL051l9uf0so/IoyfvaQiFtZXxy1SdtEZ+IMrYVi8BFgBfhNhyGuaU+ZqTjYSxaGk= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715056420; c=relaxed/simple; bh=/E/V6iqWldQvNewwoCG/uQI+67ab0DotQYknFeOiXGo=; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type: Date:MIME-Version; b=sFTUH3hblmeGn/VF0Q5F9AF6atCK0pHUZ7kxUdD5WQabH10eAUe/IgjDVR/6/JSdY8v963QOlpAc8/4pACgvzG0xfSQqP93yl0XALuxmDWdbyKz67aJTiVeAaHEiLFC2fBlh8juI2mKT0wowqQszAbMgF8GDvbykRWoDYFmIWBo= 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=Wahkq3y2; arc=fail smtp.client-ip=40.107.113.55 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="Wahkq3y2" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Pc2Pz27QAb99Sv6jLBHIveEYQ5fPB2WgFIPCKzkLjdJI/DHFClcI8uLkjzMMV/MxTsKSw0Z+6jOM9cElJJwK7T92fWfGGLholup4FSc4nZy7T0w5Pidp7nDXp133QAFGbLAPtFNgUVn3Vj3n3/FAv1rXBIKs377CbRbpie6WvDWCbj18KWFiyPmk++lrnciEikUh5R5+Vhmzrp/8r0scxw70XAwvvsUJwm6OyoFb9r+ggwd+3bJlP/fzZl95z7280sN68GUXuaqsigFUQVJtZWgxpzpVQ8IzBupNDh1i1OSE4dKXaHXpWdGTsUsVk4y1jLctVNv/mV37qM8GdsTKLg== 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=heqPtfEv9Cw6mac72AGiZGpcQsh0zBQKwszcoJ9YY5E=; b=MXrfn13nFOGLXZi0BUM24F+0LZhgbf2odoasVeXcQ565jkvDOMMNiy0Mj/MrdTz7T4SupMqMSSGqftXbBzSGKsm/ft3Klieqsh9GsnAXOa5DUr+rbJCbDZ5GoEUvphBqPtIfcX54IowKOiMTxzYXrdE+veXCUzeeaJGm0g9/5qWue53gKL/IugfhuFtRMNnhvIzmQrfIYU0RnJ2qP1lV89xCbn2dhxEnxrWWlPN9qEAxrr8ny+jPWe2wJ9AUULjpcnVkhk+IJDhZY3FVmrXyXkBKhPsXVXeubnYm2FewCB8BwSHBkEmDMmcb7VEf60smU5QLsfvdxuhdICwmtzLd+Q== 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=heqPtfEv9Cw6mac72AGiZGpcQsh0zBQKwszcoJ9YY5E=; b=Wahkq3y2WpvutRDzoa4jIuEawfkFLfQGmrOxFayHGp5YSf0ongeIVRoMFen21Jrnr//M40mj1RGyc0uozc0pc5rTq3N/Gj/OyWp/XJfzEewTUEJJmQDN9MkbnQ8UT7QlHb/b4TSoTGWwrTq5KrhmB1YitwdCOxxtRlxZ/cSw8oA= 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 TYBPR01MB5421.jpnprd01.prod.outlook.com (2603:1096:404:802e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Tue, 7 May 2024 04:33:34 +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.7544.041; Tue, 7 May 2024 04:33:34 +0000 Message-ID: <87ttjadyw3.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 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-sound@vger.kernel.org In-Reply-To: <87wmo6dyxg.wl-kuninori.morimoto.gx@renesas.com> References: <87wmo6dyxg.wl-kuninori.morimoto.gx@renesas.com> Date: Tue, 7 May 2024 04:33:33 +0000 X-ClientProxiedBy: TYCP301CA0042.JPNP301.PROD.OUTLOOK.COM (2603:1096:400:380::10) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYBPR01MB5421:EE_ X-MS-Office365-Filtering-Correlation-Id: 5d8aa712-8622-4e25-9dbd-08dc6e4edb6b 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|1800799015|52116005|38350700005|921011; X-Microsoft-Antispam-Message-Info: wndNTtvonKlw2egRJ7EHILVYPsFt+fZUXbyKANkzCksnClr2rbNKaaiUUPs268Fk7ZaCAATEHtRrI+4BvwCkXobVr8yIi5vPICN0G8piIJUN2rUpKD6ljXKCaYgz7/Bo3aEuwAL6RUwA6j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1ek2XmchXAxr2PmchYHyoOOpgqfeOhUb/Ey5tRHxCOy5Ja6mddSvPJ4bCalFqvLGQxqG+/gegQlghuNLuVTz9OML5uY9vmbMmUOO9fv7Jn44MOWADzsD5cKqobpgt4wIJw== 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)(1800799015)(52116005)(38350700005)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: KgGrO0qtELVAANZ1/s0lBStvz8g9hZhGpa7TP8HjkU4MGxsYy3Q3mwUWQqdrUbZXiNuqd3DoCdsqviEqr6FMOX1h40qA9/MeLKXkDJD7fwPcez6K+WbLzoUGyofRnPB5+a1DMgb3NfQV9SeLjT+NdGz0n1WNoxjK0vOYvktd9Lyebk/X+g5JpLi55BsQdKOWR3ETGFE1pynrD+RHzTFMcbl/gHKb9qhRc/tVvr69op/uO+N9pS0KNWeDCBawxitWbQQVruwhWEjtDqjzBxe+IdbiBAFtSEGdALS/etVoTlFwIZuPvu5T4BO9SjINU13pX7botAAcphJGC3HuTPs0gbiq+gpnxCCs6VPHGVm/fi2eLwyGxIBCTVitqhsIcjjn+XV397XAzcEa72RCsC9wKb0of9jku29E9uAYZOdtgBs60Yea8UoJkqZK/nXYAtnu+7ni6sXNvWCbJS5ngHAHUzf6+6D8dF/KKyykww3QrOPFYJZ64MwXJ69ZuRGvobma8QhgUjpZ0ivJZRCZAFDDuyrhEh3yFyOLMJROIJwmJdvgzy7u4Y/jgQuSOKDy562jUTHV5hLNJ2etpiHn34BmKwos/F2J1g/KqljGPxBRraFHd8boPf9bIFBeAuk01aVaF5ViNRAJNvQkC9u7EmHRs5YJ1bMqVB2TTbj5xBkAFyq/pXnxPdXQm+PVNDUAFHV682Fpbh7/IakfmUcWmtNrTPpNU5/sfjkHSb4vGnsmtPjN4pCxvwtCb8/1CHw+58cQ2llexLZzIlPjnYnZo6lCbaft+qG13vp0DvkU/dmfYd5OJiPULvWLtglKmcFNwa776UbZ78jF/cL8tR/YbzOwwCABVjcZA2mVe9UArLCsNEAHwrlzqWWfW66ykBJyRPTyZp5T2Dd2hGxbQ1+Jw+DU9exoEMKFa4b0vDDJ6fIGKqYytH+jEiDCUzMihBq3pEyfCTemtGNpndKOJL3HZpdkyLLdNKobMnoTTGrNF7CBOqRiMo306ro+1eZ+gzeVI9TTg/W+SEhdD/YJ2F3+D+xZyk3+ottNnVzcD73NDzuOtzdRoNfJPipdSpeHL2iBSP1TwHiqgUuBs/WgoFZRf44g6lixTeRZZCEM3cBFG/d+rpramDSPvc/FgC8lJGvrFjuu4WKXyNmW3IcCnAc9ipu1FInWilLSDLRjoNF52Oi3BomiSKu+P7v0zSxfnSE8j7xl4QHdyRSBV3PNU0iN69NtimhwZUYAa8jE8mO/5By424jgzMXVf9HXQkpKSilUo/VImPb6PrtiQaSH7V8szsEvG4RnUoTTOWoPzm1SKs+Pd4VEo4oky5YjOW5JZEVuARbJ+fW+taArFewer8/4a5mdx3o8TX4EbuycO7J1qeItSRwqoPqREkzOX/YuTCRSXpjcTaCrl5u/zdVF60GkplqgXj6tbhPviGUuTarj0sU5E2INX9qvsO48jEnSvXCCQeMQbN3NVGrW7rdlhmesnCKCy3PvMEnIvN5l1pIopjyARjI397BW5J3H0x20kT+W89KRVaEqu4wiTiJvPx3bw+gWdDdu7l0HkVMJXFf4mY2Nb33et7bDQxUHP9X9Y1WWBi5RoCY8FF52MS81jz2D6oWvQs7kUwzB5RYDEa7L3AHc/7M= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5d8aa712-8622-4e25-9dbd-08dc6e4edb6b X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2024 04:33:34.8683 (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: aKc4pezdxuzjmDTH4WaMseORWzNZOu/owD7lCn2xDMEDssEB8uYSJ8VW6fOEoaMjMR8FfqHCiuejbJHxVRApSf19zXpCDEbidK8v4EVj37yCUc1a8VRuScSubGZC4qkh X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYBPR01MB5421 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 | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index c4d80cad5982..8652057fce55 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,25 @@ 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 (has_playback && !has_playback_both) + dev_warn(rtd->card->dev, + "CPU playback is available but Codec playback is not (%s)" + " Please update Codec driver\n", + dai_link->stream_name); + if (has_capture && !has_capture_both) + dev_warn(rtd->card->dev, + "CPU capture is available but Codec capture is not (%s)" + " Please update Codec driver\n", + dai_link->stream_name); + } 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 Tue May 7 04:33:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13656215 Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01on2086.outbound.protection.outlook.com [40.107.113.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 3F5381849 for ; Tue, 7 May 2024 04:33:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.113.86 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715056430; cv=fail; b=T7vZQwPSicZMsR3Z/WBcuTP7hlDQ0H4ectFAixmnpJ3xnTEsRgjZV/46oaRD9dxWBVtCefPz0xxrW6tUCxjBFJ7ZoZyw6EPbGnzRh2u/jDTEwmvtrn1+MLWA1ro2i9P2h19fFuRrFfTc2x7OAyK8or1Yl1cOzp8RodZQa3K6fJ8= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715056430; c=relaxed/simple; bh=JaEfXBWlGHqdYwZ2dANrrSieJSCowt5IpkWOna4hHjI=; h=Message-ID:From:Subject:To:In-Reply-To:References:Content-Type: Date:MIME-Version; b=RcL2f5Fqd9suZ83QPu2XSohD2AGMwGdkRyvmxPv8aEQhoYG06AEKJ4hBUoZFQseCKuaD4eAQDZ10G/Z+rn503cDMD4o4GMTptneYWoziGXcr/vl/Rd+Eo5PEqRGJGUdP6bUm4jNdX5Zcy5/bsR7t81giDW7H2VdVwbOtzXOCepQ= 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=XoCmDYd/; arc=fail smtp.client-ip=40.107.113.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="XoCmDYd/" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=QSce4s1IqoIXne3vtycCFIOSBol6bPCqk24AQkXYr+RiYXQtxokyzWfqHV6dPmOoTMcsP6n3S5Tcom+K0KpCd2YlgNgri9BoM+wwVHkteFtLMLz6cj73CyznlNdNjJM9NzhUSBGN4qxy0hfeTjDVqVx3kDrEuUUgWZ7ycnftZruOS66uVqVMqUedGyKmBhAy760GRy2jmFiaCUpdhJun5rBQC8QHYuKjzwtfHB4EV3zbEgoRuhgHxs3XCVhSECg0TzNZFfshaHPCco/Jmk5uajbirPRjquj0+KSwQfu3Egq62X3ngzTlHu3cyziuM3EzJiPrxt3uP6eppkiHzHf/9w== 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=gd/RuwGBxdKkc1doDWgGbnL0DgaOjhPXyj17s8rXG816CX3UeJMBOrN5i7tvCzNLoKeTND5wQ+grdkmTTaiytysYpK53ize2icWWs2Ee3tY/0yb0cZUCMTPi628g/VtaxoMhivCWnwG/My+q8eQEjJQDGWaydmnFDg5tVRXsPCXukJ89GSe7COvyvF1FuzowmZFUcOFlhIU82HkjkkHpGn/iOzZrdUnd5xA+rOpvx87PfIza0FDpgnrdy44CFxorh+m9GLsByJl8LYZ+Dx6deZoSx2nSD6RLtsGU7bbTNnLfP2+ps9TUBq8adUg4V0GbLroferBWqJBur7iGvUKhsw== 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=XoCmDYd/ozXIk82rcVsh4bpG+pWp9TcZX+Q7k7cTXTAuZH39pmkmHpPWIC1q/Cczx8ShIcIfrVa0bb9QA27tZSZCyKLdlOfvZieNFcI/n4s13YuDqLAcLxu9035GQGhJwzjG8fhEfZZx6sqyHLy8LgYsd6NF4YYBwRQNVsMJ8yQ= 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 TYBPR01MB5421.jpnprd01.prod.outlook.com (2603:1096:404:802e::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7544.41; Tue, 7 May 2024 04:33:45 +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.7544.041; Tue, 7 May 2024 04:33:45 +0000 Message-ID: <87seyudyvr.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 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-sound@vger.kernel.org In-Reply-To: <87wmo6dyxg.wl-kuninori.morimoto.gx@renesas.com> References: <87wmo6dyxg.wl-kuninori.morimoto.gx@renesas.com> Date: Tue, 7 May 2024 04:33:45 +0000 X-ClientProxiedBy: TYCP286CA0165.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:383::11) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYBPR01MB5421:EE_ X-MS-Office365-Filtering-Correlation-Id: b052f01a-9e9d-48c8-85cc-08dc6e4ee1e3 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|1800799015|52116005|38350700005|921011; X-Microsoft-Antispam-Message-Info: kz8Q6yIp8ZWpEfKsMymJy7YzzBspaR1TI7tBy5RT7qaRXoeGRRonIgJOXo0f5q7v3oKj2A+jikS2kfOZrrYFWwbqToe2utdl6ihZ5biKOHfURutXdGUW6KZLtVGpMRG/KXce0W5ZLaHQGjtoXGvLnDn7jGtXMgbSPg/pKX1wHxe69j5af0wwDIVO2nxSRuutovtEEFez5PsU+cEN06BZnP+9ShZvrh0GCCGIwjdnhHkc5p7hG09XClxSUCo2S/19zAE1L/1nz9xFaVshV5zEtHjvcwE17D4eHknjfeXcfHcICyNUE1WnvE7wMTtgtBw9yaxATUPNlnMOG+xpnSQ0lz2V7WHY0lhC90bi1lkmKIUUKU/h3nXMoV/b+myOpcFbT9mFluiVYYDSDvdweOeoqr7UXU+akHI5XrfqcjJ1RQlcdYIDivPOt6MBgtEbgwDvNAlpijRIEUSTEs+48OYaizY2K4N4uy/AX0XPf0Nfq3Hx7R/t1uN+Z268DwADrkhH2E4XxGhaEq9I+3c70aKtwY0rO48Eipkt5unbQlWm7WwQpbLd2aDl6QdhNSGhRM4Zv/YaVSdOOgRviygPUKSFNWa+LNYNihNLIWxjcWAbUwtR65S8qhA9jsQ7FnBt3XcrQC5hHK94H3B16sZsXAmflUbg2F4EaaxuJEFuJIA5IJyO8eQB1r91k9pC8QDzgoplnJ34sPGXQUo8nH4MG99tWbnEQDf8nBfNn+/a6h1Zrgb/GZy6Q0PJXQQrjLVBnW3IpAfK9hjtyPfzoJhYCalpCUCWXoF/nUcmPnIxuI9F0/xr5e8/KKCYTERIVpmYdPWW9x9C5UynW0qfy58SaXCmgYrEGLqZJGhb1HRITMkG7jF5V40QOaH9LiAYy5PvdzeqhK96+Y+TQUnbg4gHSTPpOFv/9bgkGKFtP1oRXd26FUoQDaOGkuhcvYuIFETTGW2JyfOu4nKOWqUkqGKrdshW6FGfOER9XduHHc4qG4ldlGTK+ejCn2djbnUUsv1mAsHtqvsxQZxJ3jXi8QKsnJT9BXhwvT9k/fyZIUQtjQoDvV7iA2QcyNuqtgVgdCM4z/iJUtzvdd0+Etbv2AhCuIW20n58VxNzlZByfwIMYhzgPjFgUdVXnIa2WqsmBUEXmhC0+zJjIlY3qMExG2n78wG7jUbtTfKjWD9yqU/J6G2AnH58DhEZodYHEK9nvyKyrdNP3FC1xd+g5fVVIIVsezp6acsHqX69RzzvZnwMBEoDFxsYh5CDZri2Wj6Rb4chSJ7ZNO1PLV9tq0vVGqYoQXJ68e8P5d4y2SkPWVt+3yakUZh+apM03c3ySGc14NRoYnSGrZ3GimbodS/OVzlTrmdTNVYm7xOAl3vFQJuJmVnwAEs= 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)(1800799015)(52116005)(38350700005)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-Anti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oMx9ANqT/SNQ34TjSfJLEAvcqFDtUmrcAU/KdMBe8dliX1Tt542R16bek8qb/497GVM1hEqorfkFUgE7hRyWHFzDzOskoHX+fBh7+vQnFWPHgJaL1AlheAHiuwYg8fLAug/647dQpmwgzj1P57GODrp/1CAtCPaA440r22ZrvGljofSzN42Elr8hZBFHHFbC59xgCCEhboHAe96RaXcYXR0o4ytJb6bVnyvh9eVosLDO5eWlqUOA9bnrtHtveqLe2jMhgznEr+DVRRnjv8BcR5W9D3A02eMSKLXkopKu/lrGR2CrMNT3Q9kMs7Q40F/5MaVUFcZPuFj7utbONUZaq+SQf+81hooj/izZ9ONRy+BKAJoIV5GohcCxehHpbd1QEjeeyVFlC2eXrXBjUe5Du9Epte0voYdyUSn27QZNkUFKJpOh4oKjPLFMnEdoOh1gZySWYuUXDgbPOr16sxg+yFrZ0YRBcazTVKaLhco+B/YAZmXqDRZRVCrLadLpgxa+kOuU6JmOxWRYC/ML3Gkpmf/0jfc8trXuRVJ+cfTBVgYUfNt76cV06tOisH9TPrGU3rMeaT3uFSmCzm9eVSqadFii2VuLDG0b8= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: b052f01a-9e9d-48c8-85cc-08dc6e4ee1e3 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 May 2024 04:33:45.7135 (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: ECtsaOg5Qh9qmqkgRTG45kBwG8zpXWYZbnHDhBTGQk6uYYr9HjPaqLQW3kNVZv0sJ85P9+MaI6Q4N0Hvtq3bfkDeq5GdO/TrhIs7wAzP0UlLfaWYdasS0zKeG/Q72irp X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYBPR01MB5421 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) {