public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH v3 0/7] ASoC: basic support for configuring bus keepers
@ 2026-03-01  8:05 James Calligeros
  2026-03-01  8:05 ` [PATCH v3 1/7] ASoC: dt-bindings: convert tdm-slot to YAML James Calligeros
                   ` (8 more replies)
  0 siblings, 9 replies; 18+ messages in thread
From: James Calligeros @ 2026-03-01  8:05 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Kuninori Morimoto, Shengjiu Wang, Jaroslav Kysela,
	Takashi Iwai, Shenghao Ding, Kevin Lu, Baojun Xu, Frank Li
  Cc: linux-sound, devicetree, imx, linux-arm-kernel, linux-kernel,
	asahi, James Calligeros

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>


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v3 1/7] ASoC: dt-bindings: convert tdm-slot to YAML
  2026-03-01  8:05 [PATCH v3 0/7] ASoC: basic support for configuring bus keepers James Calligeros
@ 2026-03-01  8:05 ` James Calligeros
  2026-03-06  1:07   ` Rob Herring (Arm)
  2026-03-01  8:05 ` [PATCH v3 2/7] ASoC: dt-bindings: update tdm-slot.txt references to tdm-slot.yaml James Calligeros
                   ` (7 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: James Calligeros @ 2026-03-01  8:05 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Kuninori Morimoto, Shengjiu Wang, Jaroslav Kysela,
	Takashi Iwai, Shenghao Ding, Kevin Lu, Baojun Xu, Frank Li
  Cc: linux-sound, devicetree, imx, linux-arm-kernel, linux-kernel,
	asahi, James Calligeros

This schema was still in plaintext form. Convert to YAML format.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
---
 .../bindings/sound/tdm-slot.txt          | 29 ----------------------
 .../bindings/sound/tdm-slot.yaml         | 33 +++++++++++++++++++++++++
 2 files changed, 33 insertions(+), 29 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/tdm-slot.txt b/Documentation/devicetree/bindings/sound/tdm-slot.txt
deleted file mode 100644
index 4bb513ae62fc..000000000000
--- a/Documentation/devicetree/bindings/sound/tdm-slot.txt
+++ /dev/null
@@ -1,29 +0,0 @@
-TDM slot:
-
-This specifies audio DAI's TDM slot.
-
-TDM slot properties:
-dai-tdm-slot-num : Number of slots in use.
-dai-tdm-slot-width : Width in bits for each slot.
-dai-tdm-slot-tx-mask : Transmit direction slot mask, optional
-dai-tdm-slot-rx-mask : Receive direction slot mask, optional
-
-For instance:
-	dai-tdm-slot-num = <2>;
-	dai-tdm-slot-width = <8>;
-	dai-tdm-slot-tx-mask = <0 1>;
-	dai-tdm-slot-rx-mask = <1 0>;
-
-And for each specified driver, there could be one .of_xlate_tdm_slot_mask()
-to specify an explicit mapping of the channels and the slots. If it's absent
-the default snd_soc_of_xlate_tdm_slot_mask() will be used to generating the
-tx and rx masks.
-
-For snd_soc_of_xlate_tdm_slot_mask(), the tx and rx masks will use a 1 bit
-for an active slot as default, and the default active bits are at the LSB of
-the masks.
-
-The explicit masks are given as array of integers, where the first
-number presents bit-0 (LSB), second presents bit-1, etc. Any non zero
-number is considered 1 and 0 is 0. snd_soc_of_xlate_tdm_slot_mask()
-does not do anything, if either mask is set non zero value.
diff --git a/Documentation/devicetree/bindings/sound/tdm-slot.yaml b/Documentation/devicetree/bindings/sound/tdm-slot.yaml
new file mode 100644
index 000000000000..ca71e3660f62
--- /dev/null
+++ b/Documentation/devicetree/bindings/sound/tdm-slot.yaml
@@ -0,0 +1,33 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/tdm-slot.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Time Division Multiplexing (TDM) Slot Parameters
+
+maintainers:
+  - Liam Girdwood <lgirdwood@gmail.com>
+
+select: false
+
+properties:
+  dai-tdm-slot-num:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Number of slots in use
+
+  dai-tdm-slot-width:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Width, in bits, of each slot
+
+patternProperties:
+  '^dai-tdm-slot-[rt]x-mask$':
+    $ref: /schemas/types.yaml#/definitions/uint32-array
+    description: Slot mask for active TDM slots. Optional. Drivers may
+      specify .xlate_tdm_slot_mask() to generate a slot mask dynamically. If
+      neither this property nor a driver-specific function are specified, the
+      default snd_soc_xlate_tdm_slot_mask() function will be used to generate
+      a mask. The first element of the array is slot 0 (LSB). Any nonzero
+      value will be treated as 1.
+
+additionalProperties: true

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 2/7] ASoC: dt-bindings: update tdm-slot.txt references to tdm-slot.yaml
  2026-03-01  8:05 [PATCH v3 0/7] ASoC: basic support for configuring bus keepers James Calligeros
  2026-03-01  8:05 ` [PATCH v3 1/7] ASoC: dt-bindings: convert tdm-slot to YAML James Calligeros
@ 2026-03-01  8:05 ` James Calligeros
  2026-03-06  1:07   ` Rob Herring (Arm)
  2026-03-01  8:05 ` [PATCH v3 3/7] ASoC: dt-bindings: add TDM slot idle mode properties James Calligeros
                   ` (6 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: James Calligeros @ 2026-03-01  8:05 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Kuninori Morimoto, Shengjiu Wang, Jaroslav Kysela,
	Takashi Iwai, Shenghao Ding, Kevin Lu, Baojun Xu, Frank Li
  Cc: linux-sound, devicetree, imx, linux-arm-kernel, linux-kernel,
	asahi, James Calligeros

Ensure that all references to tdm-slot.txt have been updated to
tdm-slot.yaml, and are schema-compliant.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
---
 .../bindings/sound/imx-audio-card.yaml   |  9 +++------
 .../bindings/sound/simple-card.yaml      | 14 ++------------
 2 files changed, 5 insertions(+), 18 deletions(-)

diff --git a/Documentation/devicetree/bindings/sound/imx-audio-card.yaml b/Documentation/devicetree/bindings/sound/imx-audio-card.yaml
index 3c75c8c78987..5424d4f16f52 100644
--- a/Documentation/devicetree/bindings/sound/imx-audio-card.yaml
+++ b/Documentation/devicetree/bindings/sound/imx-audio-card.yaml
@@ -24,6 +24,7 @@ patternProperties:
       cpu/codec dais.
 
     type: object
+    $ref: tdm-slot.yaml#
 
     properties:
       link-name:
@@ -38,13 +39,9 @@ patternProperties:
             - i2s
             - dsp_b
 
-      dai-tdm-slot-num:
-        description: see tdm-slot.txt.
-        $ref: /schemas/types.yaml#/definitions/uint32
+      dai-tdm-slot-num: true
 
-      dai-tdm-slot-width:
-        description: see tdm-slot.txt.
-        $ref: /schemas/types.yaml#/definitions/uint32
+      dai-tdm-slot-width: true
 
       playback-only:
         description: link is used only for playback
diff --git a/Documentation/devicetree/bindings/sound/simple-card.yaml b/Documentation/devicetree/bindings/sound/simple-card.yaml
index 533d0a1da56e..a14716b2732f 100644
--- a/Documentation/devicetree/bindings/sound/simple-card.yaml
+++ b/Documentation/devicetree/bindings/sound/simple-card.yaml
@@ -27,14 +27,6 @@ definitions:
     description: dai-link uses bit clock inversion
     $ref: /schemas/types.yaml#/definitions/flag
 
-  dai-tdm-slot-num:
-    description: see tdm-slot.txt.
-    $ref: /schemas/types.yaml#/definitions/uint32
-
-  dai-tdm-slot-width:
-    description: see tdm-slot.txt.
-    $ref: /schemas/types.yaml#/definitions/uint32
-
   system-clock-frequency:
     description: |
       If a clock is specified and a multiplication factor is given with
@@ -115,6 +107,8 @@ definitions:
 
   dai:
     type: object
+    $ref: tdm-slot.yaml#
+
     properties:
       sound-dai:
         maxItems: 1
@@ -133,10 +127,6 @@ definitions:
       bitclock-master:
         $ref: /schemas/types.yaml#/definitions/flag
 
-      dai-tdm-slot-num:
-        $ref: "#/definitions/dai-tdm-slot-num"
-      dai-tdm-slot-width:
-        $ref: "#/definitions/dai-tdm-slot-width"
       clocks:
         maxItems: 1
       system-clock-frequency:

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 3/7] ASoC: dt-bindings: add TDM slot idle mode properties
  2026-03-01  8:05 [PATCH v3 0/7] ASoC: basic support for configuring bus keepers James Calligeros
  2026-03-01  8:05 ` [PATCH v3 1/7] ASoC: dt-bindings: convert tdm-slot to YAML James Calligeros
  2026-03-01  8:05 ` [PATCH v3 2/7] ASoC: dt-bindings: update tdm-slot.txt references to tdm-slot.yaml James Calligeros
@ 2026-03-01  8:05 ` James Calligeros
  2026-03-06  1:08   ` Rob Herring (Arm)
  2026-03-01  8:05 ` [PATCH v3 4/7] ASoC: soc-dai: define possible idle TDM slot modes James Calligeros
                   ` (5 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: James Calligeros @ 2026-03-01  8:05 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Kuninori Morimoto, Shengjiu Wang, Jaroslav Kysela,
	Takashi Iwai, Shenghao Ding, Kevin Lu, Baojun Xu, Frank Li
  Cc: linux-sound, devicetree, imx, linux-arm-kernel, linux-kernel,
	asahi, James Calligeros

Add properties to describe TDM slot idle behaviour. These properties can
be used to describe how a DAI is supposed to behave when not active.

For example, Apple Silicon laptops split a single I2S bus between two
physical lines which are combined at an OR gate in front of the
receiving port. One codec on each line is expected to transmit zeroes
during the active TDM slots of the opposite line, or we will have corrupted
data at the receiver.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
---
 .../bindings/sound/tdm-slot.yaml         | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/Documentation/devicetree/bindings/sound/tdm-slot.yaml b/Documentation/devicetree/bindings/sound/tdm-slot.yaml
index ca71e3660f62..457a899e8872 100644
--- a/Documentation/devicetree/bindings/sound/tdm-slot.yaml
+++ b/Documentation/devicetree/bindings/sound/tdm-slot.yaml
@@ -20,6 +20,20 @@ properties:
     $ref: /schemas/types.yaml#/definitions/uint32
     description: Width, in bits, of each slot
 
+  dai-tdm-idle-mode:
+    $ref: /schemas/types.yaml#/definitions/string
+    enum:
+      - none
+      - off
+      - zero
+      - pulldown
+      - hiz
+      - pullup
+      - drivehigh
+    description: Drive mode for inactive/idle TDM slots. For hardware that
+      implements .set_tdm_idle(). Optional. "None" represents undefined
+      behaviour and is the same as not setting this property.
+
 patternProperties:
   '^dai-tdm-slot-[rt]x-mask$':
     $ref: /schemas/types.yaml#/definitions/uint32-array
@@ -30,4 +44,9 @@ patternProperties:
       a mask. The first element of the array is slot 0 (LSB). Any nonzero
       value will be treated as 1.
 
+  '^dai-tdm-slot-[rt]x-idle-mask$':
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: Idle slot mask. Optional. A bit being set to 1 indicates
+      that the corresponding TDM slot is inactive/idle.
+
 additionalProperties: true

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 4/7] ASoC: soc-dai: define possible idle TDM slot modes
  2026-03-01  8:05 [PATCH v3 0/7] ASoC: basic support for configuring bus keepers James Calligeros
                   ` (2 preceding siblings ...)
  2026-03-01  8:05 ` [PATCH v3 3/7] ASoC: dt-bindings: add TDM slot idle mode properties James Calligeros
@ 2026-03-01  8:05 ` James Calligeros
  2026-03-01  8:05 ` [PATCH v3 5/7] ASoC: soc-dai: add common operation to set TDM idle mode James Calligeros
                   ` (4 subsequent siblings)
  8 siblings, 0 replies; 18+ messages in thread
