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: 797888 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 A9F7AC04FFE for ; Mon, 20 May 2024 12:28:56 +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 D8EDDB76; Mon, 20 May 2024 14:28:44 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz D8EDDB76 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1716208134; bh=HkaBqKoPlMRX/KjF6QtW/3H8GT5Ld2DmN4kB0Jo97PI=; h=From:Subject:To:In-Reply-To:References:Date:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From; b=a/KQq8IUR7SCYmoj+JOPMGzkGdYocKaVOxcJNrHSJylsfDkzOzE/INKPOktM/Dls5 ioCXlDoivovhX4qQ+oQzI0/sL4AtD0XCo5p75E1qfTnWhYSQncRmCQSjzUpXKGU3lN N35OpjJhZtbQaNpv06LCHHOLypALIoGyboDsEmAQ= Received: by alsa1.perex.cz (Postfix, from userid 50401) id B6CB2F80694; Mon, 20 May 2024 14:26:53 +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 A64CFF8067F; Mon, 20 May 2024 14:26:52 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 41F27F8020D; Mon, 20 May 2024 14:20:48 +0200 (CEST) Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on20600.outbound.protection.outlook.com [IPv6:2a01:111:f403:2019::600]) (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 9231AF8028B for ; Mon, 20 May 2024 14:18:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 9231AF8028B 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=KtmzNmH8 Received: from OSZPR01MB8402.jpnprd01.prod.outlook.com (2603:1096:604:16d::11) by TY1PR01MB10723.jpnprd01.prod.outlook.com (2603:1096:400:31c::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7587.36; Mon, 20 May 2024 10:39:27 +0000 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) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OSZPR01MB8402:EE_|TY1PR01MB10723: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+NxNXLCmmOKiiwDSKNEt8S415vHloJ6Y36MCgUl2yofBQWfQPxEXi1i7OaSwCxIvjrFbrCYOfXUgUiRynmzortFkpe4KbD9cPT8Q7zrZvh+G96TpTfqU+6xGzILwOvYkeXy0ifdYDHtWi+s8UHdRKjfm6J7HxQ+Gxr+EW6PWgMdShnfLskd6cY03iEYsdAZg55roQcJp91WgEbNMM6e1WljfIJJBgd8mWPnZEvJtG/vZQZ0ELb9wyMkLqxE0uOsCE5kZsy4vERMOpflBcxOGTwONaIxxMil+OsOXW1VgV6t5ytuOCISBDkWPIrcSzdhurtOQaQRGlVXV1uIx5f8OJkx8/x76FEytMlRumTEAsTqQ8In8JL4Nh4CJoL3W7WQz2nY5NF779eXlXgl0lNSTce+nHQ/IEIWYthhokyi+k0lG1F1pJZ5Skeb6PNNm7XYmQHvRI2qjEw8G+1Q+zGRQE/wCB+r4+d2XJnHTEW6k9qDUnKxP3G7WIKSvXLmSmkP/T0Xe4qELgc1OFYDwcyEBR3mvR7t/g8LP4A5hH2y+rDndrNsg/Ymy+QVnHI988OIfUtsga7siAKRiA4CQ40J50cgCRD33yJ0cTHMFBq0TarfWSlll29BNXvmyF6vEhO9TA/oRlIuCld19pLkYReUOrm/I7KzKPcXl/xm/1TtzCzxcrfjbGC4ELnYUx5JtfKRo1gy2nRRZlEvCaewTTx9IjbF2dWmEvBK1og30PmYioZxPtC7h/30+NtC2PX+sL9S7f5zTFoqbFTk6NBmvEmTqZZ+3HZnRjgBESSn6wXbn5Vmxwga3D4Wdiyxx/G7+fEWfnl3/zQPznUaRB8LvPy8+DDMrTC8Vvu6XWwGoevIpfWwE6OzuydZoBiMrUyIvOeL1jOMqab+VhbF6Uuftl143nlGkdd4vrEBoxk+Dr6cPKEay6cxoaP42Wj+QF1+YEyuvm/m25TMshdaVcEwj6Ved7gOAzaK4+4U+PGA6qAcL7UXsOytXZ87rZbeCtldsQPXHTavDpktdx3bQ5Y1of8lHzdyL72rp2ERpzEfeGw6NZ2X0j1Ld4glm5+kJxUm0MoA5UpViXrK86wlydDoBC/JckzmWALaHugPaDzG4CiWT5qNw3cUNM7Qd/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+RXotJFdsYn2QHFTQVUMxRKM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FVGp28OOL2KOhEROlVvPVA6A7hCzJEdcGJwqvC4Cu8eFkiOSCrM8ETdCihnmkb4fZ9mcIAVYArTP2qumDAwWuXitSBJsmYywYWrjMtDUZYOhtBSpL/vEJ7AypNyysrNWo/bSqSVcf+rhQJ7KRgJNF5gwbvxxRRvDt5DyKSEiLZWIIZ+aCkUVs7KlBreqN4kykWYqNwkm7PSEFz1/n3Z8CEKR73gzpAPlqGeqFB/GwaYxuqqMuK5UUnto97+mIa1LpB/REEeTcg= X-MS-Exchange-CrossTenant-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 X-OriginatorOrg: renesas.com Message-ID-Hash: B7FYWABEW4SCP3IZKKMJISJMN4333DTI X-Message-ID-Hash: B7FYWABEW4SCP3IZKKMJISJMN4333DTI 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: 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);