[PATCH v3 2/2] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK

Troy Mitchell troy.mitchell at linux.spacemit.com
Fri May 22 06:17:47 PDT 2026


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




More information about the linux-riscv mailing list