From: James Calligeros @ 2026-03-01  8:05 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Kuninori Morimoto, Shengjiu Wang, Jaroslav Kysela,
	Takashi Iwai, Shenghao Ding, Kevin Lu, Baojun Xu, Frank Li
  Cc: linux-sound, devicetree, imx, linux-arm-kernel, linux-kernel,
	asahi, James Calligeros

Some audio devices, such as certain Texas Instruments codecs,
include configurable bus keepers. We currently don't have
a standardised way to configure such hardware, and instead
rely on the hardware initialising setting itself up into a
sane state. There are situations where this is insufficient,
however, and some platforms require more concrete guarantees
as to the state of the bus, and being able to explicitly
configure bus keepers enables this.

For example, some Apple Silicon machines have an odd bus topology where
the SDOUT pins of all codecs are split across two data lines, which
are summed via an OR gate in front of the receiving port on the
SoC's I2S peripheral. Each line must transmit 0 while a codec
on the other line is actively transmitting data, or the SoC
will receive garbage data. To do this, one codec on each line
must be configured to transmit zeroes during the other line's
active TDM slots.

Thus, we define seven possible bus-keeping modes that a device can
be in: NONE (UB/as initialised), OFF (explicitly disabled), ZERO
(actively transmit a 0), PULLDOWN, HIZ (floating), PULLUP, and
DRIVE_HIGH.

These will be consumed by CODEC/CPU drivers via a common DAI
op, enabling the explicit configuration of bus keepers where
required.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
---
 include/sound/soc-dai.h | 15 +++++++++++++++
 1 file changed, 15 insertions(+)

diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 224396927aef..44dd06add52e 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -52,6 +52,21 @@ struct snd_compr_stream;
 #define SND_SOC_POSSIBLE_DAIFMT_AC97		(1 << SND_SOC_DAI_FORMAT_AC97)
 #define SND_SOC_POSSIBLE_DAIFMT_PDM		(1 << SND_SOC_DAI_FORMAT_PDM)
 
+/*
+ * DAI TDM slot idle modes
+ *
+ * Describes a CODEC/CPU's behaviour when not actively receiving or
+ * transmitting on a given TDM slot. NONE is undefined behaviour.
+ * Add new modes to the end.
+ */
+#define SND_SOC_DAI_TDM_IDLE_NONE	0
+#define SND_SOC_DAI_TDM_IDLE_OFF	1
+#define SND_SOC_DAI_TDM_IDLE_ZERO	2
+#define SND_SOC_DAI_TDM_IDLE_PULLDOWN	3
+#define SND_SOC_DAI_TDM_IDLE_HIZ	4
+#define SND_SOC_DAI_TDM_IDLE_PULLUP	5
+#define SND_SOC_DAI_TDM_IDLE_DRIVE_HIGH	6
+
 /*
  * DAI Clock gating.
  *

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 5/7] ASoC: soc-dai: add common operation to set TDM idle mode
  2026-03-01  8:05 [PATCH v3 0/7] ASoC: basic support for configuring bus keepers James Calligeros
                   ` (3 preceding siblings ...)
  2026-03-01  8:05 ` [PATCH v3 4/7] ASoC: soc-dai: define possible idle TDM slot modes James Calligeros
@ 2026-03-01  8:05 ` James Calligeros
  2026-03-03  2:11   ` Kuninori Morimoto
  2026-03-01  8:05 ` [PATCH v3 6/7] ASoC: tas2764: expose SDOUT bus keeper via set_tdm_idle operation James Calligeros
                   ` (3 subsequent siblings)
  8 siblings, 1 reply; 18+ messages in thread
From: James Calligeros @ 2026-03-01  8:05 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Kuninori Morimoto, Shengjiu Wang, Jaroslav Kysela,
	Takashi Iwai, Shenghao Ding, Kevin Lu, Baojun Xu, Frank Li
  Cc: linux-sound, devicetree, imx, linux-arm-kernel, linux-kernel,
	asahi, James Calligeros

Some audio devices, like certain Texas Instruments codecs, integrate
configurable bus keepers that dictate the codec's behaviour during
idle TDM slots. Now that we have definitions for various idle modes,
add a snd_soc_dai_set_tdm_idle() operation to control this in a
standardised way.

This is useful on Apple Silicon laptops, where a single I2S bus is
comprised of two physical lines which are ORed just before the
receiving port. When a codec on one line is transmitting, we must
guarantee that the other line is low. We can achieve this by
configuring one codec on each line to use its bus keeper to fill
its line with zeroes during the active slots of the other line.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
---
 include/sound/soc-dai.h |  7 +++++
 sound/soc/soc-dai.c     | 40 +++++++++++++++++++++++++
 2 files changed, 47 insertions(+)

diff --git a/include/sound/soc-dai.h b/include/sound/soc-dai.h
index 44dd06add52e..6a42812bba8c 100644
--- a/include/sound/soc-dai.h
+++ b/include/sound/soc-dai.h
@@ -196,6 +196,10 @@ int snd_soc_dai_set_fmt(struct snd_soc_dai *dai, unsigned int fmt);
 int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
 	unsigned int tx_mask, unsigned int rx_mask, int slots, int slot_width);
 
+int snd_soc_dai_set_tdm_idle(struct snd_soc_dai *dai,
+			     unsigned int tx_mask, unsigned int rx_mask,
+			     int tx_mode, int rx_mode);
+
 int snd_soc_dai_set_channel_map(struct snd_soc_dai *dai,
 	unsigned int tx_num, const unsigned int *tx_slot,
 	unsigned int rx_num, const unsigned int *rx_slot);
@@ -312,6 +316,9 @@ struct snd_soc_dai_ops {
 	int (*set_tdm_slot)(struct snd_soc_dai *dai,
 		unsigned int tx_mask, unsigned int rx_mask,
 		int slots, int slot_width);
+	int (*set_tdm_idle)(struct snd_soc_dai *dai,
+			    unsigned int tx_mask, unsigned int rx_mask,
+			    int tx_mode, int rx_mode);
 	int (*set_channel_map)(struct snd_soc_dai *dai,
 		unsigned int tx_num, const unsigned int *tx_slot,
 		unsigned int rx_num, const unsigned int *rx_slot);
diff --git a/sound/soc/soc-dai.c b/sound/soc/soc-dai.c
index a1e05307067d..2f370fda1266 100644
--- a/sound/soc/soc-dai.c
+++ b/sound/soc/soc-dai.c
@@ -282,6 +282,46 @@ int snd_soc_dai_set_tdm_slot(struct snd_soc_dai *dai,
 }
 EXPORT_SYMBOL_GPL(snd_soc_dai_set_tdm_slot);
 
+/**
+ * snd_soc_dai_set_tdm_idle() - Configure a DAI's TDM idle mode
+ * @dai: The DAI to configure
+ * @tx_mask: bitmask representing idle TX slots.
+ * @rx_mask: bitmask representing idle RX slots.
+ * @tx_mode: idle mode to set for TX slots.
+ * @rx_mode: idle mode to set for RX slots.
+ *
+ * This function configures the DAI to handle idle TDM slots in the
+ * specified manner. @tx_mode and @rx_mode can be one of
+ * SND_SOC_DAI_TDM_IDLE_NONE, SND_SOC_DAI_TDM_IDLE_ZERO,
+ * SND_SOC_DAI_TDM_IDLE_PULLDOWN, or SND_SOC_DAI_TDM_IDLE_HIZ.
+ * SND_SOC_TDM_IDLE_NONE represents the DAI's default/unset idle slot
+ * handling state and could be any of the other modes depending on the
+ * hardware behind the DAI. It is therefore undefined behaviour when set
+ * explicitly.
+ *
+ * Mode and mask can be set independently for both the TX and RX direction.
+ * Some hardware may ignore both TX and RX masks depending on its
+ * capabilities.
+ */
+int snd_soc_dai_set_tdm_idle(struct snd_soc_dai *dai,
+			     unsigned int tx_mask, unsigned int rx_mask,
+			     int tx_mode, int rx_mode)
+{
+	int ret = -EOPNOTSUPP;
+
+	/* You can't write to the RX line */
+	if (rx_mode == SND_SOC_DAI_TDM_IDLE_ZERO)
+		return soc_dai_ret(dai, -EINVAL);
+
+	if (dai->driver->ops &&
+	    dai->driver->ops->set_tdm_idle)
+		ret = dai->driver->ops->set_tdm_idle(dai, tx_mask, rx_mask,
+						     tx_mode, rx_mode);
+
+	return soc_dai_ret(dai, ret);
+}
+EXPORT_SYMBOL_GPL(snd_soc_dai_set_tdm_idle);
+
 /**
  * snd_soc_dai_set_channel_map - configure DAI audio channel map
  * @dai: DAI

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 6/7] ASoC: tas2764: expose SDOUT bus keeper via set_tdm_idle operation
  2026-03-01  8:05 [PATCH v3 0/7] ASoC: basic support for configuring bus keepers James Calligeros
                   ` (4 preceding siblings ...)
  2026-03-01  8:05 ` [PATCH v3 5/7] ASoC: soc-dai: add common operation to set TDM idle mode James Calligeros
@ 2026-03-01  8:05 ` James Calligeros
  2026-03-01  8:05 ` [PATCH v3 7/7] ASoC: tas2770: expose SDOUT bus keeper via set_tdm_idle James Calligeros
                   ` (2 subsequent siblings)
  8 siblings, 0 replies; 18+ messages in thread
From: James Calligeros @ 2026-03-01  8:05 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Kuninori Morimoto, Shengjiu Wang, Jaroslav Kysela,
	Takashi Iwai, Shenghao Ding, Kevin Lu, Baojun Xu, Frank Li
  Cc: linux-sound, devicetree, imx, linux-arm-kernel, linux-kernel,
	asahi, James Calligeros

TAS2764, and the Apple-exclusive variant SN012776, include bus keepers
on the SDOUT pin that can be configured to alter the behaviour of the
SDOUT pin during specified TDM slots. The chip can either leave the
bus floating (default/uninitialised behaviour) or fill the specified
slots with zeroes.

Expose the SDOUT bus keeper and allow it to be configured using the
set_tdm_idle DAI op. The mask must be cropped to only cover slots
valid for the configured BCLK ratio, so introduce a set_bclk_ratio
op that properly configures this.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
---
 sound/soc/codecs/tas2764.c | 95 +++++++++++++++++++++++++
 sound/soc/codecs/tas2764.h | 11 +++
 2 files changed, 106 insertions(+)

diff --git a/sound/soc/codecs/tas2764.c b/sound/soc/codecs/tas2764.c
index 36e25e48b354..423b7073b302 100644
--- a/sound/soc/codecs/tas2764.c
+++ b/sound/soc/codecs/tas2764.c
@@ -44,6 +44,11 @@ struct tas2764_priv {
 
 	bool dac_powered;
 	bool unmuted;
+
+	struct {
+		int tx_mode;
+		unsigned int tx_mask;
+	} idle_slot_config;
 };
 
 #include "tas2764-quirks.h"
@@ -509,11 +514,101 @@ static int tas2764_set_dai_tdm_slot(struct snd_soc_dai *dai,
 	return 0;
 }
 
+static int tas2764_write_sdout_idle_mask(struct tas2764_priv *tas2764, u32 mask)
+{
+	struct snd_soc_component *component = tas2764->component;
+	int i, ret;
+
+	/* Hardware supports up to 64 slots, but we don't */
+	for (i = 0; i < 4; i++) {
+		ret = snd_soc_component_write(component,
+					      TAS2764_SDOUT_HIZ_1 + i,
+					      (mask >> (i * 8)) & 0xff);
+		if (ret < 0)
+			return ret;
+	}
+
+	return 0;
+}
+
+static int tas2764_set_dai_tdm_idle(struct snd_soc_dai *dai,
+				    unsigned int tx_mask, unsigned int rx_mask,
+				    int tx_mode, int rx_mode)
+{
+	struct snd_soc_component *component = dai->component;
+	struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(component);
+	int ret;
+
+	/* We don't support setting anything on SDIN */
+	if (rx_mode)
+		return -EOPNOTSUPP;
+
+	if (tas2764->idle_slot_config.tx_mask == tx_mask &&
+	    tas2764->idle_slot_config.tx_mode == tx_mode)
+		return 0;
+
+	switch (tx_mode) {
+	case SND_SOC_DAI_TDM_IDLE_ZERO:
+		if (!tx_mask)
+			return -EINVAL;
+
+		ret = tas2764_write_sdout_idle_mask(tas2764, tx_mask);
+		if (ret < 0)
+			return ret;
+
+		ret = snd_soc_component_update_bits(component,
+						    TAS2764_SDOUT_HIZ_9,
+						    TAS2764_SDOUT_HIZ_9_FORCE_0_EN,
+						    TAS2764_SDOUT_HIZ_9_FORCE_0_EN);
+		if (ret < 0)
+			return ret;
+
+		tas2764->idle_slot_config.tx_mask = tx_mask;
+		tas2764->idle_slot_config.tx_mode = tx_mode;
+		break;
+	case SND_SOC_DAI_TDM_IDLE_HIZ:
+	case SND_SOC_DAI_TDM_IDLE_OFF:
+		/* HiZ mode does not support a slot mask */
+		ret = tas2764_write_sdout_idle_mask(tas2764, 0);
+		if (ret < 0)
+			return ret;
+
+		ret = snd_soc_component_update_bits(component,
+						    TAS2764_SDOUT_HIZ_9,
+						    TAS2764_SDOUT_HIZ_9_FORCE_0_EN, 0);
+		if (ret < 0)
+			return ret;
+
+		tas2764->idle_slot_config.tx_mask = 0;
+		tas2764->idle_slot_config.tx_mode = tx_mode;
+		break;
+	default:
+		return -EOPNOTSUPP;
+	}
+
+	return 0;
+}
+
+/* The SDOUT idle slot mask must be cropped based on the BCLK ratio */
+static int tas2764_set_bclk_ratio(struct snd_soc_dai *dai, unsigned int ratio)
+{
+	struct tas2764_priv *tas2764 = snd_soc_component_get_drvdata(dai->component);
+
+	if (!tas2764->idle_slot_config.tx_mask)
+		return 0;
+
+	tas2764->idle_slot_config.tx_mask &= GENMASK((ratio / 8) - 1, 0);
+
+	return tas2764_write_sdout_idle_mask(tas2764, tas2764->idle_slot_config.tx_mask);
+}
+
 static const struct snd_soc_dai_ops tas2764_dai_ops = {
 	.mute_stream = tas2764_mute,
 	.hw_params  = tas2764_hw_params,
 	.set_fmt    = tas2764_set_fmt,
+	.set_bclk_ratio = tas2764_set_bclk_ratio,
 	.set_tdm_slot = tas2764_set_dai_tdm_slot,
+	.set_tdm_idle = tas2764_set_dai_tdm_idle,
 	.no_capture_mute = 1,
 };
 
