RE: [PATCH v2 2/3] ASoC: rsnd: don't indicate warning on rsnd_kctrl_accept_runtime()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



Hello Morimoto-san,

> From: Kuninori Morimoto, Sent: Wednesday, February 5, 2025 9:21 AM
> 
> rsnd_kctrl_accept_runtime() (1) is used for runtime convert rate
> (= Synchronous SRC Mode). Now, rsnd driver has 2 kctrls for it
> 
> (A):	"SRC Out Rate Switch"
> (B):	"SRC Out Rate"		// it calls (1)
> 
> (A): can be called anytime
> (B): can be called only runtime, and will indicate warning if it was used
>    at non-runtime.
> 
> To use runtime convert rate (= Synchronous SRC Mode), user might uses
> command in below order.
> 
> (X):	> amixer set "SRC Out Rate" on
> 	> aplay xxx.wav &
> (Y):	> amixer set "SRC Out Rate" 48010 // convert rate to 48010Hz
> 
> (Y): calls B
> (X): calls both A and B.
> 
> In this case, when user calls (X), it calls both (A) and (B), but it is not
> yet start running. So, (B) will indicate warning.
> 
> This warning was added by commit b5c088689847 ("ASoC: rsnd: add warning
> message to rsnd_kctrl_accept_runtime()"), but the message sounds like the
> operation was not correct. Let's update warning message.
> 
> The message is very SRC specific, implement it in src.c
> 
> Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@xxxxxxxxxxx>

Thank you for the patch!
On v1 patch, I mentioned about 'amixer cset name="SRC Out Rate Switch" on',
but I confirmed that 'amixer set "SRC Out Rate" on' also worked.
So,

Reviewed-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@xxxxxxxxxxx>

Best regards,
Yoshihiro Shimoda

> ---
>  sound/soc/renesas/rcar/core.c | 14 --------------
>  sound/soc/renesas/rcar/rsnd.h |  1 -
>  sound/soc/renesas/rcar/src.c  | 18 +++++++++++++++++-
>  3 files changed, 17 insertions(+), 16 deletions(-)
> 
> diff --git a/sound/soc/renesas/rcar/core.c b/sound/soc/renesas/rcar/core.c
> index d3709fd0409e4..f3f0c3f0bb9f5 100644
> --- a/sound/soc/renesas/rcar/core.c
> +++ b/sound/soc/renesas/rcar/core.c
> @@ -1770,20 +1770,6 @@ int rsnd_kctrl_accept_anytime(struct rsnd_dai_stream *io)
>  	return 1;
>  }
> 
> -int rsnd_kctrl_accept_runtime(struct rsnd_dai_stream *io)
> -{
> -	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
> -	struct rsnd_priv *priv = rsnd_io_to_priv(io);
> -	struct device *dev = rsnd_priv_to_dev(priv);
> -
> -	if (!runtime) {
> -		dev_warn(dev, "Can't update kctrl when idle\n");
> -		return 0;
> -	}
> -
> -	return 1;
> -}
> -
>  struct rsnd_kctrl_cfg *rsnd_kctrl_init_m(struct rsnd_kctrl_cfg_m *cfg)
>  {
>  	cfg->cfg.val = cfg->val;
> diff --git a/sound/soc/renesas/rcar/rsnd.h b/sound/soc/renesas/rcar/rsnd.h
> index a5f54b65313c4..04c70690f7a25 100644
> --- a/sound/soc/renesas/rcar/rsnd.h
> +++ b/sound/soc/renesas/rcar/rsnd.h
> @@ -742,7 +742,6 @@ struct rsnd_kctrl_cfg_s {
>  #define rsnd_kctrl_vals(x)	((x).val)	/* = (x).cfg.val[0] */
> 
>  int rsnd_kctrl_accept_anytime(struct rsnd_dai_stream *io);
> -int rsnd_kctrl_accept_runtime(struct rsnd_dai_stream *io);
>  struct rsnd_kctrl_cfg *rsnd_kctrl_init_m(struct rsnd_kctrl_cfg_m *cfg);
>  struct rsnd_kctrl_cfg *rsnd_kctrl_init_s(struct rsnd_kctrl_cfg_s *cfg);
>  int rsnd_kctrl_new(struct rsnd_mod *mod,
> diff --git a/sound/soc/renesas/rcar/src.c b/sound/soc/renesas/rcar/src.c
> index e7f86db0d94c3..3099180297722 100644
> --- a/sound/soc/renesas/rcar/src.c
> +++ b/sound/soc/renesas/rcar/src.c
> @@ -531,6 +531,22 @@ static irqreturn_t rsnd_src_interrupt(int irq, void *data)
>  	return IRQ_HANDLED;
>  }
> 
> +static int rsnd_src_kctrl_accept_runtime(struct rsnd_dai_stream *io)
> +{
> +	struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io);
> +
> +	if (!runtime) {
> +		struct rsnd_priv *priv = rsnd_io_to_priv(io);
> +		struct device *dev = rsnd_priv_to_dev(priv);
> +
> +		dev_warn(dev, "\"SRC Out Rate\" can use during running\n");
> +
> +		return 0;
> +	}
> +
> +	return 1;
> +}
> +
>  static int rsnd_src_probe_(struct rsnd_mod *mod,
>  			   struct rsnd_dai_stream *io,
>  			   struct rsnd_priv *priv)
> @@ -594,7 +610,7 @@ static int rsnd_src_pcm_new(struct rsnd_mod *mod,
>  			       rsnd_io_is_play(io) ?
>  			       "SRC Out Rate" :
>  			       "SRC In Rate",
> -			       rsnd_kctrl_accept_runtime,
> +			       rsnd_src_kctrl_accept_runtime,
>  			       rsnd_src_set_convert_rate,
>  			       &src->sync, 192000);
> 
> --
> 2.43.0






[Index of Archives]     [Pulseaudio]     [Linux Audio Users]     [ALSA Devel]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]

  Powered by Linux