diff mbox series

[v2,2/2] ASoC: export DPCM runtime update functions

Message ID 20200312095214.15126-3-guennadi.liakhovetski@linux.intel.com (mailing list archive)
State Accepted
Commit f17a14789e55f45514d1d72a4e51dcc6bdd8d463
Headers show
Series ASoC: SOF: preparatory patches | expand

Commit Message

Guennadi Liakhovetski March 12, 2020, 9:52 a.m. UTC
This makes DPCM runtime update functions available for external
calling. As an example, virtualised ASoC component drivers may need
to call these when managing shared DAPM routes that are used by more
than one driver (i.e. when host driver and guest drivers have a DAPM
path from guest PCM to host DAI where some parts are owned by host
driver and others by guest driver).

Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
---
 include/sound/soc-dpcm.h | 4 ++--
 sound/soc/soc-dapm.c     | 8 ++++----
 sound/soc/soc-pcm.c      | 5 ++++-
 3 files changed, 10 insertions(+), 7 deletions(-)

Comments

Pierre-Louis Bossart March 12, 2020, 10:51 a.m. UTC | #1
On 3/12/20 4:52 AM, Guennadi Liakhovetski wrote:
> This makes DPCM runtime update functions available for external
> calling. As an example, virtualised ASoC component drivers may need
> to call these when managing shared DAPM routes that are used by more
> than one driver (i.e. when host driver and guest drivers have a DAPM
> path from guest PCM to host DAI where some parts are owned by host
> driver and others by guest driver).
> 
> Signed-off-by: Guennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>

My understanding of Mark's feedback was to avoid exposing DPCM functions 
to other subsystems, since there's a long-term desire to move to a 
different domain-based handling instead of the existing FE/BE split.

> ---
>   include/sound/soc-dpcm.h | 4 ++--
>   sound/soc/soc-dapm.c     | 8 ++++----
>   sound/soc/soc-pcm.c      | 5 ++++-
>   3 files changed, 10 insertions(+), 7 deletions(-)
> 
> diff --git a/include/sound/soc-dpcm.h b/include/sound/soc-dpcm.h
> index 4022357..0f6c50b 100644
> --- a/include/sound/soc-dpcm.h
> +++ b/include/sound/soc-dpcm.h
> @@ -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);
> diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
> index e00a465..d5eb52f 100644
> --- a/sound/soc/soc-dapm.c
> +++ b/sound/soc/soc-dapm.c
> @@ -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;
>   }
> diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
> index bf4c5dc..2b915f4 100644
> --- a/sound/soc/soc-pcm.c
> +++ b/sound/soc/soc-pcm.c
> @@ -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
> @@ -2969,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;
> @@ -2993,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)
>   {
>
Mark Brown March 12, 2020, 12:38 p.m. UTC | #2
On Thu, Mar 12, 2020 at 05:51:59AM -0500, Pierre-Louis Bossart wrote:
> On 3/12/20 4:52 AM, Guennadi Liakhovetski wrote:

> > This makes DPCM runtime update functions available for external
> > calling. As an example, virtualised ASoC component drivers may need
> > to call these when managing shared DAPM routes that are used by more
> > than one driver (i.e. when host driver and guest drivers have a DAPM
> > path from guest PCM to host DAI where some parts are owned by host
> > driver and others by guest driver).

> My understanding of Mark's feedback was to avoid exposing DPCM functions to
> other subsystems, since there's a long-term desire to move to a different
> domain-based handling instead of the existing FE/BE split.

While we have it I can see that some individual driver might need to
fiddle about with it though, after all a big problem currently is that
the abstraction isn't terribly abstract.
diff mbox series

Patch

diff --git a/include/sound/soc-dpcm.h b/include/sound/soc-dpcm.h
index 4022357..0f6c50b 100644
--- a/include/sound/soc-dpcm.h
+++ b/include/sound/soc-dpcm.h
@@ -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);
diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
index e00a465..d5eb52f 100644
--- a/sound/soc/soc-dapm.c
+++ b/sound/soc/soc-dapm.c
@@ -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;
 }
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index bf4c5dc..2b915f4 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -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
@@ -2969,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;
@@ -2993,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)
 {