From patchwork Wed Aug 6 01:18:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lunn X-Patchwork-Id: 4682921 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 B5A969F375 for ; Wed, 6 Aug 2014 01:27:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D58C520170 for ; Wed, 6 Aug 2014 01:27:07 +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 6EFB520173 for ; Wed, 6 Aug 2014 01:27:05 +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 1XEpy3-00087E-9n; Wed, 06 Aug 2014 01:24:39 +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 1XEpxw-00084w-0L for linux-arm-kernel@lists.infradead.org; Wed, 06 Aug 2014 01:24:32 +0000 Received: from lunn by vps0.lunn.ch with local (Exim 4.80) (envelope-from ) id 1XEpsF-00054K-75; Wed, 06 Aug 2014 03:18:39 +0200 From: Andrew Lunn To: Russell King Subject: [RFC 2/8] ASoC: simple-card: Make mclk setting a dai link property Date: Wed, 6 Aug 2014 03:18:26 +0200 Message-Id: <1407287912-19447-3-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_182432_212559_A464CC68 X-CRM114-Status: GOOD ( 13.60 ) 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 The mclk factor between between stream rate and codec clk was wrongly made a property of the whole card, when in fact it is a property of a dai link. Correct this. Signed-off-by: Andrew Lunn --- The only users of this property are kirkwood devices, which are updated in a later patch. There is an ABI break anyway, in order to make use of DPCM, which is the right way to handle the kirkwood hardware, rather than what we currently have. --- Documentation/devicetree/bindings/sound/simple-card.txt | 4 ++-- sound/soc/generic/simple-card.c | 16 +++++++++------- 2 files changed, 11 insertions(+), 9 deletions(-) diff --git a/Documentation/devicetree/bindings/sound/simple-card.txt b/Documentation/devicetree/bindings/sound/simple-card.txt index c2e9841dfce4..8b9f902cdfc7 100644 --- a/Documentation/devicetree/bindings/sound/simple-card.txt +++ b/Documentation/devicetree/bindings/sound/simple-card.txt @@ -15,8 +15,6 @@ Optional properties: Each entry is a pair of strings, the first being the connection's sink, the second being the connection's source. -- simple-audio-card,mclk-fs : Multiplication factor between stream rate and codec - mclk. Optional subnodes: @@ -51,6 +49,8 @@ Optional dai-link subnode properties: dai-link uses bit clock inversion. - frame-inversion : bool property. Add this if the dai-link uses frame clock inversion. +- mclk-fs : Multiplication factor between stream + rate and codec mclk. For backward compatibility the frame-master and bitclock-master properties can be used as booleans in codec subnode to indicate if the diff --git a/sound/soc/generic/simple-card.c b/sound/soc/generic/simple-card.c index 03a7fdcdf114..63f3d16d43ba 100644 --- a/sound/soc/generic/simple-card.c +++ b/sound/soc/generic/simple-card.c @@ -23,8 +23,8 @@ struct simple_card_data { struct simple_dai_props { struct asoc_simple_dai cpu_dai; struct asoc_simple_dai codec_dai; + unsigned int mclk_fs; } *dai_props; - unsigned int mclk_fs; struct snd_soc_dai_link dai_link[]; /* dynamically allocated */ }; @@ -34,11 +34,13 @@ static int asoc_simple_card_hw_params(struct snd_pcm_substream *substream, struct snd_soc_pcm_runtime *rtd = substream->private_data; struct snd_soc_dai *codec_dai = rtd->codec_dai; struct simple_card_data *priv = snd_soc_card_get_drvdata(rtd->card); + int num = rtd - rtd->card->rtd; + struct simple_dai_props *dai_props = &priv->dai_props[num]; unsigned int mclk; int ret = 0; - if (priv->mclk_fs) { - mclk = params_rate(params) * priv->mclk_fs; + if (dai_props->mclk_fs) { + mclk = params_rate(params) * dai_props->mclk_fs; ret = snd_soc_dai_set_sysclk(codec_dai, 0, mclk, SND_SOC_CLOCK_IN); } @@ -186,6 +188,10 @@ static int simple_card_dai_link_of(struct device_node *node, &bitclkmaster, &framemaster); daifmt &= ~SND_SOC_DAIFMT_MASTER_MASK; + /* Factor to mclk, used in hw_params() */ + of_property_read_u32(node, "mclk-fs", + &dai_props->mclk_fs); + snprintf(prop, sizeof(prop), "%scpu", prefix); np = of_get_child_by_name(node, prop); if (!np) { @@ -324,10 +330,6 @@ static int asoc_simple_card_parse_of(struct device_node *node, return ret; } - /* Factor to mclk, used in hw_params() */ - of_property_read_u32(node, "simple-audio-card,mclk-fs", - &priv->mclk_fs); - dev_dbg(dev, "New simple-card: %s\n", priv->snd_card.name ? priv->snd_card.name : "");