Skip to contentSkip to conversation

ASoC: Add TAS67524 quad-channel Class-D amplifier driver

PATCH Superseded Sen Wang 3 participants 10 messages Apr 8 – Apr 9

Subsystems (5)

v4 of 6 Superseded Latest is v6 →

lore
Share & tools
lore

Sen Wang

author maintainer
#0 lore raw

v4 cover ASoC: Add TAS67524 quad-channel Class-D amplifier driver

This series adds support for the TI TAS675x (TAS6754, TAS67524) quad-channel automotive Class-D amplifiers. The devices have an integrated DSP and load diagnostics, and are controlled over I2C.

Patch 1 adds the dt-binding, patch 2 the codec driver, patch 3 the ALSA mixer controls documentation, and patch 4 adds the MAINTAINERS entry.

Tested on AM62D-EVM with a TAS67CD-AEC daughter card. For setup & test procedures, refer to the GitHub repository.

GitHub: https://github.com/SenWang125/tas67-linux

Changes in v4:
- Corrected dt-binding compatibles (1/4)
- Reverted v3's change and made tas67524.c back to tas675x.c (2/4)
- Links to v3: https://lore.kernel.org/all/[email protected]/

Changes in v3:
- Renamed ALL tas675x filenames to tas67524, removed tas6754 compatible instance
- Changed pd-gpios to powerdown-gpios, cleanup unnessary .yaml formatting (1/4)
- Opt to use disable delayed_work and re-enable on runtime suspend/resume, similarly, use disable/enable IRQ on system suspend/resume. (2/4)
- Include IRQ_NONE on ISR returns. (2/4)
- Clarify _check_faults() function which now returns need_clear boolean (2/4)
- Added register section (3/4)
- Added addintional notes: for clarification (3/4)
- Links to v2: https://lore.kernel.org/all/[email protected]/

Changes in v2:
- Remove redundant DAPM event function (2/4)
- Move IRQ request past power_on, so regs can be set in a clean state (2/4)
- Add delayed_work at probe time to accomdate no PM configs (2/4)
- Change .set_fmt and .dapm_routes callbacks to the same tas675x_set_fmt name (2/4)
- Links to v1: https://lore.kernel.org/all/[email protected]/

Sen Wang (4):
ASoC: dt-bindings: Add ti,tas67524
ASoC: codecs: Add TAS67524 quad-channel audio amplifier driver
Documentation: sound: Add TAS675x codec mixer controls documentation
MAINTAINERS: add entry for TAS67524 audio amplifier

 .../bindings/sound/ti,tas67524.yaml           |  280 +++
 Documentation/sound/codecs/index.rst          |    1 +
 Documentation/sound/codecs/tas675x.rst        |  686 ++++++
 MAINTAINERS                                   |    4 +
 sound/soc/codecs/Kconfig                      |   11 +
 sound/soc/codecs/Makefile                     |    2 +
 sound/soc/codecs/tas675x.c                    | 2172 +++++++++++++++++
 sound/soc/codecs/tas675x.h                    |  367 +++
 8 files changed, 3523 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/ti,tas67524.yaml
 create mode 100644 Documentation/sound/codecs/tas675x.rst
 create mode 100644 sound/soc/codecs/tas675x.c
 create mode 100644 sound/soc/codecs/tas675x.h
Signature · 1 line
2.43.0
author maintainer
#1 lore raw

PATCH v4 1/4 ASoC: dt-bindings: Add ti,tas67524

Add device tree binding for the Texas Instruments TAS67524 family of four-channel Class-D audio amplifiers with integrated DSP.

---
Changes in v4:
- Corrected ti,tas6754 compatible with a fallback of ti,tas67524
- Corrected comment spacing

Changes in v3:
- Renamed ti,tas675x to ti,tas67524.yaml
- Removed tas6754 compatible instance
- Changed pd-gpios to powerdown-gpios
- Cleanup unnessary "|" formatting

Changes in v2:
- None

 .../bindings/sound/ti,tas67524.yaml           | 280 ++++++++++++++++++
 1 file changed, 280 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/sound/ti,tas67524.yaml
