Commit 1bf1b8cf authored by Charles Keepax's avatar Charles Keepax Committed by Mark Brown

ASoC: adav80x: Update locking around use of DAPM pin API

The pin updates in this driver look like they are intended to be done
atomically, update to do so.
Signed-off-by: default avatarCharles Keepax <ckeepax@opensource.wolfsonmicro.com>
Acked-by: default avatarLars-Peter Clausen <lars@metafoo.de>
Signed-off-by: default avatarMark Brown <broonie@linaro.org>
parent 3eb29dfb
...@@ -541,6 +541,7 @@ static int adav80x_set_sysclk(struct snd_soc_codec *codec, ...@@ -541,6 +541,7 @@ static int adav80x_set_sysclk(struct snd_soc_codec *codec,
unsigned int freq, int dir) unsigned int freq, int dir)
{ {
struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec); struct adav80x *adav80x = snd_soc_codec_get_drvdata(codec);
struct snd_soc_dapm_context *dapm = &codec->dapm;
if (dir == SND_SOC_CLOCK_IN) { if (dir == SND_SOC_CLOCK_IN) {
switch (clk_id) { switch (clk_id) {
...@@ -573,7 +574,7 @@ static int adav80x_set_sysclk(struct snd_soc_codec *codec, ...@@ -573,7 +574,7 @@ static int adav80x_set_sysclk(struct snd_soc_codec *codec,
regmap_write(adav80x->regmap, ADAV80X_ICLK_CTRL2, regmap_write(adav80x->regmap, ADAV80X_ICLK_CTRL2,
iclk_ctrl2); iclk_ctrl2);
snd_soc_dapm_sync(&codec->dapm); snd_soc_dapm_sync(dapm);
} }
} else { } else {
unsigned int mask; unsigned int mask;
...@@ -600,17 +601,21 @@ static int adav80x_set_sysclk(struct snd_soc_codec *codec, ...@@ -600,17 +601,21 @@ static int adav80x_set_sysclk(struct snd_soc_codec *codec,
adav80x->sysclk_pd[clk_id] = false; adav80x->sysclk_pd[clk_id] = false;
} }
snd_soc_dapm_mutex_lock(dapm);
if (adav80x->sysclk_pd[0]) if (adav80x->sysclk_pd[0])
snd_soc_dapm_disable_pin(&codec->dapm, "PLL1"); snd_soc_dapm_disable_pin_unlocked(dapm, "PLL1");
else else
snd_soc_dapm_force_enable_pin(&codec->dapm, "PLL1"); snd_soc_dapm_force_enable_pin_unlocked(dapm, "PLL1");
if (adav80x->sysclk_pd[1] || adav80x->sysclk_pd[2]) if (adav80x->sysclk_pd[1] || adav80x->sysclk_pd[2])
snd_soc_dapm_disable_pin(&codec->dapm, "PLL2"); snd_soc_dapm_disable_pin_unlocked(dapm, "PLL2");
else else
snd_soc_dapm_force_enable_pin(&codec->dapm, "PLL2"); snd_soc_dapm_force_enable_pin_unlocked(dapm, "PLL2");
snd_soc_dapm_sync(&codec->dapm); snd_soc_dapm_sync_unlocked(dapm);
snd_soc_dapm_mutex_unlock(dapm);
} }
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment