[PW_SID:1096338] ASoC: add shared BCLK rate constraint for cross-DAI coordination#1960
[PW_SID:1096338] ASoC: add shared BCLK rate constraint for cross-DAI coordination#1960linux-riscv-bot wants to merge 2 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>
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 hw_rule is registered unconditionally for every DAI that has a bclk clock pointer set. The actual peer scanning happens inside the rule callback at hw_refine time: it walks all DAIs on the card, 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: "[v3,1/2] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v3,1/2] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v3,1/2] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v3,1/2] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v3,1/2] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v3,1/2] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v3,1/2] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v3,1/2] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v3,1/2] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v3,1/2] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v3,1/2] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 1: "[v3,1/2] ASoC: soc-dai: add shared BCLK clock for cross-DAI rate constraints" |
|
Patch 2: "[v3,2/2] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 2: "[v3,2/2] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 2: "[v3,2/2] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 2: "[v3,2/2] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 2: "[v3,2/2] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 2: "[v3,2/2] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 2: "[v3,2/2] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 2: "[v3,2/2] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 2: "[v3,2/2] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 2: "[v3,2/2] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 2: "[v3,2/2] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
|
Patch 2: "[v3,2/2] ASoC: soc-pcm: constrain hw_params when DAIs share the same BCLK" |
PR for series 1096338 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=1096338
Version: 3