Documentation/devicetree/bindings/sound/ti,tas67524.yaml new file +280 -0
new file mode 100644
index 000000000000..812a4d39e2a5
@@ -0,0 +1,280 @@
+# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
+%YAML 1.2
+---
+$id: http://devicetree.org/schemas/sound/ti,tas67524.yaml#
+$schema: http://devicetree.org/meta-schemas/core.yaml#
+
+title: Texas Instruments TAS67524 Audio Amplifier
+
+maintainers:
+  - Sen Wang <[email protected]>
+
+description:
+  The TAS67524 is a four-channel, digital-input, automotive
+  Class-D audio amplifier with load diagnostics and an integrated
+  DSP for audio processing.
+
+allOf:
+  - $ref: dai-common.yaml#
+
+properties:
+  compatible:
+    oneOf:
+      - items:
+          - enum:
+              - ti,tas6754
+          - const: ti,tas67524
+      - const: ti,tas67524
+
+  reg:
+    maxItems: 1
+
+  '#sound-dai-cells':
+    const: 1
+    description: |
+      The device exposes three DAIs, selected by index.
+        0 - Standard Audio Path (Playback)
+        1 - Low-Latency Playback Path (Playback)
+        2 - Sensory Feedback (Capture - Vpredict and Isense)
+      By default, all four channels of each DAI are active.
+
+  interrupts:
+    maxItems: 1
+    description:
+      Active-low falling-edge interrupt from the FAULT pin. When provided,
+      the driver uses IRQ-driven fault reporting instead of polling.
+
+  powerdown-gpios:
+    maxItems: 1
+    description:
+      GPIO connected to the PD pin, active low. Controls the internal
+      digital circuitry power state. When asserted the device enters
+      full power-down mode and all register state is lost. Can be omitted if
+      PD pin is hardwired or externally controlled.
+
+  standby-gpios:
+    maxItems: 1
+    description:
+      GPIO connected to the STBY pin, active low. Controls the analog
+      power stage. When asserted the device enters Deep Sleep mode but
+      remains I2C-accessible with registers retained. Can be omitted if
+      STBY pin is tied to PD or hardwired.
+
+  dvdd-supply:
+    description:
+      Digital logic supply (1.62 V to 3.6 V). All three supply rails must
+      be within their recommended operating ranges before the PD pin is
+      released.
+
+  pvdd-supply:
+    description:
+      Output FET power supply (4.5 V to 19 V). All three supply rails must
+      be within their recommended operating ranges before the PD pin is
+      released.
+
+  vbat-supply:
+    description:
+      Battery supply for the Class-D output stage (4.5 V to 19 V). Optional
+      when PVDD and VBAT are connected to the same supply rail. When absent,
+      VBAT is assumed hardwired to PVDD.
+
+  ti,fast-boot:
+    type: boolean
+    description:
+      Skip DC load diagnostic sweep at power-on to reduce boot latency.
+      Automatic diagnostics after fault conditions remain enabled. Hardware
+      overcurrent protection is always active.
+
+  ti,audio-slot-no:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      TDM slot offset for the standard audio playback path via SDIN1. A value
+      of 4 maps to slot 4. If omitted, slot assignment is derived from the
+      tx_mask provided via set_tdm_slot(). Without either property, no slot
+      mapping is configured.
+
+  ti,llp-slot-no:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description:
+      TDM slot offset for the low-latency playback path via SDIN1. If omitted,
+      slot assignment is derived from the tx_mask provided via set_tdm_slot().
+      Without either property, no slot mapping is configured. Disabled outside
+      of LLP mode, and only relevant for TDM formats.
+
+  ti,vpredict-slot-no:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      In TDM mode, enables Vpredict output and assigns its starting slot;
+      four consecutive slots carry Vpredict Ch1-4 on SDOUT1. May coexist
+      with ti,isense-slot-no using separate non-overlapping slots.
+
+      In I2S mode, enables Vpredict output on SDOUT1 (Ch1/Ch2) and SDOUT2
+      (Ch3/Ch4). The slot value is unused. Requires a GPIO configured as
+      sdout2 for Ch3/Ch4; without it only Ch1/Ch2 are output. Mutually
+      exclusive with ti,isense-slot-no; if both are set, Vpredict takes
+      priority.
+
+      Irrelevant in Left-J and Right-J modes.
+
+  ti,isense-slot-no:
+    $ref: /schemas/types.yaml#/definitions/uint32
+    description: |
+      In TDM mode, enables Isense output and assigns its starting slot;
+      four consecutive slots carry Isense Ch1-4 on SDOUT1. May coexist
+      with ti,vpredict-slot-no using separate non-overlapping slots.
+
+      In I2S mode, enables Isense output on SDOUT1 (Ch1/Ch2) and SDOUT2
+      (Ch3/Ch4). The slot value is unused. Requires a GPIO configured as
+      SDOUT2 for Ch3/Ch4; without it only Ch1/Ch2 are output. Mutually
+      exclusive with ti,vpredict-slot-no; Vpredict takes priority if both
+      are set.
+
+      Irrelevant in Left-J and Right-J modes.
+
+  ti,gpio1-function:
+    $ref: /schemas/types.yaml#/definitions/string
+    description:
+      Function for the GPIO_1 pin. When omitted, GPIO_1 remains in its
+      power-on default state.
+    enum:
+      - low            # Output: driven low
+      - auto-mute      # Output: high when all channels are auto-muted
+      - auto-mute-ch4  # Output: high when channel 4 is auto-muted
+      - auto-mute-ch3  # Output: high when channel 3 is auto-muted
+      - auto-mute-ch2  # Output: high when channel 2 is auto-muted
+      - auto-mute-ch1  # Output: high when channel 1 is auto-muted
+      - sdout2         # Output: Routes secondary serial data output 2
+      - sdout1         # Output: Re-routes secondary serial data output 1
+      - warn           # Output: warning signal (OTW, CBC)
+      - fault          # Output: fault signal (OTSD, OC, DC)
+      - clock-sync     # Output: clock synchronisation
+      - invalid-clock  # Output: high when clock is invalid
+      - high           # Output: driven high
+      - mute           # Input: external mute control
+      - phase-sync     # Input: phase synchronisation
+      - sdin2          # Input: secondary SDIN2 for I2S/LJ/RJ ch3/ch4
+      - deep-sleep     # Input: asserted transitions device to Deep Sleep
+      - hiz            # Input: asserted transitions device to Hi-Z
+      - play           # Input: asserted transitions device to Play
+      - sleep          # Input: asserted transitions device to Sleep
+
+  ti,gpio2-function:
+    $ref: /schemas/types.yaml#/definitions/string
+    description:
+      Function for the GPIO_2 pin. When omitted, GPIO_2 remains in its
+      power-on default state.
+    enum:
+      - low            # Output: driven low
+      - auto-mute      # Output: high when all channels are auto-muted
+      - auto-mute-ch4  # Output: high when channel 4 is auto-muted
+      - auto-mute-ch3  # Output: high when channel 3 is auto-muted
+      - auto-mute-ch2  # Output: high when channel 2 is auto-muted
+      - auto-mute-ch1  # Output: high when channel 1 is auto-muted
+      - sdout2         # Output: Routes secondary serial data output 2
+      - sdout1         # Output: Re-routes secondary serial data output 1
+      - warn           # Output: warning signal (OTW, CBC)
+      - fault          # Output: fault signal (OTSD, OC, DC)
+      - clock-sync     # Output: clock synchronisation
+      - invalid-clock  # Output: high when clock is invalid
+      - high           # Output: driven high
+      - mute           # Input: external mute control
+      - phase-sync     # Input: phase synchronisation
+      - sdin2          # Input: secondary SDIN2 for I2S/LJ/RJ ch3/ch4
+      - deep-sleep     # Input: asserted transitions device to Deep Sleep
+      - hiz            # Input: asserted transitions device to Hi-Z
+      - play           # Input: asserted transitions device to Play
+      - sleep          # Input: asserted transitions device to Sleep
+
+  ports:
+    $ref: /schemas/graph.yaml#/properties/ports
+    properties:
+      port@0:
+        $ref: audio-graph-port.yaml#
+        unevaluatedProperties: false
+        description: Standard audio playback port (DAI 0).
+
+      port@1:
+        $ref: audio-graph-port.yaml#
+        unevaluatedProperties: false
+        description: Low-latency playback port (LLP) (DAI 1).
+
+      port@2:
+        $ref: audio-graph-port.yaml#
+        unevaluatedProperties: false
+        description: Sensory feedback capture port (DAI 2).
+
+  port:
+    $ref: audio-graph-port.yaml#
+    unevaluatedProperties: false
+
+required:
+  - compatible
+  - reg
+  - '#sound-dai-cells'
+  - dvdd-supply
+  - pvdd-supply
+
+anyOf:
+  - required: [powerdown-gpios]
+  - required: [standby-gpios]
+
+unevaluatedProperties: false
+
+examples:
+  - |
+    #include <dt-bindings/gpio/gpio.h>
+
+    i2c {
+        #address-cells = <1>;
+        #size-cells = <0>;
+
+        amplifier@70 {
+            compatible = "ti,tas67524";
+            reg = <0x70>;
+            #sound-dai-cells = <1>;
+            sound-name-prefix = "TAS0";
+
+            standby-gpios = <&main_gpio0 33 GPIO_ACTIVE_LOW>;
+
+            dvdd-supply = <&dvdd_1v8>;
+            pvdd-supply = <&pvdd_12v>;
+            vbat-supply = <&vbat_12v>;
+
+            ti,audio-slot-no = <0>;
+            ti,llp-slot-no = <4>;
+            ti,vpredict-slot-no = <0>;
+            ti,isense-slot-no = <4>;
+
+            ti,gpio2-function = "warn";
+
+            ports {
+                #address-cells = <1>;
+                #size-cells = <0>;
+
+                port@0 {
+                    reg = <0>;
+
+                    tas0_audio_ep: endpoint {
+                        dai-format = "dsp_b";
+                        remote-endpoint = <&be_tas0_audio_ep>;
+                    };
+                };
+
+                port@1 {
+                    reg = <1>;
+
+                    tas0_anc_ep: endpoint {
+                        remote-endpoint = <&be_tas0_anc_ep>;
+                    };
+                };
+
+                port@2 {
+                    reg = <2>;
+
+                    tas0_fb_ep: endpoint {
+                        remote-endpoint = <&be_tas0_fb_ep>;
+                    };
+                };
+            };
+        };
+    };
Signature · 1 line
2.43.0
author maintainer
#3 lore raw

