linux/sound/soc/intel/common
Mark Brown 3bd860dcf9
ASoC: add shared BCLK rate constraint for cross-DAI coordination
Troy Mitchell <troy.mitchell@linux.spacemit.com> says:

On some SoCs (e.g. SpacemiT K3), multiple I2S controllers share the
same physical BCLK. When one controller is already streaming, the
others must use hw_params that result in the same BCLK rate, otherwise
the shared clock would be reconfigured and corrupt the active stream.

This series adds framework-level support for this constraint:

Patch 1 adds the dt-bindings for the spacemit,k3-i2s compatible.
The K3 SoC uses the same I2S IP as K1 but requires additional clocks:
a dedicated sysclk_div, along with c_sysclk and c_bclk which are
shared across multiple I2S controllers.

Patch 2 adds a DEFINE_GUARD wrapping snd_soc_card_mutex_lock() and
snd_soc_card_mutex_unlock() so that scope-based locking picks up the
SND_SOC_CARD_CLASS_RUNTIME lockdep subclass.

Patch 3 adds the constraint logic in soc-pcm.c. During PCM open,
every DAI that has a bclk clock pointer gets a hw_rule registered
unconditionally. The rule callback runs at hw_refine time: it scans
the card for an active peer sharing the same physical BCLK (via
clk_is_match()) that has already completed hw_params, then constrains
the current stream's rate to match the established BCLK rate. The
first DAI to complete hw_params is unconstrained; subsequent DAIs
must match. Two modes are supported:

  - Default (I2S): BCLK = rate * channels * sample_bits. The rule
    derives the valid rate range from the current channel and
    sample_bits intervals.

  - Explicit ratio (TDM): if the driver sets dai->bclk_ratio
    (e.g. slots * slot_width), the rule computes the single valid
    rate as active_bclk_rate / bclk_ratio.

This series was prompted by review feedback on the SpacemiT K3 I2S
series, where a vendor-specific fixed-sample-rate property was rejected
in favor of a generic framework solution:
https://lore.kernel.org/all/afFqgF6ZRwYdfUmL@sirena.co.uk/

Link: https://patch.msgid.link/20260522-i2s-same-blk-v4-0-a71a86faaa20@linux.spacemit.com
2026-05-25 11:42:45 +01:00
..
Makefile ASoC: Intel: soc-acpi: add NVL match tables 2025-11-17 12:04:28 +01:00
soc-acpi-intel-adl-match.c ASoC: Intel: adl: add 2xrt1316 audio configuration 2025-03-05 14:05:36 +00:00
soc-acpi-intel-arl-match.c ASoC: Merge up fixes 2026-05-15 22:39:50 +09:00
soc-acpi-intel-bxt-match.c ASoC: Intel: soc-acpi: add more ACPI HIDs for ES83x6 devices 2022-03-09 13:30:21 +00:00
soc-acpi-intel-byt-match.c ASoC: Intel: soc-acpi-byt: Fix "WM510205" match no longer working 2023-04-24 16:41:58 +01:00
soc-acpi-intel-cfl-match.c ASoC: Intel: remove duplicate MODULE_LICENSE/DESCRIPTION tags 2021-01-28 17:11:39 +00:00
soc-acpi-intel-cht-match.c ASoC: Intel: soc-acpi-cht: Make Lenovo Yoga Tab 3 X90F DMI match less strict 2024-08-23 11:02:53 +01:00
soc-acpi-intel-cml-match.c ASoC: Intel: bxt_da7219_max98357a: remove cml support 2024-04-29 23:49:10 +09:00
soc-acpi-intel-cnl-match.c ASoC: Intel: Drop skl_machine_pdata usage 2024-08-19 13:10:45 +01:00
soc-acpi-intel-ehl-match.c ASoC: Intel: Drop skl_machine_pdata usage 2024-08-19 13:10:45 +01:00
soc-acpi-intel-glk-match.c ASoC: Intel: glk_rt5682_max98357a: delete driver 2024-04-29 23:49:15 +09:00
soc-acpi-intel-hda-match.c ASoC: SOF: Intel: hda: refactoring topology name fixup for HDA mach 2024-08-28 13:01:54 +01:00
soc-acpi-intel-hsw-bdw-match.c ASoC: Intel: Drop legacy HSW/BDW board-match information 2022-08-16 13:08:04 +01:00
soc-acpi-intel-icl-match.c ASoC: Intel: Drop skl_machine_pdata usage 2024-08-19 13:10:45 +01:00
soc-acpi-intel-jsl-match.c ASoC: Intel: sof_da7219: board id cleanup for jsl boards 2024-03-25 22:45:02 +00:00
soc-acpi-intel-kbl-match.c ASoC: Intel: Drop skl_machine_pdata usage 2024-08-19 13:10:45 +01:00
soc-acpi-intel-lnl-match.c ASoC: Intel: soc-acpi-intel-lnl-match: add rt1320_l12_rt714_l0 support 2025-07-08 09:49:58 +01:00
soc-acpi-intel-mtl-match.c ASoC: tac5xx2-sdw: ACPI match for intel mtl platform 2026-05-07 17:18:40 +09:00
soc-acpi-intel-nvl-match.c ASoC: Intel: soc-acpi: Add entry for sof_es8336 in NVL match table. 2026-05-21 19:13:25 +01:00
soc-acpi-intel-ptl-match.c ASoC: Intel: soc-acpi-intel-ptl-match: Remove unnecessary cs42l43 match 2026-05-21 19:18:01 +01:00
soc-acpi-intel-rpl-match.c ASoC: Intel: soc-acpi-intel-rpl-match: add missing empty item 2024-10-01 12:07:46 +01:00
soc-acpi-intel-sdca-quirks.c ASoC: soc-acpi-intel-ptl-match: Make Chrome matches conditional 2026-05-21 19:18:00 +01:00
soc-acpi-intel-sdca-quirks.h ASoC: soc-acpi-intel-ptl-match: Make Chrome matches conditional 2026-05-21 19:18:00 +01:00
soc-acpi-intel-sdw-mockup-match.c ASoC: Intel: add multi-function SDW mockup codec match 2025-03-05 14:05:39 +00:00
soc-acpi-intel-sdw-mockup-match.h ASoC: Intel: add multi-function SDW mockup codec match 2025-03-05 14:05:39 +00:00
soc-acpi-intel-skl-match.c ASoC: Intel: Drop skl_machine_pdata usage 2024-08-19 13:10:45 +01:00
soc-acpi-intel-ssp-common.c ASoC: Intel: ti-common: support tas2563 amplifier 2025-12-17 12:04:27 +00:00
soc-acpi-intel-tgl-match.c ASoC: Intel: soc-acpi-intel-tgl-match: declare adr as ull 2025-02-04 16:26:12 +00:00
soc-intel-quirks.h ASoC: Intel: use soc_intel_is_byt_cr() only when IOSF_MBI is reachable 2024-07-22 13:04:49 +01:00
sof-function-topology-lib.c ASoC: sof-function-topology-lib: add virtual loop dai support 2026-04-27 08:29:00 +09:00
sof-function-topology-lib.h ASoC: soc-acpi / SOF: Add best_effort flag to get_function_tplg_files op 2025-12-15 23:08:35 +09:00