The Linux Kernel Mailing List
 help / color / mirror / Atom feed
From: "Troy Mitchell" <troy.mitchell@linux.spacemit.com>
To: "Mark Brown" <broonie@kernel.org>,
	"Troy Mitchell" <troy.mitchell@linux.spacemit.com>
Cc: "Liam Girdwood" <lgirdwood@gmail.com>,
	"Jaroslav Kysela" <perex@perex.cz>,
	"Takashi Iwai" <tiwai@suse.com>, "Yixun Lan" <dlan@kernel.org>,
	<linux-sound@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
	<linux-riscv@lists.infradead.org>, <spacemit@lists.linux.dev>,
	<jinmei.wei@spacemit.com>
Subject: Re: [PATCH v3 2/2] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK
Date: Fri, 22 May 2026 21:17:47 +0800	[thread overview]
Message-ID: <DIP8GKFQOKZL.9JA38OXBFMIA@linux.spacemit.com> (raw)
In-Reply-To: <be91aacd-2e02-45d8-9293-e9551f688c68@sirena.org.uk>

On Fri May 22, 2026 at 8:58 PM CST, Mark Brown wrote:
> On Mon, May 18, 2026 at 02:21:09PM +0800, Troy Mitchell wrote:
>> When multiple CPU DAIs on the same sound card share the same physical
>> BCLK, add a hw_rule during PCM open that constrains the sample rate so
>> the resulting BCLK rate stays consistent across all sharing DAIs.
>
>> +	/*
>> +	 * Protect the rtd list traversal.  No nesting: this callback runs
>> +	 * from snd_pcm_hw_refine() which does not hold card->mutex.
>> +	 */
>> +	guard(mutex)(&card->mutex);
>
> We have helpers for acquiring these mutexes which deal with some lockdep
> issues using subclasses.  Either use those or provide whatever's needed
> to have the equivalent thing in a guard.
Thanks for pointing that out. I've added a local DEFINE_GUARD wrapping
snd_soc_card_mutex_lock()/snd_soc_card_mutex_unlock() so it picks up
the SND_SOC_CARD_CLASS_RUNTIME subclass while still getting scope-based
auto-release. Will be in v4.

                                      - Troy


      reply	other threads:[~2026-05-22 13:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-18  6:21 [PATCH v3 0/2] ASoC: add shared BCLK rate constraint for cross-DAI coordination Troy Mitchell
2026-05-18  6:21 ` [PATCH v3 1/2] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints Troy Mitchell
2026-05-18  6:21 ` [PATCH v3 2/2] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK Troy Mitchell
2026-05-22 12:58   ` Mark Brown
2026-05-22 13:17     ` Troy Mitchell [this message]

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=DIP8GKFQOKZL.9JA38OXBFMIA@linux.spacemit.com \
    --to=troy.mitchell@linux.spacemit.com \
    --cc=broonie@kernel.org \
    --cc=dlan@kernel.org \
    --cc=jinmei.wei@spacemit.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-riscv@lists.infradead.org \
    --cc=linux-sound@vger.kernel.org \
    --cc=perex@perex.cz \
    --cc=spacemit@lists.linux.dev \
    --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