diff --git a/sound/soc/codecs/tas2764.h b/sound/soc/codecs/tas2764.h
index 538290ed3d92..4494bc4889dc 100644
--- a/sound/soc/codecs/tas2764.h
+++ b/sound/soc/codecs/tas2764.h
@@ -126,4 +126,15 @@
 
 #define TAS2764_BOP_CFG0                TAS2764_REG(0X0, 0x1d)
 
+#define TAS2764_SDOUT_HIZ_1            TAS2764_REG(0x1, 0x3d)
+#define TAS2764_SDOUT_HIZ_2            TAS2764_REG(0x1, 0x3e)
+#define TAS2764_SDOUT_HIZ_3            TAS2764_REG(0x1, 0x3f)
+#define TAS2764_SDOUT_HIZ_4            TAS2764_REG(0x1, 0x40)
+#define TAS2764_SDOUT_HIZ_5            TAS2764_REG(0x1, 0x41)
+#define TAS2764_SDOUT_HIZ_6            TAS2764_REG(0x1, 0x42)
+#define TAS2764_SDOUT_HIZ_7            TAS2764_REG(0x1, 0x43)
+#define TAS2764_SDOUT_HIZ_8            TAS2764_REG(0x1, 0x44)
+#define TAS2764_SDOUT_HIZ_9            TAS2764_REG(0x1, 0x45)
+#define TAS2764_SDOUT_HIZ_9_FORCE_0_EN BIT(7)
+
 #endif /* __TAS2764__ */

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v3 7/7] ASoC: tas2770: expose SDOUT bus keeper via set_tdm_idle
  2026-03-01  8:05 [PATCH v3 0/7] ASoC: basic support for configuring bus keepers James Calligeros
                   ` (5 preceding siblings ...)
  2026-03-01  8:05 ` [PATCH v3 6/7] ASoC: tas2764: expose SDOUT bus keeper via set_tdm_idle operation James Calligeros
