ramips: add support for A5-V11 board (resubmit)
[openwrt/openwrt.git] / target / linux / brcm2708 / patches-3.10 / 0115-ASoC-core-Add-API-for-configuration-of-DAI-BCLK-rati.patch
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
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 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);
28
29 +int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio);
30 +
31 /* Digital Audio interface formatting */
32 int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt);
33
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);
39
40 /*
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);
48
49 /**
50 + * snd_soc_dai_set_bclk_ratio - configure BCLK to sample rate ratio.
51 + * @dai: DAI
52 + * @ratio Ratio of BCLK to Sample rate.
53 + *
54 + * Configures the DAI for a preset BCLK to sample rate ratio.
55 + */
56 +int snd_soc_dai_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio)
57 +{
58 + if (dai->driver && dai->driver->ops->set_bclk_ratio)
59 + return dai->driver->ops->set_bclk_ratio(dai, ratio);
60 + else
61 + return -EINVAL;
62 +}
63 +EXPORT_SYMBOL_GPL(snd_soc_dai_set_bclk_ratio);
64 +
65 +/**
66 * snd_soc_dai_set_fmt - configure DAI hardware audio format.
67 * @dai: DAI
68 * @fmt: SND_SOC_DAIFMT_ format value.
69 --
70 1.9.1
71