diff options
-rw-r--r-- | sound/soc/codecs/wm8731.c | 9 |
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); |