PATCH v4 2/4 ASoC: codecs: Add TAS67524 quad-channel audio amplifier driver

In reply to Sen Wang

The TAS675x (TAS6754, TAS67524) are quad-channel, digital-input Class-D amplifiers with an integrated DSP, controlled over I2C. They support I2S and TDM serial audio interfaces.

The driver exposes three DAI endpoints: standard playback, a low-latency DSP bypass path, and a sense capture DAI for real-time voltage and current feedback. DC, AC and real-time load diagnostics and hardware fault monitoring are supported.

---
Changes in v4:
- Reverted filename change from tas67524.c back to tas675x.c
- Removed improper kernel doc syntax

Changes in v3:
- Use disable delayed_work and re-enable on runtime suspend/resume
- Similarly, use disable/enable IRQ on system suspend/resume
- Include IRQ_NONE on ISR returns
- Clarify _check_faults() which now returns need_clear boolean

Changes in v2:
- Remove redundant DAPM event function
- Move IRQ request past power_on(2/4)
- Add delayed_work at probe time to accomdate no PM config
- Change .set_fmt and .dapm_routes callbacks to the same tas675x_set_fmt name

 sound/soc/codecs/Kconfig   |   11 +
 sound/soc/codecs/Makefile  |    2 +
 sound/soc/codecs/tas675x.c | 2172 ++++++++++++++++++++++++++++++++++++
 sound/soc/codecs/tas675x.h |  367 ++++++
 4 files changed, 2552 insertions(+)
 create mode 100644 sound/soc/codecs/tas675x.c
 create mode 100644 sound/soc/codecs/tas675x.h
