aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars-Peter Clausen <lars@metafoo.de>2014-11-09 11:01:00 -0500
committerMark Brown <broonie@kernel.org>2014-11-10 14:08:09 -0500
commita51ff30f45473a80f78b2572666473887e010d91 (patch)
treef429e889570a25141de5b6fab8f63e1ba75cadf3
parentd74bcaaeb66826192c9e361cbfe8fd1ffaccf74e (diff)
ASoC: wm8731: Move the deemph lock to the driver level
The wm8731 uses the snd_soc_codec mutex to protect its deemph settings from concurrent access. This patch moves this lock to the driver level. This will allow us to eventually remove the snd_soc_codec mutex. Signed-off-by: Lars-Peter Clausen <lars@metafoo.de> Acked-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/wm8731.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/sound/soc/codecs/wm8731.c b/sound/soc/codecs/wm8731.c
index eebb3280bfad..5dae9a6f8076 100644
--- a/sound/soc/codecs/wm8731.c
+++ b/sound/soc/codecs/wm8731.c
@@ -24,6 +24,7 @@
24#include <linux/regulator/consumer.h> 24#include <linux/regulator/consumer.h>
25#include <linux/spi/spi.h> 25#include <linux/spi/spi.h>
26#include <linux/of_device.h> 26#include <linux/of_device.h>
27#include <linux/mutex.h>
27#include <sound/core.h> 28#include <sound/core.h>
28#include <sound/pcm.h> 29#include <sound/pcm.h>
29#include <sound/pcm_params.h> 30#include <sound/pcm_params.h>
@@ -50,6 +51,8 @@ struct wm8731_priv {
50 int sysclk_type; 51 int sysclk_type;
51 int playback_fs; 52 int playback_fs;
52 bool deemph; 53 bool deemph;
54
55 struct mutex lock;
53}; 56};
54 57
55 58
@@ -138,7 +141,7 @@ static int wm8731_put_deemph(struct snd_kcontrol *kcontrol,
138 if (deemph > 1) 141 if (deemph > 1)
139 return -EINVAL; 142 return -EINVAL;
140 143
141 mutex_lock(&codec->mutex); 144 mutex_lock(&wm8731->lock);
142 if (wm8731->deemph != deemph) { 145 if (wm8731->deemph != deemph) {
143 wm8731->deemph = deemph; 146 wm8731->deemph = deemph;
144 147
@@ -146,7 +149,7 @@ static int wm8731_put_deemph(struct snd_kcontrol *kcontrol,
146 149
147 ret = 1; 150 ret = 1;
148 } 151 }
149 mutex_unlock(&codec->mutex); 152 mutex_unlock(&wm8731->lock);
150 153
151 return ret; 154 return ret;
152} 155}
@@ -685,6 +688,8 @@ static int wm8731_spi_probe(struct spi_device *spi)
685 if (wm8731 == NULL) 688 if (wm8731 == NULL)
686 return -ENOMEM; 689 return -ENOMEM;
687 690
691 mutex_init(&wm8731->lock);
692
688 wm8731->regmap = devm_regmap_init_spi(spi, &wm8731_regmap); 693 wm8731->regmap = devm_regmap_init_spi(spi, &wm8731_regmap);
689 if (IS_ERR(wm8731->regmap)) { 694 if (IS_ERR(wm8731->regmap)) {
690 ret = PTR_ERR(wm8731->regmap); 695 ret = PTR_ERR(wm8731->regmap);