All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ben Dooks <ben.dooks@codethink.co.uk>
To: alsa-devel@alsa-project.org
Cc: kuninori.morimoto.gx@renesas.com, broonie@kernel.org,
	lgirdwood@gmail.com, linux-sh@vger.kernel.org,
	magnus.damm@opensource.se, linux-kernel@lists.codethink.co.uk,
	William Towle <william.towle@codethink.co.uk>
Subject: [PATCH] ASoC: rsnd: SSI needs to prepare clocks before enabling
Date: Fri, 28 Mar 2014 12:27:06 +0000	[thread overview]
Message-ID: <1396009626-24699-1-git-send-email-ben.dooks@codethink.co.uk> (raw)

From: William Towle <william.towle@codethink.co.uk>

The rsnd_ssi_hw_{stop|start} functions need to call clk_prepare_enable()
and clk_disable_unprepare(), otherwise the following warning occurs on
attempt to play sound:

WARNING: CPU: 2 PID: 1176 at drivers/clk/clk.c:926 __clk_enable+0x30/0x9c()

due to drivers/clk/clk.c:

    926         if (WARN_ON(clk->prepare_count = 0))
    927                 return -ESHUTDOWN;

Signed-off-by: William Towle <william.towle@codethink.co.uk>
[ben.dooks@codethink.co.uk: add more bug info to report]
Tested-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 sound/soc/sh/rcar/ssi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 4b8cf7c..1c07ef7 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -250,7 +250,7 @@ static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi,
 	u32 cr;
 
 	if (0 = ssi->usrcnt) {
-		clk_enable(ssi->clk);
+		clk_prepare_enable(ssi->clk);
 
 		if (rsnd_rdai_is_clk_master(rdai)) {
 			if (rsnd_ssi_clk_from_parent(ssi))
@@ -309,7 +309,7 @@ static void rsnd_ssi_hw_stop(struct rsnd_ssi *ssi,
 				rsnd_ssi_master_clk_stop(ssi);
 		}
 
-		clk_disable(ssi->clk);
+		clk_disable_unprepare(ssi->clk);
 	}
 
 	dev_dbg(dev, "ssi%d hw stopped\n", rsnd_mod_id(&ssi->mod));
-- 
1.9.0


WARNING: multiple messages have this Message-ID (diff)
From: Ben Dooks <ben.dooks@codethink.co.uk>
To: alsa-devel@alsa-project.org
Cc: kuninori.morimoto.gx@renesas.com, broonie@kernel.org,
	lgirdwood@gmail.com, linux-sh@vger.kernel.org,
	magnus.damm@opensource.se, linux-kernel@lists.codethink.co.uk,
	William Towle <william.towle@codethink.co.uk>
Subject: [PATCH] ASoC: rsnd: SSI needs to prepare clocks before enabling
Date: Fri, 28 Mar 2014 12:27:06 +0000	[thread overview]
Message-ID: <1396009626-24699-1-git-send-email-ben.dooks@codethink.co.uk> (raw)

From: William Towle <william.towle@codethink.co.uk>

The rsnd_ssi_hw_{stop|start} functions need to call clk_prepare_enable()
and clk_disable_unprepare(), otherwise the following warning occurs on
attempt to play sound:

WARNING: CPU: 2 PID: 1176 at drivers/clk/clk.c:926 __clk_enable+0x30/0x9c()

due to drivers/clk/clk.c:

    926         if (WARN_ON(clk->prepare_count == 0))
    927                 return -ESHUTDOWN;

Signed-off-by: William Towle <william.towle@codethink.co.uk>
[ben.dooks@codethink.co.uk: add more bug info to report]
Tested-by: Ben Dooks <ben.dooks@codethink.co.uk>
---
 sound/soc/sh/rcar/ssi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c
index 4b8cf7c..1c07ef7 100644
--- a/sound/soc/sh/rcar/ssi.c
+++ b/sound/soc/sh/rcar/ssi.c
@@ -250,7 +250,7 @@ static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi,
 	u32 cr;
 
 	if (0 == ssi->usrcnt) {
-		clk_enable(ssi->clk);
+		clk_prepare_enable(ssi->clk);
 
 		if (rsnd_rdai_is_clk_master(rdai)) {
 			if (rsnd_ssi_clk_from_parent(ssi))
@@ -309,7 +309,7 @@ static void rsnd_ssi_hw_stop(struct rsnd_ssi *ssi,
 				rsnd_ssi_master_clk_stop(ssi);
 		}
 
-		clk_disable(ssi->clk);
+		clk_disable_unprepare(ssi->clk);
 	}
 
 	dev_dbg(dev, "ssi%d hw stopped\n", rsnd_mod_id(&ssi->mod));
-- 
1.9.0


             reply	other threads:[~2014-03-28 12:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-28 12:27 Ben Dooks [this message]
2014-03-28 12:27 ` [PATCH] ASoC: rsnd: SSI needs to prepare clocks before enabling Ben Dooks
2014-03-29 10:09 ` Mark Brown
2014-04-04 11:42   ` [alsa-devel] " Ben Dooks
2014-04-04 11:42     ` Ben Dooks

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=1396009626-24699-1-git-send-email-ben.dooks@codethink.co.uk \
    --to=ben.dooks@codethink.co.uk \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=kuninori.morimoto.gx@renesas.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@lists.codethink.co.uk \
    --cc=linux-sh@vger.kernel.org \
    --cc=magnus.damm@opensource.se \
    --cc=william.towle@codethink.co.uk \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.