alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
To: Mark Brown <broonie@kernel.org>
Cc: Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	alsa-devel@alsa-project.org
Subject: [PATCH] ASoC: core: Add API for configuration of DAI FS
Date: Fri, 13 Sep 2013 18:09:48 +0100	[thread overview]
Message-ID: <1379092188-7385-4-git-send-email-liam.r.girdwood@linux.intel.com> (raw)
In-Reply-To: <1379092188-7385-1-git-send-email-liam.r.girdwood@linux.intel.com>

Some codec drivers when running in slave mode require that FS is explicitly
set by the machine driver as it may not be exactly BCLK/rate.

Extend the DAI API by adding :-

int snd_soc_dai_set_fs(struct snd_soc_dai *dai, unsigned int fs);

Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
---
 include/sound/soc-dai.h |  3 +++
 sound/soc/soc-core.c    | 16 ++++++++++++++++
 2 files changed, 19 insertions(+)

diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index ae9a227..06d2ce5 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -105,6 +105,8 @@ int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai,
 int snd_soc_dai_set_pll(struct snd_soc_dai *dai,
 	int pll_id, int source, unsigned int freq_in, unsigned int freq_out);
 
+int snd_soc_dai_set_dfs(struct snd_soc_dai *dai, unsigned int fs);
+
 /* Digital Audio interface formatting */
 int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt);
 
@@ -131,6 +133,7 @@ struct snd_soc_dai_ops {
 	int (*set_pll)(struct snd_soc_dai *dai, int pll_id, int source,
 		unsigned int freq_in, unsigned int freq_out);
 	int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div);
+	int (*set_dfs)(struct snd_soc_dai *dai, unsigned int fs);
 
 	/*
 	 * DAI format configuration
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 09e341d..90b86cc 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -3380,6 +3380,22 @@ int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source,
 EXPORT_SYMBOL_GPL(snd_soc_codec_set_pll);
 
 /**
+ * snd_soc_dai_set_dfs - configure DAI FS.
+ * @dai: DAI
+ * @fs Ration of BCLK to Sample rate
+ *
+ * Configures the DAI for a preset FS.
+ */
+int snd_soc_dai_set_dfs(struct snd_soc_dai *dai, unsigned int fs)
+{
+	if (dai->driver && dai->driver->ops->set_dfs)
+		return dai->driver->ops->set_dfs(dai, fs);
+	else
+		return -EINVAL;
+}
+EXPORT_SYMBOL_GPL(snd_soc_dai_set_dfs);
+
+/**
  * snd_soc_dai_set_fmt - configure DAI hardware audio format.
  * @dai: DAI
  * @fmt: SND_SOC_DAIFMT_ format value.
-- 
1.8.1.2

  parent reply	other threads:[~2013-09-13 17:10 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-09-13 17:09 [PATCH] ASoC: core: Only add platform DAI widgets once Liam Girdwood
2013-09-13 17:09 ` [PATCH] ASoC: trace: Make sure trace header doesnt depend on any headers Liam Girdwood
2013-09-13 17:27   ` Mark Brown
2013-09-13 17:09 ` [PATCH] ASoC: core utils: Dont set DMA params for BE substreams Liam Girdwood
2013-09-13 17:27   ` Mark Brown
2013-09-13 17:09 ` Liam Girdwood [this message]
2013-09-13 17:26   ` [PATCH] ASoC: core: Add API for configuration of DAI FS Mark Brown
2013-09-16 10:28     ` Liam Girdwood
2013-09-16 11:05       ` Mark Brown
2013-09-16 11:32         ` Liam Girdwood
2013-09-13 17:28 ` [PATCH] ASoC: core: Only add platform DAI widgets once Mark Brown

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=1379092188-7385-4-git-send-email-liam.r.girdwood@linux.intel.com \
    --to=liam.r.girdwood@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).