[PATCH 17/19] ASoC: soc-card: add snd_soc_card_set_bias_level_post()

Ranjani Sridharan ranjani.sridharan at linux.intel.com
Wed May 27 02:24:00 CEST 2020


On Tue, 2020-05-26 at 10:19 +0900, Kuninori Morimoto wrote:
> From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
> 
> Card related function should be implemented at soc-card now.
> This patch adds it.
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
> ---
>  include/sound/soc-card.h |  3 +++
>  sound/soc/soc-card.c     | 12 ++++++++++++
>  sound/soc/soc-dapm.c     |  4 ++--
>  3 files changed, 17 insertions(+), 2 deletions(-)
> 
> diff --git a/include/sound/soc-card.h b/include/sound/soc-card.h
> index 4bcdc1d382bf..54341e4d818a 100644
> --- a/include/sound/soc-card.h
> +++ b/include/sound/soc-card.h
> @@ -31,6 +31,9 @@ int snd_soc_card_remove(struct snd_soc_card *card);
>  int snd_soc_card_set_bias_level(struct snd_soc_card *card,
>  				struct snd_soc_dapm_context *dapm,
>  				enum snd_soc_bias_level level);
> +int snd_soc_card_set_bias_level_post(struct snd_soc_card *card,
> +				     struct snd_soc_dapm_context *dapm,
> +				     enum snd_soc_bias_level level);
>  
>  /* device driver data */
>  static inline void snd_soc_card_set_drvdata(struct snd_soc_card
> *card,
> diff --git a/sound/soc/soc-card.c b/sound/soc/soc-card.c
> index a9f25b6a4c67..8db3b98d1c80 100644
> --- a/sound/soc/soc-card.c
> +++ b/sound/soc/soc-card.c
> @@ -184,3 +184,15 @@ int snd_soc_card_set_bias_level(struct
> snd_soc_card *card,
>  
>  	return soc_card_ret(card, ret);
>  }
> +
> +int snd_soc_card_set_bias_level_post(struct snd_soc_card *card,
> +				     struct snd_soc_dapm_context *dapm,
> +				     enum snd_soc_bias_level level)
> +{
> +	int ret = 0;
> +
> +	if (card->set_bias_level_post)
> +		ret = card->set_bias_level_post(card, dapm, level);
> +
> +	return soc_card_ret(card, ret);
> +}
> diff --git a/sound/soc/soc-dapm.c b/sound/soc/soc-dapm.c
> index add39d24a583..af457ee5ef83 100644
> --- a/sound/soc/soc-dapm.c
> +++ b/sound/soc/soc-dapm.c
> @@ -736,8 +736,8 @@ static int snd_soc_dapm_set_bias_level(struct
> snd_soc_dapm_context *dapm,
>  	if (ret != 0)
>  		goto out;
>  
> -	if (card && card->set_bias_level_post)
> -		ret = card->set_bias_level_post(card, dapm, level);
> +	if (card)
> +		ret = snd_soc_card_set_bias_level_post(card, dapm,
> level);
same here too. We can move the check to
snd_soc_card_set_bias_level_post() and remove the first parameter?

Thanks,
Ranjani



More information about the Alsa-devel mailing list