提交 d27c5e15 编写于 作者: C Charles Keepax 提交者: Mark Brown

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: NCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Signed-off-by: NMark Brown <broonie@kernel.org>
上级 078e7183
...@@ -451,6 +451,7 @@ static int wm_adsp_fw_put(struct snd_kcontrol *kcontrol, ...@@ -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 snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol);
struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
struct wm_adsp *dsp = snd_soc_codec_get_drvdata(codec); struct wm_adsp *dsp = snd_soc_codec_get_drvdata(codec);
int ret = 0;
if (ucontrol->value.integer.value[0] == dsp[e->shift_l].fw) if (ucontrol->value.integer.value[0] == dsp[e->shift_l].fw)
return 0; return 0;
...@@ -458,12 +459,16 @@ static int wm_adsp_fw_put(struct snd_kcontrol *kcontrol, ...@@ -458,12 +459,16 @@ static int wm_adsp_fw_put(struct snd_kcontrol *kcontrol,
if (ucontrol->value.integer.value[0] >= WM_ADSP_NUM_FW) if (ucontrol->value.integer.value[0] >= WM_ADSP_NUM_FW)
return -EINVAL; return -EINVAL;
if (dsp[e->shift_l].running) mutex_lock(&dsp[e->shift_l].pwr_lock);
return -EBUSY;
if (dsp[e->shift_l].running)
ret = -EBUSY;
else
dsp[e->shift_l].fw = ucontrol->value.integer.value[0]; dsp[e->shift_l].fw = ucontrol->value.integer.value[0];
return 0; mutex_unlock(&dsp[e->shift_l].pwr_lock);
return ret;
} }
static const struct soc_enum wm_adsp_fw_enum[] = { static const struct soc_enum wm_adsp_fw_enum[] = {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册