Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp968741yba; Thu, 16 May 2019 11:52:08 -0700 (PDT) X-Google-Smtp-Source: APXvYqwEAVK7GYwFH9l7vIsvlLnGHquBZgjTqK7s66chHrdXjPxbwkoTIoJWXFVhUGvHzDDj7GiD X-Received: by 2002:aa7:86c3:: with SMTP id h3mr54140533pfo.169.1558032728140; Thu, 16 May 2019 11:52:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1558032728; cv=none; d=google.com; s=arc-20160816; b=wK3qQb2sOg9RXxZCd80n7CISY6NR5N54IRspcd2abvdocA7E9yPx/MRhBNZlHp2t2l xcLUU25n6UOdnnxIBXZIe6VIT8wJDtu/PjkBH18C0L83TMhbo0W38dgJ4Sv9uppjcNyo x/Pg02VcWA0mzq2SRCoLcsU/mla/dz/kRFZ16PQUzCFHv+8ALVOK1/EzW0Zgm/lap3Ri aSSztfIOqA6P8rVJQOeytOJUI/11M4FLFvo6B2fKWazu/owr6nHujsoJ6Pb3byAXcPBR OwnduHzfOfclIdr3Ch8pX4szz6XdQZqHdgo1O743KHqTv4Tx0akZPalaSckwN0e0qTgZ a+Fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:dkim-signature:mime-version:message-id :date:subject:cc:to:from; bh=yB3KkuZkbrO3YjQsTuD3PSDyuis5tu4UMkVyz1IzSIs=; b=SsF2zOODiICXpRAJ7sz2Y9GGlsOXENeh2nz+J6jRSGtAC284rwx1LscgTWXtbXeDyq JCjRntdgxmJpshFylhFm90p0M6rnP6HTxxWVMxrv9/Wqjqfdg+3VNGJCFT1SlUvyHY6w ddwTMSr0TuJ4fR6AqY+HdtGcpFp9+lnmUvXdS4CY8ztrO7kTQFXtG2diOBEEk5TmSkge EVqefk4L1Z2LRve27RMCSxe71ItbQkzFMDa2lLAWl6NNigL214XdQU0kkMaiNQK1f1yC 6pDjQzXhwk53eTVhwtE8UkKO4opFLN6CMjmxqRz5p8VIC7nTpURYf6MjoCuJlv/IFITO SHEQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nvidia.com header.s=n1 header.b=PuCiB1me; 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=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id n20si5498788plp.141.2019.05.16.11.51.52; Thu, 16 May 2019 11:52:08 -0700 (PDT) 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; dkim=pass header.i=@nvidia.com header.s=n1 header.b=PuCiB1me; 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=pass (p=NONE sp=NONE dis=NONE) header.from=nvidia.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728100AbfEPRvf (ORCPT + 99 others); Thu, 16 May 2019 13:51:35 -0400 Received: from hqemgate14.nvidia.com ([216.228.121.143]:2856 "EHLO hqemgate14.nvidia.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726441AbfEPRvf (ORCPT ); Thu, 16 May 2019 13:51:35 -0400 Received: from hqpgpgate101.nvidia.com (Not Verified[216.228.121.13]) by hqemgate14.nvidia.com (using TLS: TLSv1.2, DES-CBC3-SHA) id ; Thu, 16 May 2019 10:51:40 -0700 Received: from hqmail.nvidia.com ([172.20.161.6]) by hqpgpgate101.nvidia.com (PGP Universal service); Thu, 16 May 2019 10:51:34 -0700 X-PGP-Universal: processed; by hqpgpgate101.nvidia.com on Thu, 16 May 2019 10:51:34 -0700 Received: from HQMAIL101.nvidia.com (172.20.187.10) by HQMAIL106.nvidia.com (172.18.146.12) with Microsoft SMTP Server (TLS) id 15.0.1473.3; Thu, 16 May 2019 17:51:33 +0000 Received: from hqnvemgw01.nvidia.com (172.20.150.20) by HQMAIL101.nvidia.com (172.20.187.10) with Microsoft SMTP Server (TLS) id 15.0.1473.3 via Frontend Transport; Thu, 16 May 2019 17:51:33 +0000 Received: from moonraker.nvidia.com (Not Verified[10.21.132.148]) by hqnvemgw01.nvidia.com with Trustwave SEG (v7,5,8,10121) id ; Thu, 16 May 2019 10:51:33 -0700 From: Jon Hunter To: Liam Girdwood , Mark Brown , Jaroslav Kysela , Takashi Iwai CC: , , , Jon Hunter Subject: [RFC PATCH] ASoC: simple-card: Fix configuration of DAI format Date: Thu, 16 May 2019 18:51:26 +0100 Message-ID: <1558029086-18024-1-git-send-email-jonathanh@nvidia.com> X-Mailer: git-send-email 2.7.4 X-NVConfidentiality: public MIME-Version: 1.0 Content-Type: text/plain DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nvidia.com; s=n1; t=1558029100; bh=yB3KkuZkbrO3YjQsTuD3PSDyuis5tu4UMkVyz1IzSIs=; h=X-PGP-Universal:From:To:CC:Subject:Date:Message-ID:X-Mailer: X-NVConfidentiality:MIME-Version:Content-Type; b=PuCiB1me1b0alm/045Qy0kui84kFwIbn4YYbcyMVGdaWVS4UvqNsTVj/5zCl2QlUC uhFLGj0c3fS47hdG2uq5fj9107eXUpsqxRYNkiVcZdP2h+uuJ5wDwiTWhaXGAlRzaI L4krH4K3JO+tr9iFmwLlnf/OeQTtiWHhbJAGuKsq8vCrN5pAwToUqXwbYY5uZBJGre rgJvk2hiC7qU+9fHZPsaOwoyopOlX2OAFq1G5fmUroZMJ3eB9eQFSIxMcO4uYC9KRN Z0ajrFMPg7PXcmyO1MV7BU5rHBirhfHlJFEnhrLMoJfXVIJNY+4GYBMaK71HP3A0pt fZs3o1pFVdVxQ== Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When configuring a codec to be both bit-clock and frame-master, it was found that the codec was always configured as bit-clock and frame-slave. Looking at the simple_dai_link_of() function there appears to be two problems with the configuration of the DAI format, which are ... 1. The function asoc_simple_parse_daifmt() is called before the function asoc_simple_parse_codec() and this means that the device-tree node for the codec has not been parsed yet, which is needed by the function asoc_simple_parse_daifmt() to determine who is the codec. 2. The phandle passed to asoc_simple_parse_daifmt() is the phandle to the 'codec' node and not the phandle of the actual codec defined by the 'sound-dai' property under the 'codec' node. Fix the above by moving the call to asoc_simple_parse_daifmt() after the the call to asoc_simple_parse_codec() and pass the phandle for the codec to asoc_simple_parse_daifmt(). Signed-off-by: Jon Hunter --- sound/soc/generic/simple-card.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 9b568f578bcd..c2c8dcbcf795 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -283,11 +283,6 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv, codec_dai = dai_props->codec_dai = &priv->dais[li->dais++]; - ret = asoc_simple_parse_daifmt(dev, node, codec, - prefix, &dai_link->dai_fmt); - if (ret < 0) - goto dai_link_of_err; - simple_parse_mclk_fs(top, cpu, codec, dai_props, prefix); ret = asoc_simple_parse_cpu(cpu, dai_link, &single_cpu); @@ -298,6 +293,11 @@ static int simple_dai_link_of(struct asoc_simple_priv *priv, if (ret < 0) goto dai_link_of_err; + ret = asoc_simple_parse_daifmt(dev, node, dai_link->codecs->of_node, + prefix, &dai_link->dai_fmt); + if (ret < 0) + goto dai_link_of_err; + ret = asoc_simple_parse_platform(plat, dai_link); if (ret < 0) goto dai_link_of_err; -- 2.7.4