Commit 101247a3 authored by Mark Brown's avatar Mark Brown

Merge series "ASoC: SOF: preparatory patches" from Guennadi Liakhovetski...

Merge series "ASoC: SOF: preparatory patches" from Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>:

2 preparatory patches for the SOF virtualisation work. No functional
changes, only some code refactoring and exporting of helper functions.

v2: rebase, no changes otherwise.

Thanks
Guennadi

Guennadi Liakhovetski (2):
  ASoC: (cosmetic) simplify dpcm_prune_paths()
  ASoC: export DPCM runtime update functions

 include/sound/soc-dpcm.h |  4 +--
 sound/soc/soc-dapm.c     |  8 +++---
 sound/soc/soc-pcm.c      | 68 +++++++++++++++++++++++++-----------------------
 3 files changed, 42 insertions(+), 38 deletions(-)

--
1.9.3
parents b239d0c2 f17a1478
......@@ -132,8 +132,8 @@ int snd_soc_dpcm_be_can_update(struct snd_soc_pcm_runtime *fe,
struct snd_pcm_substream *
snd_soc_dpcm_get_substream(struct snd_soc_pcm_runtime *be, int stream);
/* internal use only */
int soc_dpcm_runtime_update(struct snd_soc_card *);
/* update audio routing between PCMs and any DAI links */
int snd_soc_dpcm_runtime_update(struct snd_soc_card *card);
#ifdef CONFIG_DEBUG_FS
void soc_dpcm_debugfs_add(struct snd_soc_pcm_runtime *rtd);
......
......@@ -2291,7 +2291,7 @@ int snd_soc_dapm_mux_update_power(struct snd_soc_dapm_context *dapm,
card->update = NULL;
mutex_unlock(&card->dapm_mutex);
if (ret > 0)
soc_dpcm_runtime_update(card);
snd_soc_dpcm_runtime_update(card);
return ret;
}
EXPORT_SYMBOL_GPL(snd_soc_dapm_mux_update_power);
......@@ -2356,7 +2356,7 @@ int snd_soc_dapm_mixer_update_power(struct snd_soc_dapm_context *dapm,
card->update = NULL;
mutex_unlock(&card->dapm_mutex);
if (ret > 0)
soc_dpcm_runtime_update(card);
snd_soc_dpcm_runtime_update(card);
return ret;
}
EXPORT_SYMBOL_GPL(snd_soc_dapm_mixer_update_power);
......@@ -3396,7 +3396,7 @@ int snd_soc_dapm_put_volsw(struct snd_kcontrol *kcontrol,
mutex_unlock(&card->dapm_mutex);
if (ret > 0)
soc_dpcm_runtime_update(card);
snd_soc_dpcm_runtime_update(card);
return change;
}
......@@ -3501,7 +3501,7 @@ int snd_soc_dapm_put_enum_double(struct snd_kcontrol *kcontrol,
mutex_unlock(&card->dapm_mutex);
if (ret > 0)
soc_dpcm_runtime_update(card);
snd_soc_dpcm_runtime_update(card);
return change;
}
......
......@@ -295,6 +295,7 @@ void snd_soc_runtime_activate(struct snd_soc_pcm_runtime *rtd, int stream)
{
snd_soc_runtime_action(rtd, stream, 1);
}
EXPORT_SYMBOL_GPL(snd_soc_runtime_activate);
/**
* snd_soc_runtime_deactivate() - Decrement active count for PCM runtime components
......@@ -310,6 +311,7 @@ void snd_soc_runtime_deactivate(struct snd_soc_pcm_runtime *rtd, int stream)
{
snd_soc_runtime_action(rtd, stream, -1);
}
EXPORT_SYMBOL_GPL(snd_soc_runtime_deactivate);
/**
* snd_soc_runtime_ignore_pmdown_time() - Check whether to ignore the power down delay
......@@ -1626,22 +1628,14 @@ void dpcm_path_put(struct snd_soc_dapm_widget_list **list)
snd_soc_dapm_dai_free_widgets(list);
}
static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream,
struct snd_soc_dapm_widget_list **list_)
static bool dpcm_be_is_active(struct snd_soc_dpcm *dpcm, int stream,
struct snd_soc_dapm_widget_list *list)
{
struct snd_soc_dpcm *dpcm;
struct snd_soc_dapm_widget_list *list = *list_;
struct snd_soc_dapm_widget *widget;
struct snd_soc_dai *dai;
int prune = 0;
int do_prune;
/* Destroy any old FE <--> BE connections */
for_each_dpcm_be(fe, stream, dpcm) {
unsigned int i;
/* is there a valid CPU DAI widget for this BE */
do_prune = 1;
for_each_rtd_cpu_dais(dpcm->be, i, dai) {
widget = snd_soc_dai_get_widget(dai, stream);
......@@ -1650,21 +1644,30 @@ static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream,
* widgets are in the active list.
*/
if (widget && widget_in_list(list, widget))
do_prune = 0;
return true;
}
if (!do_prune)
continue;
/* is there a valid CODEC DAI widget for this BE */
do_prune = 1;
for_each_rtd_codec_dais(dpcm->be, i, dai) {
widget = snd_soc_dai_get_widget(dai, stream);
/* prune the BE if it's no longer in our active list */
if (widget && widget_in_list(list, widget))
do_prune = 0;
return true;
}
if (!do_prune)
return false;
}
static int dpcm_prune_paths(struct snd_soc_pcm_runtime *fe, int stream,
struct snd_soc_dapm_widget_list **list_)
{
struct snd_soc_dpcm *dpcm;
int prune = 0;
/* Destroy any old FE <--> BE connections */
for_each_dpcm_be(fe, stream, dpcm) {
if (dpcm_be_is_active(dpcm, stream, *list_))
continue;
dev_dbg(fe->dev, "ASoC: pruning %s BE %s for %s\n",
......@@ -2968,7 +2971,7 @@ static int soc_dpcm_fe_runtime_update(struct snd_soc_pcm_runtime *fe, int new)
/* Called by DAPM mixer/mux changes to update audio routing between PCMs and
* any DAI links.
*/
int soc_dpcm_runtime_update(struct snd_soc_card *card)
int snd_soc_dpcm_runtime_update(struct snd_soc_card *card)
{
struct snd_soc_pcm_runtime *fe;
int ret = 0;
......@@ -2992,6 +2995,7 @@ int soc_dpcm_runtime_update(struct snd_soc_card *card)
mutex_unlock(&card->mutex);
return ret;
}
EXPORT_SYMBOL_GPL(snd_soc_dpcm_runtime_update);
static void dpcm_fe_dai_cleanup(struct snd_pcm_substream *fe_substream)
{
......
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