[PATCH 1/2] ASoC: bcm2835-i2s: Remove redundant clock start/stop in trigger path

From: phucduc . bui

Date: Thu Dec 03 2026 - 01:34:58 EST


From: bui duc phuc <phucduc.bui@xxxxxxxxx>

bcm2835_i2s_stop() is called from .trigger and .shutdown, and stops
the clock when the DAI is no longer active and SND_SOC_DAIFMT_CONT is
not set. In .trigger the DAI is always active, so the clock is never
stopped there. In .shutdown, bcm2835_i2s_shutdown() stops the clock
itself right after calling bcm2835_i2s_stop() once no stream is left.
The check in bcm2835_i2s_stop() is therefore not needed and can be
removed.

Likewise, the bcm2835_i2s_start_clock() call in .trigger has no
effect, as the clock has already been started in .hw_params and is
not stopped before the stream is started.

Remove both, which also keeps clk_prepare_enable() and
clk_disable_unprepare(), which may sleep, out of the atomic .trigger
callback. Drop the now unused dai argument of bcm2835_i2s_stop() and
the outdated comment in bcm2835_i2s_shutdown().

No functional change intended.

Signed-off-by: bui duc phuc <phucduc.bui@xxxxxxxxx>
---
sound/soc/bcm/bcm2835-i2s.c | 16 +++-------------
1 file changed, 3 insertions(+), 13 deletions(-)

diff --git a/sound/soc/bcm/bcm2835-i2s.c b/sound/soc/bcm/bcm2835-i2s.c
index 8702f1d062df..68be1ded6f93 100644
--- a/sound/soc/bcm/bcm2835-i2s.c
+++ b/sound/soc/bcm/bcm2835-i2s.c
@@ -639,8 +639,7 @@ static int bcm2835_i2s_prepare(struct snd_pcm_substream *substream,
}

static void bcm2835_i2s_stop(struct bcm2835_i2s_dev *dev,
- struct snd_pcm_substream *substream,
- struct snd_soc_dai *dai)
+ struct snd_pcm_substream *substream)
{
uint32_t mask;

@@ -651,10 +650,6 @@ static void bcm2835_i2s_stop(struct bcm2835_i2s_dev *dev,

regmap_update_bits(dev->i2s_regmap,
BCM2835_I2S_CS_A_REG, mask, 0);
-
- /* Stop also the clock when not SND_SOC_DAIFMT_CONT */
- if (!snd_soc_dai_active(dai) && !(dev->fmt & SND_SOC_DAIFMT_CONT))
- bcm2835_i2s_stop_clock(dev);
}

static int bcm2835_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
@@ -667,7 +662,6 @@ static int bcm2835_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_START:
case SNDRV_PCM_TRIGGER_RESUME:
case SNDRV_PCM_TRIGGER_PAUSE_RELEASE:
- bcm2835_i2s_start_clock(dev);

if (substream->stream == SNDRV_PCM_STREAM_CAPTURE)
mask = BCM2835_I2S_RXON;
@@ -681,7 +675,7 @@ static int bcm2835_i2s_trigger(struct snd_pcm_substream *substream, int cmd,
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- bcm2835_i2s_stop(dev, substream, dai);
+ bcm2835_i2s_stop(dev, substream);
break;
default:
return -EINVAL;
@@ -720,7 +714,7 @@ static void bcm2835_i2s_shutdown(struct snd_pcm_substream *substream,
{
struct bcm2835_i2s_dev *dev = snd_soc_dai_get_drvdata(dai);

- bcm2835_i2s_stop(dev, substream, dai);
+ bcm2835_i2s_stop(dev, substream);

/* If both streams are stopped, disable module and clock */
if (snd_soc_dai_active(dai))
@@ -730,10 +724,6 @@ static void bcm2835_i2s_shutdown(struct snd_pcm_substream *substream,
regmap_update_bits(dev->i2s_regmap, BCM2835_I2S_CS_A_REG,
BCM2835_I2S_EN, 0);

- /*
- * Stopping clock is necessary, because stop does
- * not stop the clock when SND_SOC_DAIFMT_CONT
- */
bcm2835_i2s_stop_clock(dev);
}

--
2.43.0