1 From 5c080b18934d9dcea2bf902c09d640daf6fe49d4 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/174] 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 --- a/include/sound/soc-dai.h
22 +++ b/include/sound/soc-dai.h
23 @@ -105,6 +105,8 @@ int snd_soc_dai_set_clkdiv(struct snd_so
24 int snd_soc_dai_set_pll(struct snd_soc_dai *dai,
25 int pll_id, int source, unsigned int freq_in, unsigned int freq_out);
27 +int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio);
29 /* Digital Audio interface formatting */
30 int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt);
32 @@ -131,6 +133,7 @@ struct snd_soc_dai_ops {
33 int (*set_pll)(struct snd_soc_dai *dai, int pll_id, int source,
34 unsigned int freq_in, unsigned int freq_out);
35 int (*set_clkdiv)(struct snd_soc_dai *dai, int div_id, int div);
36 + int (*set_bclk_ratio)(struct snd_soc_dai *dai, unsigned int ratio);
39 * DAI format configuration
40 --- a/sound/soc/soc-core.c
41 +++ b/sound/soc/soc-core.c
42 @@ -3463,6 +3463,22 @@ int snd_soc_codec_set_pll(struct snd_soc
43 EXPORT_SYMBOL_GPL(snd_soc_codec_set_pll);
46 + * snd_soc_dai_set_bclk_ratio - configure BCLK to sample rate ratio.
48 + * @ratio Ratio of BCLK to Sample rate.
50 + * Configures the DAI for a preset BCLK to sample rate ratio.
52 +int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio)
54 + if (dai->driver && dai->driver->ops->set_bclk_ratio)
55 + return dai->driver->ops->set_bclk_ratio(dai, ratio);
59 +EXPORT_SYMBOL_GPL(snd_soc_dai_set_bclk_ratio);
62 * snd_soc_dai_set_fmt - configure DAI hardware audio format.
64 * @fmt: SND_SOC_DAIFMT_ format value.