sound/soc/codecs/Kconfig +11 -0
index f9e6a83e55c6..28a976f32d9f 100644
@@ -275,6 +275,7 @@ config SND_SOC_ALL_CODECS
 	imply SND_SOC_TAS571X
 	imply SND_SOC_TAS5720
 	imply SND_SOC_TAS6424
+	imply SND_SOC_TAS675X
 	imply SND_SOC_TDA7419
 	imply SND_SOC_TFA9879
 	imply SND_SOC_TFA989X
@@ -2240,6 +2241,16 @@ config SND_SOC_TAS6424
 	  Enable support for Texas Instruments TAS6424 high-efficiency
 	  digital input quad-channel Class-D audio power amplifiers.
 
+config SND_SOC_TAS675X
+	tristate "Texas Instruments TAS675x Quad-Channel Audio Amplifier"
+	depends on I2C
+	select REGMAP_I2C
+	help
+	  Enable support for Texas Instruments TAS675x quad-channel Class-D
+	  audio power amplifier. The device supports I2S and TDM interfaces
+	  with real-time voltage and current sense feedback via SDOUT, and
+	  provides DC/AC/real-time load diagnostics for speaker monitoring.
+
 config SND_SOC_TDA7419
 	tristate "ST TDA7419 audio processor"
 	depends on I2C