@ 2026-03-01  8:05 ` James Calligeros
  2026-03-12 14:33   ` Mark Brown
  2026-03-16  1:13 ` [PATCH v3 0/7] ASoC: basic support for configuring bus keepers Mark Brown
  2026-03-16 17:52 ` Mark Brown
  8 siblings, 1 reply; 18+ messages in thread
From: James Calligeros @ 2026-03-01  8:05 UTC (permalink / raw)
  To: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Kuninori Morimoto, Shengjiu Wang, Jaroslav Kysela,
	Takashi Iwai, Shenghao Ding, Kevin Lu, Baojun Xu, Frank Li
  Cc: linux-sound, devicetree, imx, linux-arm-kernel, linux-kernel,
	asahi, James Calligeros

TAS2770 includes a bus keeper which can be used to control the behaviour
of the SDOUT pin during specified TDM slots. The chip can either pull
the pin to ground, actively transmit zeroes, or keep the pin floating
(default/uninitialised behaviour).

Expose the bus keeper via the set_tdm_idle DAI op so that it can be
configured by consumers.

Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
---
 sound/soc/codecs/tas2770.c | 75 +++++++++++++++++++++++++
 sound/soc/codecs/tas2770.h | 12 ++++
 2 files changed, 87 insertions(+)

diff --git a/sound/soc/codecs/tas2770.c b/sound/soc/codecs/tas2770.c
index 6f878b01716f..d4d7d056141b 100644
--- a/sound/soc/codecs/tas2770.c
+++ b/sound/soc/codecs/tas2770.c
@@ -492,11 +492,86 @@ static int tas2770_set_dai_tdm_slot(struct snd_soc_dai *dai,
 	return 0;
 }
 
+static int tas2770_set_dai_tdm_idle(struct snd_soc_dai *dai,
+				    unsigned int tx_mask,
+				    unsigned int rx_mask,
+				    int tx_mode, int rx_mode)
+{
+	struct snd_soc_component *component = dai->component;
+	struct tas2770_priv *tas2770 = snd_soc_component_get_drvdata(component);
+	int ret;
+
+	/* We don't support setting anything for SDIN */
+	if (rx_mode)
+		return -EOPNOTSUPP;
+
+	if (tas2770->idle_tx_mode == tx_mode)
+		return 0;
+
+	switch (tx_mode) {
+	case SND_SOC_DAI_TDM_IDLE_PULLDOWN:
+		ret = snd_soc_component_update_bits(component, TAS2770_DIN_PD,
+						    TAS2770_DIN_PD_SDOUT,
+						    TAS2770_DIN_PD_SDOUT);
+		if (ret)
+			return ret;
+
+		break;
+	case SND_SOC_DAI_TDM_IDLE_ZERO:
+		ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG4,
+						    TAS2770_TDM_CFG_REG4_TX_KEEPER,
+						    TAS2770_TDM_CFG_REG4_TX_KEEPER);
+		if (ret)
+			return ret;
+
+		ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG4,
+						    TAS2770_TDM_CFG_REG4_TX_FILL, 0);
+		if (ret)
+			return ret;
+
+		break;
+	case SND_SOC_DAI_TDM_IDLE_HIZ:
+		ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG4,
+						    TAS2770_TDM_CFG_REG4_TX_KEEPER,
+						    TAS2770_TDM_CFG_REG4_TX_KEEPER);
+		if (ret)
+			return ret;
+
+		ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG4,
+						    TAS2770_TDM_CFG_REG4_TX_FILL,
+						    TAS2770_TDM_CFG_REG4_TX_FILL);
+		if (ret)
+			return ret;
+
+		break;
+	case SND_SOC_DAI_TDM_IDLE_OFF:
+		ret = snd_soc_component_update_bits(component, TAS2770_DIN_PD,
+						    TAS2770_DIN_PD_SDOUT, 0);
+		if (ret)
+			return ret;
+
+		ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG4,
+						    TAS2770_TDM_CFG_REG4_TX_KEEPER, 0);
+		if (ret)
+			return ret;
+
+		break;
+
+	default:
+		return -EOPNOTSUPP;
+	}
+
+	tas2770->idle_tx_mode = tx_mode;
+
+	return 0;
+}
+
 static const struct snd_soc_dai_ops tas2770_dai_ops = {
 	.mute_stream = tas2770_mute,
 	.hw_params  = tas2770_hw_params,
 	.set_fmt    = tas2770_set_fmt,
 	.set_tdm_slot = tas2770_set_dai_tdm_slot,
+	.set_tdm_idle = tas2770_set_dai_tdm_idle,
 	.no_capture_mute = 1,
 };
 
diff --git a/sound/soc/codecs/tas2770.h b/sound/soc/codecs/tas2770.h
index 3fd2e7003c50..102040b6bdf8 100644
--- a/sound/soc/codecs/tas2770.h
+++ b/sound/soc/codecs/tas2770.h
@@ -67,6 +67,14 @@
 #define TAS2770_TDM_CFG_REG3_RXS_SHIFT 0x4
 #define TAS2770_TDM_CFG_REG3_30_MASK  GENMASK(3, 0)
 #define TAS2770_TDM_CFG_REG3_30_SHIFT 0
