From patchwork Sun Nov 26 23:19:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13468964 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 CE6EBC4167B for ; Sun, 26 Nov 2023 23:19:56 +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 B4233828; Mon, 27 Nov 2023 00:19:44 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B4233828 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1701040794; bh=0caVp/le8xOjFzqALvsnnUHcTEf7JntOe2d9ASKjKhw=; 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=ft/ygKmtV7wDWhdO29Ha2T0vnUS9SOvCB1fhro4AxLH7eq6X4rtblRFsLxGMjqTuy /ABySii+g3gJhZfqeOXuQWG7kzcMpG/rf4hnvTde3LZHowtJHfMYz2GZNBpOYOzldI DLqYVDZswAnm6Phmr92YAZPFquGjK46R8EpiG2U8= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 35A35F805CB; Mon, 27 Nov 2023 00:19:28 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id E20D2F805CB; Mon, 27 Nov 2023 00:19:27 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8A19FF8055A; Mon, 27 Nov 2023 00:19:22 +0100 (CET) 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 55044F805AE for ; Mon, 27 Nov 2023 00:19:12 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 55044F805AE 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=N4nDNBje ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=I7fYay3TBqdwt2oPWhByeG6S4UvBALrBf/L6EIT9DkT2ZzO6HxqKsnvaaEuSe9sXG7foJqkOdSpW7BeghdmGqPI5+kisIqzznsZDiKbH3iBpssM0s9AxcglByXKvX3pf1psxeWL1s0WX8kmkqb2lrhQMCFI+c+KHRzKQE4/FUwWoKLqauV5JLrRZYwQzoXcM7FSWE8uMyk/u2cap7fs+vgtLqK5gDc6BCKgLAJHtjVzc87v0hSAgo2h5E0W2WLupq6Xc63Atvm+3Dvj0OJlVtsGb3Y1w4SVB5KCtWDUpauO+qj0OR/xHCB2lWp6R/S7ANNcawIpSMvPHkBo22T0Pow== 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=9mzn6aEEqfjRey7eAmQFxfH0YJvdMXpBFkFgceCG4ZM=; b=Jp/mCBMPj6mu0LLoBtLOA73kowcpAwgawbtVwWhVUS19dqrCaGJct/yOFTFrmOEzx0ktmK/AY94XXUwRkTsv0UOEFKN3IxnjTIqoPsBOyrf9DMCECIZPyBvYa2SDZgpsyv4sVwv8o2ESH6lMVMnrUoRpv6sJKqa1zyBBs9UCBRlzXlUfyZBfyMj8y8oIgGiYinDa0tQkJW+IzueABLtCJsGzFXpC00Tz0mV8PIORyVQTJ0J2qFABeCQFKPfQb1S4ZA0lBzBlmxj4Nc0sGLA+FLUNa2qOpm/VXNwGKbT5suMEVlcW4FqmgWayKEHsUm04/6f373ox5pQGSoAqUmwZFA== 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=9mzn6aEEqfjRey7eAmQFxfH0YJvdMXpBFkFgceCG4ZM=; b=N4nDNBjetYdvKjRRwyEQr1OS2x8uRklEAe2xi54XIABlf27RQ+G8yfWqjDFKA+W2F4qDLrMNDnx+J5Wwr/gpJi5uYbBHzwi/CYe3L1xzefnVnVjMvSh/cc+sHRand6ewDwhH3W14UBzhL1euJDZPrX7nBpWx3QqQZixTqWQm0+g= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by OSRPR01MB11697.jpnprd01.prod.outlook.com (2603:1096:604:230::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.27; Sun, 26 Nov 2023 23:19:05 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::16b3:a84d:faa6:4846]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::16b3:a84d:faa6:4846%6]) with mapi id 15.20.7025.022; Sun, 26 Nov 2023 23:19:05 +0000 Message-ID: <87sf4sw1av.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v7 resend 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: <87ttp8w1bk.wl-kuninori.morimoto.gx@renesas.com> References: <87ttp8w1bk.wl-kuninori.morimoto.gx@renesas.com> Date: Sun, 26 Nov 2023 23:19:05 +0000 X-ClientProxiedBy: TYCPR01CA0006.jpnprd01.prod.outlook.com (2603:1096:405::18) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OSRPR01MB11697:EE_ X-MS-Office365-Filtering-Correlation-Id: 2870b504-83f7-4de9-a23c-08dbeed6155f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 4KwyhlwcmGfUcwhgR9wQiKyRBl2dRSYwyLJDj0JJ2kOtCUy7nZJ3ys1UsBw1KW/4qDQTIeFrq250AMcsW6Dt5KiosZddNgQ8k2kRoRWjPesOYDr+hIs0lBf+zCVjW7B58d03LFhzYXkQvlHTBuDjwKxgEHo3xD1URDCamO+9jyZ9wm93iqyuCbxXshIlvGRb0fq/tpQhL5AVtScOsnGI+uR2nePgtMHve4zNDvp4wrY7XOdDX3DEg5ozuiMfteQLjCdui8qaA50e6y/lveFhSTBcVePqsKOjNM9H5s05lEhVVNqjujhuS5oM1gawJPl3/1w17hIfkMhaTWW6fJmDyuLKTYh8beqSPfuLC3XLwWIlfL+AiMj3+eElwebqIQ6fIruEPdPbFB29Ky6IGPGfdWXK8MB1yyHu2KttORUnQ/ayXdNDHnAyHv9kx+OSQ07VKRTj4GwI1f712kNgejEm8SZLBSJYlNUUJulN3RtKRO2az3Lx5vXoNnm3TF9E6HVqCYZYy/bVsNDeMRVHQ/Hq26ObrvgMYux28gWsgGRYsfLtaph9M/yqa5ENi3+dbkuGO6CfWNZ1KlasWzbRwQhJBRuchQt7A442xwuPJ2c/cpfy+1ZlygW7XEXZkQAfTWvg/ORrkh8NcU1E/cd199vbOy8KhUnqs3aLCoX2RHrNt9g= 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)(39860400002)(396003)(376002)(136003)(366004)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(7416002)(4326008)(2906002)(30864003)(8676002)(8936002)(41300700001)(26005)(66476007)(110136005)(316002)(66946007)(66556008)(6512007)(52116002)(5660300002)(2616005)(6506007)(83380400001)(966005)(86362001)(38100700002)(38350700005)(6486002)(478600001)(36756003)(41533002);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: yxhsnOYJ//r1pklrb1leqsV9IKc/BTx1tfASw9A6dDNgO70IiS/yqTHp/B1c5uNLzqNQQVPZdEBMKAJYuoIhwUr/pKM547Q0mr+2ovF006B0n3U9hnVlkGMsJFjRVGemlNfw8pXCdXlthBQcAwz4ib/b1kjcJM9mq2RRNzKLci26hG9vn0U/OP0NHkFj+FQg5DTuwfshUuh7UdkIEtbrpynjIfP6jVRkm9JElUhdldaMuZwjD1uGiQA2NIeKaLP1M1y2yIavdfW77EPiduputl5iARB6sVogb/KiqbxBvfG/zsBx92yKp/XeqYkvahlQyqlzG4WjqOhftJTOebZ4RFyCa5lvHl7YtjEJyqXXuG5WnkA9qU+11U7oS5YdralI3VkL1AXzTRhWigflNVPhddXQ/K2RKBwaa5BJuPvTMMhvhRXfvLrbO68wK/QGFJ7O9SCapxMpU76STJnxqJuxd/76+srCpmZf4JZyHCUEoC3misgMzRFNX1cN8vj1RjXftnrkpZHkz1YDR/D9uet8+rThyRYxx04Qcmwai0ZZyVnA3boJ9Y7PbkmtONcE1mnYi79ccSxJBzO1VksmwRYtwbxdox51Dc5zEZdurRLRPUE2dgXi+1TJhZCq3Ta1N1D8WOQD/lhF7EjPmLBaZKy0B7OeZikK7d3IGyvL7a31zSZ1NGcGdWeD1Gab6GozG49sBG0u+LWI+2y+7fmaYvfPJuFjVPiR7BN9+F6Uv5r4dLiRNRpw6x2JG4Ysu0ydf1NxmdeaG15EsImo/ssoXNOSPvAZHLMxJPbkTZGkUUlc+RTDHai8VXueRnLSlywLML9Bk+etoTYhady0J5RNTFTNTcO5YGyeiLNoNEIk2KQLY6Hnj8Zv5iWwWMlU9GTH1JXziguOnMavzixWU7WqBp4wjeoH9bBYvY5PL5krOsFzMCZqJa06+oVOSZ3X+DU8a5nAjdWEc+YG4nImHTsLhE3r/SxqIOL9LgzdWisPOmtk6ZfeuzuwNvmE6TU5wlJ48lj9zb8/4ZG1q0U0IJmj2ewe4r6mzci4TuuhrlcmV0Z1ChDeNO1cXMiGEzPlskY5EdA1aqFZbUFRZQxv4B8pQOC+hdgfmUoGFISxtvQzRvG6suLMTOzeWb7tGnJf7dsG+MfkAk5MR3OvcUOo1VNZISqIFdBQLqslzstPaVO1CC7aa8fbd59/9QDybMLCaxT0djGeRSHmoGPvr8etlseSux6+w4XH6cRaPMLgtVAX6HJHyaIXRvTIzYtcpbqY1aOW1DrDgfkGf9Z4Yalk0iMgBJ0ZIZf2t4nVZrbo9x28KrpLSzozqoltHd79omH4lqjZS0xzJlfXhxOp+v5OlmUp7Mox0JlMBEXpZ0CelD6IuS/X1vNZmX7Yz5IgM9zdseacz3xG19lu4Xj/k2pCaHxKCOACV8/hOa22rEis2jGD6EwgtdVO9ZIQXyQGso5dTqeP1raPVjWKV1DyevDaAo8veA9RpHDLzmVfX/QrpvKt2V3Tpx0xnA1r7akqJXJl4JEpMpDXc4cwE0ohBrQ2tOGOuvVk7Nn15/7RFFytZMS8s3fjPW7F4MeoqvFx43n5Vr00vw3xWvM7wq2EEwT5UFCUTJ+DnQdRyyLih/4Eibz3FoXXjS4= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2870b504-83f7-4de9-a23c-08dbeed6155f X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2023 23:19:05.3865 (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: Exbe9ZDnzA3SSbD3NXA7iSFyOpAoX8KXOKcrhlO7wZSY28DmMBnGgglYB6zjiX0JOmT0yHXi6k5rAPLnjfkYKOLmrM0Q+98wedk2LHzu5YnBfld7aFz15BvjfbBN0Ho1 X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSRPR01MB11697 Message-ID-Hash: ECZ5X3FJF27JWOJQ3R3C6W26R6NTT3TB X-Message-ID-Hash: ECZ5X3FJF27JWOJQ3R3C6W26R6NTT3TB X-MailFrom: kuninori.morimoto.gx@renesas.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 Tested-by: Jerome Brunet --- include/sound/soc.h | 56 ++++++++++++++++++- sound/soc/intel/boards/sof_sdw.c | 28 ++++------ sound/soc/soc-core.c | 95 +++++++++++++++++++++++++++++++- sound/soc/soc-dapm.c | 45 ++++----------- sound/soc/soc-pcm.c | 44 +++++---------- 5 files changed, 185 insertions(+), 83 deletions(-) diff --git a/include/sound/soc.h b/include/sound/soc.h index 7792c393e238..f3803c2dc349 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 * @@ -1163,6 +1212,7 @@ struct snd_soc_pcm_runtime { ((i) < (rtd)->dai_link->num_cpus + (rtd)->dai_link->num_codecs) && \ ((dai) = (rtd)->dais[i]); \ (i)++) +#define for_each_rtd_ch_maps(rtd, i, ch_maps) for_each_link_ch_maps(rtd->dai_link, i, ch_maps) void snd_soc_close_delayed_work(struct snd_soc_pcm_runtime *rtd); diff --git a/sound/soc/intel/boards/sof_sdw.c b/sound/soc/intel/boards/sof_sdw.c index 3312ad8a563b..2faf7372bad0 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 b2bd45e87bc3..4ca3319a8e19 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -1015,6 +1015,94 @@ 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; + + /* + * 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: + 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 +1209,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 3844f777c87b..3d72084b6a34 100644 --- a/sound/soc/soc-dapm.c +++ b/sound/soc/soc-dapm.c @@ -4438,11 +4438,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. @@ -4450,39 +4453,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_rtd_ch_maps(rtd, i, ch_maps) { + cpu_dai = snd_soc_rtd_to_cpu(rtd, ch_maps->cpu); + codec_dai = snd_soc_rtd_to_codec(rtd, ch_maps->codec); - 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 323e4d7b6adf..c20573aeb756 100644 --- a/sound/soc/soc-pcm.c +++ b/sound/soc/soc-pcm.c @@ -1050,6 +1050,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; @@ -1063,22 +1064,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_rtd_ch_maps(rtd, 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; @@ -2826,35 +2825,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_rtd_ch_maps(rtd, i, ch_maps) { + cpu_dai = snd_soc_rtd_to_cpu(rtd, ch_maps->cpu); + codec_dai = snd_soc_rtd_to_codec(rtd, ch_maps->codec); if (snd_soc_dai_stream_valid(codec_dai, SNDRV_PCM_STREAM_PLAYBACK) && snd_soc_dai_stream_valid(cpu_dai, cpu_playback)) From patchwork Sun Nov 26 23:19:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13468965 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 8D017C4167B for ; Sun, 26 Nov 2023 23:20:18 +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 A8B1A847; Mon, 27 Nov 2023 00:20:06 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz A8B1A847 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1701040816; bh=B9INzx5SQ3rvMn71z3vavdFEIIXCiCe063g3y2yX9eQ=; 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=N5oG/T6iqTL6RzCBexQ1PN08cliAOfsfQBaBZgZASuD2hre/ezUVUbLKp3Kvmx/HX KKmzTRAunKTxiKtBWqkhw83Sr8vkFF3HCUa60e+dnIvjdK0EhGeAGS9rBhNy9u5IYO 3xi5l2Rc5qe0NVZzu386KRoT79wkwVFcWiT19LUk= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 60406F805DF; Mon, 27 Nov 2023 00:19:31 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id DA507F805ED; Mon, 27 Nov 2023 00:19:30 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id CEC6BF802BE; Mon, 27 Nov 2023 00:19:24 +0100 (CET) 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 320FBF805AD for ; Mon, 27 Nov 2023 00:19:14 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 320FBF805AD 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=HCVUoHpZ ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=iyJarqE4/ZH6BhrC4aXHNGB2ROp8CYVkZEiiQhFT7TP3fZH3J3jmCd4SUgJWZxgh8J+7iXljB76R0pQA2uuVAR2Lh8RlzDInDC6M4q8RbQN9ybo+5JW5A3BDOqnvhV/1w+wltXRRzcPcBeDUJGdP1N/YPe902GlScXLkGVlM/NyYgh3NiwFo3RN76cOIpDOlEi6ezWYlezaJ++nFYE/gnRlXrUEeUzAxzXsoTAQGx2/zS+Ex8FTcpm1pSAgLgi6Q+sRNIEhMu4ilYe/Kv8FTSP2W+n2UwPBWv7zwBHzN8pjLa4KOGzAAxTNe/gU9q0ojC6745hPINrdsNUoMnzSZpg== 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=6lgI+NnMtUgwd80kqYyvT4xzHLP/hbXj+sVpR7rVGo4=; b=oBq9xO/bbc8rTT2byaWQerLSYi2lKOgywc5Kw+waIGDFWfaX9y08wNFSd7iT+wlu3YBHqukKSuNozLn2X3LkAupw5rJi2fxmi0c2dn3iLW/YsD0KT8/coX2C8Ohd8ZkffZXASsOGZn/FUkN3MuT7JOwWZcV9OtuaQPg8Ca3VfNFay6RUDwNi0mWBZUbXwry+jsBxCRy6hkbrnTYQJDszkqyWZnCgNsYx9caDI6AJY5aF6NZxE8zGO3xo2549un1G4ZxWli5TD29vcU2iAz2l0O4Hrm7giwj9T50KPnpgeb+JJ0/AiXQN1uW4wtCK4jwwAvly4Cd0WMHuMgL7ETKi2g== 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=6lgI+NnMtUgwd80kqYyvT4xzHLP/hbXj+sVpR7rVGo4=; b=HCVUoHpZJuqWgt7AuQ8TNuAkIb+RwNNz9V4g/PjHe+2+erNqvUnLfDSjNMZ48ZlLXB/wjRIccRgpOS6cePlB+TdoA3NbOMpGA0dMkH5y9n+bVd60msr0Ko96RQn3lDsqCv9NdZ/wpYNRdcjQi/JRWejSiqTh3i9LSFFDsgUDgbI= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by OSRPR01MB11697.jpnprd01.prod.outlook.com (2603:1096:604:230::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.27; Sun, 26 Nov 2023 23:19:10 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::16b3:a84d:faa6:4846]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::16b3:a84d:faa6:4846%6]) with mapi id 15.20.7025.022; Sun, 26 Nov 2023 23:19:10 +0000 Message-ID: <87r0kcw1ap.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v7 resend 2/5] ASoC: audio-graph-card2: use better image for Multi connection 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: <87ttp8w1bk.wl-kuninori.morimoto.gx@renesas.com> References: <87ttp8w1bk.wl-kuninori.morimoto.gx@renesas.com> Date: Sun, 26 Nov 2023 23:19:10 +0000 X-ClientProxiedBy: TYCPR01CA0202.jpnprd01.prod.outlook.com (2603:1096:405:7a::15) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OSRPR01MB11697:EE_ X-MS-Office365-Filtering-Correlation-Id: 75a5e342-7e0c-426c-1c18-08dbeed61870 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: r1xEdpbOukkEwpy3fwDbxVaoVl5bb05DODia28EGrOMujzMEaS3eMaRD4XKPp+jNMg1hyxMJVup2FDDXBjHP7o2BBjVrFvcodArrZ9sluhgWiSZflDrwNfPGA0vWMS2i+UqsdV0E28RC7cDvZNDuL4v0zLqF5AbB4vGhHGDclkeFcHBsJfZ50w64iT2P2GhXtKAsgAvyUdx+4E5lxmPrvTXnFTdZym0IuPMpdzGJbJlwO4DbLFgyZIxoLY5l0fMo11ut4Nzu1a9oyRVUeeuOqoHG+IeQ6TbTmYR2czX2Jsvnc0mc55bkvdP2ndXnfmuH9eGtUWaU1eatJu8fxg7MARn2ERy4wVVLf6Lj5IPwSzZqJXSTHYsYFDfthhEGAm0IAkX1qTcjDpE+iyg/EY+1UX4GfnAvK7pN8+hRYIAjc2zhrKT4Md0bbNMASGwsTktSLZlklxTt88VZyyWE27qYJ1fabXSpW2M2AA4r2nyH48N3kQKdEIt1fhWKFAgzKTKYqK82kYXXBrWkM4Ia0n9aEP3+Gt5rWaGagI6Xe8Vs7ngRJGnk0TAUNiHdMJ1OirmmZzjnJSuSOzf5yI3s0HY7jWtisisMCvpmH3gfhluMRO7wmTIBHR1v9wOC9Edl59M3uptYSHkCgQM0xEUv5FpDPA== 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)(39860400002)(396003)(376002)(136003)(366004)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(7416002)(4326008)(2906002)(8676002)(8936002)(41300700001)(26005)(66476007)(110136005)(316002)(66946007)(66556008)(6512007)(52116002)(5660300002)(2616005)(6506007)(83380400001)(86362001)(38100700002)(38350700005)(6486002)(478600001)(36756003)(2013699003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UFQVertSQZG3X+7mYJUZYBHa36Aus1IEF3qdZiT1jOlyquGNbm8WeX2eDMB92pYap1TigPswuqucm4SYFUk9mlGmAFfkFGEZUozzYmjXvARV/pcz2Tzz4t4gz+4EOndnlwIrFI6uJYSCS/NGg6182txYuKibSMjVvu+TWsoc0EYD7V2qbi5STRTVQ3cvDC+DscLNhtBI6UuaxChT2H6H0NYDsHrO8RCsiVG2EhR71jnY+4JxCt/hlDe47I8xxY/238qtkcLQ2cVpmCA4N53X4Ama7fCN2tOjHu6CEoq0WadWsgs7dGq+KQ35MsggHGXfrIpfplL+rjZfyAopSfqJ2jFOtS7YK5axPNcDSm5gmdyKqXRMzKiH3KXIyJECNd8JRgD63/Jk3FIjoTfki0HquCsQ2mEzWtnlqT87KLX2i3NVTUSG9oU0t7eR2vUQH7YT652rercH5j2xcoPTyqvP5ZSjj5VbAVZ9P4+88s2Ymj9zLvPJA/h47JSoKF1OXjwlVtvVaDcdmcOIwTYnGLJYCm/cDWvcGJ4Q7BJxJVAtbbouVNE+kiBAH6Y4Umj1Ktopz+zKYFBCtd9tXnehasJXXJ1TQ7t0iZ26kg+SKXeCYAvC30oYJKVsY+x99BBC7GDoGMZnG0c29eAgatul4FxTtHxsUFy5XECMqEUgjM6TPkxDbqZjFNyVtvlZceFW7wNrSr6dxZrzHvZOybmMvGAB5GeIjMdN5HIrmMwr8tbLirb86WQHMynJ3W5sUDY6QL+RJUDsl5OJIrasj561SuUrT/lyeeXzkblScBKBjR70e0PA/phe8Z+7f7tS4LgjOULDelLB007bsuW36SNUO5IJ1T+nVUxepXyMeE8umNPQMwFxuYi4supiSXsKnBDOdS9Fl1DD1nII3t5s9MkM4htPzZoR0TUFqjZWhvHpbsygBvFgwUctYzkv2T3NAWbjhLGUPn8QSl5BAxRrDka6PlCIFgWzTltNaesI7OI4VSUjUlQBM6lkCIMu5pXnE5BvUzrd99heLG9RgetSID89vzEVSnEQ4xWLGaNwtY32eZpOCTtDFNTQavBxxtnLJWL8tywZ0CO+KWso9sxlBvEJoNgEn6tgzim77jgwWoBRfNhdeQpzCKh6nT89pRS5N4HHuxB/lU1f7Z6TS52E6rYni/hBlQuZz/qXRFNAvwU/C2YRyiy7Ooj4efA4jq6ckhFGrgQUnnO29R+IUjRXJchubMCDMYcp4zOGBxC6FRJL00W2/PHLcUoWSigqjOj/JE0DucONg1bdXkfLfdWZGZ+QV6Hupbh4V8WXWgSWu62aBEZ4/Zqx5rNuSyZMNhOx1PIvruf2qBMNd7pKtVuflyV0j9k3jpNJxk9u4miaxPOkpa9ZnbD3JOA4ecltkpe4QL2uPO4Wvx8oeq1whLqaBoN/11D3yLvGyF4pRee4y4QYquPWO22MEloL5WCfodmm4WsSeyf8k3yAzw4Zcva7AnXO5EL00qOR5PA6Mbt/x5qbYIfcZWBx1+8bTU/UQ4cC/XMlUFPzHpxnL5oNsyIVSSgHQKm3BpTJCTcZGDsy1Jh0krrcGlFNkxVaQW9UpKexCxENS8bzU9cSVFR3q7KEiynr1YbEqYc1PMSHUihoI/AnsikJGdc= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 75a5e342-7e0c-426c-1c18-08dbeed61870 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2023 23:19:10.5308 (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: jcCYH09ofJyN1Bl4X4R6SMvdORtLkbu7NwXoDoXzhz0rqkKLm5MA+Vogorf20I6S3yvp+CQLNTb/gnVYATMuQUT2FnY/m38adtfFXSl4nqJOeJUJQgU1aH9qrH9n4KBP X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSRPR01MB11697 Message-ID-Hash: 46FCNBCY3FYP4PJKUWD4GM2GRKF56IO4 X-Message-ID-Hash: 46FCNBCY3FYP4PJKUWD4GM2GRKF56IO4 X-MailFrom: kuninori.morimoto.gx@renesas.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 1st port on Multi ports is for paired CPU/Codec, and the 2nd or later port are for Multi Elements. This patch indicates its image to easy to understand. Signed-off-by: Kuninori Morimoto --- sound/soc/generic/audio-graph-card2.c | 52 +++++++++++++-------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index 7146611df730..c564f630abf6 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -83,32 +83,32 @@ Multi-CPU/Codec ************************************ -It has connection part (= X) and list part (= y). -links indicates connection part of CPU side (= A). +It has link connection part (= X,x) and list part (= A,B,a,b). +"links" is connection part of CPU side (= @). - +-+ (A) +-+ - CPU1 --(y) | | <-(X)--(X)-> | | (y)-- Codec1 - CPU2 --(y) | | | | (y)-- Codec2 - +-+ +-+ + +----+ +---+ + CPU1 --|A X| <-@----> |x a|-- Codec1 + CPU2 --|B | | b|-- Codec2 + +----+ +---+ - sound { - compatible = "audio-graph-card2"; + sound { + compatible = "audio-graph-card2"; -(A) links = <&mcpu>; +(@) links = <&mcpu>; - multi { - ports@0 { -(X) (A) mcpu: port@0 { mcpu0_ep: endpoint { remote-endpoint = <&mcodec0_ep>; }; }; -(y) port@1 { mcpu1_ep: endpoint { remote-endpoint = <&cpu1_ep>; }; }; -(y) port@2 { mcpu2_ep: endpoint { remote-endpoint = <&cpu2_ep>; }; }; - }; - ports@1 { -(X) port@0 { mcodec0_ep: endpoint { remote-endpoint = <&mcpu0_ep>; }; }; -(y) port@1 { mcodec1_ep: endpoint { remote-endpoint = <&codec1_ep>; }; }; -(y) port@2 { mcodec2_ep: endpoint { remote-endpoint = <&codec2_ep>; }; }; - }; + multi { + ports@0 { +(@) mcpu: port@0 { mcpu0_ep: endpoint { remote-endpoint = <&mcodec0_ep>; }; }; // (X) to pair + port@1 { mcpu1_ep: endpoint { remote-endpoint = <&cpu1_ep>; }; }; // (A) Multi Element + port@2 { mcpu2_ep: endpoint { remote-endpoint = <&cpu2_ep>; }; }; // (B) Multi Element + }; + ports@1 { + port@0 { mcodec0_ep: endpoint { remote-endpoint = <&mcpu0_ep>; }; }; // (x) to pair + port@1 { mcodec1_ep: endpoint { remote-endpoint = <&codec1_ep>; }; }; // (a) Multi Element + port@2 { mcodec2_ep: endpoint { remote-endpoint = <&codec2_ep>; }; }; // (b) Multi Element }; }; + }; CPU { ports { @@ -328,9 +328,9 @@ static struct device_node *graph_get_next_multi_ep(struct device_node **port) /* * multi { * ports { - * => lnk: port@0 { ... }; - * port@1 { ep { ... = rep0 } }; - * port@2 { ep { ... = rep1 } }; + * => lnk: port@0 { ... }; // to pair + * port@1 { ep { ... = rep0 } }; // Multi Element + * port@2 { ep { ... = rep1 } }; // Multi Element * ... * }; * }; @@ -920,9 +920,9 @@ static int graph_counter(struct device_node *lnk) * * multi { * ports { - * => lnk: port@0 { ... }; - * port@1 { ... }; - * port@2 { ... }; + * => lnk: port@0 { ... }; // to pair + * port@1 { ... }; // Multi Element + * port@2 { ... }; // Multi Element * ... * }; * }; From patchwork Sun Nov 26 23:19:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13468966 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 A2033C4167B for ; Sun, 26 Nov 2023 23:20:39 +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 BFCF4DF3; Mon, 27 Nov 2023 00:20:27 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz BFCF4DF3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1701040837; bh=qXMk6wPl5s0oYGEv1K3A3lhfKxHGEfcxCoK8YaF1hY0=; 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=TemyGeiOgxKYh+5NXlHNZ+BCt9cOYD2Hw7cRdXsg1p+bO/TrkO8EvEyJM9O9TSTIH YeCrSjM2oT79nlZFfhaJy/ENHUEcdcEvFdm09a9DOrsCydZ/JQEELB5bO0qy28tl5l VgOzaYF2DbFwIVWoJqiw1AGHSRNkbybSGWvqZ81A= Received: by alsa1.perex.cz (Postfix, from userid 50401) id A1EA8F80614; Mon, 27 Nov 2023 00:19:37 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id A0942F801D5; Mon, 27 Nov 2023 00:19:36 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id B40D3F805F0; Mon, 27 Nov 2023 00:19:31 +0100 (CET) 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 EC9C3F8016E for ; Mon, 27 Nov 2023 00:19:23 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz EC9C3F8016E 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=iKvvKVG/ ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jULpaWMc5jWbgEw6/teEbczKIraiPKlE/7J/VUSsxLo141Gpzym1r5pcsZPk/6RzosHy2Y6VMc22B9TVqTav/WByM2rAZ8w9E/DKtf6GkaBM3WbilkERJHoqpYaFf93uPh0zKrnGcqb69bZymT2hcdi451QkpeuxMO5fcgdvGSggIVsEDV/Qd69AsH/sobAd1mNWAt0EZkkJn6GG+X5xcwy1TykYz9FIPhJBMQdO+v8AHBILJQRvVheuG9CoBrAHPJgyGg9RErHUPw1bp9oFbkliYV20zuSKU37wTcDkZ+ENsqmzk4CPDbU4G6UvtJJtjibz7Qg2QlNJepuv3Dhyrg== 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=rh+zD44dFT2EJaVtm9IsUpVq9y8f8ECkxLzw1/NSXoU=; b=inGtxFS+vKNskYetqvOfp9a2157uBRiFz9sBi9uN+RJaO1Jle0pGHB1j1XUDVM31NIHA5YuTAL2beIzetv+gBPFqCGjOD0+OOGr+Ywb1TQKOEEDTxzM0rxD0QTWMYk9zYqhcXJMpp7KElbcG+amhOrtHg/wvKKb6tLaMifkN5O40G6B8Z/6ESGGOSHkOS0D7/wejXlVeVz8ZIJEfz833f78vsdK9cZvBFF4sqvFAx6bTHDoAUdbZRQM4rJgmqCDa5viY+NIldEDp23qCIcDLp8Ka93VF77F7bGfcuVGsgkfXMcAXceEN2biC0Mn0+hHTl8jdkFlCOE9iZ5cEPMyC8Q== 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=rh+zD44dFT2EJaVtm9IsUpVq9y8f8ECkxLzw1/NSXoU=; b=iKvvKVG/Bq4SzzUdJPyXzCpAs/CcXS1c5i4i+kJATkgdXwMeJLRZD9/q6Eu5ITRLUKGfhYi0IIKaflKEZJWqRvEjXivijWZ4RgeR1IKeZVwq+cblwKwsgeWVgURgjxbTYJ+DoTtkHggVaIAzcgVUeMOQY7WaHSk6M56e8AGi8wg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by OSRPR01MB11697.jpnprd01.prod.outlook.com (2603:1096:604:230::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.27; Sun, 26 Nov 2023 23:19:17 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::16b3:a84d:faa6:4846]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::16b3:a84d:faa6:4846%6]) with mapi id 15.20.7025.022; Sun, 26 Nov 2023 23:19:15 +0000 Message-ID: <87plzww1ak.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v7 resend 3/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: <87ttp8w1bk.wl-kuninori.morimoto.gx@renesas.com> References: <87ttp8w1bk.wl-kuninori.morimoto.gx@renesas.com> Date: Sun, 26 Nov 2023 23:19:15 +0000 X-ClientProxiedBy: TYCP286CA0153.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:383::15) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OSRPR01MB11697:EE_ X-MS-Office365-Filtering-Correlation-Id: 4992634e-f001-43e3-5ad9-08dbeed61b85 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 9YSRDArtrl6s4ITYVC2AV1sUiGMSQ5E03sZeOlD9TyUv79uYkgmo7sbyjZJ1o0RezPoHayPr4ROvnJwBD2PYaeF4cmg5Oq3dljNVzOYPa8ymcQFiK8bERqCoflQLbb/b2/OtQ/hHBPPlRCol4IpM7MDzzCTOgSDWNNcAQUrmZG2IW2DldgNA6SpV1+ORmDBPxosS6Sz5kweP2acEtNorwPiwLBJ/y42hsN8Nd/yMUvpuTATv52aM58YCV+lI8Eb1AjnmOyrUr+lrHt1Ve04K78bWUDxm5JThHP+UWQp1NgJAbMJdlzfSPlvAIiFGvCqbp6QZVr2apMhmn54KtDxGeaIqaF/hDZjesTUVwZxRNDnAQt6cfOEHdIxsc9TwIxGc4ylcJc5uimg5a9L+9I7L2pS7XjP1d6PlB+Uj1FmEntHP7I1Pm0/pV3FF33K47qim5W/2CCXGi6h7vwIxm8U5mgUXOoAu30Y0tbHpS258I840+dM0EIzWWoUcqhEOn9XBXoGrjz7y5bsf2yUzD3W/3hFtwmsstUhe1VVrnj2Gol480yw1Vb0y+jVdPjo8v68O+ofup+3c+ZmZTqpWomnrd7APakospU6wTc/49bZ21hKkqSz71J5QOZBdjocW5hQpe/bAOIh0LsUR5ALaaRphOg== 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)(39860400002)(396003)(376002)(136003)(366004)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(7416002)(4326008)(2906002)(8676002)(8936002)(41300700001)(26005)(66476007)(110136005)(316002)(66946007)(66556008)(6512007)(52116002)(5660300002)(2616005)(6506007)(83380400001)(86362001)(38100700002)(38350700005)(6486002)(478600001)(36756003)(2013699003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: OwngzbvwZMalIi2XVD68SvQg59kQlwWb2jnp5StvnPfwJDiXB5fPtWBIXs4FJpkAVgzVNYyxfK+dtO2fHEMAh7fAQNGo3oBv8bPAn8nGWM2uYvclXNxXwhNA4ELzmOGpLqEW1iYh9VIyUw9gWsz1UFLNbMkiBRx/8AhXrVgw49tO/4BAnt0jGM+YFFoxq0hJuyzdVntrMUb8YV3OzRxDLODmRMkXLGXJNI9Jc+Ya4Y0ahLDkkGjN4Z/dc145/w4iGACqTzCoU1EXaHiwNT3iWZQ7a8rELOH9mJP93EsWpfpLlS4U4znwHcIKW5kjCerwbGJtPH+l+Y3f0KRwVggADkeNPfVDd0OX8O+fbc/7O3NGMa57Rt5M6/R8EU7OoO6+T4wVnPAAibmjjBCZksNNsuOSEMdNUdqMDnWwEImZ+JXyre688B81Q/jfHesuvwB2l/wk1OO7ULpiWZrAYXr0W7F/QwbLFMUm6HEyVcJoQOudC+a0KZGbx7PYU+Gt4dJITaZXJT1/w2qERgarhhfQUZTaURpgm050PhjGLfG0T83by//J3fJgNuBIb5ioADeQOrOgA2RYfS+G4zAM4xd1Y09p9PFfnQVAokCn1mKF7jtSABwgSNNxng2Dp4rUjAHW8edNF5yIBmNwUJLRQxvC9g6RPLaqwigKqCEy6J5H7E/y9oKtsta6kyJhiVBGnuiw1d8Q//Mnr53piF1TXoDKMdecV4tUWLvNv6U95LaWWEnJeGuVU8s4YAU/9d65FkonAVwaMJigfvebqoulJ1lwI7Zvg+x2ez21MS64ebeKac3TJhG3JlryB7vspzhSbiPeIUxo6VSAlVZ3YRCfEdRLiBsD6S8iys0A2YqZt5askt1c9i+PEsd46HqqxhaVCv+0V0q5Kvj4KFzIvl53sJKOc3GlJvhEANoyCVZchvYg1j6Tq8FmxDFVVu5btsgQ9WAcCbGmdU9FrdhzYdukc1sdpz4h7aNjRoU34t5RLnXPge+7x1wnER3NAI0hFuqJuZrVi/GzLc3+SUQtOMR/MNOsFEQBUlHDTwLSRCxiWKfQPD4Uc89fr2VUaApAqWLTMEoEWjMEvZxFjd/qD1U/IrW5Cmm5Hb8iV22zaHFv76Dr1X9AN3XNxfQfthL/BwtSab7Hpw+at9giAaHOeH0QBiJWggr5EXJjwruDTDz2ilh23YjWIV9jAE7RguJlTpSbwOfRX15KJh4C8Zxz+RgKh/UAglT/lWOBiIiPaDHZMXXcUzkkFajfBlTcPn4Oy34V/Kn1HoQ/Ky7HxZWsXnuWRdaQ+rb/hBydPqRXstb8tsnpDqB2VeKpS0dsABHzRoqeJASVlVdu7usIuxS5jZ0Pu4Wzt6SzxOlc5Jr3W7w0BF+swypVksNQMvUmR39XcZ0k2o452XV9SyZbCbNngy+myEFJRSnPRmUgsXDdQTGKCSHaNloRVTgcHAWk0J6pkERhOr4/GM2hX4gKzfr58FMT59GRjfo4URK+vqh/dIhsRMGpf5Tsagcrm14w6ieXxH8Nb9rxcTZDSCN9aMqIzpHDuAvzNgFgYgrLhBsgFF3504LtbIGDm8x/QWO63VJSH2tNVBj/cdVCqvuax6myJ5BB4HghyWoXtKOJp0q1pqRbMtIN0Ec= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 4992634e-f001-43e3-5ad9-08dbeed61b85 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2023 23:19:15.6457 (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: r+a+7a4lvikNSBhS3bYlUk7acGQxqpFatGXnx89JpwIXjdBAyKSL5fjN6NxAIYFrRjkiNMKobvbSCq7IEqpkPvkwKCqVkbn1myi1JbyAOe3exgstxIO4BIuyRzJi/z9c X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSRPR01MB11697 Message-ID-Hash: VA6FVAQ7WOZVMJ2BVD6YPBOZACMDPPBF X-Message-ID-Hash: VA6FVAQ7WOZVMJ2BVD6YPBOZACMDPPBF X-MailFrom: kuninori.morimoto.gx@renesas.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 | 225 +++++++++++++++++++++++--- 1 file changed, 202 insertions(+), 23 deletions(-) diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index c564f630abf6..d9e10308a508 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -504,40 +504,203 @@ static int __graph_parse_node(struct simple_util_priv *priv, return 0; } -static int graph_parse_node(struct simple_util_priv *priv, - enum graph_type gtype, - struct device_node *port, - struct link_info *li, int is_cpu) +static int graph_parse_node_multi_nm(struct snd_soc_dai_link *dai_link, + int *nm_idx, int cpu_idx, + struct device_node *mcpu_port) { - struct device_node *ep; - int ret = 0; + /* + * +---+ +---+ + * | X|<-@------->|x | + * | | | | + * cpu0 <--|A 1|<--------->|4 a|-> codec0 + * cpu1 <--|B 2|<-----+--->|5 b|-> codec1 + * cpu2 <--|C 3|<----/ +---+ + * +---+ + * + * multi { + * ports { + * port@0 { mcpu_top_ep {... = mcodec_ep; }; }; // (X) to pair + * port@1 { mcpu0_ep { ... = cpu0_ep; }; // (A) Multi Element + * mcpu0_ep_0 { ... = mcodec0_ep_0; }; }; // (1) connected Codec + * port@2 { mcpu1_ep { ... = cpu1_ep; }; // (B) Multi Element + * mcpu1_ep_0 { ... = mcodec1_ep_0; }; }; // (2) connected Codec + * port@3 { mcpu2_ep { ... = cpu2_ep; }; // (C) Multi Element + * mcpu2_ep_0 { ... = mcodec1_ep_1; }; }; // (3) connected Codec + * }; + * + * ports { + * port@0 { mcodec_top_ep {... = mcpu_ep; }; }; // (x) to pair + * port@1 { mcodec0_ep { ... = codec0_ep; }; // (a) Multi Element + * mcodec0_ep_0 { ... = mcpu0_ep_0; }; }; // (4) connected CPU + * port@2 { mcodec1_ep { ... = codec1_ep; }; // (b) Multi Element + * mcodec1_ep_0 { ... = mcpu1_ep_0; }; // (5) connected CPU + * mcodec1_ep_1 { ... = mcpu2_ep_0; }; }; // (5) connected CPU + * }; + * }; + */ + struct device_node *mcpu_ep = port_to_endpoint(mcpu_port); + struct device_node *mcpu_ep_n = mcpu_ep; + struct device_node *mcpu_port_top = of_get_next_child(of_get_parent(mcpu_port), NULL); + struct device_node *mcpu_ep_top = port_to_endpoint(mcpu_port_top); + struct device_node *mcodec_ep_top = of_graph_get_remote_endpoint(mcpu_ep_top); + struct device_node *mcodec_port_top = of_get_parent(mcodec_ep_top); + struct device_node *mcodec_ports = of_get_parent(mcodec_port_top); + int nm_max = max(dai_link->num_cpus, dai_link->num_codecs); + int ret = -EINVAL; - if (graph_lnk_is_multi(port)) { - int idx; + if (cpu_idx > dai_link->num_cpus) + goto mcpu_err; - of_node_get(port); + while (1) { + struct device_node *mcodec_ep_n; + struct device_node *mcodec_port_i; + struct device_node *mcodec_port; + int codec_idx; - for (idx = 0;; idx++) { - ep = graph_get_next_multi_ep(&port); - if (!ep) - break; + if (*nm_idx > nm_max) + break; - ret = __graph_parse_node(priv, gtype, ep, - li, is_cpu, idx); - of_node_put(ep); - if (ret < 0) + mcpu_ep_n = of_get_next_child(mcpu_port, mcpu_ep_n); + if (!mcpu_ep_n) { + ret = 0; + break; + } + + mcodec_ep_n = of_graph_get_remote_endpoint(mcpu_ep_n); + mcodec_port = of_get_parent(mcodec_ep_n); + + if (mcodec_ports != of_get_parent(mcodec_port)) + goto mcpu_err; + + codec_idx = 0; + mcodec_port_i = of_get_next_child(mcodec_ports, NULL); + while (1) { + if (codec_idx > dai_link->num_codecs) + goto mcodec_err; + + mcodec_port_i = of_get_next_child(mcodec_ports, mcodec_port_i); + + if (!mcodec_port_i) + goto mcodec_err; + + if (mcodec_port_i == mcodec_port) break; + + codec_idx++; } - } else { - /* Single CPU / Codec */ - ep = port_to_endpoint(port); - ret = __graph_parse_node(priv, gtype, ep, li, is_cpu, 0); + + dai_link->ch_maps[*nm_idx].cpu = cpu_idx; + dai_link->ch_maps[*nm_idx].codec = codec_idx; + + (*nm_idx)++; + + of_node_put(mcodec_port_i); +mcodec_err: + of_node_put(mcodec_port); + of_node_put(mcpu_ep_n); + of_node_put(mcodec_ep_n); + } +mcpu_err: + of_node_put(mcpu_ep); + of_node_put(mcpu_port_top); + of_node_put(mcpu_ep_top); + of_node_put(mcodec_ep_top); + of_node_put(mcodec_port_top); + of_node_put(mcodec_ports); + + return ret; +} + +static int graph_parse_node_multi(struct simple_util_priv *priv, + enum graph_type gtype, + struct device_node *port, + struct link_info *li, int is_cpu) +{ + struct snd_soc_dai_link *dai_link = simple_priv_to_link(priv, li->link); + struct device *dev = simple_priv_to_dev(priv); + struct device_node *ep; + int ret = -ENOMEM; + int nm_idx = 0; + int nm_max = max(dai_link->num_cpus, dai_link->num_codecs); + + /* + * 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) { + + dai_link->ch_maps = devm_kcalloc(dev, nm_max, + sizeof(struct snd_soc_dai_link_ch_map), GFP_KERNEL); + if (!dai_link->ch_maps) + goto multi_err; + } + + for (int idx = 0;; idx++) { + /* + * multi { + * ports { + * port@0 { ... }; // to pair + * port@1 { mcpu1_ep { ... = cpu1_ep };}; // Multi Element + * port@2 { mcpu2_ep { ... = cpu2_ep };}; // Multi Element + * }; + * }; + * + * cpu { + * ports { + * port@0 { cpu1_ep { ... = mcpu1_ep };}; + * }; + * }; + */ + ep = graph_get_next_multi_ep(&port); + if (!ep) + break; + + ret = __graph_parse_node(priv, gtype, ep, li, is_cpu, idx); of_node_put(ep); + if (ret < 0) + goto multi_err; + + /* CPU:Codec = N:M */ + if (is_cpu && dai_link->ch_maps) { + ret = graph_parse_node_multi_nm(dai_link, &nm_idx, idx, port); + if (ret < 0) + goto multi_err; + } } + if (is_cpu && dai_link->ch_maps && (nm_idx != nm_max)) + ret = -EINVAL; + +multi_err: return ret; } +static int graph_parse_node_single(struct simple_util_priv *priv, + enum graph_type gtype, + struct device_node *port, + struct link_info *li, int is_cpu) +{ + struct device_node *ep = port_to_endpoint(port); + int ret = __graph_parse_node(priv, gtype, ep, li, is_cpu, 0); + + of_node_put(ep); + + return ret; +} + +static int graph_parse_node(struct simple_util_priv *priv, + enum graph_type gtype, + struct device_node *port, + struct link_info *li, int is_cpu) +{ + if (graph_lnk_is_multi(port)) + return graph_parse_node_multi(priv, gtype, port, li, is_cpu); + else + return graph_parse_node_single(priv, gtype, port, li, is_cpu); +} + static void graph_parse_daifmt(struct device_node *node, unsigned int *daifmt, unsigned int *bit_frame) { @@ -929,8 +1092,24 @@ static int graph_counter(struct device_node *lnk) * * ignore first lnk part */ - if (graph_lnk_is_multi(lnk)) - return of_graph_get_endpoint_count(of_get_parent(lnk)) - 1; + if (graph_lnk_is_multi(lnk)) { + struct device_node *ports = of_get_parent(lnk); + struct device_node *port = NULL; + int cnt = 0; + + /* + * CPU/Codec = N:M case has many endpoints. + * We can't use of_graph_get_endpoint_count() here + */ + while(1) { + port = of_get_next_child(ports, port); + if (!port) + break; + cnt++; + } + + return cnt - 1; + } /* * Single CPU / Codec */ From patchwork Sun Nov 26 23:19:19 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13468967 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 3D643C4167B for ; Sun, 26 Nov 2023 23:20:50 +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 89130A4B; Mon, 27 Nov 2023 00:20:38 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 89130A4B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1701040848; bh=L8acr5tOzjEuvH1DljVPXc7fuoXjAHHUNM6H11iwDfM=; 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=mEV5nyCWGbKe/LJ72187B6bt0xflRGFW4F6tN3KiUFd8VUvZBl49a9R/qcGvrGe7/ wpU9C8knaTcg5/bPlsMDWqJ72jY3qw8USly2XF5bUyxgb+VcA/eR5Cn0uznkUPDUnR UHbPrU6vipXF2Hk1uJ/rfdhVGD5hlVdiQTuAQkCs= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 5F6FDF80623; Mon, 27 Nov 2023 00:19:41 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 43660F8025A; Mon, 27 Nov 2023 00:19:41 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 61813F805FF; Mon, 27 Nov 2023 00:19:37 +0100 (CET) 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 7A5DAF805B3 for ; Mon, 27 Nov 2023 00:19:26 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 7A5DAF805B3 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=oe6eOrzn ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dt2hPkHNdEIQaU7t01LO8FMk3eu+xk7eMKpzq+yNnCDqkaarhnpIwpZJdaTBVKFO93Q6rVHwmXAo4kWH1ndhw8dMOU1KB62MAbxQevsXEO8Kr7azKX17b1ZRg/QvcGgGZ5QCf3dqcfZklvr+gJXWMXr9Iej9KslG+KYNSkHBPKaog2PnOlJWF8BKhgmNUr+dLv+6qUpFAlXlbZ2zwEouXC4orWM4y+P/6sDUBtG5Y4m9UdRve0c6IQgPwF/nx3Q93vwyxfyOFMdZHooZqgw5JURxCMw+d/cXM9xP9+Z/sUMVieaJTpj58uIbEUQYG4p0I9oaM3jr3UF8ElY9nQ1TaA== 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=Hm6041/w3CFB2TLbUjigDvbKgkjEi/yd9CJilzLOY/w=; b=ixBd3bgJjP2Pfv/eD8oq3CaDd2RMJFeKHok0j5CzEmjy7SOefPLVkYiLEcj2VjpTtw/SdSBFq9cpjsPIHFTjSUf1KogdluJR+wJSe6pSRBUz0Yx++UaADNVRH0ZydvpgjRDdXOEbj69EhTy+QdMX711x7A4HjwLgnxfkXfwYAd1nQMN17A3kF8vZWQGpCeJ918LUp1/gTZZmi24EayACcc0YL0/esIQZe10NoX2lk9XhX7Nx9Bzhcau/LHFmcRcYC8WPvVlDcmRCftykQct1Ht1hfv4nRFSfEggIvp9YHmuK1OEFwUcRIbtqJDf0wV/5Wj+pnAqrrYQgItVOfw6sXw== 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=Hm6041/w3CFB2TLbUjigDvbKgkjEi/yd9CJilzLOY/w=; b=oe6eOrznyrNeK6skf3gGMvXUQl0NH/4PKuHxb8R9KbcYmI//slv3/kRdCxV5P58F+V7eUVQStHLR2Dro7oAgGLfPNR9DywxY44Yi3OJH27CUi/HKSV3z1+XP+8FlvWR8RpErE0WSDsTmcVa34/52G3p1JQOHaIILe0RNEsONoOg= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by OSRPR01MB11697.jpnprd01.prod.outlook.com (2603:1096:604:230::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.27; Sun, 26 Nov 2023 23:19:19 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::16b3:a84d:faa6:4846]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::16b3:a84d:faa6:4846%6]) with mapi id 15.20.7025.022; Sun, 26 Nov 2023 23:19:19 +0000 Message-ID: <87o7fgw1ag.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v7 resend 4/5] ASoC: audio-graph-card2-custom-sample: Add connection image 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: <87ttp8w1bk.wl-kuninori.morimoto.gx@renesas.com> References: <87ttp8w1bk.wl-kuninori.morimoto.gx@renesas.com> Date: Sun, 26 Nov 2023 23:19:19 +0000 X-ClientProxiedBy: TYCPR01CA0155.jpnprd01.prod.outlook.com (2603:1096:400:2b1::17) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OSRPR01MB11697:EE_ X-MS-Office365-Filtering-Correlation-Id: 1ac572f0-eb7e-4bfe-c538-08dbeed61dc8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: mckLOiF7z4Dn//tZ8IpDIGJt0MtyvNdoGrKTdLimhw+qUGn0icKTPgNXVHr5O+amWzk/1udpFJ+II9q0DmaOnbhbSr8Z6tBQz8E213ZEteqC+9x8BFDfWJzLnFQoTUS0nges9PqRS2TgpXqQzoYQhuQI4MGawOAJ9dNYBPsmkJdjVcgHKoo0WRkXfRIcdO4RsS8CHmMQZK11+sgubcGoE5vq9oWCa7GL/lg+LcRO6eyT+BHh2k+VhSzlqoHcans0p7vfAgTEL6OD08GSCbYL+cPZkKqjksqB3wkUthVX5TMK2Xo8iw2JGYqzaCVPtcNgi7TnpVhWEr3T2CLx5W9F4rKwPQbItfFeQ/lKtEF99rCFSiYECyKkf6c7815fGP6XEGmmLPi3m4F1z5T+QLcQHoZFKEEyCZgaFNSESmTRi56RLe5KWfpmFHVS8sYbks5/OmbmlIKPAGzbouUzcbWVwBvWyvhvyGs3y4sprK6c33gPbakGTb/sbxRO9lt6B3dShBwpdV84QaRgl+ZBhpCkVfodCEesJrC+4MT/+e1SQM6NCvlAbXy/1y+i60uX4nAnI6sUp6UlMlLktcmAxw55x+qtOZXc/iiejgXuyyhRxkpls4j73NIjDu4mGe1isy06RQb4HQEF9AwLlcNdYz7XNw== 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)(39860400002)(396003)(376002)(136003)(366004)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(7416002)(4326008)(2906002)(8676002)(8936002)(41300700001)(26005)(66476007)(110136005)(316002)(66946007)(66556008)(6512007)(52116002)(5660300002)(2616005)(6506007)(83380400001)(86362001)(38100700002)(38350700005)(6486002)(478600001)(36756003)(2013699003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: DzEiGawFu0hOGmcWKyE4vA005l/lir9d0F4dDdjxAJ+45fZZhJlZLjnC264ozXlLp7RfDi+eniAX4Qkmz5jks/5BgnSlnA3POUENcXqA+rimNva6QjysKdt8qSjoHnILo0AIVWVs8rT6vWVvmGr0G6DY6P/xgE0wEo1YNxoue8Tiiwg7wCFM7FadQFpjtaXp6k/OKBz7yu/WOxZ3OxvGA9sDM2i7SE8j4/drAD5xUoKiodOdh2rMD4ob769PssYbf8p4jHq52GM5G6OTPvfLKVNX1V1n7DJu7N8JyVFmSqyvylalCtQBv3xsOtkn9ePs58wc6ncIdaW6c1rGTytjIR8tQ7g0ausLBY3fCG/cB2C6mgB8ZYlUYV+EFeTCr/hKbHPWt/qfw+mZhfOkdsUIMSTp6/5yekrV2L3M8hTKP7sEYOZLr46I6IbNVsgn62CuueJqF6CKT5oFBqy5Kwv4T5lyX9MMc6SeJ2cYKFjSPKoL/L72mnO3DyUcebDHSyp3yy7MWRHDhK3TR0mFeGWu/r6/YDw9XF389DlN1enRmi4AbCY6MCHyugFnYTQbPHf4q4Rp/e01ZMT/8MaY4L2evAd8bye/aXp9oHnR/sYIKt+PtdM/V9ZrI+aOUI5vwdyaXakwe7sEfn8/pePk5B+Fw0hIbIYTZqxRIHtbxUcehQ4wr2t2QcUndT3gXDSDuTwR8HbWcP+FK/b2g0NMuy01xd+qi7qQgaCBbp+mCJRzaTmlriEedl+OYo5eiXPRxnWyL8JCdniGK1t7P+vHAqtKGkGVoSK+lZtbfSZTQdBScKf/95ypbBWyeJQg9gM//ET7rwwY6EBWpCZwesvs2kzoGohpI9sFAabJgBA8Tqi0Ok7UBDs8oGKkEv8aodmmqU1CHWUqxhLYalD8SAv/tUTAlx11ox4NDauIseJU/u1IpMX1ZLO8Xd+d3zpMwK12d22rZjTrubhuc0jsMDhMiSZRjFg8eD7fCPKuU/nIlm3RFJ1npySsCbnLTtYeVdpYkbX7+MDXnxivrKRtXc/Cve2S1txpGZQbNkSt2atj5390AnycW6tBB9pgclMNIHbUJsqjR+FHnbxbANupueNHK5WRArtQpsDiv/xnaC4pPAllhrkMdAIbrXGjtqY8ZiX4crOggRX+41lMdn8Sr3/9yOrpvDDDGRRZeYfaGQkKNKrzuTn+VKxvj0KPlaQVrcxFDMsRNlSIyomOrH2XVaLqQU0+WQ9yUGsECwkZjTK3yLmiIfa0cnNdc0qfdsNnVtu93fwbAJFJgDperXgR3rdcRGVoznCR54WgrXoBifTBx0d6BehK2oqFZ5hzOy1IOGzDFE+wdELNTbgBdUSh3pW1URzaGQ5RZ71tNhipFeTSS0jaEzKKUF3bTGJRerDWNWQYR0cas2Xaa7H4AL7X3RJTl0TkduDYXl5WB8BfBoVqCkFaOxfM50CvjEkIOadoa6KU5Ue19mxwa5yVgHmeJqCVX1XKpj3cqiLsFC8av1IxoIvXa0/eOOdD59xpcbUFU/muc72ryu3Wu+3WNkvbftiKH7/wPdOy/s3bemtXwu7CVSFIZki8BX5qClmHtQT+TaHkm1NngDX20umXPwqeoXCNvzFR3o2cUm9Ml6BPTm7yl6ZtSsA= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 1ac572f0-eb7e-4bfe-c538-08dbeed61dc8 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2023 23:19:19.4511 (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: SB4q3PTYXq8Zg6Y72ID1htWk+PWx5v3eoBfdUQtEdln5cqGUzsmwkjyRHz1FGbLP65g5UlG/YR8leAHfrFZxZeKJHvMoc3xHG64LxwE3K2f4iNpxJFznheYUHwgb1a2W X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSRPR01MB11697 Message-ID-Hash: P3L5SVYVR6OJLQA23MEZOCRSU3BIJDKE X-Message-ID-Hash: P3L5SVYVR6OJLQA23MEZOCRSU3BIJDKE X-MailFrom: kuninori.morimoto.gx@renesas.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Audio Graph Card2 is supporting many type of Sound connections, but thus it is very difficult to understand how these are connected. To support well understanding, this patch adds each connection images and indicates each settings are for where. Signed-off-by: Kuninori Morimoto --- .../audio-graph-card2-custom-sample.dtsi | 181 ++++++++++++++---- 1 file changed, 142 insertions(+), 39 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..7e2cd9cc3fa8 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,64 +185,115 @@ multi { #address-cells = <1>; #size-cells = <0>; + /* + * [Multi-CPU-0] + * + * +---+ +---+ + * cpu1 <--|A X|<-@------->|x a|-> codec1 + * cpu2 <--|B | | b|-> codec2 + * +---+ +---+ + */ 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>; };};/* (X) to pair */ + port@1 { reg = <1>; mcpu01_ep: endpoint { remote-endpoint = <&cpu1_ep>; };};/* (A) Multi Element */ + port@2 { reg = <2>; mcpu02_ep: endpoint { remote-endpoint = <&cpu2_ep>; };};/* (B) Multi Element */ }; - /* [Multi-Codec] */ + /* + * [Multi-Codec-0] + * + * +---+ +---+ + * cpu1 <--|A X|<-@------->|x a|-> codec1 + * cpu2 <--|B | | b|-> codec2 + * +---+ +---+ + */ 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>; };};/* (x) to pair */ + port@1 { reg = <1>; mcodec01_ep: endpoint { remote-endpoint = <&codec1_ep>; };};/* (a) Multi Element */ + port@2 { reg = <2>; mcodec02_ep: endpoint { remote-endpoint = <&codec2_ep>; };};/* (b) Multi Element */ }; - /* [DPCM-Multi]::BE */ + /* + * [DPCM-Multi]::BE + * + * FE BE + * **** +---+ + * cpu5 <-@--* *-----@--->|x a|-> codec4 + * cpu6 <-@--* * | b|-> codec5 + * **** +---+ + */ ports@2 { reg = <2>; #address-cells = <1>; #size-cells = <0>; - port@0 { reg = <0>; mbe_ep: endpoint { remote-endpoint = <&be10_ep>; }; }; - port@1 { reg = <1>; mbe1_ep: endpoint { remote-endpoint = <&codec4_ep>; }; }; - port@2 { reg = <2>; mbe2_ep: endpoint { remote-endpoint = <&codec5_ep>; }; }; + port@0 { reg = <0>; mbe_ep: endpoint { remote-endpoint = <&be10_ep>; };};/* (x) to pair */ + port@1 { reg = <1>; mbe1_ep: endpoint { remote-endpoint = <&codec4_ep>; };};/* (a) Multi Element */ + port@2 { reg = <2>; mbe2_ep: endpoint { remote-endpoint = <&codec5_ep>; };};/* (b) Multi Element */ }; - /* [Codec2Codec-Multi]::CPU */ + /* + * [Codec2Codec-Multi]::CPU + * + * +---+ + * +-@->|X A|-> codec8 + * | | B|-> codec9 + * | +---+ + * | +---+ + * +--->|x a|-> codec10 + * | b|-> codec11 + * +---+ + */ ports@3 { reg = <3>; #address-cells = <1>; #size-cells = <0>; - port@0 { reg = <0>; mc2c0_ep: endpoint { remote-endpoint = <&c2cmf_ep>; }; }; - port@1 { reg = <1>; mc2c00_ep: endpoint { remote-endpoint = <&codec8_ep>; }; }; - port@2 { reg = <2>; mc2c01_ep: endpoint { remote-endpoint = <&codec9_ep>; }; }; + port@0 { reg = <0>; mc2c0_ep: endpoint { remote-endpoint = <&c2cmf_ep>; };};/* (X) to pair */ + port@1 { reg = <1>; mc2c00_ep: endpoint { remote-endpoint = <&codec8_ep>; };};/* (A) Multi Element */ + port@2 { reg = <2>; mc2c01_ep: endpoint { remote-endpoint = <&codec9_ep>; };};/* (B) Multi Element */ }; - /* [Codec2Codec-Multi]::Codec */ + /* + * [Codec2Codec-Multi]::Codec + * + * +---+ + * +-@->|X A|-> codec8 + * | | B|-> codec9 + * | +---+ + * | +---+ + * +--->|x a|-> codec10 + * | b|-> codec11 + * +---+ + */ ports@4 { reg = <4>; #address-cells = <1>; #size-cells = <0>; - port@0 { reg = <0>; mc2c1_ep: endpoint { remote-endpoint = <&c2cmb_ep>; }; }; - port@1 { reg = <1>; mc2c10_ep: endpoint { remote-endpoint = <&codec10_ep>; }; }; - port@2 { reg = <2>; mc2c11_ep: endpoint { remote-endpoint = <&codec11_ep>; }; }; + port@0 { reg = <0>; mc2c1_ep: endpoint { remote-endpoint = <&c2cmb_ep>; };};/* (x) to pair */ + port@1 { reg = <1>; mc2c10_ep: endpoint { remote-endpoint = <&codec10_ep>; };};/* (a) Multi Element */ + port@2 { reg = <2>; mc2c11_ep: endpoint { remote-endpoint = <&codec11_ep>; };};/* (b) Multi Element */ }; - /* [Semi-Multi] */ + /* + * [Semi-Multi] + * + * +---+ + * cpu7 <-@------->|X A|-> codec12 + * | B|-> codec13 + * +---+ + */ ports@5 { reg = <5>; #address-cells = <1>; #size-cells = <0>; - port@0 { reg = <0>; smcodec0_ep: endpoint { remote-endpoint = <&cpu7_ep>; }; }; - port@1 { reg = <1>; smcodec1_ep: endpoint { remote-endpoint = <&codec12_ep>; }; }; - port@2 { reg = <2>; smcodec2_ep: endpoint { remote-endpoint = <&codec13_ep>; }; }; + port@0 { reg = <0>; smcodec0_ep: endpoint { remote-endpoint = <&cpu7_ep>; };};/* (X) to pair */ + port@1 { reg = <1>; smcodec1_ep: endpoint { remote-endpoint = <&codec12_ep>; };};/* (A) Multi Element */ + port@2 { reg = <2>; smcodec2_ep: endpoint { remote-endpoint = <&codec13_ep>; };};/* (B) Multi Element */ }; }; @@ -252,11 +306,27 @@ ports@0 { #address-cells = <1>; #size-cells = <0>; - /* [DPCM]::FE */ + /* + * [DPCM]::FE + * + * FE BE + * **** + * cpu3 <-@(fe00)--* *--(be0)@--> codec3 + * cpu4 <-@(fe01)--* * (44.1kHz) + * **** + */ fe00: port@0 { reg = <0>; fe00_ep: endpoint { remote-endpoint = <&cpu3_ep>; }; }; fe01: port@1 { reg = <1>; fe01_ep: endpoint { remote-endpoint = <&cpu4_ep>; }; }; - /* [DPCM-Multi]::FE */ + /* + * [DPCM-Multi]::FE + * + * FE BE + * **** +-+ + * cpu5 <-@(fe10)--* *---(be1)@-->| |-> codec4 + * cpu6 <-@(fe11)--* * | |-> codec5 + * **** +-+ + */ fe10: port@2 { reg = <2>; fe10_ep: endpoint { remote-endpoint = <&cpu5_ep>; }; }; fe11: port@3 { reg = <3>; fe11_ep: endpoint { remote-endpoint = <&cpu6_ep>; }; }; }; @@ -266,10 +336,26 @@ ports@1 { #address-cells = <1>; #size-cells = <0>; - /* [DPCM]::BE */ + /* + * [DPCM]::BE + * + * FE BE + * **** + * cpu3 <-@(fe00)--* *--(be0)@--> codec3 + * cpu4 <-@(fe01)--* * (44.1kHz) + * **** + */ be0: port@0 { reg = <0>; be00_ep: endpoint { remote-endpoint = <&codec3_ep>; }; }; - /* [DPCM-Multi]::BE */ + /* + * [DPCM-Multi]::BE + * + * FE BE + * **** +-+ + * cpu5 <-@(fe10)--* *---(be1)@-->| |-> codec4 + * cpu6 <-@(fe11)--* * | |-> codec5 + * **** +-+ + */ be1: port@1 { reg = <1>; be10_ep: endpoint { remote-endpoint = <&mbe_ep>; }; }; }; }; @@ -277,7 +363,13 @@ ports@1 { codec2codec { #address-cells = <1>; #size-cells = <0>; - /* [Codec2Codec] */ + /* + * [Codec2Codec] + * + * +-@(c2c)-> codec6 + * | + * +--------> codec7 + */ ports@0 { reg = <0>; @@ -289,7 +381,18 @@ ports@0 { port@1 { reg = <1>; c2cb_ep: endpoint { remote-endpoint = <&codec7_ep>; }; }; }; - /* [Codec2Codec-Multi] */ + /* + * [Codec2Codec-Multi] + * + * +-+ + * +-@(c2c_m)-->| |-> codec8 + * | | |-> codec9 + * | +-+ + * | +-+ + * +----------->| |-> codec10 + * | |-> codec11 + * +-+ + */ ports@1 { reg = <1>; @@ -323,9 +426,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 +466,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 Sun Nov 26 23:19:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 13468968 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 53C0EC4167B for ; Sun, 26 Nov 2023 23:21: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 6A6C5E0D; Mon, 27 Nov 2023 00:21:03 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6A6C5E0D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1701040873; bh=UUm9JccEsp1jgqyTb2wTS4JiSjMXGsssq+Y18Ei6Lmo=; 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=sAX8MbeVYZEk+EqvOCrEqs65BN8Rr+rqpiiF1tLEkWpZI26j0f7KgWdbmd6fX5D6Z k5y+QDxP4CqLjH08Vhn1KSRhJJF7fHUljXb/ccGQr37X5CsXBoYq9J4eO/ehMHsrCs k419LVP1mzSviU1iIXjbLrOqaHEV7JGeSNKNgHy4= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 98F33F80671; Mon, 27 Nov 2023 00:19:47 +0100 (CET) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id 02EABF80651; Mon, 27 Nov 2023 00:19:47 +0100 (CET) Received: by alsa1.perex.cz (Postfix, from userid 50401) id A3F84F80618; Mon, 27 Nov 2023 00:19:43 +0100 (CET) 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 5BBF0F800F5 for ; Mon, 27 Nov 2023 00:19:28 +0100 (CET) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 5BBF0F800F5 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=l8I4UbzZ ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=MaF/IUBQM8E/gSckRDFZoehi85CZSw6Rs5eagzJkWFB3OTNPyiJ07xTj6HymMgM9jxVA35pUVpZX5HuaQ/7qiC2O4OXxN1Lk5R09aITbKU1lZjMZ/PO16Q9GszZBsjrHjUEmtixX02C2+UMXzztia/Iyc5nYY17ElRlTHBRWr4kd0nDwunAv5bVJDZk2oUC049lJwruHZQVZgromlPktLWEcfjeVxQegZTp2WENZr6IIaFLH7s7mu3HbBMHfB+NKrof8MoFIJaldbUKQQGxuiFBEdjqdQs0z+JeaDw1FOhjZc12tlvWjuzEwd38KrXcxvOdoP9vVuqqWwnBexzmNjQ== 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=ufCmAgxj4vWDs+5p6C0t9sXW43Dw7ngQaq3vAMp+Z9Y=; b=XEKd+qNmJvR4h5SmfO7js66rKHn/Rye+yRW+dsxuptx28s8EMPhtzuQg7tb+qOsBoKEhJCJ0qupeya0qciCdfTABmB3ZJEXhPdOMXiddTE23WV7/6vg0XKEMBxqR2POK1HoyggCxDQIOzFiBlgv01olmvRrYFj84ig1+hPSLxJYAPJLlqltdGFo3GpdPqChpW3ome+qmSr0cTm9TF1M1H8Pv30GZJPxhrpOzqih/qgJKp4OTcpA/GQUkIdyZ104cE/FhNa2zVL38NRdw8d1w8yZfdPS2+3ypxNKtv4/dDYIyGRWl97waRS5+XLGmorApzcbfmRIRmFRSMmLqy2c4jw== 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=ufCmAgxj4vWDs+5p6C0t9sXW43Dw7ngQaq3vAMp+Z9Y=; b=l8I4UbzZw4Ev1N9iuek9tkux3Z9gselzusZXbXBvO69RnB8b+8O/lJmmgDq22UsSqJh9joqN2mVfXamT8EVjYgUXR1dSn/KjH1+/4bYBrLJUdbFjBODZoH4DZs6ZTGauWtTOo7iGg0iDZLGiXoon81D0Q3haczmHGxu/ZIqcEnE= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by OSRPR01MB11697.jpnprd01.prod.outlook.com (2603:1096:604:230::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7025.27; Sun, 26 Nov 2023 23:19:23 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::16b3:a84d:faa6:4846]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::16b3:a84d:faa6:4846%6]) with mapi id 15.20.7025.022; Sun, 26 Nov 2023 23:19:22 +0000 Message-ID: <87msv0w1ad.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v7 resend 5/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: <87ttp8w1bk.wl-kuninori.morimoto.gx@renesas.com> References: <87ttp8w1bk.wl-kuninori.morimoto.gx@renesas.com> Date: Sun, 26 Nov 2023 23:19:22 +0000 X-ClientProxiedBy: TYCP286CA0087.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:2b3::18) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|OSRPR01MB11697:EE_ X-MS-Office365-Filtering-Correlation-Id: 2c4c6824-aeb2-4548-4417-08dbeed61fe1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: s69WLMWMi7bUqG/MphReyBBeEMLYAI7Dt8z+L9ZCZuzACZKBhHmQaG0Bt/xeorZJoVHACEUZ+l2uYLTsuqvzDbrEcrS3aknD1Lx3uCB7/J6VWnRB80TvLXA1QqiAgiPkvYisXz4J824rlP3hsbGasgB1l72nEWJa/nFnU2xvSHnnkP6Ca8r3DQ2hRm14yHuS9EGKHr9YeABRGJNHDtOHDj7kyyHOSB8fZO/rPeAse1cuWc6IKan3OnGwTTJbK7nk655n9lm8UipCczJfZRmkC36OOa7Ke9k9tOeh0JtPgqXUJmqEU2ZVxt1WQmOIsqi27WGLSfMvX7bAwMo3vDB1ksDx31mltJGNem/KCpyI4rBYt4zxjCS7EsaWTsrrIY7oFtf/P7rJF39ab+j8z70qocNacAqy4u1JYDeqfg1OHtbA4xyQN11MqXS/ia5eq8VkA30TJ0saFcY+2bmSYKaZxIARZc10v+b8QM1E5ZtmKFqwHKszrbbT38DhdNCdqo4w3UYWGIHyeuoXv2COWTbigJqC5q6ZqpBqzijBGkDAjQr5/mrlH0mWDB1bTKA5do42YPxjxqtahlLoPGACtiuWEjHzHk2NhzYgZkem/DeugvWDazx/2FrlR67zcNA1bFUQaq0wv01AyucRVRzE7ul1+Q== 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)(39860400002)(396003)(376002)(136003)(366004)(346002)(230922051799003)(1800799012)(186009)(451199024)(64100799003)(7416002)(4326008)(2906002)(8676002)(8936002)(41300700001)(26005)(66476007)(110136005)(316002)(66946007)(66556008)(6512007)(52116002)(5660300002)(2616005)(6506007)(83380400001)(86362001)(38100700002)(38350700005)(6486002)(478600001)(36756003)(2013699003);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GuiYLlYPeCMkRVvV89pzi45mN3SaDNMIy+ToBL5lt4Dpc1tqFsAZKELeUzyLC6LHErvDktkdw33NXs/kFhDxub4+Y/90pnHDPmgDgkbZCtD9dH/2LQGDYidH/ayrygolyBCRYYbxuPZQCYJE2ppnUAfNt67ekektNpYEor+36uI1Lud0Lv3GIE727C6G+HoX/yTlVc5R3VHyfyKFb7boTvZkrR7S+2UfkH9C90E7SLEtYNixHSp3Z2SqHYsfYTR7klMxMtFyyEkO8sar+pPOLHxmuwQkqvxohCzDo8Mey89D1MCb5CXKEWcH4OnQMluronDt3/DwvyV6r0sELs9ElfvZY/jVph7qmdOPo+DR7vYDmcFDR8vkVME/sIjFVRgo3ctkkBqZAg3DeaiRUAUuZiVxtd4pU9mgDXY6UljaAEUIM10AMgAA1tJ9lxGZ91/0Oc445bL4nKAgTIBuUoCcipI8B4tnYePPLfrJgIYU0TUVXtHQdm1GqZmhFj0ukITCO4ukJsUc/LPPGWCJKSzeZV3g4wPOMjfE1reYNLyQ2oqH0+75PvCs2Juw1o+nyAogvrhL0UyhiEfipLu4UiLb9qcSGAKJ5drXIbDBz1Z3BomSq99+JZEgftgMI2u65Xr5dd+5vaZ8riEzlgLzEK/yeqQx4xtRwyypKxn4nBAyN4Svld0Dhv8rjHk3r8TfWpY3BiVX4JpsVn1lTpGd+gAfdOnAWDUVcPZlib8I0HrxZGUXs7vC5VWnJWThvy3kcdp3umlOngmyCJzCEtYFUTUfpRqqTCeMScGDkQ59skPWxN6co4RjkFAn5WlTMqLSRqoLXTvMeSCWIat9mibV5ROCoWonKLme7YUngIMBdHo9LBNylPXe2AhHhFVCvHxD2ckJugVy1vjF0oBAjlq4LKAZVaRWG7XP6BP9a4mR4cyyDjdwPo1q+0kZwzYYP5Tbvh/rw+No5Mfv9yMrO+g04F8MVFJFkjZHG2uVSo+FJq8LTHdxzy8zdQgvh3I/Ti5acavyC2rE9JlePstgNkR1rqBtEEowM612d8HlIMX6FrryB4vGCYIHfv3pH4BNPZ4XWeimY2dCmJsAtc3AgbNAKlUd0Q6YLHJhTvTZAlw+2MdClCkxoPvA5AHcaCs7LODbRPRYqZo9Rrx+npnyD+YLXtW+gHe4KGgBCHNEOkcRJS73rn0fmejEUxNOBep6S11PMVYUqtvmGxpmJxHtGeV+bnmJ0Sz4GSb2pQ4DJohTEl/uHgNDrkzaCy1I81y7J5QgeNhUp19wjkCcQY2AR9SSspCdBxaFGKWbKxxx2R/9EXI000GvFXoxUEuDhbkPnsNjJbVA2ohhwV9dQKUbpW9ZzqSKizknq4VN+cf8SGrsInNHtABHaLUUqZg6/8a7yZL6MXdT15zfh97tjAnuGQ8B1psMLDlSkDGOG8kYHAWfARs6R6snaZ/NhkjovSvoA/+QGOzygNmn38bV8qyQ/EqSgpfiUQd4VwsSjI4MJCcxqjHSSVNBEerQ2xj7pwKcYr6+1/hutZIYfqQDQ8oES9FXwtWaeTyTWO99BpUL95kU+hl7FHyMWCP8UX+PIIje6tmFHynQG5B9tLsvS8Bx08ys3LaxlKZhF3JhFt27EB98XWKBQZM= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2c4c6824-aeb2-4548-4417-08dbeed61fe1 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 26 Nov 2023 23:19:22.9187 (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: 4XTuMYM8+uXMSx2Dkhda1uaFr13/jWd9RzbqRGVOM/+BllOqY8LslVzDyTq7nAc/15syVbeyTkgQ7nHqH3tBN3HmV10fHU3ok1MiQiLUFr1weMeQlKJQOLxyc6F2kJqP X-MS-Exchange-Transport-CrossTenantHeadersStamped: OSRPR01MB11697 Message-ID-Hash: Z4N5TEDBYEPI7AI7MT5WXCO2FC23CYV3 X-Message-ID-Hash: Z4N5TEDBYEPI7AI7MT5WXCO2FC23CYV3 X-MailFrom: kuninori.morimoto.gx@renesas.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: 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 | 199 ++++++++++++++++++ 1 file changed, 199 insertions(+) diff --git a/sound/soc/generic/audio-graph-card2-custom-sample.dtsi b/sound/soc/generic/audio-graph-card2-custom-sample.dtsi index 7e2cd9cc3fa8..9efd31206c9b 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] + * + * +-+ +-+ + * | |<-@--------->| | + * | | | | + * cpu8 <--| |<----------->| |-> codec14 + * cpu9 <--| |<---+------->| |-> codec15 + * +-+ \------>| |-> codec16 + * +-+ + * + * [Multi-CPU/Codec-2] + * + * +-+ +-+ + * | |<-@--------->| | + * | | | | + * cpu10 <-| |<----------->| |-> codec17 + * cpu11 <-| |<-----+----->| |-> codec18 + * cpu12 <-| |<----/ +-+ + * +-+ + * * [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 @@ -295,6 +335,150 @@ ports@5 { port@1 { reg = <1>; smcodec1_ep: endpoint { remote-endpoint = <&codec12_ep>; };};/* (A) Multi Element */ port@2 { reg = <2>; smcodec2_ep: endpoint { remote-endpoint = <&codec13_ep>; };};/* (B) Multi Element */ }; + + /* + * [Multi-CPU-1] + * + * +---+ +---+ + * | X|<-@------->|x | + * | | | | + * cpu8 <--|A 1|<--------->|3 a|-> codec14 + * cpu9 <--|B 2|<---+----->|4 b|-> codec15 + * +---+ \---->|5 c|-> codec16 + * +---+ + */ + ports@6 { + reg = <6>; + #address-cells = <1>; + #size-cells = <0>; + mcpu1: port@0 { reg = <0>; mcpu10_ep: endpoint { remote-endpoint = <&mcodec10_ep>; };}; /* (X) to pair */ + port@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + mcpu11_ep: endpoint@0 { reg = <0>; remote-endpoint = <&cpu8_ep>; }; /* (A) Multi Element */ + mcpu11_ep_0: endpoint@1 { reg = <1>; remote-endpoint = <&mcodec11_ep_0>; }; /* (1) connected Codec */ + }; + port@2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + mcpu12_ep: endpoint@0 { reg = <0>; remote-endpoint = <&cpu9_ep>; }; /* (B) Multi Element */ + mcpu12_ep_0: endpoint@1 { reg = <1>; remote-endpoint = <&mcodec12_ep_0>; }; /* (2) connected Codec */ + mcpu12_ep_1: endpoint@2 { reg = <2>; remote-endpoint = <&mcodec13_ep_0>; }; /* (2) connected Codec */ + }; + }; + + /* + * [Multi-Codec-1] + * + * +---+ +---+ + * | X|<-@------->|x | + * | | | | + * cpu8 <--|A 1|<--------->|3 a|-> codec14 + * cpu9 <--|B 2|<---+----->|4 b|-> codec15 + * +---+ \---->|5 c|-> codec16 + * +---+ + */ + ports@7 { + reg = <7>; + #address-cells = <1>; + #size-cells = <0>; + port@0 { reg = <0>; mcodec10_ep: endpoint { remote-endpoint = <&mcpu10_ep>; };}; /* (x) to pair */ + port@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + mcodec11_ep: endpoint@0 { reg = <0>; remote-endpoint = <&codec14_ep>; }; /* (a) Multi Element */ + mcodec11_ep_0: endpoint@1 { reg = <1>; remote-endpoint = <&mcpu11_ep_0>; }; /* (3) connected CPU */ + }; + port@2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + mcodec12_ep: endpoint@0 { reg = <0>; remote-endpoint = <&codec15_ep>; }; /* (b) Multi Element */ + mcodec12_ep_0: endpoint@1 { reg = <1>; remote-endpoint = <&mcpu12_ep_0>; }; /* (4) connected CPU */ + }; + port@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <3>; + mcodec13_ep: endpoint@0 { reg = <0>; remote-endpoint = <&codec16_ep>; }; /* (c) Multi Element */ + mcodec13_ep_0: endpoint@1 { reg = <1>; remote-endpoint = <&mcpu12_ep_1>; }; /* (5) connected CPU */ + }; + }; + + /* + * [Multi-CPU-2] + * + * +---+ +---+ + * | X|<-@------->|x | + * | | | | + * cpu10 <-|A 1|<--------->|4 a|-> codec17 + * cpu11 <-|B 2|<-----+--->|5 b|-> codec18 + * cpu12 <-|C 3|<----/ +---+ + * +---+ + */ + ports@8 { + reg = <8>; + #address-cells = <1>; + #size-cells = <0>; + mcpu2: port@0 { reg = <0>; mcpu20_ep: endpoint { remote-endpoint = <&mcodec20_ep>; };}; /* (X) to pair */ + port@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + mcpu21_ep: endpoint@0 { reg = <0>; remote-endpoint = <&cpu10_ep>; }; /* (A) Multi Element */ + mcpu21_ep_0: endpoint@1 { reg = <1>; remote-endpoint = <&mcodec21_ep_0>; }; /* (1) connected Codec */ + }; + port@2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + mcpu22_ep: endpoint@0 { reg = <0>; remote-endpoint = <&cpu11_ep>; }; /* (B) Multi Element */ + mcpu22_ep_0: endpoint@1 { reg = <1>; remote-endpoint = <&mcodec22_ep_0>; }; /* (2) connected Codec */ + }; + port@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <3>; + mcpu23_ep: endpoint@0 { reg = <0>; remote-endpoint = <&cpu12_ep>; }; /* (C) Multi Element */ + mcpu23_ep_0: endpoint@1 { reg = <1>; remote-endpoint = <&mcodec22_ep_1>; }; /* (3) connected Codec */ + }; + }; + + /* + * [Multi-Codec-2] + * + * +---+ +---+ + * | X|<-@------->|x | + * | | | | + * cpu10 <-|A 1|<--------->|4 a|-> codec17 + * cpu11 <-|B 2|<-----+--->|5 b|-> codec18 + * cpu12 <-|C 3|<----/ +---+ + * +---+ + */ + ports@9 { + reg = <9>; + #address-cells = <1>; + #size-cells = <0>; + port@0 { reg = <0>; mcodec20_ep: endpoint { remote-endpoint = <&mcpu20_ep>; };}; /* (x) to pair */ + port@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <1>; + mcodec21_ep: endpoint@0 { reg = <0>; remote-endpoint = <&codec17_ep>; }; /* (a) Multi Element */ + mcodec21_ep_0: endpoint@1 { reg = <1>; remote-endpoint = <&mcpu21_ep_0>; }; /* (4) connected CPU */ + }; + port@2 { + #address-cells = <1>; + #size-cells = <0>; + reg = <2>; + mcodec22_ep: endpoint@0 { reg = <0>; remote-endpoint = <&codec18_ep>; }; /* (b) Multi Element */ + mcodec22_ep_0: endpoint@1 { reg = <1>; remote-endpoint = <&mcpu22_ep_0>; }; /* (5) connected CPU */ + mcodec22_ep_1: endpoint@2 { reg = <2>; remote-endpoint = <&mcpu23_ep_0>; }; /* (5) connected CPU */ + }; + }; }; dpcm { @@ -440,6 +624,14 @@ 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>; }; }; + port@9 { reg = <9>; cpu9_ep: endpoint { remote-endpoint = <&mcpu12_ep>; }; }; + /* [Multi-CPU-2] */ + port@a { reg = <10>; cpu10_ep: endpoint { remote-endpoint = <&mcpu21_ep>; }; }; + port@b { reg = <11>; cpu11_ep: endpoint { remote-endpoint = <&mcpu22_ep>; }; }; + port@c { reg = <12>; cpu12_ep: endpoint { remote-endpoint = <&mcpu23_ep>; }; }; }; }; @@ -498,6 +690,13 @@ 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>; }; }; + port@f { reg = <15>; codec15_ep: endpoint { remote-endpoint = <&mcodec12_ep>; }; }; + port@10 { reg = <16>; codec16_ep: endpoint { remote-endpoint = <&mcodec13_ep>; }; }; + /* [Multi-Codec-2] */ + port@11 { reg = <17>; codec17_ep: endpoint { remote-endpoint = <&mcodec21_ep>; }; }; + port@12 { reg = <18>; codec18_ep: endpoint { remote-endpoint = <&mcodec22_ep>; }; }; }; }; };