From patchwork Fri Jun 23 12:03:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mark Brown X-Patchwork-Id: 9806325 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 024CA6089D for ; Fri, 23 Jun 2017 12:13:11 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E1AD22874A for ; Fri, 23 Jun 2017 12:13:10 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D6B20286B9; Fri, 23 Jun 2017 12:13:10 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 256B72874A for ; Fri, 23 Jun 2017 12:13:10 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id C7038266B9F; Fri, 23 Jun 2017 14:03:54 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 23778266BA6; Fri, 23 Jun 2017 14:03:50 +0200 (CEST) Received: from mezzanine.sirena.org.uk (mezzanine.sirena.org.uk [106.187.55.193]) by alsa0.perex.cz (Postfix) with ESMTP id 7B04B266AE9 for ; Fri, 23 Jun 2017 14:03:48 +0200 (CEST) Received: from debutante.sirena.org.uk ([2001:470:1f1d:6b5::3] helo=debutante) by mezzanine.sirena.org.uk with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.89) (envelope-from ) id 1dONJL-0003W3-KB; Fri, 23 Jun 2017 12:03:41 +0000 Received: from broonie by debutante with local (Exim 4.89) (envelope-from ) id 1dONJI-0006Ko-VZ; Fri, 23 Jun 2017 13:03:36 +0100 From: Mark Brown To: Kuninori Morimoto In-Reply-To: <87fuesczrm.wl%kuninori.morimoto.gx@renesas.com> Message-Id: Date: Fri, 23 Jun 2017 13:03:36 +0100 X-SA-Exim-Connect-IP: 2001:470:1f1d:6b5::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk X-SA-Exim-Version: 4.2.1 (built Tue, 02 Aug 2016 21:08:31 +0000) X-SA-Exim-Scanned: No (on mezzanine.sirena.org.uk); Unknown failure Cc: linux-renesas-soc@vger.kernel.org, alsa-devel@alsa-project.org, Mark Brown , Simon Subject: [alsa-devel] Applied "ASoC: audio-graph-scu-card: support 2nd codec endpoint on DT" to the asoc tree X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP The patch ASoC: audio-graph-scu-card: support 2nd codec endpoint on DT has been applied to the asoc tree at git://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git All being well this means that it will be integrated into the linux-next tree (usually sometime in the next 24 hours) and sent to Linus during the next merge window (or sooner if it is a bug fix), however if problems are discovered then the patch may be dropped or reverted. You may get further e-mails resulting from automated or manual testing and review of the tree, please engage with people reporting problems and send followup patches addressing any issues that are reported if needed. If any updates are required or you are submitting further changes they should be sent as incremental updates against current git, existing patches will not be replaced. Please add any relevant lists and maintainers to the CCs when replying to this mail. Thanks, Mark From f1f940490d3ccff96da9cc81d57c2c083c398a18 Mon Sep 17 00:00:00 2001 From: Kuninori Morimoto Date: Thu, 22 Jun 2017 06:22:49 +0000 Subject: [PATCH] ASoC: audio-graph-scu-card: support 2nd codec endpoint on DT audio-graph-scu-card can handle below connection which is mainly for sound mixing purpose. +----------+ +-------+ | CPU0--+--|-->| Codec | | | | +-------+ | CPU1--+ | +----------+ >From OF-graph point of view, it should have CPU0 <-> Codec, and CPU1 <-> Codec on DT. But current driver doesn't care about 2nd connection of Codec, because it is dummy from DPCM point of view. This patch can care 2nd Codec connection, and it should be supported from OF-graph point of view. It still have backward compatibility. Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown --- .../bindings/sound/audio-graph-scu-card.txt | 9 +++++-- sound/soc/generic/audio-graph-scu-card.c | 28 +++++++++++++++++++--- 2 files changed, 32 insertions(+), 5 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/audio-graph-scu-card.txt b/Documentation/devicetree/bindings/sound/audio-graph-scu-card.txt index b63c5594bbb3..8b8afe9fcb31 100644 --- a/Documentation/devicetree/bindings/sound/audio-graph-scu-card.txt +++ b/Documentation/devicetree/bindings/sound/audio-graph-scu-card.txt @@ -90,9 +90,12 @@ Example 2. 2 CPU 1 Codec (Mixing) ... port { - codec_endpoint: endpoint { + codec_endpoint0: endpoint { remote-endpoint = <&cpu_endpoint0>; }; + codec_endpoint1: endpoint { + remote-endpoint = <&cpu_endpoint1>; + }; }; }; @@ -101,7 +104,7 @@ Example 2. 2 CPU 1 Codec (Mixing) ports { cpu_port0: port { cpu_endpoint0: endpoint { - remote-endpoint = <&codec_endpoint>; + remote-endpoint = <&codec_endpoint0>; dai-format = "left_j"; ... @@ -109,6 +112,8 @@ Example 2. 2 CPU 1 Codec (Mixing) }; cpu_port1: port { cpu_endpoint1: endpoint { + remote-endpoint = <&codec_endpoint1>; + dai-format = "left_j"; ... }; diff --git a/sound/soc/generic/audio-graph-scu-card.c b/sound/soc/generic/audio-graph-scu-card.c index 061c7a60d6b4..dcd2df37bc3b 100644 --- a/sound/soc/generic/audio-graph-scu-card.c +++ b/sound/soc/generic/audio-graph-scu-card.c @@ -183,6 +183,8 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv) struct device_node *cpu_ep; struct device_node *codec_ep; struct device_node *rcpu_ep; + struct device_node *codec_port; + struct device_node *codec_port_old; unsigned int daifmt = 0; int dai_idx, ret; int rc, codec; @@ -235,6 +237,7 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv) } dai_idx = 0; + codec_port_old = NULL; for (codec = 0; codec < 2; codec++) { /* * To listup valid sounds continuously, @@ -245,15 +248,22 @@ static int asoc_graph_card_parse_of(struct graph_card_data *priv) cpu_port = it.node; cpu_ep = of_get_next_child(cpu_port, NULL); codec_ep = of_graph_get_remote_endpoint(cpu_ep); + codec_port = of_graph_get_port_parent(codec_ep); of_node_put(cpu_port); of_node_put(cpu_ep); of_node_put(codec_ep); + of_node_put(codec_port); if (codec) { - if (!codec_ep) + if (!codec_port) continue; + if (codec_port_old == codec_port) + continue; + + codec_port_old = codec_port; + /* Back-End (= Codec) */ ret = asoc_graph_card_dai_link_of(codec_ep, priv, daifmt, dai_idx++, 0); if (ret < 0) @@ -284,22 +294,34 @@ static int asoc_graph_get_dais_count(struct device *dev) struct device_node *cpu_port; struct device_node *cpu_ep; struct device_node *codec_ep; + struct device_node *codec_port; + struct device_node *codec_port_old; int count = 0; int rc; + codec_port_old = NULL; of_for_each_phandle(&it, rc, node, "dais", NULL, 0) { cpu_port = it.node; cpu_ep = of_get_next_child(cpu_port, NULL); codec_ep = of_graph_get_remote_endpoint(cpu_ep); + codec_port = of_graph_get_port_parent(codec_ep); of_node_put(cpu_port); of_node_put(cpu_ep); of_node_put(codec_ep); + of_node_put(codec_port); if (cpu_ep) count++; - if (codec_ep) - count++; + + if (!codec_port) + continue; + + if (codec_port_old == codec_port) + continue; + + count++; + codec_port_old = codec_port; } return count;