From patchwork Wed Aug 6 01:18:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 4682951 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 40FB09F39D for ; Wed, 6 Aug 2014 01:27:13 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6876720170 for ; Wed, 6 Aug 2014 01:27:12 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 359D32018E for ; Wed, 6 Aug 2014 01:27:11 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1XEpyp-0001Fe-8S; Wed, 06 Aug 2014 01:25:27 +0000 Received: from vps0.lunn.ch ([178.209.37.122]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1XEpyf-0008IE-0Q for linux-arm-kernel@lists.infradead.org; Wed, 06 Aug 2014 01:25:17 +0000 Received: from lunn by vps0.lunn.ch with local (Exim 4.80) (envelope-from ) id 1XEpsF-00054W-BU; Wed, 06 Aug 2014 03:18:39 +0200 From: Andrew Lunn To: Russell King Subject: [RFC 5/8] ASoC: simple-card: Don't set DAI format for dynamic DAIs Date: Wed, 6 Aug 2014 03:18:29 +0200 Message-Id: <1407287912-19447-6-git-send-email-andrew@lunn.ch> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1407287912-19447-1-git-send-email-andrew@lunn.ch> References: <1407287912-19447-1-git-send-email-andrew@lunn.ch> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140805_182517_219039_0FDF8685 X-CRM114-Status: GOOD ( 10.82 ) X-Spam-Score: -0.7 (/) Cc: Jean-Francois Moine , linux ARM , Andrew Lunn X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Dynamic DAIs, i.e. frontend's should not have a fmt. Skip setting it when the dynamic property has been found in DT. Signed-off-by: Andrew Lunn --- sound/soc/generic/simple-card.c | 88 +++++++++++++++++++++++++---------------- 1 file changed, 55 insertions(+), 33 deletions(-) diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 735a54099b8d..c3235923b12f 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -166,6 +166,52 @@ asoc_simple_card_sub_parse_of(struct device_node *np, return 0; } +static void simple_card_cpu_dia_fmt(int daifmt, + struct simple_dai_props *dai_props, + struct device_node *np, + struct device_node *bitclkmaster, + struct device_node *framemaster) +{ + dai_props->cpu_dai.fmt = daifmt; + switch (((np == bitclkmaster) << 4) | (np == framemaster)) { + case 0x11: + dai_props->cpu_dai.fmt |= SND_SOC_DAIFMT_CBS_CFS; + break; + case 0x10: + dai_props->cpu_dai.fmt |= SND_SOC_DAIFMT_CBS_CFM; + break; + case 0x01: + dai_props->cpu_dai.fmt |= SND_SOC_DAIFMT_CBM_CFS; + break; + default: + dai_props->cpu_dai.fmt |= SND_SOC_DAIFMT_CBM_CFM; + break; + } +} + +static void simple_card_codec_dia_fmt(int daifmt, + struct simple_dai_props *dai_props, + struct device_node *np, + struct device_node *bitclkmaster, + struct device_node *framemaster) +{ + dai_props->codec_dai.fmt = daifmt; + switch (((np == bitclkmaster) << 4) | (np == framemaster)) { + case 0x11: + dai_props->codec_dai.fmt |= SND_SOC_DAIFMT_CBM_CFM; + break; + case 0x10: + dai_props->codec_dai.fmt |= SND_SOC_DAIFMT_CBM_CFS; + break; + case 0x01: + dai_props->codec_dai.fmt |= SND_SOC_DAIFMT_CBS_CFM; + break; + default: + dai_props->codec_dai.fmt |= SND_SOC_DAIFMT_CBS_CFS; + break; + } +} + static int simple_card_dai_link_of(struct device_node *node, struct device *dev, struct snd_soc_dai_link *dai_link, @@ -210,21 +256,9 @@ static int simple_card_dai_link_of(struct device_node *node, if (ret < 0) goto dai_link_of_err; - dai_props->cpu_dai.fmt = daifmt; - switch (((np == bitclkmaster) << 4) | (np == framemaster)) { - case 0x11: - dai_props->cpu_dai.fmt |= SND_SOC_DAIFMT_CBS_CFS; - break; - case 0x10: - dai_props->cpu_dai.fmt |= SND_SOC_DAIFMT_CBS_CFM; - break; - case 0x01: - dai_props->cpu_dai.fmt |= SND_SOC_DAIFMT_CBM_CFS; - break; - default: - dai_props->cpu_dai.fmt |= SND_SOC_DAIFMT_CBM_CFM; - break; - } + if (!dai_link->dynamic) + simple_card_cpu_dia_fmt(daifmt, dai_props, np, + bitclkmaster, framemaster); of_node_put(np); snprintf(prop, sizeof(prop), "%scodec", prefix); @@ -242,30 +276,18 @@ static int simple_card_dai_link_of(struct device_node *node, goto dai_link_of_err; if (strlen(prefix) && !bitclkmaster && !framemaster) { - /* No dai-link level and master setting was not found from - sound node level, revert back to legacy DT parsing and - take the settings from codec node. */ + /* No dai-link level and master setting was not found + from sound node level, revert back to legacy DT + parsing and take the settings from codec node. */ dev_dbg(dev, "%s: Revert to legacy daifmt parsing\n", __func__); dai_props->cpu_dai.fmt = dai_props->codec_dai.fmt = snd_soc_of_parse_daifmt(np, NULL, NULL, NULL) | (daifmt & ~SND_SOC_DAIFMT_CLOCK_MASK); } else { - dai_props->codec_dai.fmt = daifmt; - switch (((np == bitclkmaster) << 4) | (np == framemaster)) { - case 0x11: - dai_props->codec_dai.fmt |= SND_SOC_DAIFMT_CBM_CFM; - break; - case 0x10: - dai_props->codec_dai.fmt |= SND_SOC_DAIFMT_CBM_CFS; - break; - case 0x01: - dai_props->codec_dai.fmt |= SND_SOC_DAIFMT_CBS_CFM; - break; - default: - dai_props->codec_dai.fmt |= SND_SOC_DAIFMT_CBS_CFS; - break; - } + if (!dai_link->dynamic) + simple_card_codec_dia_fmt(daifmt, dai_props, np, + bitclkmaster, framemaster); } if (!dai_link->cpu_dai_name || !dai_link->codec_dai_name) {