linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: b29396@freescale.com (Dong Aisheng)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/4] ASoC: mxs-saif: fix clock prepare and enable unbalance issue
Date: Fri, 20 Jul 2012 17:20:24 +0800	[thread overview]
Message-ID: <1342776027-31758-2-git-send-email-b29396@freescale.com> (raw)
In-Reply-To: <1342776027-31758-1-git-send-email-b29396@freescale.com>

From: Dong Aisheng <dong.aisheng@linaro.org>

Currently we directly call a clock_enable in trigger function without
a clk_prepare as pair first.
This will cause system hang immediately when run capture because
the clock was not prepared(playback does not hang because the clock was
prepared already by get_mclk before), a warning message in clock framework
may cause a deadlock to reclaim clock lock (see: pl011_console_write).

Here we prepare clock first in hw_param, then enable it in trigger
function to guarantee the balance.

Cc: Mark Brown <broonie@opensource.wolfsonmicro.com>
Cc: Liam Girdwood <lrg@ti.com>
Cc: Wolfram Sang <w.sang@pengutronix.de>
Cc: Shawn Guo <shawn.guo@linaro.org>
Signed-off-by: Dong Aisheng <dong.aisheng@linaro.org>
---
 sound/soc/mxs/mxs-saif.c |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/sound/soc/mxs/mxs-saif.c b/sound/soc/mxs/mxs-saif.c
index aba71bf..fdbb36a 100644
--- a/sound/soc/mxs/mxs-saif.c
+++ b/sound/soc/mxs/mxs-saif.c
@@ -394,9 +394,14 @@ static int mxs_saif_hw_params(struct snd_pcm_substream *substream,
 			     struct snd_soc_dai *cpu_dai)
 {
 	struct mxs_saif *saif = snd_soc_dai_get_drvdata(cpu_dai);
+	struct mxs_saif *master_saif;
 	u32 scr, stat;
 	int ret;
 
+	master_saif = mxs_saif_get_master(saif);
+	if (!master_saif)
+		return -EINVAL;
+
 	/* mclk should already be set */
 	if (!saif->mclk && saif->mclk_in_use) {
 		dev_err(cpu_dai->dev, "set mclk first\n");
@@ -420,6 +425,11 @@ static int mxs_saif_hw_params(struct snd_pcm_substream *substream,
 		return ret;
 	}
 
+	/* prepare clk in hw_param, enable in trigger */
+	clk_prepare(saif->clk);
+	if (saif != master_saif)
+		clk_prepare(master_saif->clk);
+
 	scr = __raw_readl(saif->base + SAIF_CTRL);
 
 	scr &= ~BM_SAIF_CTRL_WORD_LENGTH;
-- 
1.7.0.4

  reply	other threads:[~2012-07-20  9:20 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-20  9:20 [PATCH 0/4] ASoC: fix saif record unwork issue Dong Aisheng
2012-07-20  9:20 ` Dong Aisheng [this message]
2012-07-21  7:03   ` [alsa-devel] [PATCH 1/4] ASoC: mxs-saif: fix clock prepare and enable unbalance issue Shawn Guo
2012-07-24 19:18   ` Mark Brown
2016-01-16 16:24   ` Måns Rullgård
2012-07-20  9:20 ` [PATCH 2/4] ASoC: mxs-saif: set a base clock rate for EXTMASTER mode work Dong Aisheng
2012-07-21  7:20   ` [alsa-devel] " Shawn Guo
2012-07-24 19:18   ` Mark Brown
2012-07-20  9:20 ` [PATCH 3/4] ASoC: sgtl5000: remove unneeded snd_soc_dapm_new_widgets in probe Dong Aisheng
2012-07-21  8:37   ` [alsa-devel] " Shawn Guo
2012-07-24 19:20   ` Mark Brown
2012-07-20  9:20 ` [PATCH 4/4] ARM: mx28evk: add missed clkmux select for saif Dong Aisheng
2012-07-21  7:40   ` [alsa-devel] " Shawn Guo
2012-07-23  2:36     ` Dong Aisheng
2012-07-28  8:25       ` Shawn Guo
2012-08-01  2:47         ` Dong Aisheng
2012-07-24 12:46 ` [alsa-devel] [PATCH 0/4] ASoC: fix saif record unwork issue Lauri Hintsala
2012-07-24 19:21   ` Mark Brown
2012-07-25  5:26     ` Lauri Hintsala
2012-07-25  6:44       ` Dong Aisheng
2012-07-25  8:55         ` Lauri Hintsala

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=1342776027-31758-2-git-send-email-b29396@freescale.com \
    --to=b29396@freescale.com \
    --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).