From patchwork Thu May 18 05:47:18 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 683425 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 D53AEC77B7D for ; Thu, 18 May 2023 05:49:44 +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 A29B36C0; Thu, 18 May 2023 07:48:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A29B36C0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1684388982; bh=aZhVSlW5vaNhTdjxgE1cYRsocL5Zegvk+2FGM26OhnY=; h=From:To:Cc:In-Reply-To:References:Subject:Date:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=XcyjrSG8u9UBBSW5Zu3Z7+mLq2shijXTjyG6dZO7el4WkCUR1GSvuW4afvJq7qtSa KrywWTNZO2ml5h7TxWVzHQ9LEU67b4YgLtZMMxoywP3zwfaIJVxAmTN8/0F9VzckZH +2M4o++FwNuiuxmFutfNQFraqviRFanxwRr27OwE= Received: by alsa1.perex.cz (Postfix, from userid 50401) id B6758F8057D; Thu, 18 May 2023 07:47:30 +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 2DFAFF805BD; Thu, 18 May 2023 07:47:30 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 38260F805BD; Thu, 18 May 2023 07:47:27 +0200 (CEST) Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on20714.outbound.protection.outlook.com [IPv6:2a01:111:f403:7010::714]) (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 1844CF805BA for ; Thu, 18 May 2023 07:47:23 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 1844CF805BA 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=odBJpZ7e ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FSo5V3DgTgAZaFWoN/MaMwjh92xAfCar4Fi9NsXtpNJZS6PNolLLrJX3E7DHhKjjCUrJUsJ3dR/P/puhRMmW+KDMjeY+MbX2pBFy6BAOjIYf0WgWi5NupAEFmgCsLIC82XRYVhqMD6++1p+WYRRcXRWBusXDdJdoy4s0eISHvwtKkJc2Iv6IE9Do/zZti6HxXYddEPZP0NQpJZdkdiorvIfBhi6qDfK4tbbkcp1LklMglBz+F3qFsXNzTU+1cUh7RNRiEXcrlOy2/lfWkaZbLBpNnorHwNqfEA1D5PjU0jeksgJZ1IrqqlUwNgvbP10QviRoSbOuodxxbsCjAMQLqw== 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=IGCJaxWIPC4J/R+zspNaOJMCWQcOhLH4B7EMXHV3pgY=; b=L2qrW+J325c2H1pT5NOwcEoPxTnQMqZfSLcDx2J2Eoyf85rCeRJbl5yufQ1IC5oa0gUPKzUiEhGrqoiyDHoszIP+MCpIRz0tQuIqfMcTUZPW5ENnorqbfeYPO+dhChHKMjcW7G7b/xM+bsXVHR0h1R8bBY9hl7dyaXyJiyeLPcQJjmpgzcfO29ebTeuYarii+cPj1SOq9CodZnxXj5XQrsH/MwOtV/WehAmwLncjmbSrnj5XA/U5YTGAAvsM2XtQQ91zQYZdiPcMoClDtZikkMpTPZd+7mkPCtxrdABaemGj6em/hg74Tw4SkSNMhqPMZkmfN2SdgASdKyW1wwAv4A== 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=IGCJaxWIPC4J/R+zspNaOJMCWQcOhLH4B7EMXHV3pgY=; b=odBJpZ7eLq2sqIuvnpA9bqCLHINTvrnQphN5b+YzSsAbFoTq4ceEvJy0CxLrl91myeYj/sJ7x0OnqJBkyXtLzMsCZgRFSo4reQTVLSxLFAL25OvRsUSNEleR5MAPOvxn1cP0Afl6e7qba9nBiDJBqOrHqXFj5N1O1OH2y3tkdWg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) by OS3PR01MB5591.jpnprd01.prod.outlook.com (2603:1096:604:b5::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6411.18; Thu, 18 May 2023 05:47:18 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::91e7:a94f:9f75:d840]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::91e7:a94f:9f75:d840%6]) with mapi id 15.20.6411.018; Thu, 18 May 2023 05:47:18 +0000 Message-ID: <87ttwap4wq.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto To: Jaroslav Kysela , Liam Girdwood , Mark Brown , Takashi Iwai Cc: alsa-devel@alsa-project.org In-Reply-To: <87353uqjiu.wl-kuninori.morimoto.gx@renesas.com> References: <87353uqjiu.wl-kuninori.morimoto.gx@renesas.com> Subject: [PATCH 06/20] ASoC: soc-pcm.c: cleanup normal connection loop at soc_get_playback_capture() part1 User-Agent: Wanderlust/2.15.9 Emacs/27.1 Mule/6.0 Date: Thu, 18 May 2023 05:47:18 +0000 X-ClientProxiedBy: TYCPR01CA0134.jpnprd01.prod.outlook.com (2603:1096:400:26d::13) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PR01MB8426:EE_|OS3PR01MB5591:EE_ X-MS-Office365-Filtering-Correlation-Id: 8ae4901d-a1e4-44a1-81e4-08db5763575a X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3L6p+ybiM46AgtGMsS/yV066p06qIHnJHfkfigpDTVJt+ALeNr0NuLnGCFKxcL/6f0eouvCh06euuqnHj3XUxrdaipUCKkafddxmzk2GOWXNo06N/WL8nByq76lBjDjk7Z5bD66cgZiqR1pqtnsbZ1L2WcGgZn+WETEqKZcfqYlSDRhhtKYy0pKhzwaZVp1Vi/RZU6jBl8FZ5jaEhxzXfl5YRrIsDTbtsREaX1RatgWYV3EYI+wMn+ZEvDyMSHwOgAlyxjyHg2DwDgF5Zzg6jX+45CC8UNOaEJlYy/bSuOhIqE47i8RSkbb3IrrK1jL8dPB6E8QrUSTBeuD/QUSgiw+WtRTkrw1hxsz7mpPiHNlrUw1Gbw6oL43jplEr0CT36dF7yx8EEi4QSAKPJQ+g3gWpxbEj4Z8GRr78KpbCZdQRb8RIQu6KO2bP+0LzM6J8wL18Ov1ndvddaOy1RGCnlk5Vesgv9hQ6HfB3Au62Y9A0ZEMnKvZ0DBOSqEzD1Q+UzNvuh4GRBfSE8PzvAD0VOcmOfCe+m0rNhSD417zZE+NH/paNVBKV9FQUg9IlYAap4eqmLU6CPJJL78R41B5ni1xqeNra7mTI434LVnxOwvlCogpeOVmKbkN7WZR3RHtf9JmvPh7wZ8Krq5I8SmdujQ== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:OS3PR01MB8426.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230028)(4636009)(136003)(396003)(346002)(366004)(376002)(39860400002)(451199021)(316002)(4326008)(66946007)(66556008)(478600001)(66476007)(52116002)(110136005)(86362001)(36756003)(83380400001)(6506007)(26005)(6512007)(186003)(2616005)(41300700001)(6486002)(5660300002)(8676002)(8936002)(2906002)(38100700002)(38350700002)(21314003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DdcjWwOGt7ztAXsTF1gIfaUfQuc6poGrsKgvdxY37NQYcvAz+ft1fkn5kKBYtDwitE0/eb6x6iN0hkF1s2kEs26vhcrEctGLuPL8PFNzh6flUdqLcMcWIiobS7v5oSbeTpkJOeWK5QIkw1h3fk1RAjYbzrghuS/qfOVnBcEkxeV0UvvXfr+3YIv2talqgjFDk2GJi/Ww2SAALoh5BK9ZF72UcQuUZYSael9hqVoMdK4VCig1qZisl7fbmvc+FBMlS/R2yBlU3b/M+KwJ/0WwFp9XAyS7cZ6kT86BXeCVr+Gv8uT6aHZn00MND2xrcXwJob3VxJ/y1KIOW7O7TyzeVuYdfKpIkBAgokVJ+yLD7NFhwH2X7CyECcZBkwIayqvsRjRdPQfKQ5SIgciDXQc2FbbpIxyzDAVwsymG1mY40pybB7r67xgkjXTja01VhjvBa6tvWMupZmNYxBICmMVvXiXY3s9h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fRL6a1aN6+Xf6Je83WHXeu30JsTWkRHocisrsq3JQuHXoBuJ0OLxDPEiGgL/XUdpIx3mDjI7Ipg9Cxq+bvk= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8ae4901d-a1e4-44a1-81e4-08db5763575a X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 18 May 2023 05:47:18.2991 (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: 47dgldjIZBqMl2Fb3Cy5Ku6JEkrF6UeQI9qvE52g62X1aa1Uuu6Z8pMvCuohSo9ZpAIVaTymg0KIGKfJ+9nDCXBsP05YK1XXcmSrjNyzHP5ArmznHMskXkISz5jAqd9Y X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB5591 Message-ID-Hash: BNYUO3BDMU4J6B2D2PEDZE6QER4VJAWB X-Message-ID-Hash: BNYUO3BDMU4J6B2D2PEDZE6QER4VJAWB 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.8 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: soc_get_playback_capture() (A) is handling both DPCM (X) / Normal (Y) connection. (A) static int soc_get_playback_capture(...) { ... ^ if (dai_link->dynamic || dai_link->no_pcm) { (X) ... v ^ } else { | ... |(@) for_each_rtd_codec_dais(rtd, i, codec_dai) { | if (dai_link->num_cpus == 1) { |(a) cpu_dai = ... (Y) } else if (dai_link->num_cpus == dai_link->num_codecs) { |(b) cpu_dai = ... | } else { |(c) dev_err(...); | } | ... | } | ... v } ... } In Normal connection case (Y), it is checking number of CPU / Codec. (a) is for Single CPU case (b) is for Multi CPU case (c) is for other case (error) Because this loop (@) is not related to dai_link->num_xxx, we can judge (c) before entering this loop. And it is needed not only for Normal connection case (Y), but DPCM connection case (X) too. This patch moves (c) to top side. Signed-off-by: Kuninori Morimoto Reviewed-by: Amadeusz Sławiński --- sound/soc/soc-pcm.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 89416c127dca..8ce6dbf37014 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -2742,6 +2742,12 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, return -EINVAL; } + if (dai_link->num_cpus != dai_link->num_codecs) { + dev_err(rtd->dev, "%s: %d cpus to %d codecs link is not supported yet\n", + dai_link->name, dai_link->num_cpus, dai_link->num_codecs); + return -EINVAL; + } + if (dai_link->dynamic || dai_link->no_pcm) { int stream; @@ -2792,10 +2798,6 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, cpu_dai = asoc_rtd_to_cpu(rtd, 0); } else if (dai_link->num_cpus == dai_link->num_codecs) { cpu_dai = asoc_rtd_to_cpu(rtd, i); - } else { - dev_err(rtd->card->dev, - "N cpus to M codecs link is not supported yet\n"); - return -EINVAL; } if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_PLAYBACK) &&