From patchwork Wed Oct 25 02:18:38 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 737880 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 EB8CFC07545 for ; Wed, 25 Oct 2023 02:23:17 +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 C7459846; Wed, 25 Oct 2023 04:22:25 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz C7459846 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1698200595; bh=pr8dYZAqJBS5+jk0lFEaUfngteMulpescejoPQvZCig=; 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=nDWAn5tz02JyFOa8MxeXy2nCOkRscAtiC+e5mDAcWLACcFy2gxlEwtdi7nBeCPjdB d3qf8xA8Re35L2DUHLSTc4YKwUTc3fq125GEY5tE1jlTRdWXl1qJboYpDMs6j3yNO8 aDhR5EUVWiPjAuui1iII5OJmxWbZgaZGPmOKHC/U= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 33E62F8055A; Wed, 25 Oct 2023 04:21:48 +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 DC68EF80165; Wed, 25 Oct 2023 04:21:47 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id DFAC6F80563; Wed, 25 Oct 2023 04:19:00 +0200 (CEST) Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01on20714.outbound.protection.outlook.com [IPv6:2a01:111:f403:700c::714]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id AE174F80224 for ; Wed, 25 Oct 2023 04:18:46 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz AE174F80224 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=iJoaSwZ3 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=TiE8dPzjUGtwofxW2CxJxPSMpNfPDW/EYCY8a8q6zsEZ6VupKxe2pN4oXLAWRQsulC43XR7F+izFHLl1mh+Dan8CA8sH5wGAuCz6TTnpAXneb/ZXfIXEVr0feHX+BpPzRpCVTOkT3a1S4QyEuRj2Ns/ZNLqTUw0IEoe28JsGYK8LX7rA/TZnQXnVM1VlnaTZPe+qm/OMTQQQFVofHC2vRYuptNKDYKPtSWRedrMuJn90f13lb19K2BsXj1Ps9s2gaIGH+qwB3QCnmqynGjkJmRuqnSX2SKCKSRqS8VMUKq+Y/RS6njRtG8661/0g7mRisMYtQU0/Yc58WN702iSY8Q== 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=cogS2eDOJsyo8yKrUcDeIx/Ae7epNAjSt0k0hC8PN2s=; b=mf2S9M+YkvGwnAjbCJ0WM1x13dtsEG4jlMIl6ud+X8FUD26Lu42/tQlsFceAsFt88sFBaAHG4Kns3wRH5flwPhN6ZIzdwr8vjJCwC287ZsLgwh9jJuiUmfgNYMCPIknrFWatm85GetRKBpji3uG1JdyEvYwBnLTOm80Uoc7LxBX0ylSQcFD49Z0T/eZ9UzljseOCbrL+3e1C+gdbAudfe5sv6hAL6Ni5nAwnJDarcekpprK6RtSROv8gqmtSQi3WWNxSzKOw9IWfWRssFujOU4EpmVwhLyR9R8b74pf33UJwxveMNttXvvapuBt6pP016QTsbFstSkQx1lGKS63ZWQ== 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=cogS2eDOJsyo8yKrUcDeIx/Ae7epNAjSt0k0hC8PN2s=; b=iJoaSwZ3cgGHbxjdtvhU6gKR5myalpW5PGK5aVDB4O/bz95CaORBXHaJgICcGOc5/xQdQLiLb45Kn86+hVMg5nLG/61ej29s+gICAm6y4KPceUdFSubBSk7510fPSo53ixdkG4H7y2S85yKNJ0VWp25lHUL168tF4n8BRztx/qQ= 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 OS3PR01MB10372.jpnprd01.prod.outlook.com (2603:1096:604:1f9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.31; Wed, 25 Oct 2023 02:18:39 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::f7e9:e682:d78b:f55a]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::f7e9:e682:d78b:f55a%3]) with mapi id 15.20.6933.019; Wed, 25 Oct 2023 02:18:39 +0000 Message-ID: <87edhjbg1u.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v6 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: <87fs1zbg2g.wl-kuninori.morimoto.gx@renesas.com> References: <87fs1zbg2g.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 25 Oct 2023 02:18:38 +0000 X-ClientProxiedBy: TY2PR02CA0040.apcprd02.prod.outlook.com (2603:1096:404:a6::28) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PR01MB8426:EE_|OS3PR01MB10372:EE_ X-MS-Office365-Filtering-Correlation-Id: ecdb6003-dc4a-4a94-94db-08dbd500b305 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: KeJWeJ5bnStzLyfm8ujyG78FCAvjvOF77Ljx2qxi0PJXeudYGt4AAjPuG0NadyN3s1e4jdIPTkRvYS3S4tgTkoDfWDpdgdud3FEhVGVcY2UdsaBK3rBLKm7xGHTLBFEibrOMm2/EdLK6NUARYd12oxsvsKSjgXfQeXUK6KcDcZOQ+J+zaQfm1BorH+y68nPA5BpX2u95fiFE5nYkgPqxz2m3rBszxuBzJVangAb8cc/5REEUAFm0n7xQiyLykeAI0OXRHJUGueVk9qhLBn4Zm6HjF/oGjcFGR8d5VCK808xO/q88pE5LO6We0X9GEuggup2+E8hColChbN1pdJ7GkhPX89EiYtPjsFfhyjhVI5K4x4t1BFCHNnpHlvgt5tB9aPgNgjuEoCOrY/HqplmQ0/GFGQxTaSjuGKN3yNu+NHQtUloGQMeQjki4EXYsBd+MLswmDz63wcfYlgbaPeCR66VR7zugjzIOa1VZw0Vw89J5EDEPPzrsgqYw8mtjXYfYlINIpNv7D1cdSU1/jRNGB0rrt3YONRN85IEiAbHERsQ9l47eqt7NNVCuDIWLlX+lGbjKO2sddigxErjf8GOVIALAUtVMgjZgVF2y2gUrolEjRirdZoXeX/u+DaVhPnXlTs+d3Cxv6Lb5HsAlefRP2CmyAastEpaw0bG0qNg7Bcw= 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)(366004)(376002)(39860400002)(396003)(346002)(136003)(230922051799003)(1800799009)(186009)(451199024)(64100799003)(38350700005)(2616005)(41300700001)(6506007)(966005)(52116002)(83380400001)(6512007)(7416002)(66556008)(26005)(4326008)(8936002)(8676002)(30864003)(6486002)(2906002)(5660300002)(66946007)(478600001)(66476007)(110136005)(316002)(86362001)(38100700002)(36756003)(41533002); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: YA9XTGNJhDNPZL4KS6bVjjw0+gkWMjsU5/NnySyb2pdbv8RD0rC1hYDRvfpud2HdSGpbwz8D0vZalrXkzP96CJt56WNsGFQc41pY7OrqDdGKYrqHvegMVXxPUCex+3bZ4LHfS+ipL+oxkETNSFF1YOngiy6+OWL8BjJClGuoYn3rxXi4hDzuoyMUL0p3jF41V/15Z6imiNOdeSSmoroarducn+5CPAFsO/37h/LyIOiLmSNiv0dhwqp4ccDPTO3aEqIptFZM+gLLUPB+tl9/mf17JCcdC2niWBUu7tfjcbAKthMZ4tVKg5+IfO8diRSd6qG1zJ3A68uKXACooZGkoABdfEAdoKuQpPjHLdVV7LR0ytVK2wAWrT/gF7oLKjnB0i/cnbxLtNJqv3kP2OA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N24lJhF8zNwVSPAbuzysiGdVzTsN+NKO2wWKnyQke5Ggs4OehWbqtu2ZZLHZLRuNkAOhqNnDrhGB55sxzX9QhiT86Jf/WvYEwI16g/gsZQgGSSMugCPDWRMEzD503SEE3jEvZ8CMrhoTIYiYvbh2UK2KRk8= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: ecdb6003-dc4a-4a94-94db-08dbd500b305 X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2023 02:18:39.5247 (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: LUnjIcgEsKqmQA9KmHan9YqpDdCyS6z8oswalx+mqdze62O5QaS302w5bQ6MJEFftJIuqMQYPZ8G4+BOy4+wQ0HF6ZjEZMXHr5+k3YVjxmtfv4AQVpvpQbWiml6opRne X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB10372 Message-ID-Hash: OZ2AKSP2OC5CAMOCGXIEMVFDWMNHBAHH X-Message-ID-Hash: OZ2AKSP2OC5CAMOCGXIEMVFDWMNHBAHH 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 Tested-by: Jerome Brunet Reviewed-by:  Bard Liao --- 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 4e2beda6f9bf..233ebc74c313 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 8c168dc553f6..7198f017c167 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_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; @@ -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_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 Wed Oct 25 02:18:45 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 737878 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 61211C25B48 for ; Wed, 25 Oct 2023 02:24:20 +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 6AFA3850; Wed, 25 Oct 2023 04:23:28 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 6AFA3850 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1698200658; bh=HQL8rKoHZYBVxYyWe+WUmvMUbZWuGjLMnAkU21CSoRc=; 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=DCQ+iRpGr6mF18NvlTnjbog6JvxnEp6ULHGEw71PbMzYHHOwqCcnNoDV460vuSFB3 Oi9SmqCcLB8d1/XaqPhxyv0pxsbnMIsYa2VHqSgNl+tlVYUhwFVXvPIiXAzzb3/ydW xsk7lO2xgYpCaAIijUwf7G2zkjJ3nqK+O6omW2OM= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 793B0F805AA; Wed, 25 Oct 2023 04:21: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 9B5F0F805A9; Wed, 25 Oct 2023 04:21:55 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 90B18F80157; Wed, 25 Oct 2023 04:21:36 +0200 (CEST) Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01on20714.outbound.protection.outlook.com [IPv6:2a01:111:f403:700c::714]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 80A16F80165 for ; Wed, 25 Oct 2023 04:18:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 80A16F80165 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=RUpLnFdN ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=AO1FuZkY2jbXggF2FEOs0yBDcW/ViP6j7565r31gAAt8FR0ptnfzi+dcktFMUmsbFUn1z8LdoIuxHqsAiAm2a75HInezvn45waWErppV//fBCK7/46SrE54WDggosYbumhPtQ1Q31L8lsNGhU6LUhjxtH7gjW3j2YpdRN6O4llx1iPTd2OJ1SZXZ2uWxakU6+8Dsj/7EKheiEZ1EX+5q8IvqgKblztt+4QzKsV/ZCjvchMAamlkyeP87+Y2KfHHNHYAyT36ybyb+4hFFPcO/A+/7ree0t4RJVTO6NMolqpbTts54zDA+ZojG7qUSRh5zp1/MjfH9q8huUXIS5aF4FA== 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=46Pmdfsrpfy9g8xE8r9Ebbo81sVxEfGihxffq/8JwyM=; b=fRNCaSJHcHnmUoblR6bi72scJQ8cHDjx/3Y6wgkmT2RPkFrW+csqUvY0kAnwt3HlEUT9gEAZcwW4nIoY4KKla3ERzcrnn3iSfBRyNGLb4Sojk0z66HBzDDuq7EAufNoMmZfr5IdV6hvf9ONYLVGx1vNkBo6MNY34gMHkVzV+vIUrPVA828Lk1zmOQGUmn+BhSE5m/MWROkbjWNa8NApLqROe3d5OtZq9t6+kisU+15C+9Fa3gQhbcLW2j4dYc9qnOwxAMXhSpdNZCdKiAq1u8nwPHyQkT79VX/QHKf770tf5gzmd3w9wcvjMtywrGJrMV6Yi6UHo5RrpP0anyQrtaA== 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=46Pmdfsrpfy9g8xE8r9Ebbo81sVxEfGihxffq/8JwyM=; b=RUpLnFdNa5/gEGEYtk++U1Okq2yQlmONxD3NzJG34mmmoYfivRXrFOzLRh9gPOMSwWXYEJ1Z0SVaIZ00nAZQ3AOWDXsrJ1Hk9RbXOr+TLq2xe8INxnWEuTzVTRCRVSZr87EJV2fgjeIbbJ6VnZGzVLezmF+o5ouKovMJMbCG8g8= 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 OS3PR01MB10372.jpnprd01.prod.outlook.com (2603:1096:604:1f9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.31; Wed, 25 Oct 2023 02:18:45 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::f7e9:e682:d78b:f55a]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::f7e9:e682:d78b:f55a%3]) with mapi id 15.20.6933.019; Wed, 25 Oct 2023 02:18:45 +0000 Message-ID: <87cyx3bg1m.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v6 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: <87fs1zbg2g.wl-kuninori.morimoto.gx@renesas.com> References: <87fs1zbg2g.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 25 Oct 2023 02:18:45 +0000 X-ClientProxiedBy: TYAPR01CA0151.jpnprd01.prod.outlook.com (2603:1096:404:7e::19) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PR01MB8426:EE_|OS3PR01MB10372:EE_ X-MS-Office365-Filtering-Correlation-Id: a0acd028-fb16-4d5b-0271-08dbd500b75f X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: SyWn8qRqa9UDAOtyuQ55qRPzJNrn4yV+J3GL3sahXcSWJAuNWzSc8xNsmgzfZ9FvM7jUi/w8VFgLAEBhHXJJDh3e3NkZoHG2hpwxccV40y79nohvuU0P1QQNuCqAaICrOkZxgGuwFP8oZkThfe34+9JxMivn6+itbWwtTxWMAlSef9D3tBh+HiSoMZroeXYVPHl7HlAQwcpz4wg9GSmIhTEGxi7OhlKaLhGl4ljqYQaICixZWHBvQN2HcmvBkEFSYuMPuJutqua1PmtmYt9GZQw5hoKXjbmGZxJ0K8jR8TFCOejR+F0YxO78XYbTJvQRlAxT8vJO0rZ+6uKYrXeH5rDmE8UfDBzHm1/VZMVvV0jSaApPYtQHSKxlPaTM0gIfRoVGmpKC9z46WBvIhhIbifIo+1ItyGfj6PsPP6CkansSDgnNS+HUjY7ZkrpXvkUAKnwntu1wjMpHQf7h1t5msPdEmVLhgzkvOIXkouYTn9BWLAorLelzcynwV38vFxfxCk4OwRGhhNKqzvMDJXf5BEaUEj2kOkmsCSIcT7eUFHyotJz4fybkvfTxBu4wM6NB5fZIw9T5zT6zZxpZw/wh9UxJIdrLejskrKDybPW0sZfCk43mbYGizX43BQAX6XQiy6jPQ9YHLm+Z2mZGnmqOJQ== 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)(366004)(376002)(39860400002)(396003)(346002)(136003)(230922051799003)(1800799009)(186009)(451199024)(64100799003)(38350700005)(2616005)(41300700001)(6506007)(52116002)(83380400001)(6512007)(7416002)(66556008)(26005)(4326008)(8936002)(8676002)(6486002)(2906002)(5660300002)(66946007)(478600001)(66476007)(110136005)(2013699003)(316002)(86362001)(38100700002)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: jh2Mzr5vFzigvo+5Ilqx5RJrcFcm6AdrywhTG7qsV3bAyngY+a5HHvulbfbjb1ebeDVS5/h2WZgSHm5DPWUBQSeyqhRwTMhtv+lmcxB4cm9qFTs79YWcyP1fLNS5R87pHYWfbyyxsa+EJjQJM78U33fTpWToHrQyy62oebXiJpTJ9PaCf2MBPIgEq/gYxuyoiL1QlQ/X1yuyqRcIYvEWiJ0mCH41dVt5xvGBtDcYliQIL0Ow8Zzlj32jekhPpfMM7GWe9ETD0HveiN5pbv1iUdodztwFjiNmDCoLv0aO0zwTf+jIbB6Nt5xTG5xKTN8iohtjqQViUZ7NhVD4aHlx6E3Lf2O7LfMPu8Z5dif3MbDEDnYmHnLwJrS2SjZWZgwwj41z21kc5WmRurghcOq0kzjGQ8Z0QtEglVw4d7ulK/6YNP1pm65395SKdV1m+pYIoRFSUOxwO6R9ho4ZAga26BVe/rR8IcXuESNGT0J4ElMyS7b3K/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HT9l3iCqG9aiwYO1BDAVtF19PpO43GJc5DVjc/7EacSUzlxT/UwU038= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: a0acd028-fb16-4d5b-0271-08dbd500b75f X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2023 02:18:45.7420 (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: 0eOlX+hmcZ7f6WW1fUQaXW0tSzNxbEqiPFTy0Px18A3TxaceXaMEPbmZlY9I1VPLqP3qM+NM3dI7AKQSlX7h0d6QHhd+NFmjnvYZJ6ZAXnJcseuF4g4zzAXH+dXAnml6 X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB10372 Message-ID-Hash: Z3YHBRYUN7ASVCFI33PHHAY27EFSUJZE X-Message-ID-Hash: Z3YHBRYUN7ASVCFI33PHHAY27EFSUJZE 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 7146611df730..25a1c7d40be9 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -504,6 +504,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, @@ -513,10 +514,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) @@ -527,7 +549,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 = "channel-map-index"; + 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 Wed Oct 25 02:18:50 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 738358 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 48704C25B48 for ; Wed, 25 Oct 2023 02:23:32 +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 0ED8D852; Wed, 25 Oct 2023 04:22:40 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 0ED8D852 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1698200610; 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=I5OLaeceq1dcUOdASD0cbzKhQG+ZrAriy4PxuCYeH/vZdDXVRRcqI+UdhUHq2QqfZ /bIFrSBt7bNNN07eS8g/TIE8McWotjXlyI+kORuqb0UbrEc8qd9CwaLKt/0ZiVbqUm Zlk2DC1nlHJgEKoA5mRFLMYJu54ShUABXwTjmhgg= Received: by alsa1.perex.cz (Postfix, from userid 50401) id D8445F80567; Wed, 25 Oct 2023 04:21:49 +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 39BD4F8055C; Wed, 25 Oct 2023 04:21:49 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 67907F8055C; Wed, 25 Oct 2023 04:19:06 +0200 (CEST) Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01on20714.outbound.protection.outlook.com [IPv6:2a01:111:f403:700c::714]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id 05E7EF8055A for ; Wed, 25 Oct 2023 04:18:52 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 05E7EF8055A 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=lxh1A0jn ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=JimeMEdX1HmzWNS1Y6qMPSJ1dLsj98pgsdSZtCEK7tPdjg3h7CgPqeB3gka4LJmEYAAm6+3nBEM48AFoqBp5gJhiomSQYE1WIV6opH8CAVs4qRHsgJpxEpJR3vCzxPNK1NTJW44n+pUPWOcbG5s/BlUpQbSS0idjqSCOjV9NoNF+AvYPDuEDwTI1bb/5hdmb+E82XJqlzFiymsWkKSBIfWttHZzSZtDJ/6gHc3o92sGAkOXJ3CabnuPB9hARSiGx83HzVwAmzO0YZsdPdXoI2nHpLUE9WR4BpvI8xiieNvZSvHkP6tKXW5AnhkzlJu/mudvY/kDLn5ICSybmQuRGOQ== 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=T9wqID10B2N798RHRtiTxCeaGsvqixnGjQHxFAbeTrl5R7hbJNNJ8f5uw8Z0C/yGTuKMDB0v5UeqMpwH44OabIuCHso1KprDkxlVOvjf8Xrcs6+D05zN8EO5cfgUVompQ7xbCPQQSoGxTKG48P6cbiu1RhnWHaOwT2njCAnxdtCepJUK+DQtkYwdGD9g/yHQbucPu0766qDfUQpPno1hNLrSzcFFSnN8YFoCYHVlYM/zmGS89OKaTOVIcriKI+m+ogxTXYmwecMtpoxUbXoSDIc9IuXRJVojEPQ6SGr02fjfH/ldvvXWE4wECMNCpkX16aP6SUkjMyCS6chrnWkygw== 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=lxh1A0jnvt2FdTUwLoJFvaLtHQXSEzWvATCVNaZq6nUqwifnZg45BZkqUpelNfahFyGwWZJHpfT2JuVC0gCJZFOUt7dhtG6SnenEho9NLdai48ypWTuQ19TegD+N3e/h69uOOJvwFPXn7t/RGOuzt4jtGhMNpaRS3a83tnzbUaM= 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 OS3PR01MB10372.jpnprd01.prod.outlook.com (2603:1096:604:1f9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.31; Wed, 25 Oct 2023 02:18:50 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::f7e9:e682:d78b:f55a]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::f7e9:e682:d78b:f55a%3]) with mapi id 15.20.6933.019; Wed, 25 Oct 2023 02:18:50 +0000 Message-ID: <87bkcnbg1h.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v6 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: <87fs1zbg2g.wl-kuninori.morimoto.gx@renesas.com> References: <87fs1zbg2g.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 25 Oct 2023 02:18:50 +0000 X-ClientProxiedBy: TYWP286CA0019.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:262::6) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PR01MB8426:EE_|OS3PR01MB10372:EE_ X-MS-Office365-Filtering-Correlation-Id: 0b1a4d9b-7ec7-478e-1e01-08dbd500ba42 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: CuggJCVDCdF2DCbo2TMDd316QQvGKOvsiufbHw6TabRg/xoZ/oFfUTuTWf7xX4bElR92MKEp3vRDvcAu5hlNoFKrAbsGphBtXMDzNB6e+EYaXtLHWV0M1pojT7z4BjE+Ddy0knBDxMMUm+7Z5WhcQx2Y4AvwCD7GvlIy3ZjM3U9WDSDnRWPFn7DQA93HmkWnaKYzWth9/SfIsL+h69U1Ct1yrQON+06NcuNPYmTh2Tz9dZffjAJTXS+66Q/O9tpmHcrS0uvZ6s2cm34SzMQ6aLBMOqvkCFaUTY/mhy7lyEFv6CDLZZBUX9t+fLusd6C2uxWYSqBEGySWexHFjKmunfVbAYfa9g44MK1EiaoXluOx3xkbvSci6oFZQj5sQvsz+4SIE3Vo+pzDCusgyif0JGCDB48k9vRQhDn6Xhsx5w1QRVcF6E6WttyFc673cuabXFQ/J6k5OXVHRrzjClONgUYgOo18mAVY7kCRHR+B3nusF8IIDHhgHujJ51eeMga5K5wP96fxqYc/FWSdWngAqLjYccdlyiRN4aLaSd4ctSJguD1nDE3OsIhYalfofxTW7zyheP++nJFGeG8KXlefi4vme99m0MNz27n/Kd7i3PwQxDnMwvNEvRhs17vB+vdzPkknOMojpTlN0WZKaI/o/Q== 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)(366004)(376002)(39860400002)(396003)(346002)(136003)(230922051799003)(1800799009)(186009)(451199024)(64100799003)(38350700005)(2616005)(41300700001)(6506007)(52116002)(83380400001)(6512007)(7416002)(66556008)(26005)(4326008)(8936002)(8676002)(6486002)(2906002)(5660300002)(66946007)(478600001)(66476007)(110136005)(2013699003)(316002)(86362001)(38100700002)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: I/7wXwHcOp1fNZV8SazgVbSSW1oESY4Ng+dx2mJsPXNrFF7BAC4yDvxo0BDnLRzKqSQvEHuok/D0Vwy/AvNp9tGh+A3d/1cp+W+3a2FirLVuOyBCkgNh683ID6iDnRbg0Yr5FLZHqU0N2cmrgXKMy7s8k3Ot8zQVkA+uNjZITdhW8hf/HdpHrxbgUkWnvV9WcpT4SEqYvgMBHs0BT4Tmu6RNFhj878guhqLEUb0lYxlZEU3B9lDIr7YQgcEOsX6dkokzqeF/rzXW696UJOXqCGklovDusy3Bgcp3wFvJiQKofskZ7WF9UirvqwFriH6ZkK1gFhSy0qHHXybsNFDyl/u1G+yhIJN2bJ1dsv8ZRV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3AZKTZOhzZt56LRI356WNJ8ZPo+71oto+pU8UbjQeJ+NbIe5ilzgXkIsqWMfhcTU+/owEnI2jwJApVQPVp/EAMldpkQiBLyAyfE6g79NDmhpG9+1QvKZKQRfI1FVp/7nXUxApZr8xSLANjGQUa9lqk4mN3aZXid7gxcVxDFFskatJ3fL6EGuo8dMMQXhyIQ9OTxY7inQ= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 0b1a4d9b-7ec7-478e-1e01-08dbd500ba42 X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2023 02:18:50.6638 (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: DdTO0qCaskmVy0Mox1/r0nkVT1He5R4ymL+EYER2BM24OkR0pnVKV35p/tSkhqJxUmARkl57c8uhnU2MChNGulXVo+7JtWvLOfTuJY0eMPfsO0oTTRlQnZPHRqvIXPNt X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB10372 Message-ID-Hash: E36K6YADICSUYQXT7FHKDWQGGP52YZGS X-Message-ID-Hash: E36K6YADICSUYQXT7FHKDWQGGP52YZGS 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 Wed Oct 25 02:18:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 737879 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 99603C07545 for ; Wed, 25 Oct 2023 02:23:34 +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 DEEF4A4C; Wed, 25 Oct 2023 04:22:41 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz DEEF4A4C DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1698200611; bh=Idug1BoSOS9VMn+xZogE4d9uVuMJ+rS6yEqL22vMMpo=; 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=H13Z7PgjQNAoYutvf8LQiZU2cXp/M8RjQ+DeBVafV7IgkVTJMOh+vtK3R5ht6DU1n xxrYMMxejoYfq0TmjAuaZGkkBNKAn5Z6xNaZlD6Iy6K5i26Wr3nyXiS2mJhRqUDrtZ ZgpvIl7+d7Af8zXD1CJ7GaH3aR62k5UuTdt7rcEc= Received: by alsa1.perex.cz (Postfix, from userid 50401) id CF711F80588; Wed, 25 Oct 2023 04:21:52 +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 E430CF80578; Wed, 25 Oct 2023 04:21:51 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id C4B22F8055B; Wed, 25 Oct 2023 04:19:15 +0200 (CEST) Received: from JPN01-OS0-obe.outbound.protection.outlook.com (mail-os0jpn01on2071f.outbound.protection.outlook.com [IPv6:2a01:111:f403:700c::71f]) (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 DBF00F8055A for ; Wed, 25 Oct 2023 04:19:05 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz DBF00F8055A 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=ZvBa3pO/ ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=OWfUKem9d3QyOGaCWFUmEzn3OcX/QEY8qWNmG3MSDcSs1WiO8YjyiO4ez+aZ+VTGQYywP9zrQ6cw6jreWVlQJlxZfQ8R6tHdVYYMiwgdNX55pDC1/pzc3QzuearfFTSSoxMqXLzrK2cGw73oWN4m/V5vlArmXTExnLvNYKWAKNfJ98MKWvOSCsIjSgr8BsMx9m2CbFLXXut8F4jvUJtDu8HhOlF90IzH5iXbd5kyoZwvLYMbKs6vioY0TU+5X2GU8anOgPvEoCrOBQ8g6axQKAXMrrOC9h4VsqoviLKbZ6A3Ptr80Ph2CZMAJelxKZZ+xXRk3dSCRKC4q/SwAk1jAw== 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=+4NxP9ri6wR9QU49HthNKfdmU1xNZLCubvXcLm15/+E=; b=RMu7pyPCUJhUyD/ewc5+yt81bE8926x1Kf03VJmBGe0rtx3CoKM3jtobWuOgHpDHVmDV1gYkVcdO+Izz3afRWq5uhvndbUVwuVPzC+FeYEjjqhM1IsZlPKntcS5cmTucoZD0c/EbfgXSBmxHTMHYEHcXxvTyYsG31bGNZoKER92dD7nPePr+U3hhXck1cSg+O3lx1QIbrsMzw80mqksYmEI9TKxk0Tko5RscgAwQ4+DjeAm/KpZW8YdmSQFU04Q+MXmF72pWSa18Vky0ZbsZF1dIPGsu5Rv6M9kLBjmoTmD3g8Wta61XO1XAZsyqc1YezIiLEGH4FYmqfHq4ErTAUA== 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=+4NxP9ri6wR9QU49HthNKfdmU1xNZLCubvXcLm15/+E=; b=ZvBa3pO/JykRUeBHYLa8Ui0kg4FNt29KFeLfWI72ZDe0zdPuKXd4wVNIByDkEB5pSaV4/g/H8/fMkr7MDypKQ73f+sMl/y8TWH6/xEPP/WscrDkm+pF3B+xurv/ymBv0EgFCuHOOw79o8x5D9S8++eCHvHLtimIbmdjo3i9iENE= 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 OS3PR01MB10372.jpnprd01.prod.outlook.com (2603:1096:604:1f9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.31; Wed, 25 Oct 2023 02:18:59 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::f7e9:e682:d78b:f55a]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::f7e9:e682:d78b:f55a%3]) with mapi id 15.20.6933.019; Wed, 25 Oct 2023 02:18:59 +0000 Message-ID: <87a5s7bg19.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v6 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: <87fs1zbg2g.wl-kuninori.morimoto.gx@renesas.com> References: <87fs1zbg2g.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 25 Oct 2023 02:18:58 +0000 X-ClientProxiedBy: TYAPR01CA0079.jpnprd01.prod.outlook.com (2603:1096:404:2c::19) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PR01MB8426:EE_|OS3PR01MB10372:EE_ X-MS-Office365-Filtering-Correlation-Id: 9453b298-ec9b-4434-5c60-08dbd500bf4e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: /+BvT5gMyhKUvCb2rtMDyjMvcZKXtqPXicvNtHPVvrOpawNziICC3LyLR5ZVmR2dTPcGqDieo+Otixa+ARlA6gFSD9Plbe9HIzzGWhEYk3axc5gJTmC2hraCY2Nq5JGPodzEVP/zZBlvhUo1uDNh0C5OLauOkoZ+XaZQFpsGHTP1Hj52LWHijEh5FIuntBSv6FaM/BHxjjKBXqx47wd09IQ1TYSn0fhM7hA2DocesUdCIaBHBKYix9uynrcfheI7DF5Px8h3fK8elNdE3o7XxAvbjzkjLZt1csvooAoTlRef24DfWtS2K44akXy5/4H4eF9jaf40TksjfhSlRjgMjJ4VWIO81XUNZjd7/T9qWu+zqZQZVgVhLmvcXrQZL3Za1YfC1ZW4eVfNCwNyIV84k1IflCxkbACK8GrwiAedYai/5e3evU6ZABdlckFrlstvCih2tMaerm8ThNWnpw+uQ3bBFK5OwMtFjXcNWZZMe90ELiACka0rRHpoEDI0RI6ZnxplfkgrrWnOmkrSiY2IV84umoZAsWAuDb/J/FB8j2eKmKKeBMShKG3ezxbGsz0z0siE83RVrGmi3fV+02imwAzL6PfYfV+Ruj1+x1DpZ4R0fsIPPlipNVZfdwGxn8mjxO2/IDXY+p0GXna+LydmVQ== 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)(366004)(376002)(39860400002)(396003)(346002)(136003)(230922051799003)(1800799009)(186009)(451199024)(64100799003)(38350700005)(2616005)(41300700001)(6506007)(52116002)(83380400001)(6512007)(7416002)(66556008)(26005)(4326008)(8936002)(8676002)(6486002)(2906002)(5660300002)(66946007)(478600001)(66476007)(110136005)(2013699003)(316002)(86362001)(38100700002)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: qklCoTkN0lJNGX6of/KrjGW/Ll9PIxwAmR5v0RUtbWhsENN5gTdXtwIfg7OVI+bjnTwv8wEb3fYjHI7MudL97iOYR+NMEA4PswgEds6rM0MTLxtT0+LK0Nwz/BmcMwUubWerzpetr/FDG0Pk+TAe5o9CUte0llP0CyPyDdBYg34Pxa71dKhPVLJaL8NHx8xkAs6HwBAsoHfsRPyvygwse7MM/EJvkeEMPeGPLSdT8tmSVHWAl6+VNMIuuEjgfAx1OS/+2UKAp870DkHlo3DULydrTQdw5xqEdpPilBz5rAXwMjHhaJw3gicM3PQfl3nIawoq8o4cBTBxjee6wTg9uytePhCjAFunBBACvQE8X209xNuuVrfBneFU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pcsKRI1C8HT21oVD55Qtwael+vwUEhA1fzy/gUh7WL3Zhu8K361kX57X6wrUrzEWCxGazm6/ShSW2kpmWq1+OSAQw/+O6tBeKNUmG5A5g3nA4fXlewT8Hs2oyLG6Xts5t2MM/1MHeVR6d2Q371ZfQIERM55/ZEsGyRv7ctK12ct5ELS1yxZ9z0qNEWlkZ6ItE= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9453b298-ec9b-4434-5c60-08dbd500bf4e X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2023 02:18:59.1350 (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: F6wOXgYxxgEZyooMziknW5FapIxjONqH8XNGgnaw+KalEe0zCrY6s8oInnEPqhZrMnbGJpLJgfkcw5L8rOGFOWKl/uwG9TBER0PMvUB1KbZv8Tb7/YChUbVYKrQN5qZU X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB10372 Message-ID-Hash: OFENAQ3FRH7MO3DQAUB4BR2VZLGHJ22B X-Message-ID-Hash: OFENAQ3FRH7MO3DQAUB4BR2VZLGHJ22B 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..f792ada69f02 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 / channel-map-index (*), 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 + * +-+ ^-- channel-map-index --^ + * + * [Multi-CPU/Codec-2] + * About ch-map / channel-map-index (*), 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 + * +-+ ^-- channel-map-index --^ + * * [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>; channel-map-index = <0>; }; }; + port@9 { reg = <9>; cpu9_ep: endpoint { remote-endpoint = <&mcpu12_ep>; channel-map-index = <1 2>; }; }; + + /* [Multi-CPU-2] */ + port@a { reg = <10>; cpu10_ep: endpoint { remote-endpoint = <&mcpu21_ep>; channel-map-index = <0>; }; }; + port@b { reg = <11>; cpu11_ep: endpoint { remote-endpoint = <&mcpu22_ep>; channel-map-index = <1>; }; }; + port@c { reg = <12>; cpu12_ep: endpoint { remote-endpoint = <&mcpu23_ep>; channel-map-index = <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>; channel-map-index = <0>;}; }; + port@f { reg = <15>; codec15_ep: endpoint { remote-endpoint = <&mcodec12_ep>; channel-map-index = <1>;}; }; + port@10 { reg = <16>; codec16_ep: endpoint { remote-endpoint = <&mcodec13_ep>; channel-map-index = <2>;}; }; + + /* [Multi-Codec-2] */ + port@11 { reg = <17>; codec17_ep: endpoint { remote-endpoint = <&mcodec21_ep>; channel-map-index = <0>; }; }; + port@12 { reg = <18>; codec18_ep: endpoint { remote-endpoint = <&mcodec22_ep>; channel-map-index = <1 2>;}; }; }; }; }; From patchwork Wed Oct 25 02:19:13 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 738357 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 07602C07545 for ; Wed, 25 Oct 2023 02:23:52 +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 B4300BC0; Wed, 25 Oct 2023 04:22:59 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz B4300BC0 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1698200629; bh=Ab5X2HQ60rNtQCh4/8KHmH5NGP/BZoFfFpdRGnvTH3A=; 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=I/69qUcE8htkCnqcRT1O5vpYgLb6iJbjWIakNh6VOyZOXmsn5wm69gLFIchu+IEee V/rTMhw0Hk5t3wuy9VeKlM46AvdWyGI8NEc25jWAXYvYkmv0ze8AKhAapQdH6v+mN3 poq6LShsNKklJ18q5CijCErKnZYTe1y8+0B4k07I= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 1AC57F805A1; Wed, 25 Oct 2023 04:21:53 +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 40DA2F80580; Wed, 25 Oct 2023 04:21:53 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 110B5F8055B; Wed, 25 Oct 2023 04:19:26 +0200 (CEST) Received: from JPN01-TYC-obe.outbound.protection.outlook.com (mail-tycjpn01on20701.outbound.protection.outlook.com [IPv6:2a01:111:f403:2019::701]) (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 BEDDFF8024E for ; Wed, 25 Oct 2023 04:19:19 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz BEDDFF8024E 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=RwLarmR3 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ElyfjbnWaa76BvdI+K971ltrYQ8vLypcFjU9lIKy5QzQB8XjlqXT2DLTsXa6+ZQE9SSlH62CBqhW5r5R1l5Dp2wU4o8F+TK3DXh/Lp9W7X/5KvdHTC9QnpdMxwO1SWDohX7HvMrNhCIFFmFp2ECJmqoHQMgLv3W2O4oVipA+AtC/81ynP2gq0eJQVG2Br6/jxTUE5ApHAiHjKNdaatljUUru9utfXbN9Y5HjvZAuwIrDcoQZXwdzYgFspSdlRkU1QPMqb54XJ7LjoskC+MSWR9DlflrVCzIV25gXhJNx1OY6SnMJ7OBiyTPvRpUbPvVc7OWLhiC2+B4T53BYPsZScA== 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=7mJ1bvcWawDtFDfdiKrmUg496h6QNVvahuspTZO9s6I=; b=mgCaWmXpbzwQwC6LNd6OpkNFykQlj+vIaKLvRVaFQB8iEtq3VmMVm6nqQDTu8m9Wn5Fy6zLPajRZUWipdjAD6DduLVXK2x1YRCIB1RQlPTHdZGc5vi8/3o6Cw+BbMcPQIy6djKkfZz2aJmrYlM+9RT0p59sU3Gq2sdc4CZw94I2VOSfos/VVZkaynXcAuvWwXZUvnpWne9+GkbG4fnXUtOyCuueK06jgRIhDOfvHIbb8HnfF3c/4RX0ZvLC8dzhR0mDeT65uFOgp/bnKnmA92u6X7v1FCFlhSP6SSA7wApxmjGqUQ7hfGBy6YIgAfjfz+OdvaoCYNNFNc8xT9v5JCw== 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=7mJ1bvcWawDtFDfdiKrmUg496h6QNVvahuspTZO9s6I=; b=RwLarmR3AnClcIk1YNy/LFdnLnj3VQj+/SxRP1TQGOtAYDdTlGyXjzla0ud3Sf15+EJ9zSlAtY+vgaiV+V1jk3rZe6p3LRh268N2uGRAYjNpHRaJ+7A/EmdPCg6imO5Oth4jzKTXTbyAuwOY+T9e6nJaiJEeQtXJ8rpq19InOr8= 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 OS3PR01MB10372.jpnprd01.prod.outlook.com (2603:1096:604:1f9::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6907.31; Wed, 25 Oct 2023 02:19:13 +0000 Received: from OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::f7e9:e682:d78b:f55a]) by OS3PR01MB8426.jpnprd01.prod.outlook.com ([fe80::f7e9:e682:d78b:f55a%3]) with mapi id 15.20.6933.019; Wed, 25 Oct 2023 02:19:13 +0000 Message-ID: <878r7rbg0v.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH v6 5/5] dt-bindings: audio-graph-port: add channel-map-index 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: <87fs1zbg2g.wl-kuninori.morimoto.gx@renesas.com> References: <87fs1zbg2g.wl-kuninori.morimoto.gx@renesas.com> Date: Wed, 25 Oct 2023 02:19:13 +0000 X-ClientProxiedBy: TYCP286CA0054.JPNP286.PROD.OUTLOOK.COM (2603:1096:400:2b5::19) To OS3PR01MB8426.jpnprd01.prod.outlook.com (2603:1096:604:194::10) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: OS3PR01MB8426:EE_|OS3PR01MB10372:EE_ X-MS-Office365-Filtering-Correlation-Id: 33c25774-256b-41d4-d619-08dbd500c7df X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: JkE+nNrKGqsscd2wK2VmmxOhflqU4076Id4mVcmn9wzKBPduT3KgMqFM/15lPb5W4ndH6JkqnfPprcnVhXInbeq1ORF24G8X/55j1WfE4DfpznmlMUfPSrAZ7RqiyJ5KF/o+RQhpP+8dVYxgE2PqzEJWfXjbfKp0NuHISMA1phJCimsE3B9XKnsjPpteaKAVVm6Omn85Ke9s2s6b0FDNpdlL/cLToWKlMkycyUY/deUVwk+2bty2wC2QLUB9CQoFNTsATDfYuFb+eVVl7yP26pzUllyVRX0dZz73mGCYkdv31cdqgTGdUX2E2xcWcW/CoKU8Gk+VllSHM+xFjYm9p0iQOpi/E7Tr3wh98ueJ/RZryPUe8YDFjqcFcfM0VwcNUBRsVbXMaJz7sPUv6fbLxafmyxMQCUCxFZy37vyoRHM4LYP59dvPQ98WsU2mpMCTh7Saj8rYu8zav4460cu6EYbmDxgqWKtruSDj58cEc84iYU61aIR8x2ii+ORJl+8SPw61o1ltYTcSnjbho7sqOKWSvDkcNlxgiDr2JWTWE6kXFnN9LBEONesEi97wyFkmRLJS6+/RFMRHdF8TUgjvQXcc5faJCDwD+HNL5TPX8DApJXsdsoJp1FaAzWz2ps2WezgxQUj2hwJWaFxdLZSKDg== 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)(366004)(376002)(39860400002)(396003)(346002)(136003)(230922051799003)(1800799009)(186009)(451199024)(64100799003)(38350700005)(2616005)(41300700001)(6506007)(52116002)(6512007)(7416002)(66556008)(26005)(4326008)(8936002)(8676002)(6486002)(2906002)(5660300002)(66946007)(478600001)(66476007)(110136005)(2013699003)(316002)(86362001)(38100700002)(36756003); DIR:OUT; SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: GXtYAxLbPHy8ShfKFWX68GkyFVTItJpCfA6rYr6RxEP/n3MGKtux87T2ABQg0QXDrPEDh3XmJO100Vx6G+psx4keSWLR7wN2FzzjW8HrdYW5suVAX+1dq1XUJBLMAkbWrdLuOqaApet7SvZzH1UaUTMsCyb2pcvZoHxYZCjb4ExF7JgG1QEOXt6sBwyxUa2IRpfdgZ8UFOyNEBhz95gBrYmaMJ9BDXDmzGl0mspm9bXCmkozohUffX4lauUwjIggivZ3tvaY4IBGrnj6CcDyRi65qsvdtveHz23a571DJCqLBz4gBACmCL3+rXyfF+vpsLdCvdpC0oeTt+VLk4JnUC0h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2Z4yBvXiTkwsZA082cMi6gEpDAeNhvX26m6A8+Rbsgsuhd4L/K0JQbWNFKLd8NH7klDNVqKA4495fgP/7Hb9VtijCmi9noEv6qvAlquMGfolq5AwW4SIBMlmAoVyekK/MRbyyUIkjUsNWwE70Wss5JTwNttzFWKOQH8rvq/cIWxLl4ntIkdcpxXmvBxGn3/tP9X96sr0/qaSyVaZTpULQ= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: 33c25774-256b-41d4-d619-08dbd500c7df X-MS-Exchange-CrossTenant-AuthSource: OS3PR01MB8426.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Oct 2023 02:19:13.5508 (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: eUd12t9y883Q04pi72JFATr7dnDfor/F9xTBfWZjmOEfkpL7hA2bG2SEdm6Fl9jMp/JbbzYd5IFLzR+QLfJIqp3GlSJMPJTPui5fPQuIT+upOwaY1D/AdID7LPUw3vaU X-MS-Exchange-Transport-CrossTenantHeadersStamped: OS3PR01MB10372 Message-ID-Hash: UXBHHLSFXIPLP5K3CTN2FWFD5CNXKXO6 X-Message-ID-Hash: UXBHHLSFXIPLP5K3CTN2FWFD5CNXKXO6 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 channel-map-index property to enable handling CPU:Codec = N:M connection. Signed-off-by: Kuninori Morimoto --- .../devicetree/bindings/sound/audio-graph-port.yaml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml index 60b5e3fd1115..2a7e0784d591 100644 --- a/Documentation/devicetree/bindings/sound/audio-graph-port.yaml +++ b/Documentation/devicetree/bindings/sound/audio-graph-port.yaml @@ -93,6 +93,19 @@ definitions: minimum: 1 maximum: 64 + channel-map-index: + description: It indicates CPU/Codec DAIs channel mapping index if number of + CPU(N) / Codec(M) were not same in one dai-link. channel-map-index is not + needed if the numbers were 1:M or N:1 or N==M. Same indexed CPU <-> Codec + will be paired. This is CPUx2 <-> Codecx3 sample. + CPUA { ... .channel-map-index = <0>; } + [0] CPUA <---> CodecA CPUB { ... .channel-map-index = <1 2>; } + [1] CPUB <-+-> CodecB + [2] \-> CodecC CodecA { ... .channel-map-index = <0>; } + CodecB { ... .channel-map-index = <1>; } + CodecC { ... .channel-map-index = <2>; } + $ref: /schemas/types.yaml#/definitions/uint32-array + ports: $ref: "#/definitions/port-base" unevaluatedProperties: false