From: kernel@martin.sperl.org (kernel at martin.sperl.org)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/3] ASoC: bcm2835: setup clock only if CPU is clock master
Date: Mon, 25 Apr 2016 13:39:39 +0000 [thread overview]
Message-ID: <1461591580-7565-2-git-send-email-kernel@martin.sperl.org> (raw)
In-Reply-To: <1461591580-7565-1-git-send-email-kernel@martin.sperl.org>
From: Matthias Reichl <hias@horus.com>
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>
---
sound/soc/bcm/bcm2835-i2s.c | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c
index d2663e7..a0026e2 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;
--
2.1.4
next prev parent reply other threads:[~2016-04-25 13:39 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-25 13:39 [PATCH 1/3] ASoC: bcm2835: add 24bit support kernel at martin.sperl.org
2016-04-25 13:39 ` kernel at martin.sperl.org [this message]
2016-04-25 13:39 ` [PATCH 3/3] ASoC: bcm2835: Register also as PCM device kernel at martin.sperl.org
2016-04-25 13:54 ` Lars-Peter Clausen
2016-04-25 17:15 ` Matthias Reichl
2016-04-26 8:47 ` [alsa-devel] " Lars-Peter Clausen
2016-04-26 13:09 ` Matthias Reichl
2016-04-26 13:22 ` Lars-Peter Clausen
2016-04-26 15:18 ` Matthias Reichl
2016-04-26 15:30 ` Lars-Peter Clausen
2016-04-26 18:05 ` Matthias Reichl
2016-04-26 19:09 ` Lars-Peter Clausen
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1461591580-7565-2-git-send-email-kernel@martin.sperl.org \
--to=kernel@martin.sperl.org \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).