From patchwork Mon Dec 9 13:53:53 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Daniel Baluta X-Patchwork-Id: 181025 Delivered-To: patch@linaro.org Received: by 2002:a92:3001:0:0:0:0:0 with SMTP id x1csp4375303ile; Mon, 9 Dec 2019 05:54:04 -0800 (PST) X-Google-Smtp-Source: APXvYqzewi5b/fmul8X2AYrTW08uarEQGPdYSOWTp50NF5j6Zlh5ZyjZjiXd6yn6KRMnkC7L4i72 X-Received: by 2002:a9d:7e8c:: with SMTP id m12mr21849166otp.346.1575899644632; Mon, 09 Dec 2019 05:54:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575899644; cv=none; d=google.com; s=arc-20160816; b=ME9rSfWSEI6h3kcOMECqAce1+7UocWyBCWC9BDZtK32qCLm9RlIXK+CxwzOp8afKrS goS+rNGEyD5tPVsqHzpDdCzz1C5YH32+nJdv4FerDs0PozUCS5kB5V7h4jyUdd92Zq8T yc+bfF8aEpMe5Y7Q+t7zMVLHCX08D/i8uEboLAarpBgp/rzlECbDb0yBr9JaUjK6jPBI sgj3VaF/UOCQMSE6fIRrNkK7Jj++lgmnyaQH/vxkqddfNn2hu0UyPQGZG0Z4Q6jO6Qv7 Q9qwWfw8ZvYv1ny3+ih1zcjgO+36oYgNluImy+uL0P2ZiWt6wtB05bMNOkSHKRlZa6rg gDPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from; bh=3OPCmFGDn/5KfEg5gfosgGkscPHya1fjm4ZHZTLdMOE=; b=u3F8DlNIYoOk0jiymQFdfYqka05WNQCquFskOA5fgyjaF0y2Dl54Uy6pV8/7zD3Pgu FcxzWVRkPt5P4J8retnjNB+0Zy30QC/xfvtBpbwUYy+6QaG4yMTHWMdmVxs2ycWn1X4u pnWx5OlAZ+1pNw7NHCc9TwNjUiKC+hQW/KR7CqLU/WSFMOwpEM4HJvkLWdBtGj2FuWrD dRKHudsEuU+Ac2T55Zg3nncz131NruT8p1OLSvwldPasPzsmDX8oyx6HF0fl+tmaW3h2 x6rXMJKhjW3gDp1QfLdRpBbovo25ctj5+xcqabeYAc3IH6AFiE+sZruEH6J3yVXXQ6ad VUtw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 10si11503229oin.212.2019.12.09.05.54.04; Mon, 09 Dec 2019 05:54:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727813AbfLINyC (ORCPT + 27 others); Mon, 9 Dec 2019 08:54:02 -0500 Received: from inva020.nxp.com ([92.121.34.13]:47258 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727436AbfLINyA (ORCPT ); Mon, 9 Dec 2019 08:54:00 -0500 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 1C4F51A0789; Mon, 9 Dec 2019 14:53:59 +0100 (CET) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 101611A0781; Mon, 9 Dec 2019 14:53:59 +0100 (CET) Received: from fsr-ub1864-103.ro-buh02.nxp.com (fsr-ub1864-103.ea.freescale.net [10.171.82.17]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id B375C20564; Mon, 9 Dec 2019 14:53:58 +0100 (CET) From: Daniel Baluta To: broonie@kernel.org Cc: kuninori.morimoto.gx@renesas.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, Daniel Baluta Subject: [PATCH] ASoC: simple-card: Don't create separate link when platform is present Date: Mon, 9 Dec 2019 15:53:53 +0200 Message-Id: <20191209135353.17427-1-daniel.baluta@nxp.com> X-Mailer: git-send-email 2.17.1 X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In normal sound case all DAIs are detected as CPU-Codec. simple_dai_link_of supports the presence of a platform but it counts it as a CPU DAI resulting in the creation of an extra link. Adding a platform property to a link description like: simple-audio-card,dai-link { cpu { sound-dai = <&sai1>; }; plat { sound-dai = <&dsp>; }; codec { sound-dai = <&wm8960>; } will result in the creation of two links: * sai1 <-> wm8960 * dsp <-> wm8960 which is obviously not what we want. We just want one single link with: * sai1 <-> wm8960 (and platform set to dsp). Signed-off-by: Daniel Baluta --- sound/soc/generic/simple-card.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.17.1 Acked-by: Kuninori Morimoto diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 10b82bf043d1..55e9f8800b3e 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -371,6 +371,7 @@ static int simple_for_each_link(struct asoc_simple_priv *priv, do { struct asoc_simple_data adata; struct device_node *codec; + struct device_node *plat; struct device_node *np; int num = of_get_child_count(node); @@ -381,6 +382,9 @@ static int simple_for_each_link(struct asoc_simple_priv *priv, ret = -ENODEV; goto error; } + /* get platform */ + plat = of_get_child_by_name(node, is_top ? + PREFIX "plat" : "plat"); /* get convert-xxx property */ memset(&adata, 0, sizeof(adata)); @@ -389,6 +393,8 @@ static int simple_for_each_link(struct asoc_simple_priv *priv, /* loop for all CPU/Codec node */ for_each_child_of_node(node, np) { + if (plat == np) + continue; /* * It is DPCM * if it has many CPUs,