sound/soc/codecs/Makefile +2 -0
index 172861d17cfd..106fdc140d42 100644
@@ -318,6 +318,7 @@ snd-soc-tas571x-y := tas571x.o
 snd-soc-tas5720-y := tas5720.o
 snd-soc-tas5805m-y := tas5805m.o
 snd-soc-tas6424-y := tas6424.o
+snd-soc-tas675x-y := tas675x.o
 snd-soc-tda7419-y := tda7419.o
 snd-soc-tas2770-y := tas2770.o
 snd-soc-tas2781-comlib-y := tas2781-comlib.o
@@ -760,6 +761,7 @@ obj-$(CONFIG_SND_SOC_TAS571X)	+= snd-soc-tas571x.o
 obj-$(CONFIG_SND_SOC_TAS5720)	+= snd-soc-tas5720.o
 obj-$(CONFIG_SND_SOC_TAS5805M)	+= snd-soc-tas5805m.o
 obj-$(CONFIG_SND_SOC_TAS6424)	+= snd-soc-tas6424.o
+obj-$(CONFIG_SND_SOC_TAS675X)	+= snd-soc-tas675x.o
 obj-$(CONFIG_SND_SOC_TDA7419)	+= snd-soc-tda7419.o
 obj-$(CONFIG_SND_SOC_TAS2770) += snd-soc-tas2770.o
 obj-$(CONFIG_SND_SOC_TFA9879)	+= snd-soc-tfa9879.o
sound/soc/codecs/tas675x.c new file +2172 -0

2,172 lines not on this page · raw message

sound/soc/codecs/tas675x.h new file +367 -0

367 lines not on this page · raw message

Signature · 1 line
2.43.0
#4 lore raw

Re: [PATCH v4 2/4] ASoC: codecs: Add TAS67524 quad-channel audio amplifier driver

sound/soc/codecs/tas675x.c line 2144