+    /* TDM Configuration Reg4 */
+#define TAS2770_TDM_CFG_REG4  TAS2770_REG(0X0, 0x0E)
+#define TAS2770_TDM_CFG_REG4_TX_LSB_CFG BIT(7)
+#define TAS2770_TDM_CFG_REG4_TX_KEEPER_CFG BIT(6)
+#define TAS2770_TDM_CFG_REG4_TX_KEEPER BIT(5)
+#define TAS2770_TDM_CFG_REG4_TX_FILL BIT(4)
+#define TAS2770_TDM_CFG_REG4_TX_OFFSET_MASK GENMASK(3, 1)
+#define TAS2770_TDM_CFG_REG4_TX_EDGE_FALLING BIT(0)
     /* TDM Configuration Reg5 */
 #define TAS2770_TDM_CFG_REG5  TAS2770_REG(0X0, 0x0F)
 #define TAS2770_TDM_CFG_REG5_VSNS_MASK  BIT(6)
@@ -115,6 +123,9 @@
 #define TAS2770_TEMP_LSB  TAS2770_REG(0X0, 0x2A)
     /* Interrupt Configuration */
 #define TAS2770_INT_CFG  TAS2770_REG(0X0, 0x30)
+    /* Data In Pull-Down */
+#define TAS2770_DIN_PD  TAS2770_REG(0X0, 0x31)
+#define TAS2770_DIN_PD_SDOUT BIT(7)
     /* Misc IRQ */
 #define TAS2770_MISC_IRQ  TAS2770_REG(0X0, 0x32)
     /* Clock Configuration */
@@ -146,6 +157,7 @@ struct tas2770_priv {
 	int pdm_slot;
 	bool dac_powered;
 	bool unmuted;
+	int idle_tx_mode;
 };
 
 #endif /* __TAS2770__ */

-- 
2.53.0


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 5/7] ASoC: soc-dai: add common operation to set TDM idle mode
  2026-03-01  8:05 ` [PATCH v3 5/7] ASoC: soc-dai: add common operation to set TDM idle mode James Calligeros
@ 2026-03-03  2:11   ` Kuninori Morimoto
  2026-03-03  9:10     ` James Calligeros
  0 siblings, 1 reply; 18+ messages in thread
From: Kuninori Morimoto @ 2026-03-03  2:11 UTC (permalink / raw)
  To: James Calligeros
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Shengjiu Wang, Jaroslav Kysela, Takashi Iwai,
	Shenghao Ding, Kevin Lu, Baojun Xu, Frank Li, linux-sound,
	devicetree, imx, linux-arm-kernel, linux-kernel, asahi


Hi James

> Some audio devices, like certain Texas Instruments codecs, integrate
> configurable bus keepers that dictate the codec's behaviour during
> idle TDM slots. Now that we have definitions for various idle modes,
> add a snd_soc_dai_set_tdm_idle() operation to control this in a
> standardised way.
> 
> This is useful on Apple Silicon laptops, where a single I2S bus is
> comprised of two physical lines which are ORed just before the
> receiving port. When a codec on one line is transmitting, we must
> guarantee that the other line is low. We can achieve this by
> configuring one codec on each line to use its bus keeper to fill
> its line with zeroes during the active slots of the other line.
> 
> Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
> ---
(snip)
> +int snd_soc_dai_set_tdm_idle(struct snd_soc_dai *dai,
> +			     unsigned int tx_mask, unsigned int rx_mask,
> +			     int tx_mode, int rx_mode);

Do we need "rx_mode" ?
Only "tx_mode" is enough if my understanding was correct.

This patch-set adds new snd_soc_dai_set_tdm_idle(), but no one is calling
it. Who use it ??

Thank you for your help !!

Best regards
---
Kuninori Morimoto

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 5/7] ASoC: soc-dai: add common operation to set TDM idle mode
  2026-03-03  2:11   ` Kuninori Morimoto
@ 2026-03-03  9:10     ` James Calligeros
  2026-03-03 18:17       ` Mark Brown
  0 siblings, 1 reply; 18+ messages in thread
From: James Calligeros @ 2026-03-03  9:10 UTC (permalink / raw)
  To: Kuninori Morimoto
  Cc: Liam Girdwood, Mark Brown, Rob Herring, Krzysztof Kozlowski,
	Conor Dooley, Shawn Guo, Sascha Hauer, Pengutronix Kernel Team,
	Fabio Estevam, Shengjiu Wang, Jaroslav Kysela, Takashi Iwai,
	Shenghao Ding, Kevin Lu, Baojun Xu, Frank Li, linux-sound,
	devicetree, imx, linux-arm-kernel, linux-kernel, asahi

Hi Kuniori,

On Tuesday, 3 March 2026 12:11:50 pm Australian Eastern Standard Time Kuninori 
Morimoto wrote:
> > +int snd_soc_dai_set_tdm_idle(struct snd_soc_dai *dai,
> > +			     unsigned int tx_mask, unsigned int rx_mask,
> > +			     int tx_mode, int rx_mode);
> 
> Do we need "rx_mode" ?
> Only "tx_mode" is enough if my understanding was correct.

For our (Asahi) purposes yes, we only require TX. However, TAS2770 also
has a bus keeper on SDIN, and I suspect other hardware may too. Rather than
break the API later on should the need to configure this arise,
I decided to add the capability now. I am happy to get rid of it if
we think it is superfluous at this time though.

> This patch-set adds new snd_soc_dai_set_tdm_idle(), but no one is calling
> it. Who use it ??

Currently no one in tree consumes this API, and it is likely that no one will
until we submit our platform driver. See the linked resources in the cover
letter for more details.

In the interests of transparency, I don't expect to have the
platform driver ready for submission any time soon; it is a bit of a mess
and given that I did not write most of it I still need to wrap my head
around why certain decisions were made during its design. However, we
are 100% committed to getting it merged at some point.

If you would prefer I can resubmit this series along with the driver
once it is ready, so that there is an example consumer for the API.

Regards,

James Calligeros



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 5/7] ASoC: soc-dai: add common operation to set TDM idle mode
  2026-03-03  9:10     ` James Calligeros
@ 2026-03-03 18:17       ` Mark Brown
  0 siblings, 0 replies; 18+ messages in thread
From: Mark Brown @ 2026-03-03 18:17 UTC (permalink / raw)
  To: James Calligeros
  Cc: Kuninori Morimoto, Liam Girdwood, Rob Herring,
	Krzysztof Kozlowski, Conor Dooley, Shawn Guo, Sascha Hauer,
	Pengutronix Kernel Team, Fabio Estevam, Shengjiu Wang,
	Jaroslav Kysela, Takashi Iwai, Shenghao Ding, Kevin Lu, Baojun Xu,
	Frank Li, linux-sound, devicetree, imx, linux-arm-kernel,
	linux-kernel, asahi

