Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Charles Keepax <ckeepax@opensource.cirrus.com>
To: Olivier Louvignes <olivier@mgcrea.io>
Cc: Mark Brown <broonie@kernel.org>,
	Liam Girdwood <lgirdwood@gmail.com>,
	David Rhodes <david.rhodes@cirrus.com>,
	Richard Fitzgerald <rf@opensource.cirrus.com>,
	linux-sound@vger.kernel.org, patches@opensource.cirrus.com
Subject: Re: [PATCH v2 2/2] ASoC: cs43130: Mute the PCM path from hw_free() to prepare()
Date: Mon, 26 Oct 2026 15:02:13 +0000	[thread overview]
Message-ID: <at9rdZn3HA84d1iA@opensource.cirrus.com> (raw)
In-Reply-To: <20261023202941.87999-2-olivier@mgcrea.io>

On Fri, Oct 23, 2026 at 10:29:41PM +0200, Olivier Louvignes wrote:
> The PCM path is unmuted when DAPM powers it up and muted again only when
> DAPM powers it down, pmdown_time after the stream closes. Meanwhile the
> DAC plays whatever its serial port carries: on a HiBy R1 (CS43131 on an
> Ingenic X1600 I2S controller), loud white noise while a stream is open
> but stopped, as when paused, and until DAPM powers down after it closes.
> 
> Add a mute_stream() op, so that ASoC mutes the path at hw_free() and
> unmutes it at prepare(). The op is not run at trigger time, since the
> codec sits on I2C.
> 
> Signed-off-by: Olivier Louvignes <olivier@mgcrea.io>
> ---
> Changes in v2: rebased on broonie/sound for-next, the ops now sit next to
> .auto_selectable_formats. No other change.
> 
> Tested on v7.3 on a HiBy R1 (CS43131), by ear: no hiss while paused or
> after the stream stops. Build-tested with W=1 on for-next.
> 
>  sound/soc/codecs/cs43130.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/sound/soc/codecs/cs43130.c b/sound/soc/codecs/cs43130.c
> index 7fb23522f081..919280711f8d 100644
> --- a/sound/soc/codecs/cs43130.c
> +++ b/sound/soc/codecs/cs43130.c
> @@ -1624,6 +1624,20 @@ static int cs43130_set_sysclk(struct snd_soc_dai *codec_dai,
>  	return 0;
>  }
>  
> +/*
> + * Mutes the PCM path from hw_free() to the next prepare(). Otherwise it stays
> + * unmuted until DAPM powers it down, pmdown_time after the stream closes, and
> + * plays what the serial port carries meanwhile: white noise on the HiBy R1.
> + */
> +static int cs43130_mute_stream(struct snd_soc_dai *dai, int mute, int stream)
> +{
> +	struct snd_soc_component *component = dai->component;
> +	struct cs43130_private *cs43130 = snd_soc_component_get_drvdata(component);
> +
> +	return regmap_update_bits(cs43130->regmap, CS43130_PCM_PATH_CTL_1,
> +				  CS43130_MUTE_MASK, mute ? CS43130_MUTE_EN : 0);
> +}

I am slightly concerned about some variants of the chips
running additional register sequences around the mute, I
was not involved in the work on this driver so little unsure
how critical those are. Would it perhaps be slightly safer to
just remove use_pmdown_time? Thereby forcing the chip to
power down immediately.

Thanks,
Charles

> +
>  static const u64 cs43130_selectable_formats =
>  	SND_SOC_POSSIBLE_DAIFMT_I2S	|
>  	SND_SOC_POSSIBLE_DAIFMT_LEFT_J	|
> @@ -1640,6 +1654,8 @@ static const struct snd_soc_dai_ops cs43130_pcm_ops = {
>  	.hw_free	= cs43130_hw_free,
>  	.set_sysclk	= cs43130_set_sysclk,
>  	.set_fmt	= cs43130_pcm_set_fmt,
> +	.mute_stream	= cs43130_mute_stream,
> +	.no_capture_mute = 1,
>  	.auto_selectable_formats	= &cs43130_selectable_formats,
>  	.num_auto_selectable_formats	= 1,
>  };
> -- 
> 2.39.5
> 

  reply	other threads:[~2026-10-26 15:04 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-23 20:29 [PATCH v2 1/2] ASoC: cs43130: Drop only the clock reference hw_params() took Olivier Louvignes
2026-10-23 20:29 ` [PATCH v2 2/2] ASoC: cs43130: Mute the PCM path from hw_free() to prepare() Olivier Louvignes
2026-10-26 15:02   ` Charles Keepax [this message]
2026-10-26 15:05 ` [PATCH v2 1/2] ASoC: cs43130: Drop only the clock reference hw_params() took Charles Keepax

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=at9rdZn3HA84d1iA@opensource.cirrus.com \
    --to=ckeepax@opensource.cirrus.com \
    --cc=broonie@kernel.org \
    --cc=david.rhodes@cirrus.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-sound@vger.kernel.org \
    --cc=olivier@mgcrea.io \
    --cc=patches@opensource.cirrus.com \
    --cc=rf@opensource.cirrus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox