Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp4122132ybl; Mon, 9 Dec 2019 05:56:36 -0800 (PST) X-Google-Smtp-Source: APXvYqyhQRnyacMBdscgvbc7h7ZndWi71H3sIvnbnhqcpH59R1Cb1VQN4TSy3L+XnbCHE1bijFIB X-Received: by 2002:a05:6808:3ca:: with SMTP id o10mr2432012oie.14.1575899796753; Mon, 09 Dec 2019 05:56:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1575899796; cv=none; d=google.com; s=arc-20160816; b=QT0hWEJ1AQJd/h50gPRvUEM5wawqOUYkO1gds/e08NWSbCYvyjtz/5mZIHy/UzzcUQ rhjfPp0wsCoMb6Qi+bTMMKjIaOLARNU0X75h6mI1WsGCOPRpoyicH2SMhBA8q7CnCWXx +MSgAbJJ6QNKwHjHtwdrL3MmZfm8RUBXs1XElLvJeZQfILt8MFdixbL0DmKf8abZil5G rP1SQcpqj94mt/U2mIrbjHK+hVXnenQE0QqFVZ5vB3BvoT586WbjwOWqudYv1sSwJAHM jVkEUM4/yyAts6wwgd5zYMZm+EzAwcSYfq5sgGSr+oBoW0BiSYlQfKLwHMPCnQXhayHW 2gYg== 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 7si11469351oir.183.2019.12.09.05.56.24; Mon, 09 Dec 2019 05:56:36 -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 S1727809AbfLINyC (ORCPT + 99 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(+) 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, -- 2.17.1