Quoted 7 lines · Sen Wang
sound/soc/codecs/tas675x.c new file +7 -0
+static const struct dev_pm_ops tas675x_pm_ops = {
+	SYSTEM_SLEEP_PM_OPS(tas675x_system_suspend, tas675x_system_resume)
+	RUNTIME_PM_OPS(tas675x_runtime_suspend, tas675x_runtime_resume, NULL)
+};
+
+static const struct of_device_id tas675x_of_match[] = {
+	{ .compatible = "ti,tas6754",  .data = (void *)TAS6754 },

Drop. This is the entire point of compatibility.

Best regards,
Krzysztof

maintainer
#5 lore raw

Re: [PATCH v4 2/4] ASoC: codecs: Add TAS67524 quad-channel audio amplifier driver

In reply to Sen Wang

sound/soc/codecs/tas675x.c line 179

Quoted 6 lines · Sen Wang
sound/soc/codecs/tas675x.c new file +5 -0
+static int tas675x_dsp_mem_write(struct tas675x_priv *tas, u8 page, u8 reg, u32 val)
+{
 
+out:
+	__tas675x_select_book(tas, TAS675X_BOOK_DEFAULT);
+	mutex_unlock(&tas->io_lock);

Do we really need to restore the book here? The book select register is marked as volatile so regmap will figure things out if it's the next thing to write, and anything else will need to set whatever it wants anyway. Alternatively if the book register were cached (which wouldn't be a bad idea) then we'd need to restore whatever the cache has or invalidate the cache.

sound/soc/codecs/tas675x.c line 214

Quoted 6 lines
sound/soc/codecs/tas675x.c new file +5 -0
+static int tas675x_dsp_mem_read(struct tas675x_priv *tas, u8 page, u8 reg, u32 *val)
+{
 
+out:
+	__tas675x_select_book(tas, TAS675X_BOOK_DEFAULT);
+	mutex_unlock(&tas->io_lock);

Same here

sound/soc/codecs/tas675x.c line 316

Quoted 8 lines
sound/soc/codecs/tas675x.c new file +8 -0
+static int tas675x_rtldg_thresh_info(struct snd_kcontrol *kcontrol,
+				     struct snd_ctl_elem_info *uinfo)
+{
+	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+	uinfo->count = 1;
+	uinfo->value.integer.min = 0;
+	/* Accepts 32-bit values, even though 8bit MSB is ignored */
+	uinfo->value.integer.max = 0xFFFFFFFF;

This is going to break on 32 bit architectures since long is a 32 bit signed value. You want LONG_MAX, or to restrict the value (which would be more friendly to mixer-test!).

Quoted 5 lines
sound/soc/codecs/tas675x.c new file +4 -0
+static int tas675x_set_dcldg_trigger(struct snd_kcontrol *kcontrol,
+				     struct snd_ctl_elem_value *ucontrol)
+{
 
+	/* Wait for LOAD_DIAG to exit */

sound/soc/codecs/tas675x.c line 410

Quoted 10 lines
sound/soc/codecs/tas675x.c new file +10 -0
+	regmap_read_poll_timeout(tas->regmap, TAS675X_STATE_REPORT_CH1_CH2_REG,
+				 state, (state & 0x0F) != TAS675X_STATE_LOAD_DIAG &&
+					(state >> 4) != TAS675X_STATE_LOAD_DIAG,
+				 TAS675X_POLL_INTERVAL_US,
+				 TAS675X_STATE_TRANSITION_TIMEOUT_US);
+	regmap_read_poll_timeout(tas->regmap, TAS675X_STATE_REPORT_CH3_CH4_REG,
+				 state34, (state34 & 0x0F) != TAS675X_STATE_LOAD_DIAG &&
+					  (state34 >> 4) != TAS675X_STATE_LOAD_DIAG,
+				 TAS675X_POLL_INTERVAL_US,
+				 TAS675X_STATE_TRANSITION_TIMEOUT_US);

Don't know how likely it is in practice but we ignore any timeout failures in this function.

sound/soc/codecs/tas675x.c line 1856

Quoted 10 lines
sound/soc/codecs/tas675x.c new file +10 -0
+static irqreturn_t tas675x_irq_handler(int irq, void *data)
+{
+	struct tas675x_priv *tas = data;
+
+	if (!tas675x_check_faults(tas))
+		return IRQ_NONE;
+
+	regmap_write(tas->regmap, TAS675X_RESET_REG, TAS675X_FAULT_CLEAR);
+	return IRQ_HANDLED;
+}

This probably ought to take a runtime PM reference to ensure the I2C controller is woken up, and in case in future you get regulator support. Even if the device itself shouldn't be generating interrupts while it's idle the interrupt might be shared or something might fire for some other reason.

author maintainer
#6 lore raw

Re: [PATCH v4 2/4] ASoC: codecs: Add TAS67524 quad-channel audio amplifier driver

Quoted 5 lines · Mark Brown
Quoted 2 lines · Sen Wang
(quoted diff) +2 -0
+static int tas675x_dsp_mem_write(struct tas675x_priv *tas, u8 page, u8 reg, u32 val)
+{
Quoted 11 lines

sound/soc/codecs/tas675x.c line 179

Quoted 3 lines
sound/soc/codecs/tas675x.c new file +3 -0
+out:
+	__tas675x_select_book(tas, TAS675X_BOOK_DEFAULT);
+	mutex_unlock(&tas->io_lock);

Do we really need to restore the book here? The book select register is marked as volatile so regmap will figure things out if it's the next thing to write, and anything else will need to set whatever it wants anyway. Alternatively if the book register were cached (which wouldn't be a bad idea) then we'd need to restore whatever the cache has or invalidate the cache.

Hi Mark, Thanks for the review!

The book restore was needed because only the page register is listed as the selector_reg, and the hardware also requires page 0 before switching books, which kind of prevents cache and including book management into the ranges config alongside page selection.

All other regmap accesses in the driver implicitly assume DEFAULT book, and therefore I can get away with simple and explicit switching of the books with help of mutex in a few places.

Would you suggest a regmap/cache mechanism better suited for this two-level hierarchy? Happy to rework it if there's a cleaner approach.

Quoted 9 lines

sound/soc/codecs/tas675x.c line 214

Quoted 6 lines
sound/soc/codecs/tas675x.c new file +5 -0
+static int tas675x_dsp_mem_read(struct tas675x_priv *tas, u8 page, u8 reg, u32 *val)
+{
 
+out:
+	__tas675x_select_book(tas, TAS675X_BOOK_DEFAULT);
+	mutex_unlock(&tas->io_lock);

Same here

Quoted 13 lines

sound/soc/codecs/tas675x.c line 316

Quoted 8 lines
sound/soc/codecs/tas675x.c new file +8 -0
+static int tas675x_rtldg_thresh_info(struct snd_kcontrol *kcontrol,
+				     struct snd_ctl_elem_info *uinfo)
+{
+	uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+	uinfo->count = 1;
+	uinfo->value.integer.min = 0;
+	/* Accepts 32-bit values, even though 8bit MSB is ignored */
+	uinfo->value.integer.max = 0xFFFFFFFF;

This is going to break on 32 bit architectures since long is a 32 bit signed value. You want LONG_MAX, or to restrict the value (which would be more friendly to mixer-test!).

Right, I should restrict the max value to be just 24bit 0x00FFFFFF to make it friendly to mixer-test. And I can also lift the explicit zero-padding in the dsp_mem_write funcs which is not necessary anymore.

Quoted 4 lines
Quoted 3 lines
sound/soc/codecs/tas675x.c new file +3 -0
+static int tas675x_set_dcldg_trigger(struct snd_kcontrol *kcontrol,
+				     struct snd_ctl_elem_value *ucontrol)
+{
Quoted 15 lines

sound/soc/codecs/tas675x.c line 410

Quoted 11 lines
sound/soc/codecs/tas675x.c new file +11 -0
+	/* Wait for LOAD_DIAG to exit */
+	regmap_read_poll_timeout(tas->regmap, TAS675X_STATE_REPORT_CH1_CH2_REG,
+				 state, (state & 0x0F) != TAS675X_STATE_LOAD_DIAG &&
+					(state >> 4) != TAS675X_STATE_LOAD_DIAG,
+				 TAS675X_POLL_INTERVAL_US,
+				 TAS675X_STATE_TRANSITION_TIMEOUT_US);
+	regmap_read_poll_timeout(tas->regmap, TAS675X_STATE_REPORT_CH3_CH4_REG,
+				 state34, (state34 & 0x0F) != TAS675X_STATE_LOAD_DIAG &&
+					  (state34 >> 4) != TAS675X_STATE_LOAD_DIAG,
+				 TAS675X_POLL_INTERVAL_US,
+				 TAS675X_STATE_TRANSITION_TIMEOUT_US);

Don't know how likely it is in practice but we ignore any timeout failures in this function.

Will add in the complete error checking for this function.

Quoted 8 lines
Quoted 8 lines
sound/soc/codecs/tas675x.c new file +8 -0
+static irqreturn_t tas675x_irq_handler(int irq, void *data)
+{
+	struct tas675x_priv *tas = data;
+
+	if (!tas675x_check_faults(tas))
+		return IRQ_NONE;
+
+	regmap_write(tas->regmap, TAS675X_RESET_REG, TAS675X_FAULT_CLEAR);
Quoted 8 lines

sound/soc/codecs/tas675x.c line 1856

Quoted 2 lines
sound/soc/codecs/tas675x.c new file +2 -0
+	return IRQ_HANDLED;
+}

This probably ought to take a runtime PM reference to ensure the I2C controller is woken up, and in case in future you get regulator support. Even if the device itself shouldn't be generating interrupts while it's idle the interrupt might be shared or something might fire for some other reason.

Absolutely, let me add the runtime PM reference (mark_busy & put_autosuspend) on this one as well. Better be safe than sorry.

Best Regards,
Sen Wang

maintainer
#7 lore raw

Re: [PATCH v4 2/4] ASoC: codecs: Add TAS67524 quad-channel audio amplifier driver

Quoted 5 lines · Sen
Quoted 1 line · Mark Brown

On Wed, Apr 08, 2026 at 12:31:46AM -0500, Sen Wang wrote:

Would you suggest a regmap/cache mechanism better suited for this two-level hierarchy? Happy to rework it if there's a cleaner approach.

I hadn't noticed that you'd got both books and pages - what you've got already should be fine.

author maintainer
#8 lore raw

PATCH v4 3/4 Documentation: sound: Add TAS675x codec mixer controls documentation

In reply to Sen Wang

Add ALSA mixer controls documentation for the TAS67524 driver, covering DSP signal path modes, volume controls, load diagnostics, and fault monitoring.

---
Changes in v3:
- Added register section
- Added few addintional notes for clarification

Changes in v2:
- None

 Documentation/sound/codecs/index.rst   |   1 +
 Documentation/sound/codecs/tas675x.rst | 686 +++++++++++++++++++++++++
 2 files changed, 687 insertions(+)
 create mode 100644 Documentation/sound/codecs/tas675x.rst
Documentation/sound/codecs/index.rst +1 -0
index 2cb95d87bbef..7594d0a38d6b 100644
@@ -7,3 +7,4 @@ Codec-Specific Information
    :maxdepth: 2
 
    cs35l56
+   tas675x
Documentation/sound/codecs/tas675x.rst new file +686 -0

686 lines not on this page · raw message

Signature · 1 line
2.43.0
author maintainer
#9 lore raw

PATCH v4 4/4 MAINTAINERS: add entry for TAS67524 audio amplifier

In reply to Sen Wang

Add Sen Wang as maintainer and register file patterns for the newly added TAS67524 amplifier driver.

---
 MAINTAINERS | 4 ++++
 1 file changed, 4 insertions(+)
MAINTAINERS +4 -0
index a626dee5c106..a78b6cb9b907 100644
@@ -26191,17 +26191,20 @@ TEXAS INSTRUMENTS AUDIO (ASoC/HDA) DRIVERS
 M:	Shenghao Ding <[email protected]>
 M:	Kevin Lu <[email protected]>
 M:	Baojun Xu <[email protected]>
+M:	Sen Wang <[email protected]>
 L:	[email protected]
 S:	Maintained
 F:	Documentation/devicetree/bindings/sound/ti,tas2552.yaml
 F:	Documentation/devicetree/bindings/sound/ti,tas2562.yaml
 F:	Documentation/devicetree/bindings/sound/ti,tas2770.yaml
 F:	Documentation/devicetree/bindings/sound/ti,tas27xx.yaml
+F:	Documentation/devicetree/bindings/sound/ti,tas67524.yaml
 F:	Documentation/devicetree/bindings/sound/ti,tpa6130a2.yaml
 F:	Documentation/devicetree/bindings/sound/ti,pcm1681.yaml
 F:	Documentation/devicetree/bindings/sound/ti,pcm3168a.yaml
 F:	Documentation/devicetree/bindings/sound/ti,tlv320*.yaml
 F:	Documentation/devicetree/bindings/sound/ti,tlv320adcx140.yaml
+F:	Documentation/sound/codecs/tas675x*
 F:	include/sound/tas2*.h
 F:	include/sound/tlv320*.h
 F:	sound/hda/codecs/side-codecs/tas2781_hda_i2c.c
@@ -26215,6 +26218,7 @@ F:	sound/soc/codecs/pcm3168a*.*
 F:	sound/soc/codecs/pcm5102a.c
 F:	sound/soc/codecs/pcm512x*.*
 F:	sound/soc/codecs/tas2*.*
+F:	sound/soc/codecs/tas675x*.*
 F:	sound/soc/codecs/tlv320*.*
 F:	sound/soc/codecs/tpa6130a2.*
 
Signature · 1 line
2.43.0