[PATCH v2 0/7] ASoC: basic support for configuring bus keepers
From: James Calligeros <hidden>
Date: 2025-12-21 09:36:27
Also in:
asahi, imx, linux-devicetree, linux-sound, lkml
Hi all, This series introduces some infrastructure to allow platform drivers to specify what a DAI should be doing when it is not active on the bus. The primary use case for this is configuring bus keepers which may be integrated into various codecs. The instigating use case for this functionality is an interesting bus topology on Apple Silicon laptops with multiple codecs. Most Apple Silicon laptops have six codecs split into groups of three, driving a pair of dual opposed woofers and a tweeter for L/R stereo sound. These codecs report the voltage and current across their connected voice coils back to the SoC via the SDOUT pin, represented as PCM data sent via configurable TDM slots. This data is used in conjunction with the connected speaker's Thiele/Small Parameters to ensure that the speaker is not being driven to levels that would permanently damage them. This is integrated into CoreAudio on macOS. speakersafetyd[1] handles this for Linux. All of the codec SDOUT pins are attached to a single receiver port on the SoC's I2S peripheral, however are split across two physical data lines (one each for the left and right codec groups). The receiver has an OR gate in front of it, which is used to sum the two lines. If at any point a codec is trying to transmit data, and the "opposite" line ends up floating high, the transmitting codec's data will be corrupted. We need to guarantee that the idle line stays idle. In the downstream Asahi Linux kernel[2], we set up one codec in each group to zero-fill or pull down its line while a codec on the opposite line is actively transmitting. This is done entirely in the codec driver, however this approach is over-fit for this one use case. This sort of functionality may also be of use for other hardware, so following previous mailing list discussions[3], I have tried to expose the functionality in a more configurable and generic way. I have integrated this approach into our downstream platform driver and select Devicetrees as an example of how this mechanism is intended to be used[4]. Regards, James [1] https://github.com/AsahiLinux/speakersafetyd [2] https://github.com/AsahiLinux/linux/tree/bits/070-audio [3] https://lore.kernel.org/asahi/20250227-apple-codec-changes-v3-17-cbb130030acf@gmail.com/ (local) [4] https://github.com/chadmed/tree/tdm-revised2 --- Changes in v2: - Reworked tdm-slot.yaml schema to silence dtschema warnings - Properly referenced new tdm-slot.yaml schema in affected bindings, again silencing dtschema warnings - Add PULLUP and DRIVE_HIGH as possible bus keeper modes - Reworded commit messages and cover letter to more clearly explain what the goal is here - Link to v1: https://lore.kernel.org/r/20251209-tdm-idle-slots-v1-0-38dabf6bc01e@gmail.com (local) --- James Calligeros (7): ASoC: dt-bindings: convert tdm-slot to YAML ASoC: dt-bindings: update tdm-slot.txt references to tdm-slot.yaml ASoC: dt-bindings: add TDM slot idle mode properties ASoC: soc-dai: define possible idle TDM slot modes ASoC: soc-dai: add common operation to set TDM idle mode ASoC: tas2764: expose SDOUT bus keeper via set_tdm_idle operation ASoC: tas2770: expose SDOUT bus keeper via set_tdm_idle .../bindings/sound/imx-audio-card.yaml | 14 ++-- .../bindings/sound/simple-card.yaml | 14 +--- .../bindings/sound/tdm-slot.txt | 29 -------- .../bindings/sound/tdm-slot.yaml | 82 +++++++++++++++++++++ include/sound/soc-dai.h | 22 ++++++ sound/soc/codecs/tas2764.c | 95 +++++++++++++++++++++++++ sound/soc/codecs/tas2764.h | 11 +++ sound/soc/codecs/tas2770.c | 75 +++++++++++++++++++ sound/soc/codecs/tas2770.h | 12 ++++ sound/soc/soc-dai.c | 40 +++++++++++ 10 files changed, 345 insertions(+), 49 deletions(-) --- base-commit: c8d8605fc53e8072848aadc7a5aa00c2f5143cac change-id: 20251201-tdm-idle-slots-10ba92516da4 Best regards, -- James Calligeros [off-list ref]