[PATCH v2 16/19] ASoC: soc-card: add snd_soc_card_set_bias_level()

Kuninori Morimoto kuninori.morimoto.gx at renesas.com
Thu May 28 03:49:35 CEST 2020


From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>

Card related function should be implemented at soc-card now.
This patch adds it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
 include/sound/soc-card.h |  4 ++++
 sound/soc/soc-card.c     | 12 ++++++++++++
 sound/soc/soc-dapm.c     |  3 +--
 3 files changed, 17 insertions(+), 2 deletions(-)

diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
index 97a34f0b0d2f..81e0c239b2e8 100644
--- a/include/sound/soc-card.h
+++ b/include/sound/soc-card.h
@@ -28,6 +28,10 @@ int snd_soc_card_probe(struct snd_soc_card *card);
 int snd_soc_card_late_probe(struct snd_soc_card *card);
 int snd_soc_card_remove(struct snd_soc_card *card);
 
+int snd_soc_card_set_bias_level(struct snd_soc_card *card,
+				struct snd_soc_dapm_context *dapm,
+				enum snd_soc_bias_level level);
+
 /* device driver data */
 static inline void snd_soc_card_set_drvdata(struct snd_soc_card *card,
 					    void *data)
diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
index 920967a9a5ea..dbcaa3d72dae 100644
--- a/sound/soc/soc-card.c
+++ b/sound/soc/soc-card.c
@@ -179,3 +179,15 @@ int snd_soc_card_remove(struct snd_soc_card *card)
 
 	return soc_card_ret(card, ret);
 }
+
+int snd_soc_card_set_bias_level(struct snd_soc_card *card,
+				struct snd_soc_dapm_context *dapm,
+				enum snd_soc_bias_level level)
+{
+	int ret = 0;
+
+	if (card && card->set_bias_level)
+		ret = card->set_bias_level(card, dapm, level);
+
+	return soc_card_ret(card, ret);
+}
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index a4de3e4bc2ef..5dc7849ecf41 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -725,8 +725,7 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm,
 
 	trace_snd_soc_bias_level_start(card, level);
 
-	if (card && card->set_bias_level)
-		ret = card->set_bias_level(card, dapm, level);
+	ret = snd_soc_card_set_bias_level(card, dapm, level);
 	if (ret != 0)
 		goto out;
 
-- 
2.17.1



More information about the Alsa-devel mailing list