Skip to contentSkip to conversation

ASoC: Ensure we only run Speyside WM8962 bias level callbacks once

PATCH In review Mark Brown 2 participants 2 messages Aug 21, 2011 – Aug 22, 2011

Subsystems (3)
lore
Share & tools
lore

Mark Brown

author
#0 lore raw

PATCH 1/1 ASoC: Ensure we only run Speyside WM8962 bias level callbacks once

We get called once per DAPM context but only need to run once. When DAPM was serialized this was a series of noops but now it can run in parallel we need to take proper care.

---
 sound/soc/samsung/speyside_wm8962.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
sound/soc/samsung/speyside_wm8962.c +6 -0
index 753e1c2..3820a6b 100644
@@ -23,6 +23,9 @@ static int speyside_wm8962_set_bias_level(struct snd_soc_card *card,
 	struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
 	int ret;
 
+	if (dapm->dev != codec_dai->dev)
+		return 0;
+
 	switch (level) {
 	case SND_SOC_BIAS_PREPARE:
 		if (dapm->bias_level == SND_SOC_BIAS_STANDBY) {
@@ -57,6 +60,9 @@ static int speyside_wm8962_set_bias_level_post(struct snd_soc_card *card,
 	struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
 	int ret;
 
+	if (dapm->dev != codec_dai->dev)
+		return 0;
+
 	switch (level) {
 	case SND_SOC_BIAS_STANDBY:
 		ret = snd_soc_dai_set_sysclk(codec_dai, WM8962_SYSCLK_MCLK,
Signature · 1 line
1.7.5.4
Acked-by on v1 1/1
#1 lore raw
Quoted 24 lines · Mark Brown

We get called once per DAPM context but only need to run once. When DAPM was serialized this was a series of noops but now it can run in parallel we need to take proper care.

---
 sound/soc/samsung/speyside_wm8962.c |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)
sound/soc/samsung/speyside_wm8962.c +3 -0
index 753e1c2..3820a6b 100644
@@ -23,6 +23,9 @@ static int speyside_wm8962_set_bias_level(struct snd_soc_card *card,
 	struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
 	int ret;
 
+	if (dapm->dev != codec_dai->dev)
+		return 0;
+
 	switch (level) {
 	case SND_SOC_BIAS_PREPARE:
 		if (dapm->bias_level == SND_SOC_BIAS_STANDBY) {

sound/soc/samsung/speyside_wm8962.c static int speyside_wm8962_set_bias_level_post(struct snd_soc_card *card, · line 68

Quoted 9 lines
sound/soc/samsung/speyside_wm8962.c +3 -0
@@ -57,6 +60,9 @@ static int speyside_wm8962_set_bias_level_post(struct snd_soc_card *card,
 	struct snd_soc_dai *codec_dai = card->rtd[0].codec_dai;
 	int ret;
 
+	if (dapm->dev != codec_dai->dev)
+		return 0;
+
 	switch (level) {
 	case SND_SOC_BIAS_STANDBY:
 		ret = snd_soc_dai_set_sysclk(codec_dai, WM8962_SYSCLK_MCLK,