[PATCH v2 4/6] ASoC: meson: aiu: add I2S Capture DAI

Valerio Setti vsetti at baylibre.com
Fri Sep 18 02:56:26 PDT 2026


> 
> [Severity: High]
> Does adding this capture stream introduce a permanent clock divider leak when
> hw_free is explicitly called?
> 
> Now that both playback and capture streams can be active simultaneously,
> snd_soc_dai_active(dai) can evaluate to 2.
> 
> In sound/soc/meson/aiu-encoder-i2s.c:aiu_encoder_i2s_hw_free():
> 
>      if (snd_soc_dai_active(dai) <= 1)
>          aiu_encoder_i2s_divider_enable(component, 0);
> 
> If a user opens both streams so snd_soc_dai_active(dai) evaluates to 2, and
> explicitly calls SNDRV_PCM_IOCTL_HW_FREE before closing them,
> snd_soc_dai_active(dai) remains 2. This skips disabling the clock divider.
> 
> When the streams are subsequently closed, the ALSA core skips invoking hw_free
> again because the state was already changed to SNDRV_PCM_STATE_OPEN. This
> would leave the clock divider permanently enabled, potentially draining battery
> or blocking system suspend.
> 

Oh, this seems to be a right claim. I can use 'ts->clk_enabled' for this 
and gate the call to 'aiu_encoder_i2s_divider_enable' based on what both 
streams are doing.

Let's wait a bit for other comments (if any) to show up, then I can 
prepare a v3 to fix this.

-- 
Valerio




More information about the linux-amlogic mailing list