[-- Attachment #1: Type: text/plain, Size: 941 bytes --]

On Tue, Mar 03, 2026 at 07:10:49PM +1000, James Calligeros wrote:
> On Tuesday, 3 March 2026 12:11:50 pm Australian Eastern Standard Time Kuninori 
> Morimoto wrote:

> > > +int snd_soc_dai_set_tdm_idle(struct snd_soc_dai *dai,
> > > +			     unsigned int tx_mask, unsigned int rx_mask,
> > > +			     int tx_mode, int rx_mode);

> > Do we need "rx_mode" ?
> > Only "tx_mode" is enough if my understanding was correct.

> For our (Asahi) purposes yes, we only require TX. However, TAS2770 also
> has a bus keeper on SDIN, and I suspect other hardware may too. Rather than
> break the API later on should the need to configure this arise,
> I decided to add the capability now. I am happy to get rid of it if
> we think it is superfluous at this time though.

I do think it's reasonable to keep things symmetric, it's probably
better to have an API that's consistent even if some of the code doesn't
currently get used.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 1/7] ASoC: dt-bindings: convert tdm-slot to YAML
  2026-03-01  8:05 ` [PATCH v3 1/7] ASoC: dt-bindings: convert tdm-slot to YAML James Calligeros
@ 2026-03-06  1:07   ` Rob Herring (Arm)
  0 siblings, 0 replies; 18+ messages in thread
From: Rob Herring (Arm) @ 2026-03-06  1:07 UTC (permalink / raw)
  To: James Calligeros
  Cc: linux-kernel, Shenghao Ding, Jaroslav Kysela, linux-sound,
	linux-arm-kernel, Krzysztof Kozlowski, Baojun Xu, Liam Girdwood,
	Fabio Estevam, imx, Shawn Guo, Takashi Iwai, devicetree, asahi,
	Shengjiu Wang, Pengutronix Kernel Team, Kuninori Morimoto,
	Sascha Hauer, Kevin Lu, Conor Dooley, Frank Li, Mark Brown


On Sun, 01 Mar 2026 18:05:20 +1000, James Calligeros wrote:
> This schema was still in plaintext form. Convert to YAML format.
> 
> Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
> ---
>  .../bindings/sound/tdm-slot.txt          | 29 ----------------------
>  .../bindings/sound/tdm-slot.yaml         | 33 +++++++++++++++++++++++++
>  2 files changed, 33 insertions(+), 29 deletions(-)
> 

Reviewed-by: Rob Herring (Arm) <robh@kernel.org>


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 2/7] ASoC: dt-bindings: update tdm-slot.txt references to tdm-slot.yaml
  2026-03-01  8:05 ` [PATCH v3 2/7] ASoC: dt-bindings: update tdm-slot.txt references to tdm-slot.yaml James Calligeros
@ 2026-03-06  1:07   ` Rob Herring (Arm)
  0 siblings, 0 replies; 18+ messages in thread
From: Rob Herring (Arm) @ 2026-03-06  1:07 UTC (permalink / raw)
  To: James Calligeros
  Cc: Conor Dooley, Liam Girdwood, imx, Mark Brown, Kevin Lu, Baojun Xu,
	Kuninori Morimoto, asahi, Shenghao Ding, linux-sound,
	Jaroslav Kysela, Shawn Guo, Shengjiu Wang, devicetree,
	Sascha Hauer, Krzysztof Kozlowski, Fabio Estevam, linux-kernel,
	Pengutronix Kernel Team, Takashi Iwai, Frank Li, linux-arm-kernel


On Sun, 01 Mar 2026 18:05:21 +1000, James Calligeros wrote:
> Ensure that all references to tdm-slot.txt have been updated to
> tdm-slot.yaml, and are schema-compliant.
> 
> Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
> ---
>  .../bindings/sound/imx-audio-card.yaml   |  9 +++------
>  .../bindings/sound/simple-card.yaml      | 14 ++------------
>  2 files changed, 5 insertions(+), 18 deletions(-)
> 

Reviewed-by: Rob Herring (Arm) <robh@kernel.org>


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 3/7] ASoC: dt-bindings: add TDM slot idle mode properties
  2026-03-01  8:05 ` [PATCH v3 3/7] ASoC: dt-bindings: add TDM slot idle mode properties James Calligeros
@ 2026-03-06  1:08   ` Rob Herring (Arm)
  0 siblings, 0 replies; 18+ messages in thread
From: Rob Herring (Arm) @ 2026-03-06  1:08 UTC (permalink / raw)
  To: James Calligeros
  Cc: Shengjiu Wang, Shawn Guo, Takashi Iwai, imx, Jaroslav Kysela,
	devicetree, Fabio Estevam, Baojun Xu, Frank Li, Kuninori Morimoto,
	asahi, Mark Brown, Liam Girdwood, Shenghao Ding,
	Pengutronix Kernel Team, linux-sound, Kevin Lu, Conor Dooley,
	Krzysztof Kozlowski, linux-kernel, linux-arm-kernel, Sascha Hauer


On Sun, 01 Mar 2026 18:05:22 +1000, James Calligeros wrote:
> Add properties to describe TDM slot idle behaviour. These properties can
> be used to describe how a DAI is supposed to behave when not active.
> 
> For example, Apple Silicon laptops split a single I2S bus between two
> physical lines which are combined at an OR gate in front of the
> receiving port. One codec on each line is expected to transmit zeroes
> during the active TDM slots of the opposite line, or we will have corrupted
> data at the receiver.
> 
> Signed-off-by: James Calligeros <jcalligeros99@gmail.com>
> ---
>  .../bindings/sound/tdm-slot.yaml         | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 

Reviewed-by: Rob Herring (Arm) <robh@kernel.org>


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 7/7] ASoC: tas2770: expose SDOUT bus keeper via set_tdm_idle
  2026-03-01  8:05 ` [PATCH v3 7/7] ASoC: tas2770: expose SDOUT bus keeper via set_tdm_idle James Calligeros
@ 2026-03-12 14:33   ` Mark Brown
  2026-03-14  2:32     ` James Calligeros
  0 siblings, 1 reply; 18+ messages in thread
From: Mark Brown @ 2026-03-12 14:33 UTC (permalink / raw)
  To: James Calligeros
  Cc: Liam Girdwood, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Kuninori Morimoto, Shengjiu Wang, Jaroslav Kysela, Takashi Iwai,
	Shenghao Ding, Kevin Lu, Baojun Xu, Frank Li, linux-sound,
	devicetree, imx, linux-arm-kernel, linux-kernel, asahi

[-- Attachment #1: Type: text/plain, Size: 1085 bytes --]

On Sun, Mar 01, 2026 at 06:05:26PM +1000, James Calligeros wrote:

> +static int tas2770_set_dai_tdm_idle(struct snd_soc_dai *dai,
> +				    unsigned int tx_mask,
> +				    unsigned int rx_mask,
> +				    int tx_mode, int rx_mode)
> +{

> +	switch (tx_mode) {
> +	case SND_SOC_DAI_TDM_IDLE_PULLDOWN:
> +		ret = snd_soc_component_update_bits(component, TAS2770_DIN_PD,
> +						    TAS2770_DIN_PD_SDOUT,
> +						    TAS2770_DIN_PD_SDOUT);
> +		if (ret)
> +			return ret;
> +
> +		break;

This and all the other cases only updates the bits it's specifically
setting for the mode, so _ZERO and _HIZ don't update the pull and this
doesn't update the _KEEP/_FILL settings.  Not sure how often anyone is
going to change this at runtime though.

> +	case SND_SOC_DAI_TDM_IDLE_OFF:
> +		ret = snd_soc_component_update_bits(component, TAS2770_DIN_PD,
> +						    TAS2770_DIN_PD_SDOUT, 0);
> +		if (ret)
> +			return ret;
> +
> +		ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG4,
> +						    TAS2770_TDM_CFG_REG4_TX_KEEPER, 0);

Actually this does _KEEP but not _FILL.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 7/7] ASoC: tas2770: expose SDOUT bus keeper via set_tdm_idle
  2026-03-12 14:33   ` Mark Brown
