From patchwork Mon Apr 1 00:32:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13612372 Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on2106.outbound.protection.outlook.com [40.107.114.106]) (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 038B4637 for ; Mon, 1 Apr 2024 00:32:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.114.106 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711931529; cv=fail; b=BJ3l0mGGjelcECkjweSVpm5WWt2X2gLxLOXWGFSj1i7hhrmMyyQbZwYz2yW7YWDWpzmjh9Fg5SuzqT/G4qmUJD39j7AGhUIeIEN9MPt6Mh2fjjPnL8uc20SvU4O+h6cf2mNX4VOJseX2ob3o1lL+JFoh1VduxERSHf1A1Ydz6lM= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711931529; c=relaxed/simple; bh=Kb5pkeF0CI90BJ3b9+wMhtCx9lVGmjA8mRx8dL0Qs1A=; h=Message-ID:To:In-Reply-To:References:From:Subject:Content-Type: Date:MIME-Version; b=n7ZXTAu47prj1aKpNuuk3Y23qPcr/IxtlzxjkVWPGR6Uq2R4uy7Td67rSfZdRS6Zww9owTmUWIgElVP6Sq3TYvFbex8Zo34ZHKf3SeaBgDd2c+u338kfEhKX18Bw7QIhfz8vmxb+S8EygVLppY0YpGeqo8pFl2kq8RVvLjOHIvo= 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=QVIpcJaZ; arc=fail smtp.client-ip=40.107.114.106 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="QVIpcJaZ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=IJNVybP2cDX3YBlUmKZF+R+5dh95eUpzEY6tERz8zIBF+sTiQDKefOCsKQzj4SVnehrkzWST0Z7jsICt8Av4DbMljC0yVGd1s66CeQSZtsoHTm9YkHVtUgxedFrglV7CLhEEXjnpnABhs0ijflhUEcK7MOYIJOs3TGPTfT/Nh5cdpRd1t+nYUqs0lnFrDFxjgmnJ1lplRYW9sjLj2GKHuG+9gKYgk/2iss8hi09oc3WDa+8LdiWg0mI2tFwybs3rS0xcXUEgO6xzOv/lx6PHO12MGixuYtxOfp84upHz1uLCagGjke9M/yroLX59nyqg8Aa/aXW9F2RNIWdUn+YFGg== 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=bWDP8ULsMstlI4nvjVF/H42MXLyyhvNUt0zZ7n9Qjkw=; b=dBV13JtsdyaN4JXTzGur319L3JDUCeqgrDdBoaEgQtBYsBr+UnLzUre99iqcwrzubsX4Q8ifSKBA0NPsnfIVu4FL6I/XFrM+4fmsqV/S5WGcNIeIOrBCVIS366/jQ6RFU611cZRKUkRhXduqb6BNS3gv6RPz2UiwuyCYj0M2y5kL9SH+bhSTs5C/suRNhTeXkuQwXsut7TaaiZVFK5v6VQ/ELtOhf0YsJmRI/PxcAsKJozA2wVPPfS/GvaYTXfPjQNDUqQpE7ajHyZAheFw70+jZ0C443n+1326WyETOkPhiKaALXYSUtD9bVXeyNlL5MUg/LZQF5PY/bqtcaUJL/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=bWDP8ULsMstlI4nvjVF/H42MXLyyhvNUt0zZ7n9Qjkw=; b=QVIpcJaZlqQERh7BlHJAPfVfvZZilAtXkBVQyEJ75VkvS5B+7QTWkYPgGuZ2K3Ty0MwBfrtM5VoAQsk9/gXV5ewo7W871D9NP8eAdd4Q4alq9YTVmFaHEuw06yCVSq/obR9SiJYf2GxbDsJ+VOdIdtrt4ab3yW8r4lQ7fWnvCVM= 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:04 +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:04 +0000 Message-ID: <87h6gludmj.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 13/16] ASoC: remove snd_soc_dai_link_set_capabilities() Date: Mon, 1 Apr 2024 00:32:04 +0000 X-ClientProxiedBy: TYCPR01CA0135.jpnprd01.prod.outlook.com (2603:1096:400:26d::15) 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_|TY3PR01MB9964:EE_ X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: m82uwQXCQm4q2U+V/TyBSfvmeeCHIvgVmXMTuRSsyI1Fdvbe1VSPCLsCU2JXKJIJbaAXacnaK8OI/I+rDI0V88mST1JRTjBxxG94G2rmtYkJJFid3Gid3kJ8cPwZLKH+CgXP5dQejHK5BzO3X8vDav9qIuHy5tYU/NCcY9QtkjybmGrXNQ0cfwmNvVI6pg6zP8+emY8WunUp4jSe0XF8Oa1D229CvHIoWgNRWXUMDcqKJM11NEDR+0aH/KKxybAJWcGGBuPJRFYyIe6rznkQpEAt4P2ysZA93MCPAobzA9weSeoL40UvG77wqhWTHhr7ID+wddjkCvx2M9pWiOo/t7MztdsW3M1KHqi5I2n/+fiz+sVzisgFjnB1bmeZtoNOr3W6XjZ48W5alkpRn/NjtY6692kzAS2erYvjX+5lE7EDEGCsGhsX6Tnn5Kq95C4ViuaW82/+JkDrkDUwFiYH2KSF8Vb5APMcGltnYeDxO/srDDa8aGM2SAJ2CLnGvEsX9s+OnAGZHs3kC6dwZICxoe0ct7BnLy4xbktYsmQcutNTUQ1nh4+vqlyvvpwcOLx98GYk/u9BJYrwX3SvX5Ze2s5h4oY6w/W/iXnxjDMY/TdwK0cg8Y90n9/oBnFVtwuhZevrxcHT1EeoUMVrI4rlvAtKSoNfQpPWfFc+KcYB/JJAWo2db7P4rXRn6safPVYrHc9xupXX4DJ/NyFOL767A5O8/M0k4eLv+yy+2RsKiK0= 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: DgpxVLsB5w3fKz409vcOcuhwFcwM/Xh1B09NXv/bK8VvQTO/ibVvqrXao7lVm4frdTPnEACx2T73iLrDTp0s5L9wk/Z3phGvwhA8x8QAtWqw10nvFAqAPGtOqc1y7iNaVfCinyiWp9keMCtCOA/WfGlFW46kzoohL14rkhc55ORhqH3trOy7bRbmae7LXttJBEwOpss75wJOBjITDFsglKIxPAeGW5NZ+CaE3NgVlSht8At6Dy0lc5Cd73XgqpLccReJbWaWDJ9ku6jT77Lq6cuwKKGu41x6WhhdvupMbvZaG199G/+htaqUmoE6oAUD9WVWLRfJZUhL6UEzFqykXKetpuPbUe1IVlfyskngMtZ1ujYT5itbnkTt43X19fBw5cKbH3wXJjCNesljbQSrzUuAMgIf5ZHifnbUrbGSYKyviKMCiXYuRFsq+u1aRudCrB48YgdQN8O2MXWBHNvxw/uv3onJfJlrqWe8/bLJP4AwXK490pbj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BZxn7sHKxwywj1ZQbMe+T8j8fLXII1SEU4tnArvz5QbuDisP4qKC6wvfQ6I= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: e216f594-ea90-469f-29a8-08dc51e327bc 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:04.6813 (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: TbPvJwGfChn0AjafyQX8IgWxALz+IWHThfgnWBicTDRtuDIkXCxXCiy9rebXiZiUN+czNXSPR2ebCtq4f8yetTNT7OqHPhD8EDUhWAgXB2tfLPB8QX7uHs3U3RXtPZ4q X-MS-Exchange-Transport-CrossTenantHeadersStamped: TY3PR01MB9964 snd_soc_dai_link_set_capabilities() checks all CPU/Codec DAI (Y)(Z) for Playback/Capture (X) and checks its validation (A), and setup dpcm_playback/capture flags (a). void snd_soc_dai_link_set_capabilities(...) { ... (X) for_each_pcm_streams(direction) { ... (Y) for_each_link_cpus(dai_link, i, cpu) { ... (A) if (... snd_soc_dai_stream_valid(...)) { ... } } (Z) for_each_link_codecs(dai_link, i, codec) { ... (A) if (... snd_soc_dai_stream_valid(...)) { ... } } ... } (a) dai_link->dpcm_playback = supported[...]; (a) dai_link->dpcm_capture = supported[...]; } This validation check will be automatically done on new soc_get_playback_capture(). snd_soc_dai_link_set_capabilities() is no longer needed. Let's 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 5b7bdc5d6784..72e90e56d59a 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 21bf1453af43..0ff7dcabd314 100644 --- a/sound/soc/meson/axg-card.c +++ b/sound/soc/meson/axg-card.c @@ -338,7 +338,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) {