1 From 573a4bcbf022cae315a2b40ddd7b96c29d22971a Mon Sep 17 00:00:00 2001
2 From: Liam Girdwood <liam.r.girdwood@linux.intel.com>
3 Date: Mon, 16 Sep 2013 13:01:46 +0100
4 Subject: [PATCH 115/196] ASoC: core: Add API for configuration of DAI BCLK
7 Some codec drivers when running in slave mode require that BCLK to sample rate ratio
8 is explicitly set by the machine driver as it may not be exactly rate * frame size.
10 Extend the DAI API by adding :-
12 int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio);
14 Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
15 Signed-off-by: Mark Brown <broonie@linaro.org>
17 include/sound/soc-dai.h | 3 +++
18 sound/soc/soc-core.c | 16 ++++++++++++++++
19 2 files changed, 19 insertions(+)
21 diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
22 index ae9a227..d8acf0c 100644
23 --- a/include/sound/soc-dai.h
24 +++ b/include/sound/soc-dai.h
25 @@ -105,6 +105,8 @@ int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai,
26 int snd_soc_dai_set_pll(struct snd_soc_dai *dai,
27 int pll_id, int source, unsigned int freq_in, unsigned int freq_out);
29 +int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio);
31 /* Digital Audio interface formatting */
32 int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt);
34 @@ -131,6 +133,7 @@ struct snd_soc_dai_ops {
35 int (*set_pll)(struct snd_soc_dai *dai, int pll_id, int source,
36 unsigned int freq_in, unsigned int freq_out);
37 int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div);
38 + int (*set_bclk_ratio)(struct snd_soc_dai *dai, unsigned int ratio);
41 * DAI format configuration
42 diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
43 index d56bbea..d18272c 100644
44 --- a/sound/soc/soc-core.c
45 +++ b/sound/soc/soc-core.c
46 @@ -3463,6 +3463,22 @@ int snd_soc_codec_set_pll(struct snd_soc_codec *codec, int pll_id, int source,
47 EXPORT_SYMBOL_GPL(snd_soc_codec_set_pll);
50 + * snd_soc_dai_set_bclk_ratio - configure BCLK to sample rate ratio.
52 + * @ratio Ratio of BCLK to Sample rate.
54 + * Configures the DAI for a preset BCLK to sample rate ratio.
56 +int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio)
58 + if (dai->driver && dai->driver->ops->set_bclk_ratio)
59 + return dai->driver->ops->set_bclk_ratio(dai, ratio);
63 +EXPORT_SYMBOL_GPL(snd_soc_dai_set_bclk_ratio);
66 * snd_soc_dai_set_fmt - configure DAI hardware audio format.
68 * @fmt: SND_SOC_DAIFMT_ format value.