mirror of https://lore.kernel.org/linux-amlogic/
 help / color / mirror / Atom feed
From: Valerio Setti <vsetti@baylibre.com>
To: sashiko-reviews@lists.linux.dev
Cc: robh@kernel.org, linux-amlogic@lists.infradead.org,
	neil.armstrong@linaro.org, conor+dt@kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v2 4/6] ASoC: meson: aiu: add I2S Capture DAI
Date: Fri, 18 Sep 2026 11:56:26 +0200	[thread overview]
Message-ID: <7da24c37-3f6a-4a85-a06c-3d587f6ed4e5@baylibre.com> (raw)
In-Reply-To: <20260917212019.4ECE61F00893@smtp.kernel.org>


> 
> [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


_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic

  reply	other threads:[~2026-09-18  9:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-09-17 21:02 [PATCH v2 0/6] ASoC: meson: gx: add base support for I2S audio input Valerio Setti
2026-09-17 21:02 ` [PATCH v2 1/6] ASoC: dt-bindings: amlogic,gx-audin: add schema Valerio Setti
2026-09-17 21:07   ` sashiko-bot
2026-09-17 21:02 ` [PATCH v2 2/6] ASoC: meson: build gx-formatter as a separate module Valerio Setti
2026-09-17 21:02 ` [PATCH v2 3/6] ASoC: meson: add AUDIN driver Valerio Setti
2026-09-17 21:17   ` sashiko-bot
2026-09-17 21:02 ` [PATCH v2 4/6] ASoC: meson: aiu: add I2S Capture DAI Valerio Setti
2026-09-17 21:20   ` sashiko-bot
2026-09-18  9:56     ` Valerio Setti [this message]
2026-09-17 21:02 ` [PATCH v2 5/6] ASoC: meson: gx-card: add support for audin FIFO Valerio Setti
2026-09-17 21:02 ` [PATCH v2 6/6] arm64: dts: amlogic: gx: add AUDIN node Valerio Setti

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=7da24c37-3f6a-4a85-a06c-3d587f6ed4e5@baylibre.com \
    --to=vsetti@baylibre.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=linux-amlogic@lists.infradead.org \
    --cc=neil.armstrong@linaro.org \
    --cc=robh@kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /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

all inboxes | Powered by JetHome®