diff options
-rw-r--r-- | include/sound/soc-dapm.h | 2 | ||||
-rw-r--r-- | sound/soc/soc-core.c | 10 | ||||
-rw-r--r-- | sound/soc/soc-dapm.c | 11 |
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 { | |||
601 | struct list_head list; | 601 | struct list_head list; |
602 | 602 | ||
603 | int (*stream_event)(struct snd_soc_dapm_context *dapm, int event); | 603 | int (*stream_event)(struct snd_soc_dapm_context *dapm, int event); |
604 | int (*set_bias_level)(struct snd_soc_dapm_context *dapm, | ||
605 | enum snd_soc_bias_level level); | ||
604 | 606 | ||
605 | #ifdef CONFIG_DEBUG_FS | 607 | #ifdef CONFIG_DEBUG_FS |
606 | struct dentry *debugfs_dapm; | 608 | 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, | |||
4285 | return 0; | 4285 | return 0; |
4286 | } | 4286 | } |
4287 | 4287 | ||
4288 | static int snd_soc_codec_set_bias_level(struct snd_soc_dapm_context *dapm, | ||
4289 | enum snd_soc_bias_level level) | ||
4290 | { | ||
4291 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(dapm); | ||
4292 | |||
4293 | return codec->driver->set_bias_level(codec, level); | ||
4294 | } | ||
4295 | |||
4288 | /** | 4296 | /** |
4289 | * snd_soc_register_codec - Register a codec with the ASoC core | 4297 | * snd_soc_register_codec - Register a codec with the ASoC core |
4290 | * | 4298 | * |
@@ -4322,6 +4330,8 @@ int snd_soc_register_codec(struct device *dev, | |||
4322 | codec->dapm.component = &codec->component; | 4330 | codec->dapm.component = &codec->component; |
4323 | codec->dapm.seq_notifier = codec_drv->seq_notifier; | 4331 | codec->dapm.seq_notifier = codec_drv->seq_notifier; |
4324 | codec->dapm.stream_event = codec_drv->stream_event; | 4332 | codec->dapm.stream_event = codec_drv->stream_event; |
4333 | if (codec_drv->set_bias_level) | ||
4334 | codec->dapm.set_bias_level = snd_soc_codec_set_bias_level; | ||
4325 | codec->dev = dev; | 4335 | codec->dev = dev; |
4326 | codec->driver = codec_drv; | 4336 | codec->driver = codec_drv; |
4327 | codec->component.val_bytes = codec_drv->reg_word_size; | 4337 | 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, | |||
427 | if (ret != 0) | 427 | if (ret != 0) |
428 | goto out; | 428 | goto out; |
429 | 429 | ||
430 | if (dapm->codec) { | 430 | if (dapm->set_bias_level) |
431 | if (dapm->codec->driver->set_bias_level) | 431 | ret = dapm->set_bias_level(dapm, level); |
432 | ret = dapm->codec->driver->set_bias_level(dapm->codec, | 432 | else if (!card || dapm != &card->dapm) |
433 | level); | ||
434 | else | ||
435 | dapm->bias_level = level; | ||
436 | } else if (!card || dapm != &card->dapm) { | ||
437 | dapm->bias_level = level; | 433 | dapm->bias_level = level; |
438 | } | ||
439 | 434 | ||
440 | if (ret != 0) | 435 | if (ret != 0) |
441 | goto out; | 436 | goto out; |