From patchwork Mon Apr 1 00:32:14 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 785952 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 4D3C3CD128A for ; Mon, 1 Apr 2024 00:35:29 +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 96F5021B3; Mon, 1 Apr 2024 02:35:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 96F5021B3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1711931727; bh=+wLzEEH1VR3pAyqzkI81w9saoGk2Nw17K8rce1d+zKw=; h=To:In-Reply-To:References:From:Subject:Date:List-Id:List-Archive: List-Help:List-Owner:List-Post:List-Subscribe:List-Unsubscribe: From; b=GJevDxq/xDLgIKhB+qZ8IAcPZUId36hWEaN9pzBmGk/9+Tu/exES1KNj5CAbzEKHA or/gl5skyPd43ox5C0YmsOysDO609x5IqIxuqJJO2HfwUYaCuu3A/1gzLOXw5taH33 NfKOuJsPb8Fg/wJuCksDSektOXpICKejnsfAfEOQ= Received: by alsa1.perex.cz (Postfix, from userid 50401) id E2ED4F80750; Mon, 1 Apr 2024 02:32:29 +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 2138FF80743; Mon, 1 Apr 2024 02:32:29 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1DC50F8060B; Mon, 1 Apr 2024 02:32:23 +0200 (CEST) Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on20701.outbound.protection.outlook.com [IPv6:2a01:111:f403:2019::701]) (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 4CA76F806B2 for ; Mon, 1 Apr 2024 02:32:17 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 4CA76F806B2 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=gO+ElW1A ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=UR4R4FrwJm6s5aHQabPGPrCfHgfZt/GrZ3Uad06AQ9nQp51d34giCJZaKDBQE6vRn3rL0rLuyA14ibFCpbyQLmC9FlO7ODvBILcUHJ0Pg0VTrse13ynJ13Fbn0kX5oK/iqm89aHpQidvQvjQxXBL6G5gULb0aFyOmqmd42pEyKqGq9JiXvSjvSvbAq/XcVe1Wt6fBczz60Rko5f6cJC99d8VVwdkpur1cd7A91oU++7kn1/fVRCph+6fX5JyNPg164az3pRWrXuIS7HtxggueAGordLi/0Npf+iVgke4Z45fA3logCKb25iHwiooy0Ar6PCz+y6yYfqBMFKFsbH9Tw== 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=isxgVF7FV4cYRw7Vog5dLrnbBaf0FGSvkU1zDV0afZY=; b=LIvXmSCoDIhtRUXjR8CnBtrLG2AiQKtrZcjDKooBs+37beifRw+5WvyFWCK864BF+EBySzaz7T5yEyUjqA9Dn/fbfbNEtJTeTHc3U4uiA++PrlXIouuHrN4t6cyjBY30l1j/7mCBViaF5tEH95mj7vTvR0HuX3k/gV2ihMNM8Oz6wcn7Kzj99VySPKC9PscTrVFRnEHjgdojbnISQMqKegqCNVlNmOQSK4Zfe6NXm+BlSRvtgH5V+PXiujAzv+G1nriCBxRL/6teIj0by4/bHMScxAA8ltt7dyHhzgPXQB7kE1ZKQfF3mNYk2JbtexJLlYBJiKpiYgINx8+sQ312Bw== 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=isxgVF7FV4cYRw7Vog5dLrnbBaf0FGSvkU1zDV0afZY=; b=gO+ElW1AAWmjwZ6qSFhZgqyBTXNQ37IB9tTGElHTr0p34NTq4BNl8xPY8H66Qn3qTp3jgInKoUPuQUUwxKNBuRAqh8EtLoTTZiFEBIhmAvu/RnKKfV3dNpXT1CY0PVagWfvr+6VOHZXDHZ+upRJ2DyAv8bIPAsMRu36hxgurIao= Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by TY3PR01MB9964.jpnprd01.prod.outlook.com (2603:1096:400:1df::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.46; Mon, 1 Apr 2024 00:32:15 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::131e:55c0:a4a0:713b]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::131e:55c0:a4a0:713b%7]) with mapi id 15.20.7386.025; Mon, 1 Apr 2024 00:32:15 +0000 Message-ID: <87edbpudm9.wl-kuninori.morimoto.gx@renesas.com> To: =?iso-8859-2?q?=22Amadeusz_S=B3awi=F1ski=22?= , Alper Nebi Yasak , AngeloGioacchino Del Regno , Banajit Goswami , Bard Liao , Brent Lu , Cezary Rojewski , Cristian Ciocaltea , Daniel Baluta , Hans de Goede , Jaroslav Kysela , Jerome Brunet , Kai Vehmanen , Kevin Hilman , Liam Girdwood , Linus Walleij , Mark Brown , Maso Huang , Matthias Brugger , Neil Armstrong , Peter Ujfalusi , Pierre-Louis Bossart , Ranjani Sridharan , Sascha Hauer , Shawn Guo , Shengjiu Wang , Srinivas Kandagatla , Sylwester Nawrocki , Takashi Iwai , Trevor Wu , Vinod Koul , Xiubo Li , alsa-devel@alsa-project.org, imx@lists.linux.dev, linux-sound@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com In-Reply-To: <87zfuesz8y.wl-kuninori.morimoto.gx@renesas.com> References: <87zfuesz8y.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v2 15/16] ASoC: soc-pcm: indicate warning if DPCM BE Codec has no settings Date: Mon, 1 Apr 2024 00:32:14 +0000 X-ClientProxiedBy: TYAPR01CA0006.jpnprd01.prod.outlook.com (2603:1096:404::18) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TY3PR01MB9964:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: jdSVM4y+rMyw3UWLmd9gwC7floHcXNll3lPBtmqwcHn5WkpAazHAkBwJvobA4IfWw6SIybIdqy7fEXqKyd8XW5PmA9g26mf5vgaznvd22mG/oPuAv44tmNj2Un2oeeEFFxQKiWdBn7fmWnV+qtKUWxnQB8tKIE7yEiFrfC/TeHu1o1f5QKwt5vcggfEz+AW5NDsc2OBwhjIP+ziro3h7oWJskJOfrrq6E8uFUn7GPNgAczKf66G2HssmX21SRPASRA7dMTxh2SWOUdk1uNwqvvMxYOL5Ajyysm+TCcJfyFA/N+Ax4J4fk6DwaBujZxDBeQSixPIOczr97s+l8mhxA8108LRh500T5I7GK6Jb7N6gOzTML+v1pYvVKzEP3RWAn3KklUXfFmdarMsf4nHZ37RxUjKJ/vjDhsK9ddOvbbQRBo93RvfZwDreR52kLy5kwT/T8dRVN1D/Ch9Hmq6+k1TPDoXj9YPnFlq5IDtlcPhnxSUCzlMy53A1XRsXl3UeYLraXHrTCVtp8M51WgbC/Rl8DTMaA3nYAI4oXZ807Y6cOMPDdkWzFadoNKVS6xZhQUviiuxHK+azC7K3Cnw3A1QO+lTcpJ9k8NBxzt1BkVSd5z4LarUeIqUrj1rS2k6EkSt7SmudhBOh/Dyu4BaAhBPl07gOskRL1lwT7orQpFt8A4QMDlGbkO7Ia/odJpiD 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)(52116005)(7416005)(376005)(1800799015)(38350700005)(921011); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-2?q?ZmB4gC2G91qwEd/oQQTrHk2?= =?iso-8859-2?q?eFTOG7ahs3lBhFUFVFzQC5NEAvVNB9M6l0oxhAsxec9GTBep8xcpT+6yzBxl?= =?iso-8859-2?q?UPx+13NID+y1e/NtsDb1MU4kuYB2Wy4g5CSqOYTiVNfLGDgkeR4pIayfhfAB?= =?iso-8859-2?q?Fwosl6vKys9+XYZptqaQIYBbPzDJs49OhbMaB/vlPb4Ymy8jREK5zPJ3TYuR?= =?iso-8859-2?q?GTP6mNkgGitwDNF1AUEz3pS9bYE/gBdgGwvn2dr1QJl6CklDkxkcSxkhFa9Z?= =?iso-8859-2?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y9wGA4bmN2w+QPmrgwefz60+x+cgK2qw4B2?= =?iso-8859-2?q?bf3U4uZtmdHbzpRY73hwqXnvTGPs3OoxLxjcgIwxiEO8FNDE5kEysAWyV/FK?= =?iso-8859-2?q?g6E7O7ee0v53bvEk4u1KBpb4Hmaf0HTiKko9pVGcUt3V9lk/OuPpPVvxafk6?= =?iso-8859-2?q?EC0XKhKibGQI2aLOU9xliHmNs873tgT8ydRQlN/0Au5wiUz6Gjjlbz3Gjy8d?= =?iso-8859-2?q?3p59wNUTRvvgi7xLTvJDJftLpr4zH+lZzhKZBshZUk4jbbeGJd3jzKArhUqq?= =?iso-8859-2?q?/jYR8O3YON5iGvXFV4Wv3DMOvYTjnMjyTIknSPPBdP7U9ILaT8tw6KWM4Dhd?= =?iso-8859-2?q?lq3pE9Su03ZqNGOzc9n9mEEzNWx+KHdAILCVjnac8Oa2EsRNA0Hy8xGUHwUf?= =?iso-8859-2?q?YEUkCLmc72NfuqIIgXOm+POfvTHS3HLICjkDn46FZJ4+XY3v2vwsTNfgS0oq?= =?iso-8859-2?q?/B6VuMdPGl/g7pjOOw5Rep5mEusUUmcL3oIFziIhJU2loOJrdaOUGszclZcA?= =?iso-8859-2?q?=3D?= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 69f6539a-31e1-4425-f141-08dc51e32e00 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Apr 2024 00:32:15.2199 (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: a6mnf4HmVE6jJL/BAfnhJQDEskefB5yLErPexGaIO0LCiU8OlwN0ihKi15Qmp+myXu3DbCVtDYmEycy3eeVajAZTqK4Gpu1eBAcDwembl0SY2C1sC2BTauwbtHr8Qi8L X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY3PR01MB9964 Message-ID-Hash: 6AI5IH73BPAGWL4F5CKLMHINLS34PAEX X-Message-ID-Hash: 6AI5IH73BPAGWL4F5CKLMHINLS34PAEX 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: Historically, ASoC doesn't have validation check for DPCM BE Codec, but it should have. Current ASoC is ignoring it same as before, but let's indicate the warning about that. This warning and code should be removed and cleanuped if DPCM BE Codec has necessary settings. One of the big user which doesn't have it is Intel. --- sound/soc/codecs/hda.c --- static struct snd_soc_dai_driver card_binder_dai = { .id = -1, .name = "codec-probing-DAI", + .capture.channels_min = 1, + .playback.channels_min = 1, }; --- sound/pci/hda/patch_hdmi.c --- static int generic_hdmi_build_pcms(...) { ... for (...) { ... + pstr->channels_min = 1; } return 0; } Link: https://lore.kernel.org/r/ab3f0c0a-62fd-a468-b3cf-0e4b59bac6ae@linux.intel.com Cc: Amadeusz Sławiński Signed-off-by: Kuninori Morimoto --- sound/soc/soc-pcm.c | 31 +++++++++++++++++++++---------- 1 file changed, 21 insertions(+), 10 deletions(-) diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index ac42c089815b..95a5e28dead3 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -2796,7 +2796,6 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, struct snd_soc_dai_link_ch_map *ch_maps; struct snd_soc_dai *cpu_dai; struct snd_soc_dai *codec_dai; - struct snd_soc_dai *dummy_dai = snd_soc_find_dai(&snd_soc_dummy_dlc); int cpu_playback; int cpu_capture; int has_playback = 0; @@ -2817,24 +2816,36 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, * soc.h :: [dai_link->ch_maps Image sample] */ 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); + int cpu_play_t, cpu_capture_t; + int codec_play_t, codec_capture_t; + + cpu_dai = snd_soc_rtd_to_cpu(rtd, ch_maps->cpu); + codec_dai = snd_soc_rtd_to_codec(rtd, ch_maps->codec); + + cpu_play_t = snd_soc_dai_stream_valid(cpu_dai, cpu_playback); + codec_play_t = snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_PLAYBACK); + + cpu_capture_t = snd_soc_dai_stream_valid(cpu_dai, cpu_capture); + codec_capture_t = snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_CAPTURE); /* - * FIXME + * FIXME / CLEAN-UP-ME * * DPCM BE Codec has been no checked before. * It should be checked, but it breaks compatibility. * It ignores BE Codec here, so far. */ - if (dai_link->no_pcm) - codec_dai = dummy_dai; + if ((dai_link->no_pcm) && + (!codec_play_t && !codec_capture_t)) { + dev_warn_once(rtd->dev, "DCPM BE Codec has no stream settings (%s)\n", + codec_dai->name); + codec_play_t = 1; + codec_capture_t = 1; + } - if (snd_soc_dai_stream_valid(cpu_dai, cpu_playback) && - snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_PLAYBACK)) + if (cpu_play_t && codec_play_t) has_playback = 1; - if (snd_soc_dai_stream_valid(cpu_dai, cpu_capture) && - snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_CAPTURE)) + if (cpu_capture_t && codec_capture_t) has_capture = 1; }