Commit 580dff36 authored by Kuninori Morimoto's avatar Kuninori Morimoto Committed by Mark Brown

ASoC: soc-pcm: merge dpcm_run_new/old_update() into dpcm_fe_runtime_update()

soc-pcm has dpcm_run_new/old_update(), but these are used from
dpcm_fe_runtime_update() only, and are very verbose functions.
This patch disassembles these.
Signed-off-by: default avatarKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87blpvjc9v.wl-kuninori.morimoto.gx@renesas.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 0c01f6ca
...@@ -2536,37 +2536,12 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream) ...@@ -2536,37 +2536,12 @@ static int dpcm_run_update_startup(struct snd_soc_pcm_runtime *fe, int stream)
return ret; return ret;
} }
static int dpcm_run_new_update(struct snd_soc_pcm_runtime *fe, int stream)
{
int ret;
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE);
ret = dpcm_run_update_startup(fe, stream);
if (ret < 0)
dev_err(fe->dev, "ASoC: failed to startup some BEs\n");
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
return ret;
}
static int dpcm_run_old_update(struct snd_soc_pcm_runtime *fe, int stream)
{
int ret;
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE);
ret = dpcm_run_update_shutdown(fe, stream);
if (ret < 0)
dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n");
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
return ret;
}
static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new) static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new)
{ {
struct snd_soc_dapm_widget_list *list; struct snd_soc_dapm_widget_list *list;
int stream; int stream;
int count, paths; int count, paths;
int ret;
if (!fe->dai_link->dynamic) if (!fe->dai_link->dynamic)
return 0; return 0;
...@@ -2603,10 +2578,14 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new) ...@@ -2603,10 +2578,14 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new)
/* update any playback/capture paths */ /* update any playback/capture paths */
count = dpcm_process_paths(fe, stream, &list, new); count = dpcm_process_paths(fe, stream, &list, new);
if (count) { if (count) {
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_BE);
if (new) if (new)
dpcm_run_new_update(fe, stream); ret = dpcm_run_update_startup(fe, stream);
else else
dpcm_run_old_update(fe, stream); ret = dpcm_run_update_shutdown(fe, stream);
if (ret < 0)
dev_err(fe->dev, "ASoC: failed to shutdown some BEs\n");
dpcm_set_fe_update_state(fe, stream, SND_SOC_DPCM_UPDATE_NO);
dpcm_clear_pending_state(fe, stream); dpcm_clear_pending_state(fe, stream);
dpcm_be_disconnect(fe, stream); dpcm_be_disconnect(fe, stream);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment