[PW_SID:1099402] ASoC: add shared BCLK rate constraint for cross-DAI coordination#1998
[PW_SID:1099402] ASoC: add shared BCLK rate constraint for cross-DAI coordination#1998linux-riscv-bot wants to merge 3 commits into
Conversation
Add a bclk field to struct snd_soc_dai and a helper function snd_soc_dai_set_bclk_clk() that platform drivers can use to declare which clock is their BCLK. Also cache the bclk_ratio in snd_soc_dai_set_bclk_ratio() so that the framework can use it later in hw_rule evaluation for TDM configurations where BCLK = rate * slots * slot_width. When multiple DAIs on the same card share the same physical BCLK (detected via clk_is_match()), the ASoC core can automatically constrain their hw_params so that the resulting BCLK rates are compatible. This commit adds the data structure support; the actual constraint logic follows in the next patch. Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Define a guard class wrapping snd_soc_card_mutex_lock() and snd_soc_card_mutex_unlock() so that scope-based locking can be used while still picking up the SND_SOC_CARD_CLASS_RUNTIME lockdep subclass. Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
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. The rule callback scans all DAIs on the card at hw_refine time, looking for an active peer that shares the same physical BCLK (via clk_is_match()) and has already completed hw_params (checked via dai->symmetric_rate != 0). This ensures the constraint uses the real BCLK rate established by the peer's clk_set_rate() in hw_params, not a stale boot-time default. The first DAI to complete hw_params is unconstrained (no active peer yet); subsequent DAIs are constrained to match. The rule supports two modes: - If the DAI has an explicit bclk_ratio set (e.g. for TDM where BCLK = rate * slots * slot_width), the rate is constrained to active_bclk_rate / bclk_ratio. - Otherwise, the default formula BCLK = rate * channels * sample_bits is used to derive the valid rate range. The constraint is purely additive: DAIs that do not set a bclk clock pointer are completely unaffected. Signed-off-by: Troy Mitchell <troy.mitchell@linux.spacemit.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[v4,1/3] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v4,1/3] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v4,1/3] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v4,1/3] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v4,1/3] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v4,1/3] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v4,1/3] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v4,1/3] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v4,1/3] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v4,1/3] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v4,1/3] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v4,1/3] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 2: "[v4,2/3] ASoC: soc-pcm: add DEFINE_GUARD for snd_soc_card_mutex" |
|
Patch 2: "[v4,2/3] ASoC: soc-pcm: add DEFINE_GUARD for snd_soc_card_mutex" |
|
Patch 2: "[v4,2/3] ASoC: soc-pcm: add DEFINE_GUARD for snd_soc_card_mutex" |
|
Patch 2: "[v4,2/3] ASoC: soc-pcm: add DEFINE_GUARD for snd_soc_card_mutex" |
|
Patch 2: "[v4,2/3] ASoC: soc-pcm: add DEFINE_GUARD for snd_soc_card_mutex" |
|
Patch 2: "[v4,2/3] ASoC: soc-pcm: add DEFINE_GUARD for snd_soc_card_mutex" |
|
Patch 2: "[v4,2/3] ASoC: soc-pcm: add DEFINE_GUARD for snd_soc_card_mutex" |
|
Patch 2: "[v4,2/3] ASoC: soc-pcm: add DEFINE_GUARD for snd_soc_card_mutex" |
|
Patch 2: "[v4,2/3] ASoC: soc-pcm: add DEFINE_GUARD for snd_soc_card_mutex" |
|
Patch 2: "[v4,2/3] ASoC: soc-pcm: add DEFINE_GUARD for snd_soc_card_mutex" |
|
Patch 2: "[v4,2/3] ASoC: soc-pcm: add DEFINE_GUARD for snd_soc_card_mutex" |
|
Patch 2: "[v4,2/3] ASoC: soc-pcm: add DEFINE_GUARD for snd_soc_card_mutex" |
|
Patch 3: "[v4,3/3] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 3: "[v4,3/3] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 3: "[v4,3/3] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 3: "[v4,3/3] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 3: "[v4,3/3] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 3: "[v4,3/3] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 3: "[v4,3/3] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 3: "[v4,3/3] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 3: "[v4,3/3] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 3: "[v4,3/3] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 3: "[v4,3/3] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 3: "[v4,3/3] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
PR for series 1099402 applied to workflow__riscv__fixes
Name: ASoC: add shared BCLK rate constraint for cross-DAI coordination
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1099402
Version: 4