diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2014-11-09 11:01:03 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2014-11-10 14:08:27 -0500 |
commit | 3e4199ef0105fb718b24cbcc837ad527fd60c880 (patch) | |
tree | db829cd46dd0d15e10bd9912c689716bdcc89984 | |
parent | fabfad2f8b23529722c6ef5b3537c457e63d2c82 (diff) |
ASoC: wm8962: Move DSP enable lock to the driver level
The wm8962 uses the snd_soc_codec mutex to protect the wm8962_dsp2_ena_put()
function from concurrent execution. This patch moves that 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/wm8962.c | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/sound/soc/codecs/wm8962.c b/sound/soc/codecs/wm8962.c index 9077411e62ce..61ca4a7cb6ea 100644 --- a/sound/soc/codecs/wm8962.c +++ b/sound/soc/codecs/wm8962.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #include <linux/regulator/consumer.h> | 26 | #include <linux/regulator/consumer.h> |
27 | #include <linux/slab.h> | 27 | #include <linux/slab.h> |
28 | #include <linux/workqueue.h> | 28 | #include <linux/workqueue.h> |
29 | #include <linux/mutex.h> | ||
29 | #include <sound/core.h> | 30 | #include <sound/core.h> |
30 | #include <sound/jack.h> | 31 | #include <sound/jack.h> |
31 | #include <sound/pcm.h> | 32 | #include <sound/pcm.h> |
@@ -67,6 +68,7 @@ struct wm8962_priv { | |||
67 | int fll_fref; | 68 | int fll_fref; |
68 | int fll_fout; | 69 | int fll_fout; |
69 | 70 | ||
71 | struct mutex dsp2_ena_lock; | ||
70 | u16 dsp2_ena; | 72 | u16 dsp2_ena; |
71 | 73 | ||
72 | struct delayed_work mic_work; | 74 | struct delayed_work mic_work; |
@@ -1570,7 +1572,7 @@ static int wm8962_dsp2_ena_put(struct snd_kcontrol *kcontrol, | |||
1570 | int dsp2_running = snd_soc_read(codec, WM8962_DSP2_POWER_MANAGEMENT) & | 1572 | int dsp2_running = snd_soc_read(codec, WM8962_DSP2_POWER_MANAGEMENT) & |
1571 | WM8962_DSP2_ENA; | 1573 | WM8962_DSP2_ENA; |
1572 | 1574 | ||
1573 | mutex_lock(&codec->mutex); | 1575 | mutex_lock(&wm8962->dsp2_ena_lock); |
1574 | 1576 | ||
1575 | if (ucontrol->value.integer.value[0]) | 1577 | if (ucontrol->value.integer.value[0]) |
1576 | wm8962->dsp2_ena |= 1 << shift; | 1578 | wm8962->dsp2_ena |= 1 << shift; |
@@ -1590,7 +1592,7 @@ static int wm8962_dsp2_ena_put(struct snd_kcontrol *kcontrol, | |||
1590 | } | 1592 | } |
1591 | 1593 | ||
1592 | out: | 1594 | out: |
1593 | mutex_unlock(&codec->mutex); | 1595 | mutex_unlock(&wm8962->dsp2_ena_lock); |
1594 | 1596 | ||
1595 | return ret; | 1597 | return ret; |
1596 | } | 1598 | } |
@@ -3557,6 +3559,8 @@ static int wm8962_i2c_probe(struct i2c_client *i2c, | |||
3557 | if (wm8962 == NULL) | 3559 | if (wm8962 == NULL) |
3558 | return -ENOMEM; | 3560 | return -ENOMEM; |
3559 | 3561 | ||
3562 | mutex_init(&wm8962->dsp2_ena_lock); | ||
3563 | |||
3560 | i2c_set_clientdata(i2c, wm8962); | 3564 | i2c_set_clientdata(i2c, wm8962); |
3561 | 3565 | ||
3562 | INIT_DELAYED_WORK(&wm8962->mic_work, wm8962_mic_work); | 3566 | INIT_DELAYED_WORK(&wm8962->mic_work, wm8962_mic_work); |