aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/sound/soc/bcm/bcm2835-i2s.c
diff options
context:
space:
mode:
authorMatthias Reichl <hias@horus.com>2016-04-25 13:39:39 +0000
committerMark Brown <broonie@kernel.org>2016-04-25 17:39:11 +0100
commit60507fe191f524e82986fa737e5b27b4d3ad9289 (patch)
treebfb9078671aab182021ec44baa8044b418ec00f9 /sound/soc/bcm/bcm2835-i2s.c
parentASoC: bcm2835: add 24bit support (diff)
downloadwireguard-linux-60507fe191f524e82986fa737e5b27b4d3ad9289.tar.xz
wireguard-linux-60507fe191f524e82986fa737e5b27b4d3ad9289.zip
ASoC: bcm2835: setup clock only if CPU is clock master
We only need to enable the clock if we are a clock master. Code ported from bcm2708-i2s driver in Raspberry Pi tree. Original work by Zoltan Szenczi. Signed-off-by: Matthias Reichl <hias@horus.com> Signed-off-by: Martin Sperl <kernel@martin.sperl.org> Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/bcm/bcm2835-i2s.c')
-rw-r--r--sound/soc/bcm/bcm2835-i2s.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c
index d2663e79ece1..a0026e2d2f0a 100644
--- a/sound/soc/bcm/bcm2835-i2s.c
+++ b/sound/soc/bcm/bcm2835-i2s.c
@@ -276,8 +276,15 @@ static int bcm2835_i2s_hw_params(struct snd_pcm_substream *substream,
/* otherwise calculate a fitting block ratio */
bclk_ratio = 2 * data_length;
- /* set target clock rate*/
- clk_set_rate(dev->clk, sampling_rate * bclk_ratio);
+ /* Clock should only be set up here if CPU is clock master */
+ switch (dev->fmt & SND_SOC_DAIFMT_MASTER_MASK) {
+ case SND_SOC_DAIFMT_CBS_CFS:
+ case SND_SOC_DAIFMT_CBS_CFM:
+ clk_set_rate(dev->clk, sampling_rate * bclk_ratio);
+ break;
+ default:
+ break;
+ }
/* Setup the frame format */
format = BCM2835_I2S_CHEN;