Linux Sound subsystem development
 help / color / mirror / Atom feed
From: Sen Wang <sen@ti.com>
To: <broonie@kernel.org>, <shenghao-ding@ti.com>, <kevin-lu@ti.com>,
	<baojun.xu@ti.com>
Cc: <lgirdwood@gmail.com>, <perex@perex.cz>, <tiwai@suse.com>,
	<linux-sound@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	Sen Wang <sen@ti.com>
Subject: [PATCH 1/3] ASoC: codecs: tas675x: use READ_ONCE for params to be used concurrently
Date: Tue, 30 Jun 2026 13:31:20 -0500	[thread overview]
Message-ID: <20260630183126.2588322-2-sen@ti.com> (raw)
In-Reply-To: <20260630183126.2588322-1-sen@ti.com>

active_playback_dais and active_capture_dais are written atomically via
set_bit()/clear_bit() and can be read concurrently from the
fault_check_work delayed work handler.

fault_check_work already uses READ_ONCE; extend the same guard to all other
reads in tas675x_hw_params() and tas675x_mute_stream().

Fixes: 133c81f84471 ("ASoC: codecs: Add TAS67524 quad-channel audio amplifier driver")
Signed-off-by: Sen Wang <sen@ti.com>
---
 sound/soc/codecs/tas675x.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/sound/soc/codecs/tas675x.c b/sound/soc/codecs/tas675x.c
index e3b18451abecc7..a3e0dd75e8ba0c 100644
--- a/sound/soc/codecs/tas675x.c
+++ b/sound/soc/codecs/tas675x.c
@@ -1133,7 +1133,7 @@ static int tas675x_hw_params(struct snd_pcm_substream *substream,
 	 * Single clock domain: SDIN and SDOUT share one SCLK/FSYNC pair,
 	 * so all active DAIs must use the same sample rate.
 	 */
-	if ((tas->active_playback_dais || tas->active_capture_dais) &&
+	if ((READ_ONCE(tas->active_playback_dais) || READ_ONCE(tas->active_capture_dais)) &&
 	    tas->rate && tas->rate != rate) {
 		dev_err(component->dev,
 			"Rate %u conflicts with active rate %u\n",
@@ -1397,14 +1397,14 @@ static int tas675x_mute_stream(struct snd_soc_dai *dai, int mute, int direction)
 		set_bit(dai->id, &tas->active_playback_dais);
 
 	/* Last playback stream */
-	if (mute && !tas->active_playback_dais) {
+	if (mute && !READ_ONCE(tas->active_playback_dais)) {
 		ret = tas675x_set_state_all(tas, TAS675X_STATE_SLEEP_BOTH);
 		regmap_read(tas->regmap, TAS675X_CLK_FAULT_LATCHED_REG, &discard);
 		return ret;
 	}
 
 	return tas675x_set_state_all(tas,
-				     tas->active_playback_dais ?
+				     READ_ONCE(tas->active_playback_dais) ?
 					TAS675X_STATE_PLAY_BOTH :
 					TAS675X_STATE_SLEEP_BOTH);
 }
-- 
2.43.0


  reply	other threads:[~2026-06-30 18:32 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-30 18:31 [PATCH 0/3] ASoC: codecs: tas675x: misc bugfixes and minor changes Sen Wang
2026-06-30 18:31 ` Sen Wang [this message]
2026-07-01 18:55   ` [PATCH 1/3] ASoC: codecs: tas675x: use READ_ONCE for params to be used concurrently Mark Brown
2026-07-02 17:59     ` Wang, Sen
2026-06-30 18:31 ` [PATCH 2/3] ASoC: codecs: tas675x: Fix CHx temperature range register bit fields Sen Wang
2026-06-30 18:31 ` [PATCH 3/3] Documentation: sound: tas675x: Fix temperature range and impedance documentation Sen Wang
2026-07-01 18:53 ` [PATCH 0/3] ASoC: codecs: tas675x: sound bugfixes and minor changes Mark Brown

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=20260630183126.2588322-2-sen@ti.com \
    --to=sen@ti.com \
    --cc=baojun.xu@ti.com \
    --cc=broonie@kernel.org \
    --cc=kevin-lu@ti.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=shenghao-ding@ti.com \
    --cc=tiwai@suse.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