[PATCH v3 0/7] ASoC: basic support for configuring bus keepers

James Calligeros posted 7 patches 1 month, 1 week ago
.../bindings/sound/imx-audio-card.yaml   |  9 +--
.../bindings/sound/simple-card.yaml      | 14 +---
.../bindings/sound/tdm-slot.txt          | 29 --------
.../bindings/sound/tdm-slot.yaml         | 52 ++++++++++++++
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, 312 insertions(+), 47 deletions(-)
[PATCH v3 0/7] ASoC: basic support for configuring bus keepers
Posted by James Calligeros 1 month, 1 week ago
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/
[4] https://github.com/chadmed/tree/tdm-revised2

---
Changes in v3:
- Rebased patch set
- Elided unnecessary $defs in tdm-slot.yaml
- Referenced entire tdm-slot.yaml instead of per-property definitions in imx-audio-card.yaml
- Changed repetitive TDM slot property definitions to patternProperties in tdm-slot.yaml
- Link to v2: https://lore.kernel.org/r/20251221-tdm-idle-slots-v2-0-ed4d96413aec@gmail.com

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

---
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   |  9 +--
 .../bindings/sound/simple-card.yaml      | 14 +---
 .../bindings/sound/tdm-slot.txt          | 29 --------
 .../bindings/sound/tdm-slot.yaml         | 52 ++++++++++++++
 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, 312 insertions(+), 47 deletions(-)
---
base-commit: d898041bfb8667f4bad10abba5dedd7edd88c751
change-id: 20251201-tdm-idle-slots-10ba92516da4

Best regards,
-- 
James Calligeros <jcalligeros99@gmail.com>
Re: [PATCH v3 0/7] ASoC: basic support for configuring bus keepers
Posted by Mark Brown 3 weeks, 6 days ago
On Sun, 01 Mar 2026 18:05:19 +1000, James Calligeros wrote:
> 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.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-next

Thanks!

[1/7] ASoC: dt-bindings: convert tdm-slot to YAML
      https://git.kernel.org/broonie/misc/c/5273cb8197d8
[2/7] ASoC: dt-bindings: update tdm-slot.txt references to tdm-slot.yaml
      https://git.kernel.org/broonie/misc/c/cc74890fb484
[3/7] ASoC: dt-bindings: add TDM slot idle mode properties
      https://git.kernel.org/broonie/misc/c/938c1ed56ab8
[4/7] ASoC: soc-dai: define possible idle TDM slot modes
      https://git.kernel.org/broonie/misc/c/7d8632f1ef6c
[5/7] ASoC: soc-dai: add common operation to set TDM idle mode
      https://git.kernel.org/broonie/misc/c/b758d3574e88
[6/7] ASoC: tas2764: expose SDOUT bus keeper via set_tdm_idle operation
      https://git.kernel.org/broonie/misc/c/45573ee1f2ba
[7/7] ASoC: tas2770: expose SDOUT bus keeper via set_tdm_idle
      https://git.kernel.org/broonie/misc/c/af176d0787d2

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark
Re: [PATCH v3 0/7] ASoC: basic support for configuring bus keepers
Posted by Mark Brown 4 weeks ago
On Sun, 01 Mar 2026 18:05:19 +1000, James Calligeros wrote:
> ASoC: basic support for configuring bus keepers
> 
> 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.
> 
> [...]

Applied to

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.1

Thanks!

[1/7] ASoC: dt-bindings: convert tdm-slot to YAML
      https://git.kernel.org/broonie/sound/c/5273cb8197d8
[2/7] ASoC: dt-bindings: update tdm-slot.txt references to tdm-slot.yaml
      https://git.kernel.org/broonie/sound/c/cc74890fb484
[3/7] ASoC: dt-bindings: add TDM slot idle mode properties
      https://git.kernel.org/broonie/sound/c/938c1ed56ab8
[4/7] ASoC: soc-dai: define possible idle TDM slot modes
      https://git.kernel.org/broonie/sound/c/7d8632f1ef6c
[5/7] ASoC: soc-dai: add common operation to set TDM idle mode
      https://git.kernel.org/broonie/sound/c/b758d3574e88
[6/7] ASoC: tas2764: expose SDOUT bus keeper via set_tdm_idle operation
      https://git.kernel.org/broonie/sound/c/45573ee1f2ba
[7/7] ASoC: tas2770: expose SDOUT bus keeper via set_tdm_idle
      https://git.kernel.org/broonie/sound/c/af176d0787d2

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark