brcm2708: update against latest rpi-3.10.y branch
[openwrt.git] / target / linux / brcm2708 / patches-3.10 / 0115-ASoC-core-Add-API-for-configuration-of-DAI-BCLK-rati.patch
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
5  ratio
6
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.
9
10 Extend the DAI API by adding :-
11
12 int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio);
13
14 Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
15 Signed-off-by: Mark Brown <broonie@linaro.org>
16 ---
17  include/sound/soc-dai.h |  3 +++
18  sound/soc/soc-core.c    | 16 ++++++++++++++++
19  2 files changed, 19 insertions(+)
20
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);
26  
27 +int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio);
28 +
29  /* Digital Audio interface formatting */
30  int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt);
31  
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);
37  
38         /*
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);
44  
45  /**
46 + * snd_soc_dai_set_bclk_ratio - configure BCLK to sample rate ratio.
47 + * @dai: DAI
48 + * @ratio Ratio of BCLK to Sample rate.
49 + *
50 + * Configures the DAI for a preset BCLK to sample rate ratio.
51 + */
52 +int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio)
53 +{
54 +       if (dai->driver && dai->driver->ops->set_bclk_ratio)
55 +               return dai->driver->ops->set_bclk_ratio(dai, ratio);
56 +       else
57 +               return -EINVAL;
58 +}
59 +EXPORT_SYMBOL_GPL(snd_soc_dai_set_bclk_ratio);
60 +
61 +/**
62   * snd_soc_dai_set_fmt - configure DAI hardware audio format.
63   * @dai: DAI
64   * @fmt: SND_SOC_DAIFMT_ format value.