@ 2026-03-14  2:32     ` James Calligeros
  0 siblings, 0 replies; 18+ messages in thread
From: James Calligeros @ 2026-03-14  2:32 UTC (permalink / raw)
  To: Mark Brown
  Cc: Liam Girdwood, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Kuninori Morimoto, Shengjiu Wang, Jaroslav Kysela, Takashi Iwai,
	Shenghao Ding, Kevin Lu, Baojun Xu, Frank Li, linux-sound,
	devicetree, imx, linux-arm-kernel, linux-kernel, asahi

On Friday, 13 March 2026 12:33:05 am Australian Eastern Standard Time Mark Brown wrote:
> On Sun, Mar 01, 2026 at 06:05:26PM +1000, James Calligeros wrote:
> > +static int tas2770_set_dai_tdm_idle(struct snd_soc_dai *dai,
> > +				    unsigned int tx_mask,
> > +				    unsigned int rx_mask,
> > +				    int tx_mode, int rx_mode)
> > +{
> > 
> > +	switch (tx_mode) {
> > +	case SND_SOC_DAI_TDM_IDLE_PULLDOWN:
> > +		ret = snd_soc_component_update_bits(component, TAS2770_DIN_PD,
> > +						    TAS2770_DIN_PD_SDOUT,
> > +						    TAS2770_DIN_PD_SDOUT);
> > +		if (ret)
> > +			return ret;
> > +
> > +		break;
> 
> This and all the other cases only updates the bits it's specifically
> setting for the mode, so _ZERO and _HIZ don't update the pull and this
> doesn't update the _KEEP/_FILL settings.  Not sure how often anyone is
> going to change this at runtime though.

I didn't notice any side effects caused by not explicitly turning off
the weak pulldown, but it makes sense to do if the consumer has asked
for a mode that is not pulldown.

> > +	case SND_SOC_DAI_TDM_IDLE_OFF:
> > +		ret = snd_soc_component_update_bits(component, TAS2770_DIN_PD,
> > +						    TAS2770_DIN_PD_SDOUT, 0);
> > +		if (ret)
> > +			return ret;
> > +
> > +		ret = snd_soc_component_update_bits(component, TAS2770_TDM_CFG_REG4,
> > +						    TAS2770_TDM_CFG_REG4_TX_KEEPER, 0);
> 
> Actually this does _KEEP but not _FILL.

_KEEPER is the important one. _FILL just controls the behaviour
of the bus keeper (zero or Hi-Z) when _KEEPER is set. If _KEEPER is
cleared, the bus keeper is turned off and the value of _FILL doesn't
matter.



^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 0/7] ASoC: basic support for configuring bus keepers
  2026-03-01  8:05 [PATCH v3 0/7] ASoC: basic support for configuring bus keepers James Calligeros
                   ` (6 preceding siblings ...)
  2026-03-01  8:05 ` [PATCH v3 7/7] ASoC: tas2770: expose SDOUT bus keeper via set_tdm_idle James Calligeros
@ 2026-03-16  1:13 ` Mark Brown
  2026-03-16 17:52 ` Mark Brown
  8 siblings, 0 replies; 18+ messages in thread
From: Mark Brown @ 2026-03-16  1:13 UTC (permalink / raw)
  To: Liam Girdwood, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Kuninori Morimoto, Shengjiu Wang, Jaroslav Kysela, Takashi Iwai,
	Shenghao Ding, Kevin Lu, Baojun Xu, Frank Li, James Calligeros
  Cc: linux-sound, devicetree, imx, linux-arm-kernel, linux-kernel,
	asahi

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


^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v3 0/7] ASoC: basic support for configuring bus keepers
  2026-03-01  8:05 [PATCH v3 0/7] ASoC: basic support for configuring bus keepers James Calligeros
                   ` (7 preceding siblings ...)
  2026-03-16  1:13 ` [PATCH v3 0/7] ASoC: basic support for configuring bus keepers Mark Brown
@ 2026-03-16 17:52 ` Mark Brown
  8 siblings, 0 replies; 18+ messages in thread
From: Mark Brown @ 2026-03-16 17:52 UTC (permalink / raw)
  To: Liam Girdwood, Rob Herring, Krzysztof Kozlowski, Conor Dooley,
	Shawn Guo, Sascha Hauer, Pengutronix Kernel Team, Fabio Estevam,
	Kuninori Morimoto, Shengjiu Wang, Jaroslav Kysela, Takashi Iwai,
	Shenghao Ding, Kevin Lu, Baojun Xu, Frank Li, James Calligeros
  Cc: linux-sound, devicetree, imx, linux-arm-kernel, linux-kernel,
	asahi

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


^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2026-03-16 17:52 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-01  8:05 [PATCH v3 0/7] ASoC: basic support for configuring bus keepers James Calligeros
2026-03-01  8:05 ` [PATCH v3 1/7] ASoC: dt-bindings: convert tdm-slot to YAML James Calligeros
2026-03-06  1:07   ` Rob Herring (Arm)
2026-03-01  8:05 ` [PATCH v3 2/7] ASoC: dt-bindings: update tdm-slot.txt references to tdm-slot.yaml James Calligeros
2026-03-06  1:07   ` Rob Herring (Arm)
2026-03-01  8:05 ` [PATCH v3 3/7] ASoC: dt-bindings: add TDM slot idle mode properties James Calligeros
2026-03-06  1:08   ` Rob Herring (Arm)
2026-03-01  8:05 ` [PATCH v3 4/7] ASoC: soc-dai: define possible idle TDM slot modes James Calligeros
2026-03-01  8:05 ` [PATCH v3 5/7] ASoC: soc-dai: add common operation to set TDM idle mode James Calligeros
2026-03-03  2:11   ` Kuninori Morimoto
2026-03-03  9:10     ` James Calligeros
2026-03-03 18:17       ` Mark Brown
2026-03-01  8:05 ` [PATCH v3 6/7] ASoC: tas2764: expose SDOUT bus keeper via set_tdm_idle operation James Calligeros
2026-03-01  8:05 ` [PATCH v3 7/7] ASoC: tas2770: expose SDOUT bus keeper via set_tdm_idle James Calligeros
2026-03-12 14:33   ` Mark Brown
2026-03-14  2:32     ` James Calligeros
2026-03-16  1:13 ` [PATCH v3 0/7] ASoC: basic support for configuring bus keepers Mark Brown
2026-03-16 17:52 ` Mark Brown

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox