summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/soc-dapm.h2
-rw-r--r--sound/soc/soc-core.c10
-rw-r--r--sound/soc/soc-dapm.c11
3 files changed, 15 insertions, 8 deletions
diff --git a/include/sound/soc-dapm.h b/include/sound/soc-dapm.h
index 8db627cc2fbe..3a5c4f969c04 100644
--- a/include/sound/soc-dapm.h
+++ b/include/sound/soc-dapm.h
@@ -601,6 +601,8 @@ struct snd_soc_dapm_context {
struct list_head list;
int (*stream_event)(struct snd_soc_dapm_context *dapm, int event);
+ int (*set_bias_level)(struct snd_soc_dapm_context *dapm,
+ enum snd_soc_bias_level level);
#ifdef CONFIG_DEBUG_FS
struct dentry *debugfs_dapm;
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index bca8a7150a4a..10e13c43bc54 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -4285,6 +4285,14 @@ static int snd_soc_codec_drv_read(struct snd_soc_component *component,
return 0;
}
+static int snd_soc_codec_set_bias_level(struct snd_soc_dapm_context *dapm,
+ enum snd_soc_bias_level level)
+{
+ struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm);
+
+ return codec->driver->set_bias_level(codec, level);
+}
+
/**
* snd_soc_register_codec - Register a codec with the ASoC core
*
@@ -4322,6 +4330,8 @@ int snd_soc_register_codec(struct device *dev,
codec->dapm.component = &codec->component;
codec->dapm.seq_notifier = codec_drv->seq_notifier;
codec->dapm.stream_event = codec_drv->stream_event;
+ if (codec_drv->set_bias_level)
+ codec->dapm.set_bias_level = snd_soc_codec_set_bias_level;
codec->dev = dev;
codec->driver = codec_drv;
codec->component.val_bytes = codec_drv->reg_word_size;
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index fab1a8813abf..6c94a6b3fce7 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -427,15 +427,10 @@ static int snd_soc_dapm_set_bias_level(struct snd_soc_dapm_context *dapm,
if (ret != 0)
goto out;
- if (dapm->codec) {
- if (dapm->codec->driver->set_bias_level)
- ret = dapm->codec->driver->set_bias_level(dapm->codec,
- level);
- else
- dapm->bias_level = level;
- } else if (!card || dapm != &card->dapm) {
+ if (dapm->set_bias_level)
+ ret = dapm->set_bias_level(dapm, level);
+ else if (!card || dapm != &card->dapm)
dapm->bias_level = level;
- }
if (ret != 0)
goto out;