diff options
author | Charles Keepax <ckeepax@opensource.wolfsonmicro.com> | 2015-12-08 19:08:28 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-12-13 01:43:15 +0300 |
commit | d27c5e155c69a4c45e9833fbf66aa580dcd01624 (patch) | |
tree | cf218573dbc3d1652d1e61b192c2371a97e7b4d2 /sound/soc/codecs/wm_adsp.c | |
parent | 078e71838cdff1c2a1a33e65459954adda9a4641 (diff) | |
download | linux-d27c5e155c69a4c45e9833fbf66aa580dcd01624.tar.xz |
ASoC: wm_adsp: Add power lock for firmware change control
We should hold the DSP power lock whilst changing the firmware since we
need to check if it is running first.
Signed-off-by: Charles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/codecs/wm_adsp.c')
-rw-r--r-- | sound/soc/codecs/wm_adsp.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c index 19f05933de54..fd85a8cc7234 100644 --- a/sound/soc/codecs/wm_adsp.c +++ b/sound/soc/codecs/wm_adsp.c @@ -451,6 +451,7 @@ static int wm_adsp_fw_put(struct snd_kcontrol *kcontrol, struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; struct wm_adsp *dsp = snd_soc_codec_get_drvdata(codec); + int ret = 0; if (ucontrol->value.integer.value[0] == dsp[e->shift_l].fw) return 0; @@ -458,12 +459,16 @@ static int wm_adsp_fw_put(struct snd_kcontrol *kcontrol, if (ucontrol->value.integer.value[0] >= WM_ADSP_NUM_FW) return -EINVAL; + mutex_lock(&dsp[e->shift_l].pwr_lock); + if (dsp[e->shift_l].running) - return -EBUSY; + ret = -EBUSY; + else + dsp[e->shift_l].fw = ucontrol->value.integer.value[0]; - dsp[e->shift_l].fw = ucontrol->value.integer.value[0]; + mutex_unlock(&dsp[e->shift_l].pwr_lock); - return 0; + return ret; } static const struct soc_enum wm_adsp_fw_enum[] = { |