Skip to content

Commit 12272cb

Browse files
SenWang125broonie
authored andcommitted
ASoC: codecs: tas675x: use READ_ONCE for params to be used concurrently
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: 133c81f ("ASoC: codecs: Add TAS67524 quad-channel audio amplifier driver") Signed-off-by: Sen Wang <sen@ti.com> Link: https://patch.msgid.link/20260630183126.2588322-2-sen@ti.com Signed-off-by: Mark Brown <broonie@kernel.org>
1 parent dc59e4f commit 12272cb

1 file changed

Lines changed: 3 additions & 3 deletions

File tree

sound/soc/codecs/tas675x.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,7 @@ static int tas675x_hw_params(struct snd_pcm_substream *substream,
11331133
* Single clock domain: SDIN and SDOUT share one SCLK/FSYNC pair,
11341134
* so all active DAIs must use the same sample rate.
11351135
*/
1136-
if ((tas->active_playback_dais || tas->active_capture_dais) &&
1136+
if ((READ_ONCE(tas->active_playback_dais) || READ_ONCE(tas->active_capture_dais)) &&
11371137
tas->rate && tas->rate != rate) {
11381138
dev_err(component->dev,
11391139
"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)
13971397
set_bit(dai->id, &tas->active_playback_dais);
13981398

13991399
/* Last playback stream */
1400-
if (mute && !tas->active_playback_dais) {
1400+
if (mute && !READ_ONCE(tas->active_playback_dais)) {
14011401
ret = tas675x_set_state_all(tas, TAS675X_STATE_SLEEP_BOTH);
14021402
regmap_read(tas->regmap, TAS675X_CLK_FAULT_LATCHED_REG, &discard);
14031403
return ret;
14041404
}
14051405

14061406
return tas675x_set_state_all(tas,
1407-
tas->active_playback_dais ?
1407+
READ_ONCE(tas->active_playback_dais) ?
14081408
TAS675X_STATE_PLAY_BOTH :
14091409
TAS675X_STATE_SLEEP_BOTH);
14101410
}

0 commit comments

Comments
 (0)