alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] ASoC: Lock the CODEC in PXA external jack controls
@ 2010-11-05 17:53 Mark Brown
  2010-11-06 10:55 ` Liam Girdwood
  0 siblings, 1 reply; 3+ messages in thread
From: Mark Brown @ 2010-11-05 17:53 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Eric Miao, Mark Brown

When doing anything with the system, especially DAPM, we need to hold the
CODEC mutex.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 sound/soc/pxa/corgi.c    |    5 +++++
 sound/soc/pxa/magician.c |    4 ++++
 sound/soc/pxa/poodle.c   |    5 +++++
 sound/soc/pxa/spitz.c    |    5 +++++
 sound/soc/pxa/tosa.c     |    5 +++++
 5 files changed, 24 insertions(+), 0 deletions(-)

diff --git a/sound/soc/pxa/corgi.c b/sound/soc/pxa/corgi.c
index 97e9423..f451acd 100644
--- a/sound/soc/pxa/corgi.c
+++ b/sound/soc/pxa/corgi.c
@@ -100,8 +100,13 @@ static int corgi_startup(struct snd_pcm_substream *substream)
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct snd_soc_codec *codec = rtd->codec;
 
+	mutex_lock(&codec->mutex);
+
 	/* check the jack status at stream startup */
 	corgi_ext_control(codec);
+
+	mutex_unlock(&codec->mutex);
+
 	return 0;
 }
 
diff --git a/sound/soc/pxa/magician.c b/sound/soc/pxa/magician.c
index b8207ce..5ef0526 100644
--- a/sound/soc/pxa/magician.c
+++ b/sound/soc/pxa/magician.c
@@ -72,9 +72,13 @@ static int magician_startup(struct snd_pcm_substream *substream)
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct snd_soc_codec *codec = rtd->codec;
 
+	mutex_lock(&codec->mutex);
+
 	/* check the jack status at stream startup */
 	magician_ext_control(codec);
 
+	mutex_unlock(&codec->mutex);
+
 	return 0;
 }
 
diff --git a/sound/soc/pxa/poodle.c b/sound/soc/pxa/poodle.c
index af84ee9..84edd03 100644
--- a/sound/soc/pxa/poodle.c
+++ b/sound/soc/pxa/poodle.c
@@ -77,8 +77,13 @@ static int poodle_startup(struct snd_pcm_substream *substream)
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct snd_soc_codec *codec = rtd->codec;
 
+	mutex_lock(&codec->mutex);
+
 	/* check the jack status at stream startup */
 	poodle_ext_control(codec);
+
+	mutex_unlock(&codec->mutex);
+
 	return 0;
 }
 
diff --git a/sound/soc/pxa/spitz.c b/sound/soc/pxa/spitz.c
index f470f36..0b30d7d 100644
--- a/sound/soc/pxa/spitz.c
+++ b/sound/soc/pxa/spitz.c
@@ -108,8 +108,13 @@ static int spitz_startup(struct snd_pcm_substream *substream)
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct snd_soc_codec *codec = rtd->codec;
 
+	mutex_lock(&codec->mutex);
+
 	/* check the jack status at stream startup */
 	spitz_ext_control(codec);
+
+	mutex_unlock(&codec->mutex);
+
 	return 0;
 }
 
diff --git a/sound/soc/pxa/tosa.c b/sound/soc/pxa/tosa.c
index 73d0edd..7b983f9 100644
--- a/sound/soc/pxa/tosa.c
+++ b/sound/soc/pxa/tosa.c
@@ -81,8 +81,13 @@ static int tosa_startup(struct snd_pcm_substream *substream)
 	struct snd_soc_pcm_runtime *rtd = substream->private_data;
 	struct snd_soc_codec *codec = rtd->codec;
 
+	mutex_lock(&codec->mutex);
+
 	/* check the jack status at stream startup */
 	tosa_ext_control(codec);
+
+	mutex_unlock(&codec->mutex);
+
 	return 0;
 }
 
-- 
1.7.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: Lock the CODEC in PXA external jack controls
  2010-11-05 17:53 [PATCH] ASoC: Lock the CODEC in PXA external jack controls Mark Brown
@ 2010-11-06 10:55 ` Liam Girdwood
  2010-11-06 15:16   ` Mark Brown
  0 siblings, 1 reply; 3+ messages in thread
From: Liam Girdwood @ 2010-11-06 10:55 UTC (permalink / raw)
  To: Mark Brown; +Cc: alsa-devel, patches, Miao, Eric

On Fri, 2010-11-05 at 13:53 -0400, Mark Brown wrote:
> When doing anything with the system, especially DAPM, we need to hold the
> CODEC mutex.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>

I'm fine for this atm, but obviously we need to rework the DAPM locking
a little as we dont want developers to have to care about locking
internals.

Acked-by: Liam Girdwood <lrg@slimlogic.co.uk>
-- 
Freelance Developer, SlimLogic Ltd
ASoC and Voltage Regulator Maintainer.
http://www.slimlogic.co.uk

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] ASoC: Lock the CODEC in PXA external jack controls
  2010-11-06 10:55 ` Liam Girdwood
@ 2010-11-06 15:16   ` Mark Brown
  0 siblings, 0 replies; 3+ messages in thread
From: Mark Brown @ 2010-11-06 15:16 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: alsa-devel, patches, Eric Miao

On Sat, Nov 06, 2010 at 10:55:09AM +0000, Liam Girdwood wrote:

> I'm fine for this atm, but obviously we need to rework the DAPM locking
> a little as we dont want developers to have to care about locking
> internals.

It's not just DAPM, either - there's the CODEC register maps as well.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2010-11-06 15:16 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-05 17:53 [PATCH] ASoC: Lock the CODEC in PXA external jack controls Mark Brown
2010-11-06 10:55 ` Liam Girdwood
2010-11-06 15:16   ` Mark Brown

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).