All of lore.kernel.org
 help / color / mirror / Atom feed
From: andrew@lunn.ch (Andrew Lunn)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC 2/8] ASoC: simple-card: Make mclk setting a dai link property
Date: Wed,  6 Aug 2014 03:18:26 +0200	[thread overview]
Message-ID: <1407287912-19447-3-git-send-email-andrew@lunn.ch> (raw)
In-Reply-To: <1407287912-19447-1-git-send-email-andrew@lunn.ch>

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 <andrew@lunn.ch>
---

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 : "");
 
-- 
2.0.1

  parent reply	other threads:[~2014-08-06  1:18 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-08-06  1:18 [RFC 0/8] DPCM with simple-card support for Kirkwood Andrew Lunn
2014-08-06  1:18 ` [RFC 1/8] ASoC: kirkwood: add DPCM support Andrew Lunn
2014-08-06  1:18 ` Andrew Lunn [this message]
2014-08-06  1:18 ` [RFC 3/8] ARM: Kirkwood: Update sound DT node to reflect " Andrew Lunn
2014-08-06  1:18 ` [RFC 4/8] ASoC: dt: Parse DPCM properties Andrew Lunn
2014-08-06  1:18 ` [RFC 5/8] ASoC: simple-card: Don't set DAI format for dynamic DAIs Andrew Lunn
2014-08-06  1:18 ` [RFC 6/8] ASoC: dt: Allow the platform name to be set for a DAI Andrew Lunn
2014-08-06  1:18 ` [RFC 7/8] ASoC: simple-card: Allow use of snd-soc-dummy as codec Andrew Lunn
2014-08-06  1:18 ` [RFC 8/8] ARM: Kirkwood: Describe DPCM audio support in DT Andrew Lunn
2014-08-06  8:33 ` [RFC 0/8] DPCM with simple-card support for Kirkwood Jean-Francois Moine
2014-08-06 14:30   ` Andrew Lunn
2014-08-06 17:43     ` Jean-Francois Moine
2014-08-06 17:53       ` Andrew Lunn
2014-08-06 18:29         ` Jean-Francois Moine

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1407287912-19447-3-git-send-email-andrew@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=linux-arm-kernel@lists.infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.