diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2020-11-27 03:07:40 +0300 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2020-11-27 16:50:26 +0300 |
commit | baed393e8550fa075512772fad27e98ba9dcb527 (patch) | |
tree | 41aad19de7829b8fc6431484bf6279667d598dad /sound/soc/soc-core.c | |
parent | d4c1d9eb6611fee6cd3623e810282342757b57f6 (diff) | |
download | linux-baed393e8550fa075512772fad27e98ba9dcb527.tar.xz |
ASoC: soc-core: add soc_dapm_suspend_resume()
snd_soc_suspend() and soc_resume_deferred() are calling
same snd_soc_dapm_stream_event() with same logic with different parameter.
This patch adds new soc_dapm_suspend_resume() and share the code.
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87im9rekfp.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/soc-core.c')
-rw-r--r-- | sound/soc/soc-core.c | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index c03b7107cb77..50b4ce6374a0 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -539,6 +539,21 @@ static void soc_playback_digital_mute(struct snd_soc_card *card, int mute) } } +static void soc_dapm_suspend_resume(struct snd_soc_card *card, int event) +{ + struct snd_soc_pcm_runtime *rtd; + int stream; + + for_each_card_rtds(card, rtd) { + + if (rtd->dai_link->ignore_suspend) + continue; + + for_each_pcm_streams(stream) + snd_soc_dapm_stream_event(rtd, stream, event); + } +} + /* powers down audio subsystem for suspend */ int snd_soc_suspend(struct device *dev) { @@ -576,16 +591,7 @@ int snd_soc_suspend(struct device *dev) /* close any waiting streams */ snd_soc_flush_all_delayed_work(card); - for_each_card_rtds(card, rtd) { - int stream; - - if (rtd->dai_link->ignore_suspend) - continue; - - for_each_pcm_streams(stream) - snd_soc_dapm_stream_event(rtd, stream, - SND_SOC_DAPM_STREAM_SUSPEND); - } + soc_dapm_suspend_resume(card, SND_SOC_DAPM_STREAM_SUSPEND); /* Recheck all endpoints too, their state is affected by suspend */ dapm_mark_endpoints_dirty(card); @@ -656,7 +662,6 @@ static void soc_resume_deferred(struct work_struct *work) struct snd_soc_card *card = container_of(work, struct snd_soc_card, deferred_resume_work); - struct snd_soc_pcm_runtime *rtd; struct snd_soc_component *component; /* @@ -676,16 +681,7 @@ static void soc_resume_deferred(struct work_struct *work) snd_soc_component_resume(component); } - for_each_card_rtds(card, rtd) { - int stream; - - if (rtd->dai_link->ignore_suspend) - continue; - - for_each_pcm_streams(stream) - snd_soc_dapm_stream_event(rtd, stream, - SND_SOC_DAPM_STREAM_RESUME); - } + soc_dapm_suspend_resume(card, SND_SOC_DAPM_STREAM_RESUME); /* unmute any active DACs */ soc_playback_digital_mute(card, 0); |