From patchwork Mon Oct 23 05:35:41 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13432402 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 C883ECDB474 for ; Mon, 23 Oct 2023 05:48:57 +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 E816086E; Mon, 23 Oct 2023 07:48:04 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz E816086E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1698040135; bh=rqeO6rkh8Pz8ZvHf1evLUSv1uI+kPsAXfRPD+4bcieU=; h=From:Subject:To:Cc:In-Reply-To:References:Date:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Ra9/ZS4KXoprh2NA6FweI0R7lUNb0gnCWeBCuABo3LxBGfWKjVERkZapjcPZBSYb+ LJEoQH+oyHQaH0pZkH0paI3OPxjCrcqRn9lOZmBFon+2ooI8vjdyRHaSw0F906k1ya OyCVJcnLffNCdGAWqM2kGJnNXxea4NtJdd2WIgi8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id A6609F8057A; Mon, 23 Oct 2023 07:47:31 +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 A85B5F80557; Mon, 23 Oct 2023 07:47:28 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 2DD6FF80552; Mon, 23 Oct 2023 07:37:45 +0200 (CEST) Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on20700.outbound.protection.outlook.com [IPv6:2a01:111:f403:2019::700]) (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 0C22DF80027 for ; Mon, 23 Oct 2023 07:35:48 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 0C22DF80027 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=pyA1nW/s ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=SYFBtsldnJPXHFgwbQjy+Ahmoe03mE0lgn/0LokCdrQFC3odxhMIHgY6KDo6efvNdS9yw0xAPlu5yjrhb4g+kWIAxMA+Cx0pU5J0ZI4CUMr5/bCFrnCPVjPa5FCVB1kt4HG/k/oiHMYr89m49MRKgp4Y55gpyj0HTeDr5HVUnP7xdQlECUbMRStFF3tTEOPhE7KDmuItJVRG0kCytPXuSmC0aPsEnm2deIhpUeYs5AhqFccpO9ygw4b6e26eOhdP1ZppUNf58uO6mxCWBm3EGqBXqAb2JwgTTDWmhcPdJ6ETkfPXFEpNi83rmkTLVj1uzN5CI4m41ZP3qhXDgucpMw== 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=rI6RK9hVG8ooCE31APybQRhzD8iezgQX1LQF114HS18=; b=jXO9dAnLGji5PCOXN2cUGmsdxUJYNGV49grcgjcF97yesdZQKrn0opkzH3xMI9nsBuUaIEXqzq8dl01dhYuXUFVQ0y37VnkM4KxVKlDZxS4l01wkSRi8LBIOXZzcn3njUZVshrk9d30dB3W3gEbpBT41M0B1bziNtJ1J9bCXApbA3dxDno5L7S6h4sOud3+0gcCflxHXS3kv4yIffhLst3Drkfr4GRRvEFjq6G0HZpJxZV2vyP86d2acIIbjN93g+zc93RkK9mU+3q+zKFhT3A5iDeWGsSeSQTT3hBu56PvS9SlHXKVXrxWL0oDEwAMQgQRaLJwJCKj/Z1gWHT1D4Q== 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=rI6RK9hVG8ooCE31APybQRhzD8iezgQX1LQF114HS18=; b=pyA1nW/sHFN+qIjkSe+qJMiwaih9k+hjr/r5KAq1Ik9Eq0c18omKvZZspELkBqgrYyqr0OiRwRZips0Nn2VaB1Gc+/Ko9vJQDyl2iRIOAJy+yX0uCTooBNZ4sSna3CFuIvjcVN+Vpr+Ys8w8o0Xz89kX5OeNEwfWt7AAs/uh69c= 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 OS3PR01MB8242.jpnprd01.prod.outlook.com (2603:1096:604:174::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.24; Mon, 23 Oct 2023 05:35:42 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::be8:b648:c989:8e7f]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::be8:b648:c989:8e7f%4]) with mapi id 15.20.6907.032; Mon, 23 Oct 2023 05:35:42 +0000 Message-ID: <8734y1lx3m.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v5 1/5] ASoC: makes CPU/Codec channel connection map more generic User-Agent: Wanderlust/2.15.9 Emacs/27.1 Mule/6.0 To: Pierre-Louis Bossart , Mark Brown , Bard Liao , bard.liao@intel.com, Conor Dooley , Krzysztof Kozlowski , Rob Herring , Jerome Brunet Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org In-Reply-To: <874jihlx44.wl-kuninori.morimoto.gx@renesas.com> References: <874jihlx44.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 23 Oct 2023 05:35:41 +0000 X-ClientProxiedBy: TYCP286CA0180.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3c6::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_|OS3PR01MB8242:EE_ X-MS-Office365-Filtering-Correlation-Id: 8984d36c-f2dc-4ad0-37de-08dbd389e584 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: sIcZQVAVjrLjrbJhAS6XtITuJ29OxiiLfangaYuCf9QDSuh11gyIs+fsxLL/raBOW4rDE9obFcuwm3/MwJg1s2JoieGToCy7LMrsCXiIESD6mSJ6Xaahs6mmarHt4q4J9pYtxJaAInw25EFzyPq+ZQvJZJM6deNVRjmgg7D8Qm1y6cGD+85nRLRjpKdUXuJ75kVRpxzi4JoDbMNKN0Fk5bWnhw358ys7UmFa9Y7ope13BikEdIN9YbJY89QRzfvZGPfO2jsKYfPEJLUP2dvLPnZhxg0qEQnKytykih+XSIIpsXaBaw8g97xL5xP9zkjjS2GDs6HUwkol4fIO6iyGvwdBNh6076OfXZxq5vAkfxmT/B0PJ5TWzGi5eENoCsIhKj9KsToh18tpjUKBzsXWxPUjwZYIs+wb6mFNT6RP0v0nTM95OBdpPDM6mXm6Lu2HeIvdlNBpp0E8NDMf4c/jy5AaA+eW+0QU/AyS5gCju/lRWMe/9gwVSD7/U8niSXlmiTnVBzwAr1RSV/+uEGuwTLr5Rk4LqgP5WgV0hl8SygoNooMkyRcTBuQ+B6dbKFxTU3bNBcx2Qr42J8vNMVS9cJspCr0t8CzGZ6V9oEEnLhE7VWWqOkGC1qg8EheN1MSI3XXBbQA/Z9NFlJhCNnw19k95X9O92gy9YIpdXfwkcCI= 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:(13230031)(136003)(366004)(396003)(346002)(39860400002)(376002)(230922051799003)(186009)(451199024)(64100799003)(1800799009)(38350700005)(36756003)(38100700002)(66476007)(66946007)(66556008)(110136005)(6512007)(86362001)(2616005)(26005)(52116002)(83380400001)(6506007)(2906002)(6486002)(7416002)(316002)(478600001)(8676002)(41300700001)(8936002)(966005)(4326008)(30864003)(5660300002)(41533002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qPx+YIL7+yw3aBPnily50jB/iiBYts6T7xlTrxh4btivkZsHzLTBr+lAqOuHZYkIqKirMsSrDGuxnmB8T0IBUiAO0tTjuXVyeo/qVJuUXC1vfLJzlzFSvhFIxXrPdxjHrh4g8WZnWf40TofqfpjpagJHkAemZblOknO+o1ApZ6IyooXHus3UhEjVKaML2SIHbHyEteSMSMY3YD00qtVLNjm7jBGk6qYdvgVqMM64Zh8AxqOqgziLguCNUy4R5/mZGDbVWNbd75fpEz9REV6Cr7DoKoKWath8YWALLnJ2yGqdJ4+f2n9Ott4plQ7TmtDEWpYIaVQjsDz0im1jezqujGYDL6WDtsXTcy2nnRB84aHj7lQ82/FpB0P23EoFRTWPfA0BH7l1DH4wo+pgBZ2Y6Wt0Q1lN0DruRF4JMMjLqtH0hPxpqUu5VQMGJogn4tz0A6Tdb1+pgb/4+OKboV97CeHnwDZY8memTBotAtD8SmCs0DLmdnO4szcQe0VUufnxv7WeJOR/eoLrdH6wLrdVFPcx2PkCiWGBWs75k6yRRt1rkDMrQOJHbKtYbGFHatpHP/avZ7JHl6CJGv+pTOZ5NhTesj/4Bz3yjn2jgCgTop0Y1h35Xzz+PzG0hw4nlxeeRNV2rCdUQeT/BiQKFydTT3VTnQU/xmETwcx3nvEU/xLpmBDkK+ARZeYon0VExO4MElJRJpcwk8rnZC5VAmowzXpd5ecSa8p25z/9NvyBRwfNcDAwRWNnn2GIATvey/9N6KSF00vr3Cxvli7BiKnBkQpbDob5p4AIp56Alx93Y02H7bL39SPrBgDBpv51E8RIqjNcUUB6ZNSvmBHpNXLIwDud2T5BJ1zzV4TLiJxYvTtEPv+HJCWwXnKHY9mgbx71wbP0IkkiOOca7E/VXftOww8a+zisFzjwaQuG+6zKnlJ9vYB/ly4c/Z2hshjsZZ0KVqOl1fEZhxnhs/EvNpQuDW46TnCAkzwIXo5epHntg/JBU+lNuX4uWr2W4j+qeHO/1DvGZOs6Jaaya+PQXMGAUUKeDN+jRqJZTJxOPT8YN+Ehv2PQ3uPhW8BIU9kAkXylgBGswMShYxn8UPHgm6hLT5RZoj2S+P7IXSQz7GOj8cx5ZXUEo9N2g73agMCliXcIJZ+uJ6ffTJs56LpL/EaPH48mSFPz6BvxXz9A9ThTCNQK+9qTJRjj7331d9t9jGO/dFsmimETAjb6aLWRb3jFZHK7u3rvUyTJlIHGxp2pl2wAlywjusEajf8scwgh5HqzxOj4IzmEo+390W9FMBCeeeSnviRq5/hm6n8GTeQtltzZuDuaVp+SCLMqVpPlAOrxhsxBeKrBpbod7Q6cvhC0fX1U88hfm+iR7knFKWV+h+mPlG1K9EpXvNv3UFLD0x+JAgfCf7qqsZM2hn25Tzlxbr4cUu++oyTRFT6V2nh04DfAn2O8tPOAWXYK5qpRzdQFfiIO6JjzWOtU7z3b56EjJY3XlfRG9YGx2rX1uCB0RQGJ6LnfI4G2YW+yLSPVcVAFo140T/nagItoFwpCRytx8UCMM/VXHeNOtxUj+YOTaTRhiKiemC55nv+wqmapCZgAgCsbSj++mB3ye7fnemsdg8ItQ8nEquuDL2vnht0Qekc= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8984d36c-f2dc-4ad0-37de-08dbd389e584 X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2023 05:35:42.3576 (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: cJRmwUbwLTXPpn3g6BEs/tnyVoVxAHyhNwaw5VJ/mH+R6TnxthlVom7jfivWVLb4B0L2Ivvc8VuIbxSjdw9citxavAz+EC7Xpgly435MsdZ2HEtOwdowbAfcbUxYZbbE X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB8242 Message-ID-Hash: DYNK6PB6D7XPULK3WOZZ4NQP7E7L5C7O X-Message-ID-Hash: DYNK6PB6D7XPULK3WOZZ4NQP7E7L5C7O 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: Current ASoC CPU:Codec = N:M connection is using connection mapping idea, but it is used for N < M case only. We want to use it for any case. By this patch, not only N:M connection, but all existing connection (1:1, 1:N, N:N) will use same connection mapping. Then, because it will use default mapping, no conversion patch is needed to exising drivers. More over, CPU:Codec = N:M (N > M) also supported in the same time. ch_maps array will has CPU/Codec index by this patch. Image CPU0 <---> Codec0 CPU1 <-+-> Codec1 CPU2 <-/ ch_map ch_map[0].cpu = 0 ch_map[0].codec = 0 ch_map[1].cpu = 1 ch_map[1].codec = 1 ch_map[2].cpu = 2 ch_map[2].codec = 1 Link: https://lore.kernel.org/r/87fs6wuszr.wl-kuninori.morimoto.gx@renesas.com Link: https://lore.kernel.org/r/878r7yqeo4.wl-kuninori.morimoto.gx@renesas.com Signed-off-by: Kuninori Morimoto Tested-by: Pierre-Louis Bossart --- include/sound/soc.h | 55 +++++++++++++++++- sound/soc/intel/boards/sof_sdw.c | 28 ++++----- sound/soc/soc-core.c | 97 +++++++++++++++++++++++++++++++- sound/soc/soc-dapm.c | 45 ++++----------- sound/soc/soc-pcm.c | 44 +++++---------- 5 files changed, 186 insertions(+), 83 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 63b57f58cc56..2eb93e357789 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -655,8 +655,45 @@ struct snd_soc_dai_link_component { struct of_phandle_args *dai_args; }; -struct snd_soc_dai_link_codec_ch_map { - unsigned int connected_cpu_id; +/* + * [dai_link->ch_maps Image sample] + * + *------------------------- + * CPU0 <---> Codec0 + * + * ch-map[0].cpu = 0 ch-map[0].codec = 0 + * + *------------------------- + * CPU0 <---> Codec0 + * CPU1 <---> Codec1 + * CPU2 <---> Codec2 + * + * ch-map[0].cpu = 0 ch-map[0].codec = 0 + * ch-map[1].cpu = 1 ch-map[1].codec = 1 + * ch-map[2].cpu = 2 ch-map[2].codec = 2 + * + *------------------------- + * CPU0 <---> Codec0 + * CPU1 <-+-> Codec1 + * CPU2 <-/ + * + * ch-map[0].cpu = 0 ch-map[0].codec = 0 + * ch-map[1].cpu = 1 ch-map[1].codec = 1 + * ch-map[2].cpu = 2 ch-map[2].codec = 1 + * + *------------------------- + * CPU0 <---> Codec0 + * CPU1 <-+-> Codec1 + * \-> Codec2 + * + * ch-map[0].cpu = 0 ch-map[0].codec = 0 + * ch-map[1].cpu = 1 ch-map[1].codec = 1 + * ch-map[2].cpu = 1 ch-map[2].codec = 2 + * + */ +struct snd_soc_dai_link_ch_map { + unsigned int cpu; + unsigned int codec; unsigned int ch_mask; }; @@ -688,7 +725,9 @@ struct snd_soc_dai_link { struct snd_soc_dai_link_component *codecs; unsigned int num_codecs; - struct snd_soc_dai_link_codec_ch_map *codec_ch_maps; + /* num_ch_maps = max(num_cpu, num_codecs) */ + struct snd_soc_dai_link_ch_map *ch_maps; + /* * You MAY specify the link's platform/PCM/DMA driver, either by * device name, or by DT/OF node, but not both. Some forms of link @@ -775,6 +814,10 @@ struct snd_soc_dai_link { #endif }; +static inline int snd_soc_link_num_ch_map(struct snd_soc_dai_link *link) { + return max(link->num_cpus, link->num_codecs); +} + static inline struct snd_soc_dai_link_component* snd_soc_link_to_cpu(struct snd_soc_dai_link *link, int n) { return &(link)->cpus[n]; @@ -808,6 +851,12 @@ snd_soc_link_to_platform(struct snd_soc_dai_link *link, int n) { ((cpu) = snd_soc_link_to_cpu(link, i)); \ (i)++) +#define for_each_link_ch_maps(link, i, ch_map) \ + for ((i) = 0; \ + ((i) < snd_soc_link_num_ch_map(link) && \ + ((ch_map) = link->ch_maps + i)); \ + (i)++) + /* * Sample 1 : Single CPU/Codec/Platform * diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 226a74a4c340..d62b3b46297f 100644 --- a/sound/soc/intel/boards/sof_sdw.c +++ b/sound/soc/intel/boards/sof_sdw.c @@ -570,16 +570,14 @@ int sdw_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { struct snd_soc_pcm_runtime *rtd = snd_soc_substream_to_rtd(substream); + struct snd_soc_dai_link_ch_map *ch_maps; int ch = params_channels(params); - struct snd_soc_dai *codec_dai; - struct snd_soc_dai *cpu_dai; unsigned int ch_mask; int num_codecs; int step; int i; - int j; - if (!rtd->dai_link->codec_ch_maps) + if (!rtd->dai_link->ch_maps) return 0; /* Identical data will be sent to all codecs in playback */ @@ -605,13 +603,9 @@ int sdw_hw_params(struct snd_pcm_substream *substream, * link has more than one codec DAIs. Set codec channel mask and * ASoC will set the corresponding channel numbers for each cpu dai. */ - for_each_rtd_cpu_dais(rtd, i, cpu_dai) { - for_each_rtd_codec_dais(rtd, j, codec_dai) { - if (rtd->dai_link->codec_ch_maps[j].connected_cpu_id != i) - continue; - rtd->dai_link->codec_ch_maps[j].ch_mask = ch_mask << (j * step); - } - } + for_each_link_ch_maps(rtd->dai_link, i, ch_maps) + ch_maps->ch_mask = ch_mask << (i * step); + return 0; } @@ -1350,15 +1344,17 @@ static int get_slave_info(const struct snd_soc_acpi_link_adr *adr_link, return 0; } -static void set_dailink_map(struct snd_soc_dai_link_codec_ch_map *sdw_codec_ch_maps, +static void set_dailink_map(struct snd_soc_dai_link_ch_map *sdw_codec_ch_maps, int codec_num, int cpu_num) { int step; int i; step = codec_num / cpu_num; - for (i = 0; i < codec_num; i++) - sdw_codec_ch_maps[i].connected_cpu_id = i / step; + for (i = 0; i < codec_num; i++) { + sdw_codec_ch_maps[i].cpu = i / step; + sdw_codec_ch_maps[i].codec = i; + } } static const char * const type_strings[] = {"SimpleJack", "SmartAmp", "SmartMic"}; @@ -1453,7 +1449,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, *ignore_pch_dmic = true; for_each_pcm_streams(stream) { - struct snd_soc_dai_link_codec_ch_map *sdw_codec_ch_maps; + struct snd_soc_dai_link_ch_map *sdw_codec_ch_maps; char *name, *cpu_name; int playback, capture; static const char * const sdw_stream_name[] = { @@ -1530,7 +1526,7 @@ static int create_sdw_dailink(struct snd_soc_card *card, int *link_index, dai_links[*link_index].nonatomic = true; set_dailink_map(sdw_codec_ch_maps, codec_num, cpu_dai_num); - dai_links[*link_index].codec_ch_maps = sdw_codec_ch_maps; + dai_links[*link_index].ch_maps = sdw_codec_ch_maps; ret = set_codec_init_func(card, adr_link, dai_links + (*link_index)++, playback, group_id, adr_index, dai_index); if (ret < 0) { diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index c305e94762c3..a55fea23f871 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1015,6 +1015,96 @@ static int soc_dai_link_sanity_check(struct snd_soc_card *card, return -EINVAL; } +#define MAX_DEFAULT_CH_MAP_SIZE 7 +static struct snd_soc_dai_link_ch_map default_ch_map_sync[MAX_DEFAULT_CH_MAP_SIZE] = { + { .cpu = 0, .codec = 0 }, + { .cpu = 1, .codec = 1 }, + { .cpu = 2, .codec = 2 }, + { .cpu = 3, .codec = 3 }, + { .cpu = 4, .codec = 4 }, + { .cpu = 5, .codec = 5 }, + { .cpu = 6, .codec = 6 }, +}; +static struct snd_soc_dai_link_ch_map default_ch_map_1cpu[MAX_DEFAULT_CH_MAP_SIZE] = { + { .cpu = 0, .codec = 0 }, + { .cpu = 0, .codec = 1 }, + { .cpu = 0, .codec = 2 }, + { .cpu = 0, .codec = 3 }, + { .cpu = 0, .codec = 4 }, + { .cpu = 0, .codec = 5 }, + { .cpu = 0, .codec = 6 }, +}; +static struct snd_soc_dai_link_ch_map default_ch_map_1codec[MAX_DEFAULT_CH_MAP_SIZE] = { + { .cpu = 0, .codec = 0 }, + { .cpu = 1, .codec = 0 }, + { .cpu = 2, .codec = 0 }, + { .cpu = 3, .codec = 0 }, + { .cpu = 4, .codec = 0 }, + { .cpu = 5, .codec = 0 }, + { .cpu = 6, .codec = 0 }, +}; +static int snd_soc_compensate_channel_connection_map(struct snd_soc_card *card, + struct snd_soc_dai_link *dai_link) +{ + struct snd_soc_dai_link_ch_map *ch_maps; + int i, max; + + /* + * dai_link->ch_maps indicates how CPU/Codec are connected. + * It will be a map seen from a larger number of DAI. + * see + * soc.h :: [dai_link->ch_maps Image sample] + */ + + /* it should have ch_maps if connection was N:M */ + if (dai_link->num_cpus > 1 && dai_link->num_codecs > 1 && + dai_link->num_cpus != dai_link->num_codecs && !dai_link->ch_maps) { + dev_err(card->dev, "need to have ch_maps when N:M connction (%s)", + dai_link->name); + return -EINVAL; + } + + /* do nothing if it has own maps */ + if (dai_link->ch_maps) + goto sanity_check; + + /* check default map size */ + if (dai_link->num_cpus > MAX_DEFAULT_CH_MAP_SIZE || + dai_link->num_codecs > MAX_DEFAULT_CH_MAP_SIZE) { + dev_err(card->dev, "soc-core.c needs update default_connection_maps"); + return -EINVAL; + } + + /* Compensate missing map for ... */ + if (dai_link->num_cpus == dai_link->num_codecs) + dai_link->ch_maps = default_ch_map_sync; /* for 1:1 or N:N */ + else if (dai_link->num_cpus < dai_link->num_codecs) + dai_link->ch_maps = default_ch_map_1cpu; /* for 1:N */ + else + dai_link->ch_maps = default_ch_map_1codec; /* for N:1 */ + +sanity_check: + max = min(dai_link->num_cpus, dai_link->num_codecs); + + dev_dbg(card->dev, "dai_link %s\n", dai_link->stream_name); + for_each_link_ch_maps(dai_link, i, ch_maps) { + if ((ch_maps->cpu >= dai_link->num_cpus) || + (ch_maps->codec >= dai_link->num_codecs)) { + dev_err(card->dev, + "unexpected dai_link->ch_maps[%d] index (cpu(%d/%d) codec(%d/%d))", + i, + ch_maps->cpu, dai_link->num_cpus, + ch_maps->codec, dai_link->num_codecs); + return -EINVAL; + } + + dev_dbg(card->dev, " [%d] cpu%d <-> codec%d\n", + i, ch_maps->cpu, ch_maps->codec); + } + + return 0; +} + /** * snd_soc_remove_pcm_runtime - Remove a pcm_runtime from card * @card: The ASoC card to which the pcm_runtime has @@ -1121,8 +1211,13 @@ int snd_soc_add_pcm_runtimes(struct snd_soc_card *card, int num_dai_link) { for (int i = 0; i < num_dai_link; i++) { - int ret = snd_soc_add_pcm_runtime(card, dai_link + i); + int ret; + + ret = snd_soc_compensate_channel_connection_map(card, dai_link + i); + if (ret < 0) + return ret; + ret = snd_soc_add_pcm_runtime(card, dai_link + i); if (ret < 0) return ret; } diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c index 2512aadf95f7..770768f4a027 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -4426,11 +4426,14 @@ static void soc_dapm_dai_stream_event(struct snd_soc_dai *dai, int stream, void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card) { struct snd_soc_pcm_runtime *rtd; + struct snd_soc_dai *cpu_dai; struct snd_soc_dai *codec_dai; - int i; /* for each BE DAI link... */ for_each_card_rtds(card, rtd) { + struct snd_soc_dai_link_ch_map *ch_maps; + int i; + /* * dynamic FE links have no fixed DAI mapping. * CODEC<->CODEC links have no direct connection. @@ -4438,39 +4441,15 @@ void snd_soc_dapm_connect_dai_link_widgets(struct snd_soc_card *card) if (rtd->dai_link->dynamic) continue; - if (rtd->dai_link->num_cpus == 1) { - for_each_rtd_codec_dais(rtd, i, codec_dai) - dapm_connect_dai_pair(card, rtd, codec_dai, - snd_soc_rtd_to_cpu(rtd, 0)); - } else if (rtd->dai_link->num_codecs == rtd->dai_link->num_cpus) { - for_each_rtd_codec_dais(rtd, i, codec_dai) - dapm_connect_dai_pair(card, rtd, codec_dai, - snd_soc_rtd_to_cpu(rtd, i)); - } else if (rtd->dai_link->num_codecs > rtd->dai_link->num_cpus) { - int cpu_id; - - if (!rtd->dai_link->codec_ch_maps) { - dev_err(card->dev, "%s: no codec channel mapping table provided\n", - __func__); - continue; - } + /* + * see + * soc.h :: [dai_link->ch_maps Image sample] + */ + for_each_link_ch_maps(rtd->dai_link, 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); - for_each_rtd_codec_dais(rtd, i, codec_dai) { - cpu_id = rtd->dai_link->codec_ch_maps[i].connected_cpu_id; - if (cpu_id >= rtd->dai_link->num_cpus) { - dev_err(card->dev, - "%s: dai_link %s cpu_id %d too large, num_cpus is %d\n", - __func__, rtd->dai_link->name, cpu_id, - rtd->dai_link->num_cpus); - continue; - } - dapm_connect_dai_pair(card, rtd, codec_dai, - snd_soc_rtd_to_cpu(rtd, cpu_id)); - } - } else { - dev_err(card->dev, - "%s: codec number %d < cpu number %d is not supported\n", - __func__, rtd->dai_link->num_codecs, rtd->dai_link->num_cpus); + dapm_connect_dai_pair(card, rtd, codec_dai, cpu_dai); } } } diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c index 8c168dc553f6..c434fc19e253 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -1042,6 +1042,7 @@ static int __soc_pcm_hw_params(struct snd_soc_pcm_runtime *rtd, } for_each_rtd_cpu_dais(rtd, i, cpu_dai) { + struct snd_soc_dai_link_ch_map *ch_maps; unsigned int ch_mask = 0; int j; @@ -1055,22 +1056,20 @@ static int __soc_pcm_hw_params(struct snd_soc_pcm_runtime *rtd, /* copy params for each cpu */ tmp_params = *params; - if (!rtd->dai_link->codec_ch_maps) - goto hw_params; /* * construct cpu channel mask by combining ch_mask of each * codec which maps to the cpu. + * see + * soc.h :: [dai_link->ch_maps Image sample] */ - for_each_rtd_codec_dais(rtd, j, codec_dai) { - if (rtd->dai_link->codec_ch_maps[j].connected_cpu_id == i) - ch_mask |= rtd->dai_link->codec_ch_maps[j].ch_mask; - } + for_each_link_ch_maps(rtd->dai_link, j, ch_maps) + if (ch_maps->cpu == i) + ch_mask |= ch_maps->ch_mask; /* fixup cpu channel number */ if (ch_mask) soc_pcm_codec_params_fixup(&tmp_params, ch_mask); -hw_params: ret = snd_soc_dai_hw_params(cpu_dai, substream, &tmp_params); if (ret < 0) goto out; @@ -2818,35 +2817,20 @@ static int soc_get_playback_capture(struct snd_soc_pcm_runtime *rtd, } } } else { + struct snd_soc_dai_link_ch_map *ch_maps; struct snd_soc_dai *codec_dai; /* 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); - for_each_rtd_codec_dais(rtd, i, codec_dai) { - if (dai_link->num_cpus == 1) { - cpu_dai = snd_soc_rtd_to_cpu(rtd, 0); - } else if (dai_link->num_cpus == dai_link->num_codecs) { - cpu_dai = snd_soc_rtd_to_cpu(rtd, i); - } else if (rtd->dai_link->num_codecs > rtd->dai_link->num_cpus) { - int cpu_id; - - if (!rtd->dai_link->codec_ch_maps) { - dev_err(rtd->card->dev, "%s: no codec channel mapping table provided\n", - __func__); - return -EINVAL; - } - - cpu_id = rtd->dai_link->codec_ch_maps[i].connected_cpu_id; - cpu_dai = snd_soc_rtd_to_cpu(rtd, cpu_id); - } else { - dev_err(rtd->card->dev, - "%s codec number %d < cpu number %d is not supported\n", - __func__, rtd->dai_link->num_codecs, - rtd->dai_link->num_cpus); - return -EINVAL; - } + /* + * see + * soc.h :: [dai_link->ch_maps Image sample] + */ + for_each_link_ch_maps(dai_link, 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(codec_dai, SNDRV_PCM_STREAM_PLAYBACK) && snd_soc_dai_stream_valid(cpu_dai, cpu_playback)) From patchwork Mon Oct 23 05:35:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13432403 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 A6359C001E0 for ; Mon, 23 Oct 2023 05:49:15 +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 BAC2F82A; Mon, 23 Oct 2023 07:48:23 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BAC2F82A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1698040153; bh=KvY+Ra7PhCfLJdZiuGWKPEDaQICxE5+EeSd1CDbAbrM=; h=From:Subject:To:Cc:In-Reply-To:References:Date:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=Pugaou7jCHCDpthqBJfw3zf1d1CpR9yx/hD2MsjhywjT8glryELKqC016YYwl2zgF HvXCXrtdxNoBbgWPSM0tqVXKq1k3jrPoqfHlbgkUBBkG8lrs5Rt+VWHI+FslB0NArN EiWHDRbIQY4akchOWNsZHvkwjuAv5IWxsttTSYw8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D2676F8055C; Mon, 23 Oct 2023 07:47:33 +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 42B50F80557; Mon, 23 Oct 2023 07:47:33 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 9EB8FF80537; Mon, 23 Oct 2023 07:37:51 +0200 (CEST) Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on20700.outbound.protection.outlook.com [IPv6:2a01:111:f403:2019::700]) (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 D1C6AF8032D for ; Mon, 23 Oct 2023 07:35:51 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz D1C6AF8032D 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=JJKBKg84 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MAgWjeVsF9U1NAGaYuYF+4FxbkIXIYKGw24Nt3nFhOxu5oGdeotfe7/rP9W9AnJF5PjfivDTLjfQmzSHLwLAbzRu6oV2Cd0dh+ttuTJL8UckRy6hmaZXTAGqKo5OKL86lLaHiqDpW6rGBO935OatdaXIYmGH1Ihfm7nouedPTA58l1OxLrky3nby+0bGRKVMTOzMlbvV0NYN2tMR0HDcp2+LkZT3EFyM3XlRzPnJl6sFLN5wz784AazhPK1H254R50yiIz/7whZ0Zszuc0GtpEtSZ+ccprILWwKMH+UeusHnH+q3e3ibbBAUZILwzga3CrvlhsP6R11SY6ZtcqHtDA== 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=wNdyrb5/z883L9GmbevbxH3TILEOnEt7MpzuuvoQtnQ=; b=kZaTbZbfl6FxfFIqURI2h4OcNSM6QphYo9/3dM+5T0iMYKSTmZaDSXztCrKazvsFcuRfpLksLa6osIZy1Mm34DOYE/bl3Of0Qjg35i8wr+PIHbfI09C/+KvH415JHEjo6IXAd2KvrmTJuE62yLOLvnSfNrV18VPXRgbzlb8ajK6UmFhfkhbvnR7Ao3F7rz2NmEamI0ubbfE5aonxEzWu39738HmJGx8uEMWXwbrZTxrvUGR91m0Ewrf1YWSTWkZ5fYXm2yGDz6wW9sfQGz7tXup+fd+rXMenQwYVAp8GSswevNTlWFqApnWlDVkD97vCmcRRSEEeUULpMJ6VySI1/w== 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=wNdyrb5/z883L9GmbevbxH3TILEOnEt7MpzuuvoQtnQ=; b=JJKBKg84V9e04uVRGjuIkDdaQH6BBmk/srge/x+iqBkMI81ZZh9ZI5kPTN4xWMF4ThVe+7P2PqSSlKokQKKGtCbTNyviiwRnk0JbMzc5AbTJEyc/hSYp9yMTQwWZeK30XLK8EOFNu3MzAh5fQ67lvy4PQYTFGqX/ws3sfKDZfnI= 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 OS3PR01MB8242.jpnprd01.prod.outlook.com (2603:1096:604:174::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.24; Mon, 23 Oct 2023 05:35:50 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::be8:b648:c989:8e7f]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::be8:b648:c989:8e7f%4]) with mapi id 15.20.6907.032; Mon, 23 Oct 2023 05:35:50 +0000 Message-ID: <871qdllx3e.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v5 2/5] ASoC: audio-graph-card2: add CPU:Codec = N:M support User-Agent: Wanderlust/2.15.9 Emacs/27.1 Mule/6.0 To: Pierre-Louis Bossart , Mark Brown , Bard Liao , bard.liao@intel.com, Conor Dooley , Krzysztof Kozlowski , Rob Herring , Jerome Brunet Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org In-Reply-To: <874jihlx44.wl-kuninori.morimoto.gx@renesas.com> References: <874jihlx44.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 23 Oct 2023 05:35:49 +0000 X-ClientProxiedBy: TYCP286CA0287.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:3c8::9) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PR01MB8426:EE_|OS3PR01MB8242:EE_ X-MS-Office365-Filtering-Correlation-Id: 86334d97-4eb7-4b17-b357-08dbd389ea6c X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3+1AoJ980fO8351Py/vpod1kIOGf5kwQLneNPkrwg5iljJJhFXJfHX8FCLYGODJfh1f3CSLX2sA0SRQ1pFfKLiUTNnOc1j+u93PeLwFMQ3iLTMq7hqP6vLc06xb92P++QuoD31t9s9/yCWGES/xx5uan9O7oEukVCFij4AWY1hJNTtS90ny73ZR+vN/jyJgWGmOLV1x/IB+O5n0NmP6y5G1pH53rfXrhle9XDJp1xorrHfGQaNF/9drs9cm3UsewkRI/Kq+6xk0FpJwCihQjI3BdsYonz3Q/BSItptcuspIGWQqSAE8IQoURq0ImmEhGN5oq4uNEBgOx6vyEE8JNcORdXFZSao2LETqGkx/EfWM2KtMSTUl/+Pb5Rd4s17ChUlbntZyy5PaelYvpKrubg/yqvR3aVjQuYbsvZ6mYyuk4QMcsZ49Ux9JRiikL2ms41n4fbYZH+j1F8GLDCBFjkV/sA4s32SMTHtf5hse6/oCip7OzFdezqs/20+8R0jsU+IPEA6tEi85ZtPsfYGln8vK+u25U4sf2vPGm0E/H70ztX3+5YUhxXihCjardyQooJgQH9SnxZLJ9n0ajtdR71xdkjLdg1MC8BpHc0Xo5YqNOrsneG8zkKzETGf+9i8CWcxXyA6uriF1uX48YNC7new== 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:(13230031)(136003)(366004)(396003)(346002)(39860400002)(376002)(230922051799003)(186009)(451199024)(64100799003)(1800799009)(38350700005)(36756003)(38100700002)(66476007)(66946007)(66556008)(2013699003)(110136005)(6512007)(86362001)(2616005)(26005)(52116002)(83380400001)(6506007)(2906002)(6486002)(7416002)(316002)(478600001)(8676002)(41300700001)(8936002)(4326008)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: cVS6WlmwXEMKKwAGqoyj7YT/isw5EfzWKEWAcwly4CDQy8nsuxrfhcCao5iE48RZBpm1f8PJ6h7AnL91dLmS4w+6pCBIW34coVU9R9QC7oYY0PyktuCQ4eoFfha4xBVMLxRKcA2CXOxvSRwm5gmywClLpPbmPcPwNZ8vZYsg0N90QstJcMkuEiuQU8iMB3bcx8tpwHCINQ7outmS1UyM5SzJSHCyiaMsCAk+r+pxykwmX+aRAUB5hBj8Wk2uYMspGGlbjYS9+WpksFzdpT6EqlH14a4Z+wxonU/LjREe/7AonvTVopRxZBtJXMAs9H2iWfROsW4iYbw+BoMsxS7Y0IlKKP3cagqLh1rRm96owEFNuheQC4snppEcM0W+sOOq8CsgIubk+SDM3/7TplCeMv5EltYR+njuK/LuzkeIXlwbJzJSiGM8TOgeeOwhYe/riqjUAqAOdB7P5RUv62ZGY8F5ZvTOG672dDcSefYHRR9DNJHU0jKgnFreIVPc/1MEwTKvLnfH8eOeAA09HPVSrF1nzlhLXLmly3WoZ3OS73i6EeCBQZJKRe/3wWjZV85zyR2bmIP+fiefPFoZkmycGqyUMEbULmkk11Z7FNaxjcye1196JhdNo4TX3u+1r/bl6NbnXbnXXmo2TDffY7JaqdGyszN2LO0r4DhnMWHqMfl6HKb1bsGFNbwMCaFza1q12m+emmpBnKuTaG+b+6lCKPs8nHdHCktl6b6XqMfU3/SSkk3QJmXzROX7Nbp64EQi6QDwVigTGE4xI3svrnEs81/8D08HQ9eZPLHH5oZMXVD7fSRvuR4gX8+sws+hRlx5nHX5rwIderFkYjtI2iXEM3aD6fp635yLjUjyJ5acllbIGNALSLQlex44e/jxLzW++Zao4hUdRK8xLlAMm5/ndf9c7G4kfFKopSbPTBHqXOgU/xqear3Xn3ftEy/bUjfCTHR09AYuwuLvF464cesZJlSWgU/X7RpJmt/QO50iqsq2ra1YmcFyGzCbES+A0cAtolHyr0dXq/Ch1ySkHO0Km41pXtak/rmw17MixrOYKp+m8La36Phfhra27qZk7ijeSzMw02MVV19U9db+Wsb/FHRc7GigvhpavPGBkjcDGLAYMU8R1YB0TCCjQk4JOoQBLDfrVhYMiiD7YlvDYsCjf12TxRW0RvPBEN5Zdrdvdioh65zEG5R3Kp1scq3uzeecIHtD4nKjBJkAX0/mAKf68tNOgv5Gg/ZGdrNXabHPxF0VEpuxzt5WK0lLlomewi5DuYhNDfEJp4B4X1aiM4H9SddZ+sGlXGEWkRJ//OI44wmvgrrv5bswy4KA49a2ABj7zcv0arGzE1Ln64Ul4mJwjYcXpPX1dpvvJcPzgfdJQics5E/DVaCivauvCpCpM4RlJtPzsnpMPwPOMmyKfiiwtU9Z7oFhxTM03S6yWGhMJohkQjYfdQW90+53sx4ILLzq31p89DfFmvMgl7XJ1MnQHPSCzF6J5sWUH/jyUa6GmGb9KkbptqWKEAFPJUWl4QWeFyEXMKLOakxke+uLNQlvcxV+u0NAOlM28p+NLKhL5fpWyXT78PiqyxQBAQxn+Lq+AS2xqbuYakdasSm8FwgfUIxj2lI4vtjnvmA3PjigIhk= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 86334d97-4eb7-4b17-b357-08dbd389ea6c X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2023 05:35:50.1041 (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: MMYDqTOc4AZYApT7w2Rj9HIr+57N29Nmzy4yXE13NM49SlLeiI0F+Ot5bDlNHSixtOe63gH+K1MXuIEuCJ1pv6/lyjWIcNI3S9Utq/ZalT8SO3iFXi/YXfVoGlkxpnap X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB8242 Message-ID-Hash: 3CSJ7HSAIEQF3N2X7HQP4XWBE4CPWGOR X-Message-ID-Hash: 3CSJ7HSAIEQF3N2X7HQP4XWBE4CPWGOR 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: Now ASoC is supporting CPU:Codec = N:M support. This patch enables it on Audio Graph Card2. Signed-off-by: Kuninori Morimoto --- sound/soc/generic/audio-graph-card2.c | 49 +++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index 5d856942bcae..bef7ef5e408c 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -506,6 +506,7 @@ static int __graph_parse_node(struct simple_util_priv *priv, return 0; } +#define MAX_PROP 7 static int graph_parse_node(struct simple_util_priv *priv, enum graph_type gtype, struct device_node *port, @@ -515,10 +516,31 @@ static int graph_parse_node(struct simple_util_priv *priv, int ret = 0; if (graph_lnk_is_multi(port)) { + struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); + struct device_node *ports = of_get_parent(port); + struct device *dev = simple_priv_to_dev(priv); int idx; + int num; of_node_get(port); + /* + * create ch_maps if CPU:Codec = N:M + * DPCM is out of scope + */ + if (gtype != GRAPH_DPCM && !dai_link->ch_maps && + dai_link->num_cpus > 1 && dai_link->num_codecs > 1 && + dai_link->num_cpus != dai_link->num_codecs) { + num = max (dai_link->num_cpus, dai_link->num_codecs); + + dai_link->ch_maps = devm_kcalloc(dev, num, + sizeof(struct snd_soc_dai_link_ch_map), GFP_KERNEL); + if (!dai_link->ch_maps) { + ret = -ENOMEM; + goto multi_end; + } + } + for (idx = 0;; idx++) { ep = graph_get_next_multi_ep(&port); if (!ep) @@ -529,7 +551,34 @@ static int graph_parse_node(struct simple_util_priv *priv, of_node_put(ep); if (ret < 0) break; + + /* CPU:Codec = N:M */ + if (dai_link->ch_maps) { + const char *props = "ch-map-idx"; + u32 num_array[MAX_PROP]; + int i; + + num = of_property_count_elems_of_size(ep, props, sizeof(u32)); + if (num > MAX_PROP) { + dev_err(dev, "need update MAX_PROP (%d)\n", num); + ret = -EINVAL; + goto multi_end; + } + + ret = of_property_read_u32_array(ep, props, num_array, num); + if (ret < 0) + goto multi_end; + + for (i = 0; i < num; i++) { + if (is_cpu) + dai_link->ch_maps[num_array[i]].cpu = idx; + else + dai_link->ch_maps[num_array[i]].codec = idx; + } + } } +multi_end: + of_node_put(ports); } else { /* Single CPU / Codec */ ep = port_to_endpoint(port); From patchwork Mon Oct 23 05:35:55 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13432405 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 2FE14CDB474 for ; Mon, 23 Oct 2023 05:51:37 +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 21D609F6; Mon, 23 Oct 2023 07:50:45 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 21D609F6 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1698040295; bh=JIftVMUTHyucbnO76pE0xCJuHGyFH8buKqCmRIpjtdI=; h=From:Subject:To:Cc:In-Reply-To:References:Date:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=ix09CI8Qll5cywrJcJ+FO+3g7cdlWP6g644ROFVD1UwU+pKYLSnGT+ylSSMwJQTOM UMgFknWQnWbX1DYkPTsREQ3PvP6cLNjAztDCiVdlY+iWzV+374/hWPF2I79sVd5Bjq yKW/3S71FUWXIo6BTqeMjGYoExIgUNrCtEaz8XCo= Received: by alsa1.perex.cz (Postfix, from userid 50401) id E42E4F8055C; Mon, 23 Oct 2023 07:49:56 +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 AC746F8055C; Mon, 23 Oct 2023 07:49:55 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 09BC3F80527; Mon, 23 Oct 2023 07:38:01 +0200 (CEST) Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on20700.outbound.protection.outlook.com [IPv6:2a01:111:f403:2019::700]) (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 6CE2BF804F3 for ; Mon, 23 Oct 2023 07:36:00 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 6CE2BF804F3 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=P+/FX+Dq ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=YSoVASmgZ+MXqAJj6NDdjsP1lMt8Iflbs4CW+9YG76cX5WLoruPubHNVmYe3NbrGJ7nTxX/8F9QnqhdRI2IN5fhZzK1fsyuCeJqdqSU1Bnh9qoj3dBdaZmKoTTMyx/HdimRbp2wgJzqZkwV0NsGJzzxxkbg5oNpB1xq0IB5DjD3Em6jecXaOn4M4/vNCuFwDodHsqP8sUlQ6CpJmKHIb6J6iG+FjNQsYJHaiahdq9e2FzMWgipYnAjoB1iXIBkEx4Tn3WDgxFpH8XPal1OzMWglqdDSd9uDTUDT5PFthzqKr9jM+P947fJVxsrk2n2HNHnF826ZG6lFwq7DsY69JVQ== 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=AM7EnB83jtlSKLAmJEJGQftdO29zDX7nmWMdLsNRMT8=; b=Myfz7/Yc+CzF2e1gS1seiHqnmTE/mm874lzlbZ00nWNeWXY2lmkJSw8DrrXeICS5LdUzV1+Hj0tLwLuZ3AxkBw8DI9b9XDhGSzZ02Qiy5iwP4oW1xREndNrqGEHgMjTykg+JiK8MyD77eYCJi8Avc0q/pCuCCbh7sA9ETc/1eK+KYk2DSgFPKIP3qtTqHAbXI+ps19BhAK0cnQbevqP19RMAlPiKFOdLDCF15SetSK74+m8NoH14l2oa9tng0+o2WQaLRid921h+eAh+rAHaNI7XzjtbO0qCWelNjDQNWNBgbV2NjtcyDjE34ZhRiKjVz84jN56JY95O4DOcqEeGWQ== 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=AM7EnB83jtlSKLAmJEJGQftdO29zDX7nmWMdLsNRMT8=; b=P+/FX+Dq4XN1wtybuSwOLLQBNMwR1e9sjYj9GkSXjIbaeIW8yAPEI6UXzLfw96+yQ1l/KKs9hcrOUl47Dm5w6YoN+hGp0k3jJ8go3mtB5hLDEkPkZSVeoX7vMfqwf5rOp99EjjnAEL4fQyfqD1WDR7gP3kAknVU0w6sZpdUdb2I= 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 OS3PR01MB8242.jpnprd01.prod.outlook.com (2603:1096:604:174::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.24; Mon, 23 Oct 2023 05:35:55 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::be8:b648:c989:8e7f]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::be8:b648:c989:8e7f%4]) with mapi id 15.20.6907.032; Mon, 23 Oct 2023 05:35:55 +0000 Message-ID: <87zg09kiit.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v5 3/5] ASoC: audio-graph-card2-custom-sample: tidyup comment / numbering User-Agent: Wanderlust/2.15.9 Emacs/27.1 Mule/6.0 To: Pierre-Louis Bossart , Mark Brown , Bard Liao , bard.liao@intel.com, Conor Dooley , Krzysztof Kozlowski , Rob Herring , Jerome Brunet Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org In-Reply-To: <874jihlx44.wl-kuninori.morimoto.gx@renesas.com> References: <874jihlx44.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 23 Oct 2023 05:35:55 +0000 X-ClientProxiedBy: TYCP286CA0350.JPNP286.PROD.OUTLOOK.COM (2603:1096:405:7c::16) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PR01MB8426:EE_|OS3PR01MB8242:EE_ X-MS-Office365-Filtering-Correlation-Id: 2e0f8c00-6e1c-486e-a4ee-08dbd389ed86 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: q7XHWOjNYQLezA6dQ66UKQzY3xvc2x4XVlqGcrHf+F0pndESgKuyIugEtg1lRodsE5Ptl44eobk1NTn8+gDq05rGlHCXs3pftTnIX2FOrNv6cv8cFMCvfpo+tqL5kaJgMcR4/IDEDfBXI7AsUEpUeah7VeqUosPTjHan2XHCzG1HjfcXyX3yongWkc1sv/8njEMB8jp2A7V276vOGtbYP99BVFX2DwuyLUaxcgwt444qJmTKE5Doa2kchM3lPXh+HLGNao3MMwFo0A3A2yPi4usWZakD+xOCtNuKSNA5m5vM3FxJuXQvOZfX3Trpcp62dSkzqnk0l+EijYFf7jS+lLfj3zcoPk/1IgogHaDsnxKgGTuRenTNpi1LnZfByvFCK9XvhHPiScVB4PzBUnnI6Px0jgxK7uDulPAI7CUnk6PAqKOAQK9Dq3x63jHt8+8nI6OQPqJsREOuU7PBh9FS6RYHzrDkkG3Cz1B7F5uDPfXEgHVLfQq3WrTq7EY0vUZyroGIQaGYOXiiBt1le9Hl/g9aGa9zglzi8t2nLd9y4Y5VUS5XF2E1l6jEKKa/FP0lWLhGcS6+3sHksPk+5dEhYk6PyM365YTw/fvPuIzEYfeazfECSNZ+kEcauS+5im1/77ip6sqOvKIrIRCGxCdcnA== 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:(13230031)(136003)(366004)(396003)(346002)(39860400002)(376002)(230922051799003)(186009)(451199024)(64100799003)(1800799009)(38350700005)(36756003)(38100700002)(66476007)(66946007)(66556008)(2013699003)(110136005)(6512007)(86362001)(2616005)(26005)(52116002)(83380400001)(6506007)(2906002)(6486002)(7416002)(316002)(478600001)(8676002)(41300700001)(8936002)(4326008)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 6M3gFv9fo4VOAmGfEuNqVCRZCWVUsGZzwdLSbTjHQ+3sjadQBnxva58JDS4prrkomjnJb1uRkFJDA+29A22M39JsVsvFqmAWEaXc+iRbp1tft+cnbDr0tXEn9CXdr78rSLVKz+8DyZG+tqwgGowlXcTPznD4kV4HBtZ6PQ0pbKM3OfZE/RYYJgVw0f/bdUPZYBwpBYmqwA32H4lPWMeQxLchmuXDULEfQn2kVlQjzY+SWGvWiE05hmg0sP83AQEARFdQgcY2eUXtavNaG3hJACY7udNgrwwHeU97ews2EizUyOe3akBeiVP20mjkT0cR9SM0tiSXUZFpKC2eiNoQEO+UgAdjM10QlyTNogA+7RFOBV3Y1UYV1rSiimxrrj5ZtO3lvBp7otLWh97aI0N6qJudeNBsBxlX7IAQ8YSCTGXJVrH9ZOWW2WZltP7xzsiUiOWnt9ZXn37BxFkwSPkoY3zgUZ0unLEN+XCgnb3P7oeIyEwTOC/dPnSd19IIdXxS83xLxHytiNHdtIygKm/ZiTrcPt82h4TaCeFFllywbpP/IT5RFyVDUQE8t5ZvhBoSftSIDSXbXNyWcB8gzL7gBs0DCVpTEIvPcW68xwh3ZEiDfBhSrbiVY7642OSrjk7gyOQJ0tyxPxulGWFTcShw4L0T+tNTYxbTHerjB1sngW2seQsp1PsuMwx4rBqWzrWkfr7eQ4UcgGjRGv/FQRRj+b0eA83CKYe04lmjbsh6Dt5H/gbCMP00Wd8ISjAz6BX2s6sJW29HPneEjGTwGVrfc/xDuEywI1cTCqQhDB40OfXCSLy78tm2SeKla2GvP7tFaKYjvmHCPqkWEUMHvwnYesFD4AGRLx+Keu0o+SbX6C/Ues5rpXOVcoiIm555xP2o9BdrgwGNJfnvMJE/nFUd7pU0rg4il7rQjjR0aUAsJI3EF7dPXjrrC0xJURpbZ3132paXUe8fWKSe9RxZV4AK9oj5ZPiEuHI9RPlFERMuIwVwsdyqPeZpISR6R4ctj17LlHJF89LNxWCEB4lUiIOrx7kBJEGH5EXJFcU8m+w55QEGvZNzoWBr3aLUfsLxCIKZfACsI4lEAc0js4sY0rIB35CFFg+SpBSqWbEFownzFFkMO4G7g0ijpBuzFh2ixGLbsPFbaVcsCtiqs7jYAHVoEqT71XkKGOPhnxMFP6F9YIJAdjb1wfYEzPWhGDXBdiRRINiRRRVdUNDHvbMaiwyePHGKGr7rzZM7GVwUXO4eANNBsPaQnTA67MCSwzaTK+L4pUJ8/pE8ouus4K93wf0kZNIxTuvHY/nF0ach90nKoNdZ2KU6mEqjHWsFpzu9DZXyYCvLXKA4vD7aOJqJeWMTZeXShVO1F8n6FSpoV0T4Ih+ejcYdfOrzerGIOlEsD28hBY8uOS0aUrccu1iBQNkZD0Sx19ReVi8zNt36xeCCmNC6jq4AHE7KyGKl3Mo34V8nS4Izfc71mp3HcBkVnExagHFsrza+BmfVCiRptyb7hi9kgjxl/Lj0gKX9Rej43U97halMYOUntXmE+9BpIDJaDxrGqkKtTYLz1pCUS6JAwjPDlJPpizGf2KeWPhcREcCCYqYHZ/rWS8R7tzLBYgx8Tr0aXsE+ya++3l8tbjFSATM= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2e0f8c00-6e1c-486e-a4ee-08dbd389ed86 X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2023 05:35:55.3412 (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: wPtslJISNF1/kkfbop+jNkhNmm/IdT5jxCcyF+FW7z5SXygkUKcM4v2CqcvaKgEmsvpzVB2gxk4znfOVVlpEbSGeCZQRyirtBgO2wjORC7+USM8eK9hQuQ4DajMvCL0T X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB8242 Message-ID-Hash: LUXRR7ARNPXBMFB55BVKJRVESW6OJHOV X-Message-ID-Hash: LUXRR7ARNPXBMFB55BVKJRVESW6OJHOV 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: Some comment doesn't match other styles, this patch tidyup it. To prepare Multi CPU/Codec, this patch fixup some CPU/Codec numbering. Signed-off-by: Kuninori Morimoto --- .../audio-graph-card2-custom-sample.dtsi | 37 ++++++++++--------- 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/sound/soc/generic/audio-graph-card2-custom-sample.dtsi b/sound/soc/generic/audio-graph-card2-custom-sample.dtsi index 8acaa2ddb335..736eca553d7c 100644 --- a/sound/soc/generic/audio-graph-card2-custom-sample.dtsi +++ b/sound/soc/generic/audio-graph-card2-custom-sample.dtsi @@ -58,7 +58,7 @@ / { * | |-> codec13 * +-+ * - * [Multi-CPU/Codec] + * [Multi-CPU/Codec-0] * +-+ +-+ * cpu1 <--| |<-@--------->| |-> codec1 * cpu2 <--| | | |-> codec2 @@ -144,11 +144,14 @@ audio-graph-card2-custom-sample { */ &cpu0 - /* [Semi-Multi] */ + /* + * [Semi-Multi] + * cpu7/codec12/codec13 + */ &sm0 /* - * [Multi-CPU/Codec]: cpu side only + * [Multi-CPU/Codec-0]: cpu side only * cpu1/cpu2/codec1/codec2 */ &mcpu0 @@ -182,24 +185,24 @@ multi { #address-cells = <1>; #size-cells = <0>; + /* [Multi-CPU-0] */ ports@0 { reg = <0>; #address-cells = <1>; #size-cells = <0>; - /* [Multi-CPU] */ - mcpu0: port@0 { reg = <0>; mcpu0_ep: endpoint { remote-endpoint = <&mcodec0_ep>; }; }; - port@1 { reg = <1>; mcpu1_ep: endpoint { remote-endpoint = <&cpu1_ep>; }; }; - port@2 { reg = <2>; mcpu2_ep: endpoint { remote-endpoint = <&cpu2_ep>; }; }; + mcpu0: port@0 { reg = <0>; mcpu00_ep: endpoint { remote-endpoint = <&mcodec00_ep>; }; }; + port@1 { reg = <1>; mcpu01_ep: endpoint { remote-endpoint = <&cpu1_ep>; }; }; + port@2 { reg = <2>; mcpu02_ep: endpoint { remote-endpoint = <&cpu2_ep>; }; }; }; - /* [Multi-Codec] */ + /* [Multi-Codec-0] */ ports@1 { reg = <1>; #address-cells = <1>; #size-cells = <0>; - port@0 { reg = <0>; mcodec0_ep: endpoint { remote-endpoint = <&mcpu0_ep>; }; }; - port@1 { reg = <1>; mcodec1_ep: endpoint { remote-endpoint = <&codec1_ep>; }; }; - port@2 { reg = <2>; mcodec2_ep: endpoint { remote-endpoint = <&codec2_ep>; }; }; + port@0 { reg = <0>; mcodec00_ep: endpoint { remote-endpoint = <&mcpu00_ep>; }; }; + port@1 { reg = <1>; mcodec01_ep: endpoint { remote-endpoint = <&codec1_ep>; }; }; + port@2 { reg = <2>; mcodec02_ep: endpoint { remote-endpoint = <&codec2_ep>; }; }; }; /* [DPCM-Multi]::BE */ @@ -323,9 +326,9 @@ ports { /* [Normal] */ cpu0: port@0 { reg = <0>; cpu0_ep: endpoint { remote-endpoint = <&codec0_ep>; }; }; - /* [Multi-CPU] */ - port@1 { reg = <1>; cpu1_ep: endpoint { remote-endpoint = <&mcpu1_ep>; }; }; - port@2 { reg = <2>; cpu2_ep: endpoint { remote-endpoint = <&mcpu2_ep>; }; }; + /* [Multi-CPU-0] */ + port@1 { reg = <1>; cpu1_ep: endpoint { remote-endpoint = <&mcpu01_ep>; }; }; + port@2 { reg = <2>; cpu2_ep: endpoint { remote-endpoint = <&mcpu02_ep>; }; }; /* [DPCM]::FE */ port@3 { reg = <3>; cpu3_ep: endpoint { remote-endpoint = <&fe00_ep>; }; }; @@ -363,9 +366,9 @@ ports { /* [Normal] */ port@0 { reg = <0>; codec0_ep: endpoint { remote-endpoint = <&cpu0_ep>; }; }; - /* [Multi-Codec] */ - port@1 { reg = <1>; codec1_ep: endpoint { remote-endpoint = <&mcodec1_ep>; }; }; - port@2 { reg = <2>; codec2_ep: endpoint { remote-endpoint = <&mcodec2_ep>; }; }; + /* [Multi-Codec-0] */ + port@1 { reg = <1>; codec1_ep: endpoint { remote-endpoint = <&mcodec01_ep>; }; }; + port@2 { reg = <2>; codec2_ep: endpoint { remote-endpoint = <&mcodec02_ep>; }; }; /* [DPCM]::BE */ port@3 { From patchwork Mon Oct 23 05:36:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13432404 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 F35FFC001E0 for ; Mon, 23 Oct 2023 05:51:22 +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 2BA9D844; Mon, 23 Oct 2023 07:50:31 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 2BA9D844 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1698040281; bh=n0GknqHwPFWT/zKdn0snzw6tbtBqGLBzQ2k4OGXmQes=; h=From:Subject:To:Cc:In-Reply-To:References:Date:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=sQvRUjNRIsaPQTTHHQBaZnRbFOZmJ7CeOVfN3BLav+3ZgrqoHMZ3ZylTncet/CfFM EHJaZ6xjalFPkY9QCkL+C3o/rIMdvdlKXA6bzSYpBUplaHfkp9Zd6iW8c/Q6qISgb0 nkUipK5VD3qg1uwtUG0uhIG12vnKGeSw0BMnGNO8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id C71DFF8032D; Mon, 23 Oct 2023 07:49:54 +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 B1491F804F3; Mon, 23 Oct 2023 07:49:53 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 91295F8032D; Mon, 23 Oct 2023 07:37:58 +0200 (CEST) Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on20700.outbound.protection.outlook.com [IPv6:2a01:111:f403:2019::700]) (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 C2BE4F80527 for ; Mon, 23 Oct 2023 07:36:09 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C2BE4F80527 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=ivImqtUI ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=FSePvkr5dKUT5d8tjurCzkxf2SSU8xD+Ele7/yCI9+CmD7CDq17NAxzOozt4NV+5mMR6JFzaIqzW9CN/8zCpzSt9wqqlMXvGJKYVjWlZgyIBjbHpUGqO2E+MbGWnnmwXVynTAEj5XaayNHidMVwMlgLFl06nVbyGScJkmN87ykw8h37f3hO7BMVTW7lyzEnpCJS8bgOjRujoF1y2NtwvopjSjuFHvIIgoe7wicgIFchuHN4ObLpjj68E4mjgMSPQuxxf3PA49K9DKjC4FjJdE+OFuBvSWsQkRVkwSOs+dr3EnAPalT18QI0wchNYpoS37+DavmeFn8cQcTwfyLfxBw== 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=mBarzRxQ9weni+UdJc4p0ndVo9W4V+NxVpUaRSYdPb4=; b=NZIm8RsyGWXgZOVlQ631U9tjneungwUAshW7a+FBYgVpFQGXLaeYfb64e+qMlnR/Mf4wL9eUWEYdCq2CbREHRVkOnh6pyZXeEJUV70dHQ85GIK4elLLbvXI6mv1osl5q6zRh1WhtXkTHi+CMxsiZLXvzjV0Z5MhCgCEC1l0R3X6Ldes3XwKA8UY1SYEzLqreE42bc9jv2iU0lAdLkpSyvAo7LYqfzgRe6UpS0jH6Ar3cPH1SEwXuV4AQLol4o4mCfXFvtKKKIzXOPAwLgd5hZDnZsm4R0GIloecS0l9ZhbjXZSDOERP2U5tJQgs2yJjXbK8carahBvGVtwJ69/H3cw== 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=mBarzRxQ9weni+UdJc4p0ndVo9W4V+NxVpUaRSYdPb4=; b=ivImqtUInvWpGRma6pu4i5nQTl+glQP34zXtiLaH7IyrF3Mhr8uLRNW04qNaJhSUbAoEzPuiVPJZwg5wv7SjtYTEPOn5sjRuifsfueg3Y86PwJRrxyjyZ/yVMXi+6iEvWZs/cRibh5XzpN+UcjahZncXcwotzC/+mUJ8/IRYPG0= 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 OS3PR01MB8242.jpnprd01.prod.outlook.com (2603:1096:604:174::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.24; Mon, 23 Oct 2023 05:36:03 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::be8:b648:c989:8e7f]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::be8:b648:c989:8e7f%4]) with mapi id 15.20.6907.032; Mon, 23 Oct 2023 05:36:03 +0000 Message-ID: <87y1ftkiik.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v5 4/5] ASoC: audio-graph-card2-custom-sample: add CPU/Codec = N:M sample User-Agent: Wanderlust/2.15.9 Emacs/27.1 Mule/6.0 To: Pierre-Louis Bossart , Mark Brown , Bard Liao , bard.liao@intel.com, Conor Dooley , Krzysztof Kozlowski , Rob Herring , Jerome Brunet Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org In-Reply-To: <874jihlx44.wl-kuninori.morimoto.gx@renesas.com> References: <874jihlx44.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 23 Oct 2023 05:36:03 +0000 X-ClientProxiedBy: TYCP286CA0331.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:38e::10) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PR01MB8426:EE_|OS3PR01MB8242:EE_ X-MS-Office365-Filtering-Correlation-Id: 267f0d2c-8ce2-4886-0c2b-08dbd389f27b X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: H6mN9trSs2+j1samxQ27naM07kM0coJ7O7sMoLasMg/S7s4HmJSUt21EZ7qBgf/aPn1Nhi1t15McTUTCTjlr0g8mGnVKOmd4/YmlpaEreRovvvyt7hmtXIHxJzEX5Z874/fPpgHTUuSv/4Yi0xmkvaPRLrRtUcn1h4Qo8+kRJtYtZRqFNIghoDef+Diz7BfdIUOViU5wzSaZLShmZGham2FaCvyiSvtYjhcr8J2RfO5V6DAqFkIJbzfd26+nXl0Z55qz3POUxXbG18grFdt3YS6Rt4rAJfMkmpMrgkuVTfib7ry4bZR0MZ5f2EGQLxouJhhyEG448ooPNKQJOP8RTYxXOd9aCKTEasFxE5T0GUTpulWlM9NQ7HzfI2gpbZ5SEHltksGkWug3Q4TDsvTjVYjHOeKWg5pvu3cFaHlNBUXUqjtCh7lsnsMg6hm7cZTva14yle8VyAdTc+IYDm95g4/mtVIj+xz0u9MGbaiX+cH1dc8lf6Hzgimhw1X/OKaDoYLf/V1OYma11y2G4TwyrT/kHA9rg5Sc3OhyS5UgqKIMTCP6V3+MBvUXukw57XPPaFTRgoR7Zg9rx1J2hoVtrCWR1i02Qvlu9IHwhfP8hXEnuMo2vlFbdt9x4Q5Ac4FTa1/U/jDah3ZSBmiGQTyXMQ== 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:(13230031)(136003)(366004)(396003)(346002)(39860400002)(376002)(230922051799003)(186009)(451199024)(64100799003)(1800799009)(38350700005)(36756003)(38100700002)(66476007)(66946007)(66556008)(2013699003)(110136005)(6512007)(86362001)(2616005)(26005)(52116002)(83380400001)(6506007)(2906002)(6486002)(7416002)(316002)(478600001)(8676002)(41300700001)(8936002)(4326008)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: D9VQamQ2U0AXdjW+W491BrT2R0JcErvu7jlh6SPOwLZvt7BMawCttdXxyGuy3xSFBRKuSRdjih54Na0fPAD+ZB6vN3Q+f2Wo8r+eqr0rTpLL65tZeGbgDPOlErYTLE712e+k5az9VlNwocFkV5xguO/R+NDA7TDE46S0OaF6RPpB+K15mU9Op5IdleMnanlMpsJVqNdfA1DeG0C5D1+p/3Lu/XpmtksSfeSgZ6FIT1CCd5PcCNpQN8sF6p5OeLTw+zvMfnz3lhNuRMT2H+AwFrw0sTjv3yGrMWvWNm+rXHS9lEOVFfViGrzuJUvtYJckcYFysPq4oEaZ+f1D57ClUE8ffks5Y4mY0TJ2DlK9tC59aEyvXwneuLniaD46PimiFHU+RtE3fWdJZANPFxmXcKvY9C9YV5zZ8sEEAE+HbjzH/kU0wdS48r/3vxqa+ReAq03w9InFHkvdwbEaz7JiBUdTnJNY0e7ABu2r9lubU0835NDzqmimaC96UArR03zrdThILRde0BwkSuI04rdYo750Y662gPM8buqyXlM9IHeiIRDuW1CEbMkgPrS5cYs4XTU/qBXahzpze7Y6/VnVOHrwVUjezorHaPgQmUBayfPuAIHLGQ+dGQ1uUp7wuxHNxjP47Cy/xnOZvdcb3ereIdHJjLwyUoxghnslgPsaxor2B8Fiffg4DRadHwx7DxC7XAc0ogTF/7u4u1SDA+/Pg+xsV2odzQZgJllbb69vEIcODGq2WSsyV1N+9AeSPu4HiwySYDA07NCBFvVZm4Fb7ZQ+5R9nAEDuUpp2gn6GRyQW4majmGTL3qe3NH1oogCjUGXsGyBi+krf8aaQwkCzuqEj7TAx8O97MVNL7o86qLnZ+HOW6YYBGPio6BKsyhsGrKkkF1N30HlBwKMpJswN05h7zHRpcwcs1LN1n6PRVe2OcrMZN4B6FA4B+K7qE7KEjDVHsTr6MRKzFqpJSo6c+1UBMFQiSn4kyGkQqG3U+xOCxJYwERy2UM6Y5s6Vd2AG3lF3kSCmvd0XwBj0tjy+ePO9AC3uSjA6bFtsaLNKf0uNSCAmnqzvPzVDKjccqrpQt0DDiJIjmhUgEJPSXR5w4UZFpsX2/pTXPCyu48OABS5cIoe0ilVJeoid7+Jxv7NqgqDSBpm823Nb8nqLA4sl3VHDIQUV8xwMeQ+6JLvh/6xEBCYr4uF8+NayYm0kTHlnA0D4fkMca8GOmNhS6SNtfY48242Plp9z2UEUnktMu9ZJc4Hd53709ZBaRWLGH1BeOx9pHWd/s/1SDHdFCGrYfTjRDZXtpg37dyhp8wkp57/UD/m5j+tj4CTvzyJ4OE5RhcKtGeeNBLu4WMe9AjfltkCoDKn8JZc8x94d4QgmrYnR2GFNdyljo9bsNDOefmTx/xuFzvXJnqWbWQ86/+rqnIh58PmF/dsaqv2ToGYw18k/vJzcwVCXO92gQoQzrCkXS4XgzoGHRK2nmGggoBK6g6lsFpumVjl+4yw2goNfZ4TnfOsI6VX81zMtDQiX8ijlIyIVUfn46xgO78EIFzFqK8tdu9i1kt6OiJqvXo0H7LlW1w7m3VKDHEQh1xkdm7aEXwru8fALq1n5ZIIZVHEAT5SRIEHJMHKHzN7ooEllCWQ= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 267f0d2c-8ce2-4886-0c2b-08dbd389f27b X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2023 05:36:03.7004 (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: fx217IHCGr14HLV9tZy6Iq4Sv5sTapSal6wwt4MX2g4DNWIrgWIo14odv/exr/v1u6rGcWVm0zIqjTQ+49ti45ARtF8A6YYToexDqmTm6vbO6SmaJ3FBjbw2A8sVQpml X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB8242 Message-ID-Hash: FN2B4CWIQSYF2SKKHSPBYZIGKY4PHDR7 X-Message-ID-Hash: FN2B4CWIQSYF2SKKHSPBYZIGKY4PHDR7 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: Now ASoC is supporting CPU/Codec = N:M connection. This patch adds its sample settings. But One note here is that it has many type of samples, it reached to maximum of sound minor number. Therefore, new sample is disabled so far. If you want to try it, you need to disable some other one instead. Signed-off-by: Kuninori Morimoto --- .../audio-graph-card2-custom-sample.dtsi | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) diff --git a/sound/soc/generic/audio-graph-card2-custom-sample.dtsi b/sound/soc/generic/audio-graph-card2-custom-sample.dtsi index 736eca553d7c..fbbc203edee1 100644 --- a/sound/soc/generic/audio-graph-card2-custom-sample.dtsi +++ b/sound/soc/generic/audio-graph-card2-custom-sample.dtsi @@ -64,6 +64,26 @@ / { * cpu2 <--| | | |-> codec2 * +-+ +-+ * + * [Multi-CPU/Codec-1] + * About ch-map / ch-map-idx (*), see + * soc.h :: [dai_link->ch_maps Image sample] + * + * +-+ +-+ ch-map (*) + * cpu8 <--| |<-@--------->| |-> codec14 ch-map[0].cpu = cpu8 ch-map[0].codec = codec14 + * cpu9 <--| | | |-> codec15 ch-map[1].cpu = cpu9 ch-map[1].codec = codec15 + * +-+ | |-> codec16 ch-map[2].cpu = cpu9 ch-map[2].codec = codec16 + * +-+ + * + * [Multi-CPU/Codec-2] + * About ch-map / ch-map-idx (*), see + * soc.h :: [dai_link->ch_maps Image sample] + * + * +-+ +-+ ch-map (*) + * cpu10 <-| |<-@--------->| |-> codec17 ch-map[0].cpu = cpu10 ch-map[0].codec = codec17 + * cpu11 <-| | | |-> codec18 ch-map[1].cpu = cpu11 ch-map[1].codec = codec18 + * cpu12 <-| | +-+ ch-map[2].cpu = cpu12 ch-map[2].codec = codec18 + * +-+ + * * [DPCM] * * CPU3/CPU4 are converting rate to 44100 @@ -156,6 +176,26 @@ &sm0 */ &mcpu0 + /* + * [Multi-CPU/Codec-1]: cpu side only + * cpu8/cpu9/codec14/codec15/codec16 + * + * Because it will reach to the maximum of sound minor number, + * disable it so far. + * If you want to try it, please disable some other one instead. + */ + //&mcpu1 + + /* + * [Multi-CPU/Codec-2]: cpu side only + * cpu10/cpu11/cpu12/codec17/codec18 + * + * Because it will reach to the maximum of sound minor number, + * disable it so far. + * If you want to try it, please disable some other one instead. + */ + //&mcpu2 + /* * [DPCM]: both FE / BE * cpu3/cpu4/codec3 @@ -244,6 +284,48 @@ ports@5 { port@1 { reg = <1>; smcodec1_ep: endpoint { remote-endpoint = <&codec12_ep>; }; }; port@2 { reg = <2>; smcodec2_ep: endpoint { remote-endpoint = <&codec13_ep>; }; }; }; + + /* [Multi-CPU-1] */ + ports@6 { + reg = <6>; + #address-cells = <1>; + #size-cells = <0>; + mcpu1: port@0 { reg = <0>; mcpu10_ep: endpoint { remote-endpoint = <&mcodec10_ep>; }; }; + port@1 { reg = <1>; mcpu11_ep: endpoint { remote-endpoint = <&cpu8_ep>; }; }; + port@2 { reg = <2>; mcpu12_ep: endpoint { remote-endpoint = <&cpu9_ep>; }; }; + }; + + /* [Multi-Codec-1] */ + ports@7 { + reg = <7>; + #address-cells = <1>; + #size-cells = <0>; + port@0 { reg = <0>; mcodec10_ep: endpoint { remote-endpoint = <&mcpu10_ep>; }; }; + port@1 { reg = <1>; mcodec11_ep: endpoint { remote-endpoint = <&codec14_ep>; }; }; + port@2 { reg = <2>; mcodec12_ep: endpoint { remote-endpoint = <&codec15_ep>; }; }; + port@3 { reg = <3>; mcodec13_ep: endpoint { remote-endpoint = <&codec16_ep>; }; }; + }; + + /* [Multi-CPU-2] */ + ports@8 { + reg = <8>; + #address-cells = <1>; + #size-cells = <0>; + mcpu2: port@0 { reg = <0>; mcpu20_ep: endpoint { remote-endpoint = <&mcodec20_ep>; }; }; + port@1 { reg = <1>; mcpu21_ep: endpoint { remote-endpoint = <&cpu10_ep>; }; }; + port@2 { reg = <2>; mcpu22_ep: endpoint { remote-endpoint = <&cpu11_ep>; }; }; + port@3 { reg = <3>; mcpu23_ep: endpoint { remote-endpoint = <&cpu12_ep>; }; }; + }; + + /* [Multi-Codec-2] */ + ports@9 { + reg = <9>; + #address-cells = <1>; + #size-cells = <0>; + port@0 { reg = <0>; mcodec20_ep: endpoint { remote-endpoint = <&mcpu20_ep>; }; }; + port@1 { reg = <1>; mcodec21_ep: endpoint { remote-endpoint = <&codec17_ep>; }; }; + port@2 { reg = <2>; mcodec22_ep: endpoint { remote-endpoint = <&codec18_ep>; }; }; + }; }; dpcm { @@ -340,6 +422,15 @@ ports { /* [Semi-Multi] */ sm0: port@7 { reg = <7>; cpu7_ep: endpoint { remote-endpoint = <&smcodec0_ep>; }; }; + + /* [Multi-CPU-1] */ + port@8 { reg = <8>; cpu8_ep: endpoint { remote-endpoint = <&mcpu11_ep>; ch-map-idx = <0>; }; }; + port@9 { reg = <9>; cpu9_ep: endpoint { remote-endpoint = <&mcpu12_ep>; ch-map-idx = <1 2>; }; }; + + /* [Multi-CPU-2] */ + port@a { reg = <10>; cpu10_ep: endpoint { remote-endpoint = <&mcpu21_ep>; ch-map-idx = <0>; }; }; + port@b { reg = <11>; cpu11_ep: endpoint { remote-endpoint = <&mcpu22_ep>; ch-map-idx = <1>; }; }; + port@c { reg = <12>; cpu12_ep: endpoint { remote-endpoint = <&mcpu23_ep>; ch-map-idx = <2>; }; }; }; }; @@ -398,6 +489,14 @@ port@3 { port@c { reg = <12>; codec12_ep: endpoint { remote-endpoint = <&smcodec1_ep>; }; }; port@d { reg = <13>; codec13_ep: endpoint { remote-endpoint = <&smcodec2_ep>; }; }; + /* [Multi-Codec-1] */ + port@e { reg = <14>; codec14_ep: endpoint { remote-endpoint = <&mcodec11_ep>; ch-map-idx = <0>;}; }; + port@f { reg = <15>; codec15_ep: endpoint { remote-endpoint = <&mcodec12_ep>; ch-map-idx = <1>;}; }; + port@10 { reg = <16>; codec16_ep: endpoint { remote-endpoint = <&mcodec13_ep>; ch-map-idx = <2>;}; }; + + /* [Multi-Codec-2] */ + port@11 { reg = <17>; codec17_ep: endpoint { remote-endpoint = <&mcodec21_ep>; ch-map-idx = <0>; }; }; + port@12 { reg = <18>; codec18_ep: endpoint { remote-endpoint = <&mcodec22_ep>; ch-map-idx = <1 2>;}; }; }; }; }; From patchwork Mon Oct 23 05:36:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13432406 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 D1FD6C001E0 for ; Mon, 23 Oct 2023 05:51:38 +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 67593A4E; Mon, 23 Oct 2023 07:50:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 67593A4E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1698040296; bh=34W381tl5n12LABW0FON5NKEFA3uYFbUG0h1WyzYmjE=; h=From:Subject:To:Cc:In-Reply-To:References:Date:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=EWzsHobrwPLgmRdZXdnjPk0EvxtndW/VgSJT88UuJLv+uScqmm36Pad1oSraR7pVE hY2mb1SlZwM016HILSWeEHVcVGsRovsL6+aKMX6iL7SCI97BEabstlpIQsyHFG6rZR rvxCAOWl5sXkDQxkLtccZBhvJx7opdBRGOABtQm0= Received: by alsa1.perex.cz (Postfix, from userid 50401) id E5134F8057A; Mon, 23 Oct 2023 07:49:58 +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 85532F80578; Mon, 23 Oct 2023 07:49:58 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 18131F8032D; Mon, 23 Oct 2023 07:42:11 +0200 (CEST) Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on20700.outbound.protection.outlook.com [IPv6:2a01:111:f403:2019::700]) (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 876FBF80536 for ; Mon, 23 Oct 2023 07:36:12 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 876FBF80536 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=NLsUzjP7 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cb2luZm5HEKydVCAVnw4YJmgn2xGsqmQvLGRUJ/2P/ujRlmyxKPzxqE6WamSz/ZBHdvofTQ/Lso1luUtg0hVsaNHMUavByyraQb24XZbL+9yyuS93FMYUR/fQTysKeMuDyzELOiVN6OEAwSHZqyUWzyIj52dCRm/Pex1MGOYiX7cxu0YSCVCoU1lcqOm1UAohI+cDlPSgMu6LymIr1iRSGFdjCjJhL//dg8zLP8zXZszMkeyAkbPgRKYHdg9ldIRzbZ8urt2UiCjdovMX+/S8V8vNZ6JshgMOX6JKKKr3CmDkvYMWXmKhmyBG1DAQ+mYa04gA8meMTcp/l78g4W9mg== 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=7HkjvLzCY4gqiQ2ULQ4uyZBhbxamAK86Y0cFHe1aKZ8=; b=OeREfVHQwuURo+fdupgoKQKjW6eS8A94QAMt38qnl0RKR7eH1ahTeSoeJCQJ2aFAop/lXgNAAnMAlLOqf/R+svxotn9bfSdCTtnUh81PN88ib/+xLWrsfr2eYCsHlJMSqsm5dNXi7x1V85655D7ioDNYBDbv9TSTp2fYs/CGyqKnEGhTB5bDYPDg4pRwoLiJGDs4E0Dk9Oy64z4VbT8GauRJcAafOwA8fE7zEBPthj7MKGOwkbSNmXxPzPar5/tX0RqZGQBjLh+OKBGFwIXnXbdjpTumPYqFurA3uIKatcvMKa7Kdx6oCtGp/O12w6DT4n6RueVvGN7nSQAfOUguMw== 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=7HkjvLzCY4gqiQ2ULQ4uyZBhbxamAK86Y0cFHe1aKZ8=; b=NLsUzjP7zubLwtD7HxcZ7+SJnBs+/xjItutYmjLq3HN7O+r5E2GS8Fc3+fHm407GEqBz6ZiE2W/89BkfhpGggfte/NkTtaYdOIQrIqn8Kaf26Yu95ZKOdEDNHm2AMePdnKQ4GHQhsytFlJYVJI+ej/YpBgH2H1zanLKMPQq9qyI= 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 OS3PR01MB8242.jpnprd01.prod.outlook.com (2603:1096:604:174::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.24; Mon, 23 Oct 2023 05:36:09 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::be8:b648:c989:8e7f]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::be8:b648:c989:8e7f%4]) with mapi id 15.20.6907.032; Mon, 23 Oct 2023 05:36:09 +0000 Message-ID: <87wmvdkiif.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v5 5/5] dt-bindings: audio-graph-port: add ch-map-idx property User-Agent: Wanderlust/2.15.9 Emacs/27.1 Mule/6.0 To: Pierre-Louis Bossart , Mark Brown , Bard Liao , bard.liao@intel.com, Conor Dooley , Krzysztof Kozlowski , Rob Herring , Jerome Brunet Cc: alsa-devel@alsa-project.org, devicetree@vger.kernel.org In-Reply-To: <874jihlx44.wl-kuninori.morimoto.gx@renesas.com> References: <874jihlx44.wl-kuninori.morimoto.gx@renesas.com> Date: Mon, 23 Oct 2023 05:36:09 +0000 X-ClientProxiedBy: TYAPR01CA0026.jpnprd01.prod.outlook.com (2603:1096:404:28::14) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PR01MB8426:EE_|OS3PR01MB8242:EE_ X-MS-Office365-Filtering-Correlation-Id: 0fd0cdfe-a982-4611-0de8-08dbd389f5e6 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 0eDJP/ETAS3sBxSHmHtAD8XPvYEVn6BlLC/5LsOBqU+DtCqTGQ7LXQb63EKzITsZ7bUwM4gpo3VDZI2BmckC85yht107mN5HdtYMjesl/KnukzyCLqpn8Xba7esLLKgyXwBLF4UwBuQ9rWUsEHnSv1mBMzE29T+buA+9F5O3JftGqnIsLGTU19+Tn9Ga5wuvPdwSLkcoVetnv9ea6gd/JxRA/clQGO96HygcA/6tzQXOksWreQCCZfPY4TJz0MV6ukU6LFX5CHwzJTUHWsq5YFjtP8w8HFNwVYfvTuqvzb+/E0sQcyMsN1nOtYTzApMsYtkDvrIJWKJTu3QyB8qtoohE1O9AOd08VTGo298yo2Y4WpLp+xYBA92GI80AWf1slGBhvzzb/MQP2DxGGsFdSYc9UY2sGVtGm2vMidr92ak8V6gShBU1BLhJ91vrToSIVSD8mDXK77TIU3B3aXpxDepYHp+NlVTCJE1B3DVZsRfQeptsmHQGDtDy4lSWIb9UKD20AA3z7YMNGqiGw1xN1lidgKv1g/RMYcycUZ16LXsY1Tnneh+AQF81lFFFjPskaGjSf8E62BNdziIcAI7Mr/g9JrL34HQdf/0FG/puRysRu8jNySArSOm1ITwUK5b6b2mriS+UwhqzNnL8b93I/w== 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:(13230031)(136003)(366004)(396003)(346002)(39860400002)(376002)(230922051799003)(186009)(451199024)(64100799003)(1800799009)(38350700005)(36756003)(38100700002)(66476007)(66946007)(66556008)(2013699003)(110136005)(6512007)(86362001)(2616005)(26005)(52116002)(83380400001)(6506007)(2906002)(6486002)(7416002)(316002)(478600001)(8676002)(41300700001)(8936002)(4326008)(5660300002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: 8Ii20NwlTDLVw/HEimMVWil85gKyMjOwTvqjfSQrqLdBbc0dti+LHlmESkyQO2XCAzqy9ShzIVQZbVBpSl6gZAq6B97V7YTtIKyIpBoZUZGDZzvKyUyKqeCKVjuKvNQVGZ8QchokVJw6HFuUK37xmzT1CDsul38pMKBa5NIE0vwyMTaCUmvMFz6xS5I/O4KJxckRELPrn2pnc3AiRYl2S82hYas/R3buY8msyCmdpiQPaTK4fL+Y3yITrLlk03ADH2SemkomgqJHVFY3883LMIJ7I5IrAPK+84i7q5W+XH7Qc9P+wh1yyMGvG8e5BJ1tF6TLGNLol6zENI6vSHXSa8WP15bzQiNILJpNV3abujva1/XL/DSi/DIuYlNPI0L40sej71whqsIu60Wum3ejBBIJC286HjiVWK0w4d6nZu2OjoTosO8CT9GWoV/j7yyGuCTWQWrYSx6SKc5UzLBUU6EPeuyCf9b0REasI0IyDAnMNAbkCmnlI2eOuFELg0S40de0TisM9mDS9CXsjkBzQRdMqnPWhnOyEsmQxcoBpTHoqjxiIqibUCqeRUfNHvEoZUqh8u80ogiQNDimUsLf85e025dzVif8dA+sntnYOd9t45PmaWfUc5izYQSA0NnIiFZY+stR7OBLg/nwaBz/Wf7/0xgHEw6jZAynAMMak5J3RiJ4uT8rJs+lyc5qEzm30FzbTD0jB6vtCY9a+GJF2LLSFGNpyGFBANlYjIiIJXJ4ImEzU4YCWcYbSuN6hFUtkVMPo8F1TNqzEJ4V0Aol0cg2DQFjCYiTt2B93j1dmD+ViMN1apzIuH7rMgYGhMnaNH/gxAETQNG/pSwBGmL9813/8DZooIIb46ebGZoyV4x0g90Ud5YGPAKPha2uQWcLbVePCRmd/3PvU3w40a4eXmkdLo4sEwQOedVPdWhuAv8XJuYE0IzJxWzgh5UC/ekmHwGCxxQu9sU2kOoaF0VcVOAyr56WZlydV8JqKc4RPLZsugM9a/NA6zObEPbxI29j8O6+MiTnV91abUBv/zx2vd5LzumJM7dY+LAUmVk4iDU4uR9VwlH4HyMmfjhL3g/Iq6fGrMPs+eINj3ByW0bcirjX2WcX+3XmqIL99COgYnzZqSd5L3WjwH4wvjysactygLb4Hz4DKttNGs4nwF5JteJmYsuwWH979nUZqFuFnEemVn0OWZ40RkK2FbegJgbd+vQYVpvpFf97z85q053FA1W4QbB4w00ANd+23kkxHroVhaFAeWNomi4ak/8oCZFUQljT0LdhcNiOh2YCFQb1HUUFb7b4M2VC+9CajwB8AtsKtKvtqsuCFMucQcWJOFCzSV8qTKHh4VGiLNDOGh/fiVo3bJLfL5yGlxu4Aus3/kSU0QVv9hf1UnDkiOPGCPqadS7MYr3zjI0+XJYBiIT5/+QfOkHmDD4shIrz8++elimysIkpb/nPZnue62oU/64lHs6mG9a6Oat14z5RaBSiuaGrx+wGwUHh7orvhjvHPW0jSjpxo/d0k6OoE4OUAPQX607YeCPaHz/lxbWzkQpC/8rgxlPTVKIkgxk+Sd+GfEXbd+iynENh6/rHdpX7ofVVAp/ZZTlJfnrzL1yEySQ0h0ScDVvnvTP6wWOGm4T2uEo= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0fd0cdfe-a982-4611-0de8-08dbd389f5e6 X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Oct 2023 05:36:09.3601 (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: q9cTpNSmK3/qp0IO9R77M98cjH9b5v8kQqUd1GoCyRTh6SdrGS6T4YmgpmJjM1eMFV7CoUqbXCvdGxn+Ip86WndQ5tuN41juAIywM5UImNPqIbbEbsG5ZUDfu/gYWpEw X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB8242 Message-ID-Hash: KCIFSR4B36GWEE3GTKWBIZ5AZQPWRBSJ X-Message-ID-Hash: KCIFSR4B36GWEE3GTKWBIZ5AZQPWRBSJ 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: This patch adds ch-maps property to enable handling CPU:Codec = N:M connection. Signed-off-by: Kuninori Morimoto --- .../devicetree/bindings/sound/audio-graph-port.yaml | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml index 60b5e3fd1115..47f04cdd6670 100644 --- a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml +++ b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml @@ -19,7 +19,12 @@ definitions: properties: mclk-fs: $ref: simple-card.yaml#/definitions/mclk-fs - + ch-map-idx: + description: It indicates index of ch_maps array for CPU / Codec if number of + CPU(N) / Codec(M) DAIs were not same in one dai-link. ch-map-idx is not needed if the + numbers were 1:M or N:1 or N=M. see soc.h::[dai_link->ch_maps Image sample] and + ${LINUX}/sound/soc/generic/audio-graph-card2-custom-sample.dtsi. It is good sample. + $ref: /schemas/types.yaml#/definitions/uint32-array endpoint-base: allOf: - $ref: /schemas/graph.yaml#/$defs/endpoint-base