From patchwork Thu Oct 17 07:05:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Biju Das X-Patchwork-Id: 11194969 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 493FF13BD for ; Thu, 17 Oct 2019 07:09:46 +0000 (UTC) Received: from mail.linuxfoundation.org (mail.linuxfoundation.org [140.211.169.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 31E5620640 for ; Thu, 17 Oct 2019 07:09:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 31E5620640 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=bp.renesas.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=cip-dev-bounces@lists.cip-project.org Received: from mail.linux-foundation.org (localhost [127.0.0.1]) by mail.linuxfoundation.org (Postfix) with ESMTP id 05D471084; Thu, 17 Oct 2019 07:07:25 +0000 (UTC) X-Original-To: cip-dev@lists.cip-project.org Delivered-To: cip-dev@mail.linuxfoundation.org Received: from smtp1.linuxfoundation.org (smtp1.linux-foundation.org [172.17.192.35]) by mail.linuxfoundation.org (Postfix) with ESMTPS id 498EB1059 for ; Thu, 17 Oct 2019 07:07:23 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp1.linuxfoundation.org (Postfix) with ESMTP id B75DA5D3 for ; Thu, 17 Oct 2019 07:07:22 +0000 (UTC) X-IronPort-AV: E=Sophos;i="5.67,306,1566831600"; d="scan'208";a="29100800" Received: from unknown (HELO relmlir6.idc.renesas.com) ([10.200.68.152]) by relmlie6.idc.renesas.com with ESMTP; 17 Oct 2019 16:07:21 +0900 Received: from be1yocto.ree.adwin.renesas.com (unknown [172.29.43.62]) by relmlir6.idc.renesas.com (Postfix) with ESMTP id D26584125436; Thu, 17 Oct 2019 16:07:19 +0900 (JST) From: Biju Das To: cip-dev@lists.cip-project.org, Nobuhiro Iwamatsu , Pavel Machek Date: Thu, 17 Oct 2019 08:05:10 +0100 Message-Id: <1571295929-47286-39-git-send-email-biju.das@bp.renesas.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1571295929-47286-1-git-send-email-biju.das@bp.renesas.com> References: <1571295929-47286-1-git-send-email-biju.das@bp.renesas.com> X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on smtp1.linux-foundation.org Cc: Biju Das Subject: [cip-dev] [PATCH 4.19.y-cip 38/57] ASoC: rsnd: add missing TDM Split mode support for simple-card X-BeenThere: cip-dev@lists.cip-project.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: cip-dev-bounces@lists.cip-project.org Errors-To: cip-dev-bounces@lists.cip-project.org From: Kuninori Morimoto commit 538a4ffea3f719ed8f853f78826e360aee5fe9d7 upstream. commit f69f452243e4e1 ("ASoC: rsnd: add TDM Split mode support") added TDM Split mode support for rsnd driver. But, it cares audio-graph-card style only. We can't use TDM Split mode on simple-card style now. This patch fixup this issue. Fixes: f69f452243e4e1 ("ASoC: rsnd: add TDM Split mode support") Signed-off-by: Kuninori Morimoto Signed-off-by: Mark Brown Signed-off-by: Biju Das --- sound/soc/sh/rcar/core.c | 53 ++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 4a88c97..c0b7d85 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -1025,6 +1025,49 @@ static const struct snd_soc_dai_ops rsnd_soc_dai_ops = { .prepare = rsnd_soc_dai_prepare, }; +static void rsnd_parse_connect_simple(struct rsnd_priv *priv, + struct device_node *dai_np, + int dai_i, int is_play) +{ + struct device *dev = rsnd_priv_to_dev(priv); + struct rsnd_dai *rdai = rsnd_rdai_get(priv, dai_i); + struct rsnd_dai_stream *io = is_play ? + &rdai->playback : + &rdai->capture; + struct device_node *ssiu_np = rsnd_ssiu_of_node(priv); + struct device_node *np; + int i, j; + + if (!ssiu_np) + return; + + if (!rsnd_io_to_mod_ssi(io)) + return; + + /* + * This driver assumes that it is TDM Split mode + * if it includes ssiu node + */ + for (i = 0;; i++) { + struct device_node *node = is_play ? + of_parse_phandle(dai_np, "playback", i) : + of_parse_phandle(dai_np, "capture", i); + + if (!node) + break; + + j = 0; + for_each_child_of_node(ssiu_np, np) { + if (np == node) { + rsnd_flags_set(io, RSND_STREAM_TDM_SPLIT); + dev_dbg(dev, "%s is part of TDM Split\n", io->name); + } + j++; + } + + } +} + static void rsnd_parse_connect_graph(struct rsnd_priv *priv, struct rsnd_dai_stream *io, struct device_node *endpoint) @@ -1240,8 +1283,14 @@ static int rsnd_dai_probe(struct rsnd_priv *priv) dai_i++; } } else { - for_each_child_of_node(dai_node, dai_np) - __rsnd_dai_probe(priv, dai_np, dai_i++); + for_each_child_of_node(dai_node, dai_np) { + __rsnd_dai_probe(priv, dai_np, dai_i); + if (rsnd_is_gen3(priv)) { + rsnd_parse_connect_simple(priv, dai_np, dai_i, 1); + rsnd_parse_connect_simple(priv, dai_np, dai_i, 0); + } + dai_i++; + } } return 0;