From patchwork Thu Apr 18 04:12:30 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13634105 Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01on2074.outbound.protection.outlook.com [40.107.113.74]) (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 235974F1E4; Thu, 18 Apr 2024 04:12:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.113.74 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713413556; cv=fail; b=oBAhGP0RzdS69XMLvvGVIWTALNcgBQAjVv0IPMInE+6FNaPS4J63OSA2NuqiHIgmjFCOgxMM9N/oDlz6Dq9miPE7oiR2qgztk/Q0p31U+1wBymhjMGbHEwIVpX90DmwDxI8sQpdAxU8HJ3W+nrrAzmHHoNvdqmWKAd7kzyD2sWU= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1713413556; c=relaxed/simple; bh=hHaNyYlnhCaM8uaABNfNFiPDmdxNfDmajYy3TVHCny4=; h=Message-ID:To:In-Reply-To:References:From:Subject:Content-Type: Date:MIME-Version; b=j4mszQDYz5GL0KszJ4Z+zRr8SJmS6z88z++Dk9Vk53ot/EHeNCj5tvbWq1TFflNWc1mK0HMqFFbkO3KtpEC4Fcjh75bnnnJ6FbA3exFmRpjYWBUKu7aVpt8dQztwsGisAI/88q/6wZ+HrMTRENo9ENYjkIhejUyjCumrnnYQ9Gg= 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=F9aj57qp; arc=fail smtp.client-ip=40.107.113.74 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="F9aj57qp" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dLqDjKTvwzP6i472p39GYqfSX9xmCctm4zPgVGfoc1vftUc/vP1ghea2FUddzgEP+QV1HqryD5B4DA4tqkeHMKWzxiYb1VBDY5N+0RTWBEgIpwBQCerZmS4P9NFyvWb9wD5jryqrX6oKjInF/Od5mBZiPsdqWovQRubuOTnVf52btx/djSVBX/P9fWaOjLosrKQdAeaJUZBDtUgiJxTV1eaNwJSCJpv3xduzYX7of1YJA4LZfjpdOGZ4ogmq4Ik+ZEYQXuEC5Cc2AWxhuJNwUrW7EJO8c6K7a7oX9w/Is16GVgF+UPR4MGp7kAdWtxfQBNkMoivrQViY4Cd+4UBeNQ== 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=Ig0emtaAXpylDYN9VLfVhDO5DaX/xxl6u/U7wbU0iCw=; b=Qt79OYDdkUaxVSPrAUWVIOfzVIegFm8TSXhgjumem4rjn86E9FqnMKPLwuomuxaV7Rb2nHp3f1DuSgUX7tr/cqmiU4V0rO2YBRmINFuBd5Z5+md6EdP1cbj55hkzXr8i1H4UgKkB5QDybXJH1NFfxD53SfMMYeOF5fmqWHxIP8C+AX62Pwa6nQ5z/mBqe+wjUEi1At+xOV1JL5tgXQKrVfM9s/wVZQYfdtE1pMB/CHhwj5PsH+NM+rTFXXKZuJ2eT4ADPN0Tjbbkk8oM68+8TaXSBiV4b5PVdUDtbrt0hcyMvMR9grM40vns42/ge208iztKxPQourFk+C17JyJbgw== 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=Ig0emtaAXpylDYN9VLfVhDO5DaX/xxl6u/U7wbU0iCw=; b=F9aj57qp+Ch+NqT0j4jceECqBk1Pphd5QYXPwGtO9U2U7acN9dXg/zO0hzsKTL9W0K2kElcXhQvv61Ps44EmDvJHmvuoNqWjlfN9toP2GATLfIi5Ur1qgNqdFHDhvfcEK2c4VxlkoYWy0I3hSUIkz3hZ3yy84u1PSU17gW0qTcE= 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 OSAPR01MB7397.jpnprd01.prod.outlook.com (2603:1096:604:142::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7472.39; Thu, 18 Apr 2024 04:12:31 +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.7472.037; Thu, 18 Apr 2024 04:12:31 +0000 Message-ID: <87edb38g29.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-doc@vger.kernel.org, linux-sound@vger.kernel.org In-Reply-To: <87h6fz8g3u.wl-kuninori.morimoto.gx@renesas.com> References: <87h6fz8g3u.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v3 02/23] ASoC: soc-pcm: indicate warning if DPCM BE Codec has no settings Date: Thu, 18 Apr 2024 04:12:30 +0000 X-ClientProxiedBy: TYWPR01CA0042.jpnprd01.prod.outlook.com (2603:1096:400:17f::13) 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_|OSAPR01MB7397:EE_ X-MS-Office365-Filtering-Correlation-Id: a49aea4f-c43e-421e-6736-08dc5f5dc457 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; X-Microsoft-Antispam-Message-Info: e2opS+QrRWzf8zjT2sz2bwQqM82PBUcOdUptx5oX2Lxyh+rqiZbWJdtN42TwGGAeXb6TLV06cFVGkfmUc7cBMfuNchNJ6sPc7Uo7j4G/hR9CeI304/qAaBVByp4NB9zfsIsl2I6M8rA5FQ6L2rY9SlzwFgaDyl3aiRoczHzPwjdTi9D+oBJvgajGY7RD7Tt4phX0sSCyLRLV5Y3P/5QeB0jvFmZ3w3Lvq/Gf3HLX/0KbJp9baTkd3TBzYsPjeDXQmmH8ZMoVNXzufH0TV3yLejiXhLHszH3Z+urSNJ6077kNFdFUe92HROZz7Mgn+6q87iNRG7R6aEddNR3f0pyia/i7tqN/6yPIVOoP7iHdFyVc2/vAJ3Ew1QLkqBrbyH7fTTxSqY0U6fDXaYcOXuwtaV+Sa1j5A1ZaXgZUePpRycIVSSyEInJXOvMEQQMgO8gkq14KGq2e35hlKHc0o137OOKEvcfL2Pw1tdJtOXEE1UbdSNz9yNQp0MUK6wninb0XqVnuNSaL9xORx1ieIMnJ5pi9SO/MBtjyeOyCHUhPkrsMT8aSNYZBVpKMFF/HNaheUMeNvrHr5GssQFp1r2u7VYq0XS2tDje7v7y5Il3T/yVx61RAWCsmZn6t571yaEm7nQ+Wa8m8piPrjl38nic9DlxyOxfThxHdDx+tZvXGODYtnkcxy119Kmj0OElCqMUCmbTSfFt7N8qmBNCXdhsTWN2XVd2t3SBS90OJLMRflRc= 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)(52116005)(7416005)(1800799015)(376005)(366007)(38350700005)(921011);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?iso-8859-2?q?ShJ2m8cVRmZ+8IeksyCO5oJ?= =?iso-8859-2?q?b2706i5NoBwIoy2w1AwRx4lVs/Ub+s/XtciMj9GWcLezJceXAaWNeLp3ke8M?= =?iso-8859-2?q?pST4DjYKOqvGL03uLdE0zdarTydWGr6r+O7HjVC5w416PeDeqcBDWMx4Zv4W?= =?iso-8859-2?q?AJXSla8I/pkDqCG+b+7C4d7Jv53rFQoYdSki8u05TK1yGVlCcif6uqQHVoW3?= =?iso-8859-2?q?CZIam0ZBkKiKM+yIvtNQuiqfYtzmvBpdbrOCxZOHNsnTfDJ0w0QeuZWtGHlc?= =?iso-8859-2?q?SZr773DRu5kNYcS3lQcxfV/TaYBjWFgIWM7p9Eq2R6FcRetFwi1SyiY7N40u?= =?iso-8859-2?q?DxIicKQdVE7TPDKjMFZeSaxWRAM5hVDfRin2T9zR7cRPx11/1X2y5WQG5F91?= =?iso-8859-2?q?SSBtnG8hyJwrTiTZsequ77zKoAFHZuUBihgozdMlL+8Q4gaAczzh38luw6ct?= =?iso-8859-2?q?9Qh0Cn+IygPl/I140dvAZc23Usf0mujlnTYhyWlT/iN/hedbB2TBurzCIheV?= =?iso-8859-2?q?fkvovpqCDXHeJFQlbkLMSLj015R/g7azdfLpNW0XEbZuD/CMtoHJr3U1orln?= =?iso-8859-2?q?trMS9MqSMOdzMFHom0W2f8Y9C77c6JxtK+3dnWFQ2BML7diykZQCXwsodjtJ?= =?iso-8859-2?q?e4IVtWlOwdp7PfT4ht7vPvEKdi254bsmdyaqrPB3ELRTCAxjQJhEYlTtoj63?= =?iso-8859-2?q?3lkLMN7JzypdPHFwuQ60jv5dRAkFzOHTxL7KW4Jm1xswaPwy2hhiSB1P0s2a?= =?iso-8859-2?q?WTijrO9T1rgOSuq09pOIH6I2ITY/CZHhy9gylsf5PI0wum43IZbMGjKiuRi4?= =?iso-8859-2?q?R0z8hJTRfqYJheSHy8Y4c/pXwrpvCq+gochIgG0EdC3DvbLocPrqTrK7QUh/?= =?iso-8859-2?q?AO7DVGE5s0bKZXVuSBGpbE5L2gdvBlrIt59NbWLRYzR9ZVDRNT/PXg6aMDML?= =?iso-8859-2?q?n4hQpJ+3iB4rJScuBfhXfiB9+PYt9ZPTGd69Jmu7S8EYhm+PxBp+wVnBohxV?= =?iso-8859-2?q?k4SDTAbcO20If3J0rg9HkJ58vp7btokxFVkfGZ0Hk37H2sGVLsXFqztCq3y2?= =?iso-8859-2?q?KwRs7XU2xLKZGM+tsU24N1IXQwsdHluFNvLaWmax4xatO7zy4sjf33XjdhUC?= =?iso-8859-2?q?B0ZRCRN6bTAPZ874QQP+FWdwVrlrVi7N+Cn5kLs2NtMgY0lXhNAi5aGfYv51?= =?iso-8859-2?q?HYfD009zdkbjYAzvjeogs0PDjHmGjZtkipK7fXsoZ2roRE8R1qKXSm4w4FdG?= =?iso-8859-2?q?oI7jkwotIC9GskQgCyCChoIciR93qxiMeLKHzsmSax4zuD1CC3MgdhCMGfS5?= =?iso-8859-2?q?0Ckj3wKC4ikz1VOfsa19kYLPRKWxLBWMUHESE2nf5G0lpbND9e1lYBBz7BWL?= =?iso-8859-2?q?SrCKy4L2/WmlIHykJycWOAflPJpjKz+L7aLGky0vlgZIkHPe2twbtepIUjzA?= =?iso-8859-2?q?LKxsWeevQ2YV8dtWJru4voJArW0Rdbr3bofi/4XDZ82VhJw7zzF5dmgB2tFz?= =?iso-8859-2?q?tq32rlrTD+ICYZx7xqH/NqX9mtVwLirxuRwvXDDb4gAkBcJBLbWdQXlnTGtd?= =?iso-8859-2?q?sHl0X5YBgmAckjWgXyCyIYX8eQslMkKPgPv5B8AXI/5jJ0gw4vIs+MscduV0?= =?iso-8859-2?q?f6187fvyTtINzei7PIkTL/9g4U0KHVwvua5T5E3kWMNfr+mB+f63u4YbNGM0?= =?iso-8859-2?q?=3D?= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: a49aea4f-c43e-421e-6736-08dc5f5dc457 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 Apr 2024 04:12:31.1708 (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: RNCRaqTAamW1fu3IfQXswKch0luZwt6q7RiFlx0QjxojJ73lDXrvW8UGz8EazXnP2VeOwyIBGWd8EXDnmtk/Aa3Qe+/4Eq+jGlqcNPYHfexdZWs+ki+BqslLHbVMdMGJ X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSAPR01MB7397 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 cleaned if all DPCM BE Codec driver has necessary settings in the future. One of the big user which doesn't have it is Intel. Below is at least already known settings missing driver. --- 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 412e7b7d97f5..a79ca115f4e7 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -2797,7 +2797,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; @@ -2836,24 +2835,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; }