From nobody Mon Jun 15 09:40:21 2026 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AB98F3A8747; Thu, 9 Apr 2026 09:03:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725440; cv=none; b=iUDFshDmQjBouBiE38ADRjL+BqjluxUOlkROZVFgTMhrNDtfDQaJ2CB0JSwiQjQO2x4RIUBEXZ+biSMacYtmeATw0UY466gWho8SykMdlVszfeUUSa9u7qXobq3Re+QJD3i0OVU8uP/MAqcoR+OHp3pBSueGrutp436u/iAxf/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725440; c=relaxed/simple; bh=QZCy8YOgU2roRTaRu1ZwpVp6FrFy4UwnRgaMkQbOOLI=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tnNIk5e0kju1IfHKpOVjoVsie/2JmayOISiuYTBJuPVfH/zUgSzP8HVPp9NgYPaceDw4HLqiSOzsM5o8OLPNoEeX/uFEZBOxWxgAkswDakNat1dY0VjBIwCb8ftcFN/e9LK8Kxalk9v0jol43k/JX3MMtx9kwp/+334p+fsRK7s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: md4Iz0KaRomSit91r3TzAA== X-CSE-MsgGUID: 24Tel7jNSWmMm6GDWcbO6Q== Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 09 Apr 2026 18:03:54 +0900 Received: from ubuntu.adwin.renesas.com (unknown [10.226.92.218]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 8AF8D4015D82; Thu, 9 Apr 2026 18:03:48 +0900 (JST) From: John Madieu To: Kuninori Morimoto , Mark Brown , Liam Girdwood , Geert Uytterhoeven Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Magnus Damm , Philipp Zabel , Claudiu Beznea , Biju Das , john.madieu@gmail.com, linux-sound@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, John Madieu Subject: [PATCH v4 01/12] ASoC: dt-bindings: renesas,rsnd: Split into generic and SoC-specific parts Date: Thu, 9 Apr 2026 11:02:50 +0200 Message-ID: <20260409090302.2243305-2-john.madieu.xa@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> References: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The current renesas,rsnd.yaml binding file handles all supported SoCs in a single schema, resulting in deeply nested if/else/then constructs that become increasingly difficult to maintain. Each new SoC addition amplifies this complexity, making reviews harder and diffs noisier than they need to be. Refactor the binding by extracting the common properties shared across all SoCs into a dedicated renesas,rsnd-common.yaml schema, and keeping only SoC-specific constraints (required nodes, port counts, clock names, etc.) in per-SoC or per-family files that $ref the common part. This prepares the ground for upcoming SoCs such as the RZ/G3E, which introduces a different set of audio resources compared to existing R-Car Gen variants. With the split in place, adding RZ/G3E support becomes a self-contained change that neither bloats a monolithic schema nor buries new constraints inside ever-deeper conditional blocks. No functional change in validation behaviour for existing device trees. Signed-off-by: John Madieu --- Changes: =20 v4: No changes v3: No changes v2: - Split of rsnd.yaml into common and R-Car-specific schemas .../bindings/sound/renesas,rsnd-common.yaml | 196 +++++++++++ .../bindings/sound/renesas,rsnd.yaml | 319 +++++------------- 2 files changed, 274 insertions(+), 241 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/renesas,rsnd-co= mmon.yaml diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd-common.ya= ml b/Documentation/devicetree/bindings/sound/renesas,rsnd-common.yaml new file mode 100644 index 000000000000..ec6bf644d1a4 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/renesas,rsnd-common.yaml @@ -0,0 +1,196 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/renesas,rsnd-common.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Renesas R-Car/RZ Sound Common Properties + +maintainers: + - Kuninori Morimoto + +description: + Common property and subnode definitions shared by Renesas R-Car and RZ + sound controller bindings. + +select: false + +properties: + compatible: true + + reg: true + + reg-names: true + + "#sound-dai-cells": + description: + Must be 0 for a single-DAI system and 1 for a multi-DAI system. + enum: [0, 1] + + "#clock-cells": + description: + Must be 0 when the system has audio_clkout and 1 when it has + audio_clkout0/1/2/3. + enum: [0, 1] + + "#address-cells": + const: 1 + + "#size-cells": + const: 0 + + clock-frequency: + description: Audio clock output frequency for audio_clkout0/1/2/3. + + clkout-lr-asynchronous: + description: audio_clkoutn is asynchronous with lr-clock. + $ref: /schemas/types.yaml#/definitions/flag + + power-domains: true + + resets: true + + reset-names: true + + clocks: true + + clock-names: true + + port: + $ref: audio-graph-port.yaml#/definitions/port-base + unevaluatedProperties: false + patternProperties: + "^endpoint(@[0-9a-f]+)?$": + $ref: audio-graph-port.yaml#/definitions/endpoint-base + properties: + playback: + $ref: /schemas/types.yaml#/definitions/phandle-array + capture: + $ref: /schemas/types.yaml#/definitions/phandle-array + unevaluatedProperties: false + + rcar_sound,dvc: + description: DVC subnode. + type: object + patternProperties: + "^dvc-[0-1]$": + type: object + additionalProperties: false + properties: + dmas: true + dma-names: true + required: + - dmas + - dma-names + additionalProperties: false + + rcar_sound,mix: + description: MIX subnode. + type: object + patternProperties: + "^mix-[0-1]$": + type: object + additionalProperties: false + additionalProperties: false + + rcar_sound,ctu: + description: CTU subnode. + type: object + patternProperties: + "^ctu-[0-7]$": + type: object + additionalProperties: false + additionalProperties: false + + rcar_sound,src: + description: SRC subnode. + type: object + patternProperties: + "^src-[0-9]$": + type: object + additionalProperties: false + properties: + interrupts: + maxItems: 1 + dmas: true + dma-names: true + additionalProperties: false + + rcar_sound,ssiu: + description: SSIU subnode. + type: object + patternProperties: + "^ssiu-[0-9]+$": + type: object + additionalProperties: false + properties: + dmas: true + dma-names: true + required: + - dmas + - dma-names + additionalProperties: false + + rcar_sound,ssi: + description: SSI subnode. + type: object + patternProperties: + "^ssi-[0-9]$": + type: object + additionalProperties: false + properties: + interrupts: + maxItems: 1 + dmas: true + dma-names: true + shared-pin: + description: Shared clock pin. + $ref: /schemas/types.yaml#/definitions/flag + pio-transfer: + description: PIO transfer mode. + $ref: /schemas/types.yaml#/definitions/flag + no-busif: + description: BUSIF is not used for the mem-to-SSI via DMA case. + $ref: /schemas/types.yaml#/definitions/flag + required: + - interrupts + additionalProperties: false + +patternProperties: + 'rcar_sound,dai(@[0-9a-f]+)?$': + description: DAI subnode. + type: object + patternProperties: + "^dai([0-9]+)?$": + type: object + additionalProperties: false + properties: + playback: + $ref: /schemas/types.yaml#/definitions/phandle-array + capture: + $ref: /schemas/types.yaml#/definitions/phandle-array + anyOf: + - required: + - playback + - required: + - capture + additionalProperties: false + + 'ports(@[0-9a-f]+)?$': + $ref: audio-graph-port.yaml#/definitions/port-base + unevaluatedProperties: false + patternProperties: + '^port(@[0-9a-f]+)?$': + $ref: "#/properties/port" + +required: + - compatible + - reg + - reg-names + - clocks + - clock-names + +allOf: + - $ref: dai-common.yaml# + +additionalProperties: true diff --git a/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml b/Do= cumentation/devicetree/bindings/sound/renesas,rsnd.yaml index e8a2acb92646..0d989922a5b4 100644 --- a/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml +++ b/Documentation/devicetree/bindings/sound/renesas,rsnd.yaml @@ -9,8 +9,11 @@ title: Renesas R-Car Sound Driver maintainers: - Kuninori Morimoto =20 -properties: +description: + Binding for Renesas R-Car Gen1/Gen2/Gen3/Gen4 and RZ/G1/G2 sound + controllers using the standard RSND layout. =20 +properties: compatible: oneOf: # for Gen1 SoC @@ -67,34 +70,6 @@ properties: minItems: 1 maxItems: 5 =20 - "#sound-dai-cells": - description: | - it must be 0 if your system is using single DAI - it must be 1 if your system is using multi DAIs - This is used on simple-audio-card - enum: [0, 1] - - "#clock-cells": - description: | - it must be 0 if your system has audio_clkout - it must be 1 if your system has audio_clkout0/1/2/3 - enum: [0, 1] - - "#address-cells": - const: 1 - - "#size-cells": - const: 0 - - clock-frequency: - description: for audio_clkout0/1/2/3 - - clkout-lr-asynchronous: - description: audio_clkoutn is asynchronizes with lr-clock. - $ref: /schemas/types.yaml#/definitions/flag - - power-domains: true - resets: minItems: 1 maxItems: 11 @@ -109,181 +84,45 @@ properties: maxItems: 31 =20 clock-names: - description: List of necessary clock names. - # details are defined below - - # ports is below - port: - $ref: audio-graph-port.yaml#/definitions/port-base - unevaluatedProperties: false - patternProperties: - "^endpoint(@[0-9a-f]+)?": - $ref: audio-graph-port.yaml#/definitions/endpoint-base - properties: - playback: - $ref: /schemas/types.yaml#/definitions/phandle-array - capture: - $ref: /schemas/types.yaml#/definitions/phandle-array - unevaluatedProperties: false - - rcar_sound,dvc: - description: DVC subnode. - type: object - patternProperties: - "^dvc-[0-1]$": - type: object - additionalProperties: false - - properties: - dmas: - maxItems: 1 - dma-names: - const: tx - required: - - dmas - - dma-names - additionalProperties: false - - rcar_sound,mix: - description: MIX subnode. - type: object - patternProperties: - "^mix-[0-1]$": - type: object - additionalProperties: false - additionalProperties: false - - rcar_sound,ctu: - description: CTU subnode. - type: object - patternProperties: - "^ctu-[0-7]$": - type: object - additionalProperties: false - additionalProperties: false - - rcar_sound,src: - description: SRC subnode. - type: object - patternProperties: - "^src-[0-9]$": - type: object - additionalProperties: false - - properties: - interrupts: - maxItems: 1 - dmas: - maxItems: 2 - dma-names: - allOf: - - items: - enum: - - tx - - rx - additionalProperties: false - - rcar_sound,ssiu: - description: SSIU subnode. - type: object - patternProperties: - "^ssiu-[0-9]+$": - type: object - additionalProperties: false - - properties: - dmas: - maxItems: 2 - dma-names: - allOf: - - items: - enum: - - tx - - rx - required: - - dmas - - dma-names - additionalProperties: false - - rcar_sound,ssi: - description: SSI subnode. - type: object - patternProperties: - "^ssi-[0-9]$": - type: object - additionalProperties: false - - properties: - interrupts: - maxItems: 1 - dmas: - minItems: 2 - maxItems: 4 - dma-names: - allOf: - - items: - enum: - - tx - - rx - - txu # if no ssiu node - - rxu # if no ssiu node - - shared-pin: - description: shared clock pin - $ref: /schemas/types.yaml#/definitions/flag - pio-transfer: - description: PIO transfer mode - $ref: /schemas/types.yaml#/definitions/flag - no-busif: - description: BUSIF is not used when [mem -> SSI] via DMA case - $ref: /schemas/types.yaml#/definitions/flag - required: - - interrupts - additionalProperties: false + description: List of clock names. + minItems: 1 + maxItems: 31 + + "#sound-dai-cells": true + + "#clock-cells": true + + "#address-cells": true + + "#size-cells": true + + clock-frequency: true + + clkout-lr-asynchronous: true + + power-domains: true + + port: true + + rcar_sound,dvc: true + + rcar_sound,mix: true + + rcar_sound,ctu: true + + rcar_sound,src: true + + rcar_sound,ssiu: true + + rcar_sound,ssi: true =20 patternProperties: - # For DAI base - 'rcar_sound,dai(@[0-9a-f]+)?$': - description: DAI subnode. - type: object - patternProperties: - "^dai([0-9]+)?$": - type: object - additionalProperties: false - - properties: - playback: - $ref: /schemas/types.yaml#/definitions/phandle-array - capture: - $ref: /schemas/types.yaml#/definitions/phandle-array - anyOf: - - required: - - playback - - required: - - capture - additionalProperties: false - - 'ports(@[0-9a-f]+)?$': - $ref: audio-graph-port.yaml#/definitions/port-base - unevaluatedProperties: false - patternProperties: - '^port(@[0-9a-f]+)?$': - $ref: "#/properties/port" - -required: - - compatible - - reg - - reg-names - - clocks - - clock-names + 'rcar_sound,dai(@[0-9a-f]+)?$': true + 'ports(@[0-9a-f]+)?$': true =20 allOf: - - $ref: dai-common.yaml# + - $ref: renesas,rsnd-common.yaml# =20 - # -------------------- - # reg/reg-names - # -------------------- - # for Gen1 - if: properties: compatible: @@ -295,11 +134,10 @@ allOf: maxItems: 3 reg-names: items: - enum: - - sru - - ssi - - adg - # for Gen2/Gen3 + - const: sru + - const: ssi + - const: adg + - if: properties: compatible: @@ -310,16 +148,34 @@ allOf: then: properties: reg: - minItems: 5 + maxItems: 5 reg-names: items: - enum: - - scu - - adg - - ssiu - - ssi - - audmapp - # for Gen4 + - const: scu + - const: adg + - const: ssiu + - const: ssi + - const: audmapp + resets: + maxItems: 11 + reset-names: + items: + oneOf: + - const: ssi-all + - pattern: '^ssi\.[0-9]$' + clocks: + maxItems: 31 + clock-names: + items: + oneOf: + - const: ssi-all + - pattern: '^ssi\.[0-9]$' + - pattern: '^src\.[0-9]$' + - pattern: '^mix\.[0-1]$' + - pattern: '^ctu\.[0-1]$' + - pattern: '^dvc\.[0-1]$' + - pattern: '^clk_(a|b|c|i)$' + - if: properties: compatible: @@ -336,38 +192,19 @@ allOf: - ssiu - ssi - sdmc - - # -------------------- - # clock-names - # -------------------- - - if: - properties: - compatible: - contains: - const: renesas,rcar_sound-gen4 - then: - properties: - clock-names: - maxItems: 3 + resets: + maxItems: 2 + reset-names: items: - enum: - - ssi.0 - - ssiu.0 - - clkin - else: - properties: + - const: ssiu.0 + - const: ssi.0 + clocks: + maxItems: 3 clock-names: - minItems: 1 - maxItems: 31 items: - oneOf: - - const: ssi-all - - pattern: '^ssi\.[0-9]$' - - pattern: '^src\.[0-9]$' - - pattern: '^mix\.[0-1]$' - - pattern: '^ctu\.[0-1]$' - - pattern: '^dvc\.[0-1]$' - - pattern: '^clk_(a|b|c|i)$' + - const: ssiu.0 + - const: ssi.0 + - const: clkin =20 unevaluatedProperties: false =20 --=20 2.25.1 From nobody Mon Jun 15 09:40:21 2026 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id E03782BE02C; Thu, 9 Apr 2026 09:04:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725449; cv=none; b=J7TrA1fm0PIhX7ZNkm1QBskcBGgljN/V+7v/Pxui8Qe7QDNc0BIDfWyTQRq32MdnW14r0c3aN77CzAQbm6oVqZSX6npMusG5XIn+oQoXadjgdMMMBeUBBLsQ5fu7Pabn3IrUplLfQeRNyh3Zd7tg++VMB6vb11OTe2CoFh6jFvY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725449; c=relaxed/simple; bh=ywVt/wYMPtl3DLkgRzWG69vyhWa31GHh4umsQRp1oQU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Ehqoc7hh2ozKKzHDR32S+1hHfChAiZXrou+zuchCaF0Y2FMFrxyFBvnrMsU40uWoKgfB815A0yUt8y3U2L/9t++GUG2pyNmsgFq+k2eHvyhj/zw5Ufs2YuGixkoXf/JKqY2hZHFNSRRFBPT2mCojAjhIrDIMl+QC2EHmydNER9I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: P4W+vTIhSw2j9YbUFTnr6g== X-CSE-MsgGUID: 7Rjmy5whTa2s85aat/bSUQ== Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 09 Apr 2026 18:04:01 +0900 Received: from ubuntu.adwin.renesas.com (unknown [10.226.92.218]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id DB31D4015D82; Thu, 9 Apr 2026 18:03:54 +0900 (JST) From: John Madieu To: Kuninori Morimoto , Mark Brown , Liam Girdwood , Geert Uytterhoeven Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Magnus Damm , Philipp Zabel , Claudiu Beznea , Biju Das , john.madieu@gmail.com, linux-sound@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, John Madieu Subject: [PATCH v4 02/12] ASoC: dt-bindings: Add RZ/G3E (R9A09G047) sound binding Date: Thu, 9 Apr 2026 11:02:51 +0200 Message-ID: <20260409090302.2243305-3-john.madieu.xa@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> References: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The RZ/G3E shares the same audio IP as the R-Car variants but differs in several aspects: it supports up to 5 DMA controllers per audio channel, requires additional clocks (47 total including per-SSI ADG clocks, SCU domain clocks and SSIF supply) and additional reset lines (14 total including SCU, ADG and Audio DMAC peri-peri resets). Add a dedicated devicetree binding for the RZ/G3E sound controller. The binding references the common renesas,rsnd-common.yaml schema for shared property and subnode definitions. Signed-off-by: John Madieu --- Changes: =20 v4: No changes v3: No changes v2: - Introduce RZ/G3E sound binding as a standalone schema .../sound/renesas,r9a09g047-sound.yaml | 371 ++++++++++++++++++ 1 file changed, 371 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/renesas,r9a09g0= 47-sound.yaml diff --git a/Documentation/devicetree/bindings/sound/renesas,r9a09g047-soun= d.yaml b/Documentation/devicetree/bindings/sound/renesas,r9a09g047-sound.ya= ml new file mode 100644 index 000000000000..1dfe9bab3382 --- /dev/null +++ b/Documentation/devicetree/bindings/sound/renesas,r9a09g047-sound.yaml @@ -0,0 +1,371 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/renesas,r9a09g047-sound.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Renesas RZ/G3E Sound Controller + +maintainers: + - Kuninori Morimoto + - John Madieu + +description: + The RZ/G3E (R9A09G047) integrates an R-Car compatible sound controller + with extended DMA channel support (up to 5 DMACs per direction), additio= nal + clock domains, and additional reset lines compared to the R-Car Gen2/Gen3 + variants. + +allOf: + - $ref: renesas,rsnd-common.yaml# + +properties: + compatible: + const: renesas,r9a09g047-sound + + reg: + maxItems: 5 + + reg-names: + items: + - const: scu + - const: adg + - const: ssiu + - const: ssi + - const: audmapp + + clocks: + maxItems: 47 + + clock-names: + items: + - const: ssi-all + - const: ssi.9 + - const: ssi.8 + - const: ssi.7 + - const: ssi.6 + - const: ssi.5 + - const: ssi.4 + - const: ssi.3 + - const: ssi.2 + - const: ssi.1 + - const: ssi.0 + - const: src.9 + - const: src.8 + - const: src.7 + - const: src.6 + - const: src.5 + - const: src.4 + - const: src.3 + - const: src.2 + - const: src.1 + - const: src.0 + - const: mix.1 + - const: mix.0 + - const: ctu.1 + - const: ctu.0 + - const: dvc.0 + - const: dvc.1 + - const: clk_a + - const: clk_b + - const: clk_c + - const: clk_i + - const: ssif_supply + - const: scu + - const: scu_x2 + - const: scu_supply + - const: adg.ssi.9 + - const: adg.ssi.8 + - const: adg.ssi.7 + - const: adg.ssi.6 + - const: adg.ssi.5 + - const: adg.ssi.4 + - const: adg.ssi.3 + - const: adg.ssi.2 + - const: adg.ssi.1 + - const: adg.ssi.0 + - const: audmapp + - const: adg + + resets: + maxItems: 14 + + reset-names: + items: + - const: ssi-all + - const: ssi.9 + - const: ssi.8 + - const: ssi.7 + - const: ssi.6 + - const: ssi.5 + - const: ssi.4 + - const: ssi.3 + - const: ssi.2 + - const: ssi.1 + - const: ssi.0 + - const: scu + - const: adg + - const: audmapp + + rcar_sound,dvc: + description: DVC subnode. + type: object + patternProperties: + "^dvc-[0-1]$": + type: object + additionalProperties: false + properties: + dmas: + maxItems: 5 + dma-names: + maxItems: 5 + allOf: + - items: + enum: + - tx + required: + - dmas + - dma-names + additionalProperties: false + + rcar_sound,src: + description: SRC subnode. + type: object + patternProperties: + "^src-[0-9]$": + type: object + additionalProperties: false + properties: + interrupts: + maxItems: 1 + dmas: + maxItems: 10 + dma-names: + maxItems: 10 + allOf: + - items: + enum: + - tx + - rx + additionalProperties: false + + rcar_sound,ssiu: + description: SSIU subnode. + type: object + patternProperties: + "^ssiu-[0-9]+$": + type: object + additionalProperties: false + properties: + dmas: + maxItems: 10 + dma-names: + maxItems: 10 + allOf: + - items: + enum: + - tx + - rx + required: + - dmas + - dma-names + additionalProperties: false + +required: + - compatible + - reg + - reg-names + - clocks + - clock-names + - resets + - reset-names + +unevaluatedProperties: false + +examples: + - | + #include + + snd_rzg3e: sound@13c00000 { + #sound-dai-cells =3D <1>; + #clock-cells =3D <0>; + compatible =3D "renesas,r9a09g047-sound"; + reg =3D <0x13c00000 0x10000>, + <0x13c20000 0x10000>, + <0x13c30000 0x1000>, + <0x13c31000 0x1f000>, + <0x13c50000 0x10000>; + reg-names =3D "scu", "adg", "ssiu", "ssi", "audmapp"; + + clocks =3D <&cpg 245>, + <&cpg 394>, <&cpg 393>, + <&cpg 392>, <&cpg 391>, + <&cpg 390>, <&cpg 389>, + <&cpg 388>, <&cpg 387>, + <&cpg 386>, <&cpg 385>, + <&cpg 381>, <&cpg 380>, + <&cpg 379>, <&cpg 378>, + <&cpg 377>, <&cpg 376>, + <&cpg 375>, <&cpg 374>, + <&cpg 373>, <&cpg 372>, + <&cpg 371>, <&cpg 370>, + <&cpg 371>, <&cpg 370>, + <&cpg 368>, <&cpg 369>, + <&audio_clk_a>, <&audio_clk_b>, + <&audio_clk_c>, <&audio_clk_i>, + <&cpg 384>, + <&cpg 246>, <&cpg 247>, + <&cpg 382>, + <&cpg 361>, <&cpg 360>, + <&cpg 359>, <&cpg 358>, + <&cpg 357>, <&cpg 356>, + <&cpg 355>, <&cpg 354>, + <&cpg 353>, <&cpg 352>, + <&cpg 248>, <&cpg 249>; + + clock-names =3D "ssi-all", + "ssi.9", "ssi.8", + "ssi.7", "ssi.6", + "ssi.5", "ssi.4", + "ssi.3", "ssi.2", + "ssi.1", "ssi.0", + "src.9", "src.8", + "src.7", "src.6", + "src.5", "src.4", + "src.3", "src.2", + "src.1", "src.0", + "mix.1", "mix.0", + "ctu.1", "ctu.0", + "dvc.0", "dvc.1", + "clk_a", "clk_b", + "clk_c", "clk_i", + "ssif_supply", + "scu", "scu_x2", + "scu_supply", + "adg.ssi.9", "adg.ssi.8", + "adg.ssi.7", "adg.ssi.6", + "adg.ssi.5", "adg.ssi.4", + "adg.ssi.3", "adg.ssi.2", + "adg.ssi.1", "adg.ssi.0", + "audmapp", "adg"; + + power-domains =3D <&cpg>; + + resets =3D <&cpg 225>, + <&cpg 235>, <&cpg 234>, <&cpg 233>, <&cpg 232>, + <&cpg 231>, <&cpg 230>, <&cpg 229>, <&cpg 228>, + <&cpg 227>, <&cpg 226>, + <&cpg 236>, <&cpg 238>, <&cpg 237>; + reset-names =3D "ssi-all", + "ssi.9", "ssi.8", "ssi.7", "ssi.6", + "ssi.5", "ssi.4", "ssi.3", "ssi.2", + "ssi.1", "ssi.0", + "scu", "adg", "audmapp"; + + rcar_sound,ssi { + ssi0: ssi-0 { + interrupts =3D ; + }; + ssi3: ssi-3 { + interrupts =3D ; + }; + ssi4: ssi-4 { + interrupts =3D ; + shared-pin; + }; + }; + + rcar_sound,ssiu { + ssiu30: ssiu-12 { + dmas =3D <&dmac0 0x1d79>, <&dmac0 0x1d7a>, + <&dmac1 0x1d79>, <&dmac1 0x1d7a>, + <&dmac2 0x1d79>, <&dmac2 0x1d7a>, + <&dmac3 0x1d79>, <&dmac3 0x1d7a>, + <&dmac4 0x1d79>, <&dmac4 0x1d7a>; + dma-names =3D "tx", "rx", "tx", "rx", "tx", "rx", + "tx", "rx", "tx", "rx"; + }; + ssiu40: ssiu-16 { + dmas =3D <&dmac0 0x1d81>, <&dmac0 0x1d82>, + <&dmac1 0x1d81>, <&dmac1 0x1d82>, + <&dmac2 0x1d81>, <&dmac2 0x1d82>, + <&dmac3 0x1d81>, <&dmac3 0x1d82>, + <&dmac4 0x1d81>, <&dmac4 0x1d82>; + dma-names =3D "tx", "rx", "tx", "rx", "tx", "rx", + "tx", "rx", "tx", "rx"; + }; + }; + + rcar_sound,src { + src0: src-0 { + interrupts =3D ; + dmas =3D <&dmac0 0x1d9f>, <&dmac0 0x1da9>, + <&dmac1 0x1d9f>, <&dmac1 0x1da9>, + <&dmac2 0x1d9f>, <&dmac2 0x1da9>, + <&dmac3 0x1d9f>, <&dmac3 0x1da9>, + <&dmac4 0x1d9f>, <&dmac4 0x1da9>; + dma-names =3D "rx", "tx", "rx", "tx", "rx", "tx", + "rx", "tx", "rx", "tx"; + }; + src1: src-1 { + interrupts =3D ; + dmas =3D <&dmac0 0x1da0>, <&dmac0 0x1daa>, + <&dmac1 0x1da0>, <&dmac1 0x1daa>, + <&dmac2 0x1da0>, <&dmac2 0x1daa>, + <&dmac3 0x1da0>, <&dmac3 0x1daa>, + <&dmac4 0x1da0>, <&dmac4 0x1daa>; + dma-names =3D "rx", "tx", "rx", "tx", "rx", "tx", + "rx", "tx", "rx", "tx"; + }; + }; + + rcar_sound,dvc { + dvc0: dvc-0 { + dmas =3D <&dmac0 0x1db3>, + <&dmac1 0x1db3>, + <&dmac2 0x1db3>, + <&dmac3 0x1db3>, + <&dmac4 0x1db3>; + dma-names =3D "tx", "tx", "tx", "tx", "tx"; + }; + dvc1: dvc-1 { + dmas =3D <&dmac0 0x1db4>, + <&dmac1 0x1db4>, + <&dmac2 0x1db4>, + <&dmac3 0x1db4>, + <&dmac4 0x1db4>; + dma-names =3D "tx", "tx", "tx", "tx", "tx"; + }; + }; + + rcar_sound,dai { + dai0 { + playback =3D <&ssi3>, <&src1>, <&dvc1>; + capture =3D <&ssi4>, <&src0>, <&dvc0>; + }; + }; + + ports { + #address-cells =3D <1>; + #size-cells =3D <0>; + rsnd_port0: port@0 { + reg =3D <0>; + rsnd_endpoint0: endpoint { + remote-endpoint =3D <&codec_endpoint>; + dai-format =3D "i2s"; + bitclock-master =3D <&rsnd_endpoint0>; + frame-master =3D <&rsnd_endpoint0>; + playback =3D <&ssi3>, <&src1>, <&dvc1>; + capture =3D <&ssi4>, <&src0>, <&dvc0>; + }; + }; + }; + }; + + codec { + port { + codec_endpoint: endpoint { + remote-endpoint =3D <&rsnd_endpoint0>; + }; + }; + }; --=20 2.25.1 From nobody Mon Jun 15 09:40:21 2026 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id D561D395261; Thu, 9 Apr 2026 09:04:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725450; cv=none; b=u1P1nvkMZdcmtUSpqCWTagN/fMyW+GRq8N1b9m/lK77u7yHRvl1AkzOsqbCCyXnDiV1bohK55cMJnMPpc0gZtACfxISutdJxDqOvbXn5EhAEgbDnRb6mGN61ElWPsNrUt02BlX/UcKQ30KobnV4LGQhPO43SFFbWy5pejhbD2Js= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725450; c=relaxed/simple; bh=1U5A6pDf6X8m5qBPyywZS71Iq6QycFn6MQnmXsg9jvQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=tA/F8pUYE2OsfxkWvkImzTRsrA8oQqlMfKJPXCQMZMS/LtPpNcN+KKbcv0tMI/JPGyEHhNV2A3hYirbaqlc56bOPASFMI481xhVmFFfAbpjbWv84uPr2IV9UH0k9utHDbPalvWFWPAuB02NBtXCcOI3euJZr+xcVWUtil4aJv4I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: 59ptPgIpSMm9tr+68PqrnQ== X-CSE-MsgGUID: vKJeVdGASCq0pSfamigvAg== Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 09 Apr 2026 18:04:07 +0900 Received: from ubuntu.adwin.renesas.com (unknown [10.226.92.218]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id D5B704015FC2; Thu, 9 Apr 2026 18:04:01 +0900 (JST) From: John Madieu To: Kuninori Morimoto , Mark Brown , Liam Girdwood , Geert Uytterhoeven Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Magnus Damm , Philipp Zabel , Claudiu Beznea , Biju Das , john.madieu@gmail.com, linux-sound@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, John Madieu Subject: [PATCH v4 03/12] ASoC: rsnd: Add reset controller support to rsnd_mod Date: Thu, 9 Apr 2026 11:02:52 +0200 Message-ID: <20260409090302.2243305-4-john.madieu.xa@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> References: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The RZ/G3E SoC requires per-module reset control for the audio subsystem. Add reset controller support to struct rsnd_mod and update rsnd_mod_init() to accept and handle a reset_control parameter and mirror it in rsnd_mod_quit(). Signed-off-by: John Madieu --- v4: - Add reset_control_assert() in rsnd_mod_quit() for symmetry with deassert in rsnd_mod_init() v3: No changes v2: No changes sound/soc/renesas/rcar/adg.c | 2 +- sound/soc/renesas/rcar/cmd.c | 2 +- sound/soc/renesas/rcar/core.c | 16 +++++++++++++++- sound/soc/renesas/rcar/ctu.c | 2 +- sound/soc/renesas/rcar/dma.c | 4 ++-- sound/soc/renesas/rcar/dvc.c | 2 +- sound/soc/renesas/rcar/mix.c | 2 +- sound/soc/renesas/rcar/rsnd.h | 3 +++ sound/soc/renesas/rcar/src.c | 2 +- sound/soc/renesas/rcar/ssi.c | 2 +- sound/soc/renesas/rcar/ssiu.c | 2 +- 11 files changed, 28 insertions(+), 11 deletions(-) diff --git a/sound/soc/renesas/rcar/adg.c b/sound/soc/renesas/rcar/adg.c index 8641b73d1f77..0105c60a144e 100644 --- a/sound/soc/renesas/rcar/adg.c +++ b/sound/soc/renesas/rcar/adg.c @@ -780,7 +780,7 @@ int rsnd_adg_probe(struct rsnd_priv *priv) return -ENOMEM; =20 ret =3D rsnd_mod_init(priv, &adg->mod, &adg_ops, - NULL, 0, 0); + NULL, NULL, 0, 0); if (ret) return ret; =20 diff --git a/sound/soc/renesas/rcar/cmd.c b/sound/soc/renesas/rcar/cmd.c index 8d9a1e345a22..13beef389797 100644 --- a/sound/soc/renesas/rcar/cmd.c +++ b/sound/soc/renesas/rcar/cmd.c @@ -171,7 +171,7 @@ int rsnd_cmd_probe(struct rsnd_priv *priv) =20 for_each_rsnd_cmd(cmd, priv, i) { int ret =3D rsnd_mod_init(priv, rsnd_mod_get(cmd), - &rsnd_cmd_ops, NULL, + &rsnd_cmd_ops, NULL, NULL, RSND_MOD_CMD, i); if (ret) return ret; diff --git a/sound/soc/renesas/rcar/core.c b/sound/soc/renesas/rcar/core.c index 69fb19964a71..28467e45acab 100644 --- a/sound/soc/renesas/rcar/core.c +++ b/sound/soc/renesas/rcar/core.c @@ -90,6 +90,7 @@ * */ =20 +#include #include #include #include "rsnd.h" @@ -196,18 +197,29 @@ int rsnd_mod_init(struct rsnd_priv *priv, struct rsnd_mod *mod, struct rsnd_mod_ops *ops, struct clk *clk, + struct reset_control *rstc, enum rsnd_mod_type type, int id) { - int ret =3D clk_prepare(clk); + int ret; =20 + ret =3D clk_prepare_enable(clk); if (ret) return ret; =20 + ret =3D reset_control_deassert(rstc); + if (ret) { + clk_disable_unprepare(clk); + return ret; + } + + clk_disable(clk); + mod->id =3D id; mod->ops =3D ops; mod->type =3D type; mod->clk =3D clk; + mod->rstc =3D rstc; mod->priv =3D priv; =20 return 0; @@ -217,6 +229,8 @@ void rsnd_mod_quit(struct rsnd_mod *mod) { clk_unprepare(mod->clk); mod->clk =3D NULL; + reset_control_assert(mod->rstc); + mod->rstc =3D NULL; } =20 void rsnd_mod_interrupt(struct rsnd_mod *mod, diff --git a/sound/soc/renesas/rcar/ctu.c b/sound/soc/renesas/rcar/ctu.c index bd4c61f9fb3c..81bba6a1af6e 100644 --- a/sound/soc/renesas/rcar/ctu.c +++ b/sound/soc/renesas/rcar/ctu.c @@ -360,7 +360,7 @@ int rsnd_ctu_probe(struct rsnd_priv *priv) } =20 ret =3D rsnd_mod_init(priv, rsnd_mod_get(ctu), &rsnd_ctu_ops, - clk, RSND_MOD_CTU, i); + clk, NULL, RSND_MOD_CTU, i); if (ret) goto rsnd_ctu_probe_done; =20 diff --git a/sound/soc/renesas/rcar/dma.c b/sound/soc/renesas/rcar/dma.c index 2035ce06fe4c..68c859897e68 100644 --- a/sound/soc/renesas/rcar/dma.c +++ b/sound/soc/renesas/rcar/dma.c @@ -803,7 +803,7 @@ static int rsnd_dma_alloc(struct rsnd_dai_stream *io, s= truct rsnd_mod *mod, =20 *dma_mod =3D rsnd_mod_get(dma); =20 - ret =3D rsnd_mod_init(priv, *dma_mod, ops, NULL, + ret =3D rsnd_mod_init(priv, *dma_mod, ops, NULL, NULL, type, dma_id); if (ret < 0) return ret; @@ -879,5 +879,5 @@ int rsnd_dma_probe(struct rsnd_priv *priv) priv->dma =3D dmac; =20 /* dummy mem mod for debug */ - return rsnd_mod_init(NULL, &mem, &mem_ops, NULL, 0, 0); + return rsnd_mod_init(NULL, &mem, &mem_ops, NULL, NULL, 0, 0); } diff --git a/sound/soc/renesas/rcar/dvc.c b/sound/soc/renesas/rcar/dvc.c index 988cbddbc611..bf7146ceb5f6 100644 --- a/sound/soc/renesas/rcar/dvc.c +++ b/sound/soc/renesas/rcar/dvc.c @@ -364,7 +364,7 @@ int rsnd_dvc_probe(struct rsnd_priv *priv) } =20 ret =3D rsnd_mod_init(priv, rsnd_mod_get(dvc), &rsnd_dvc_ops, - clk, RSND_MOD_DVC, i); + clk, NULL, RSND_MOD_DVC, i); if (ret) goto rsnd_dvc_probe_done; =20 diff --git a/sound/soc/renesas/rcar/mix.c b/sound/soc/renesas/rcar/mix.c index aea74e703305..566e9b2a488c 100644 --- a/sound/soc/renesas/rcar/mix.c +++ b/sound/soc/renesas/rcar/mix.c @@ -328,7 +328,7 @@ int rsnd_mix_probe(struct rsnd_priv *priv) } =20 ret =3D rsnd_mod_init(priv, rsnd_mod_get(mix), &rsnd_mix_ops, - clk, RSND_MOD_MIX, i); + clk, NULL, RSND_MOD_MIX, i); if (ret) goto rsnd_mix_probe_done; =20 diff --git a/sound/soc/renesas/rcar/rsnd.h b/sound/soc/renesas/rcar/rsnd.h index 04c70690f7a2..cd7e7df62298 100644 --- a/sound/soc/renesas/rcar/rsnd.h +++ b/sound/soc/renesas/rcar/rsnd.h @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -353,6 +354,7 @@ struct rsnd_mod { struct rsnd_mod_ops *ops; struct rsnd_priv *priv; struct clk *clk; + struct reset_control *rstc; u32 status; }; /* @@ -420,6 +422,7 @@ int rsnd_mod_init(struct rsnd_priv *priv, struct rsnd_mod *mod, struct rsnd_mod_ops *ops, struct clk *clk, + struct reset_control *rstc, enum rsnd_mod_type type, int id); void rsnd_mod_quit(struct rsnd_mod *mod); diff --git a/sound/soc/renesas/rcar/src.c b/sound/soc/renesas/rcar/src.c index 6a3dbc84f474..8b58cc20e7a8 100644 --- a/sound/soc/renesas/rcar/src.c +++ b/sound/soc/renesas/rcar/src.c @@ -766,7 +766,7 @@ int rsnd_src_probe(struct rsnd_priv *priv) } =20 ret =3D rsnd_mod_init(priv, rsnd_mod_get(src), - &rsnd_src_ops, clk, RSND_MOD_SRC, i); + &rsnd_src_ops, clk, NULL, RSND_MOD_SRC, i); if (ret) goto rsnd_src_probe_done; =20 diff --git a/sound/soc/renesas/rcar/ssi.c b/sound/soc/renesas/rcar/ssi.c index 0420041e282c..c06cebb36170 100644 --- a/sound/soc/renesas/rcar/ssi.c +++ b/sound/soc/renesas/rcar/ssi.c @@ -1225,7 +1225,7 @@ int rsnd_ssi_probe(struct rsnd_priv *priv) ops =3D &rsnd_ssi_dma_ops; =20 ret =3D rsnd_mod_init(priv, rsnd_mod_get(ssi), ops, clk, - RSND_MOD_SSI, i); + NULL, RSND_MOD_SSI, i); if (ret) goto rsnd_ssi_probe_done; =20 diff --git a/sound/soc/renesas/rcar/ssiu.c b/sound/soc/renesas/rcar/ssiu.c index 244fb833292a..0cfa84fe5ea8 100644 --- a/sound/soc/renesas/rcar/ssiu.c +++ b/sound/soc/renesas/rcar/ssiu.c @@ -586,7 +586,7 @@ int rsnd_ssiu_probe(struct rsnd_priv *priv) } =20 ret =3D rsnd_mod_init(priv, rsnd_mod_get(ssiu), - ops, NULL, RSND_MOD_SSIU, i); + ops, NULL, NULL, RSND_MOD_SSIU, i); if (ret) return ret; } --=20 2.25.1 From nobody Mon Jun 15 09:40:21 2026 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2A4293A875D; Thu, 9 Apr 2026 09:04:14 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725457; cv=none; b=MWMloGfCPuDFgokX6Kp2/y+pICMsjf/LGSA/In1qQwAhcCaN/NTtOaOJNanlabeMsowhJKG99pHTa6PmM4LUWYmyZIOefdAmMzJPcIwt4yG24c+oq3Or4RlVFDfpA7Tdxh0DgM8OxwCSkHorkYKRGppebEqLA3c1Zy7JsQ/mFPg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725457; c=relaxed/simple; bh=j+e2gtcNDn0Tjdt1t8Q0/HqIxNs38EKQWCTBged4THs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=KwOjrqmcA2xd0QJG1QoO+j4PfBpIhmvOa401XfTf3o1w4W589gbzoAAuRLhSNqjEqiFyeTsmmwpqPbs/I8J2ufs20WAnL03OpKAtYceJDhefQ5a7/rJhVvHBlTln6lBLVAUyfNew0IJxv4JJiHp7AvRI9PN1VnrRKgcTrQr9zYE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: x2ONObH+ThK5LlhKk0bE2Q== X-CSE-MsgGUID: cNvcBCwMQS2zNf22aRdlFw== Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 09 Apr 2026 18:04:14 +0900 Received: from ubuntu.adwin.renesas.com (unknown [10.226.92.218]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 64F944015D82; Thu, 9 Apr 2026 18:04:08 +0900 (JST) From: John Madieu To: Kuninori Morimoto , Mark Brown , Liam Girdwood , Geert Uytterhoeven Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Magnus Damm , Philipp Zabel , Claudiu Beznea , Biju Das , john.madieu@gmail.com, linux-sound@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, John Madieu Subject: [PATCH v4 04/12] ASoC: rsnd: Add RZ/G3E SoC probing and register map Date: Thu, 9 Apr 2026 11:02:53 +0200 Message-ID: <20260409090302.2243305-5-john.madieu.xa@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> References: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" RZ/G3E audio subsystem has a different register layout compared to R-Car Gen2/Gen3/Gen4, as described below: - Different base address organization (SCU, ADG, SSIU, SSI as separate regions accessed by name) - Additional registers: AUDIO_CLK_SEL3, SSI_MODE3, SSI_CONTROL2 - Different register offsets within each region Add RZ/G3E SoC's audio subsystem register layouts and probe support. Signed-off-by: John Madieu --- Changes: =20 v4: - Fix RSND_SOC_MASK to (0xF << 4) to avoid overlap with RSND_RZ_MASK - Add comment documenting flag nibble layout v3: No changes v2: No changes sound/soc/renesas/rcar/core.c | 1 + sound/soc/renesas/rcar/gen.c | 180 ++++++++++++++++++++++++++++++++++ sound/soc/renesas/rcar/rsnd.h | 26 ++++- 3 files changed, 204 insertions(+), 3 deletions(-) diff --git a/sound/soc/renesas/rcar/core.c b/sound/soc/renesas/rcar/core.c index 28467e45acab..4544791f3883 100644 --- a/sound/soc/renesas/rcar/core.c +++ b/sound/soc/renesas/rcar/core.c @@ -107,6 +107,7 @@ static const struct of_device_id rsnd_of_match[] =3D { { .compatible =3D "renesas,rcar_sound-gen4", .data =3D (void *)RSND_GEN4 = }, /* Special Handling */ { .compatible =3D "renesas,rcar_sound-r8a77990", .data =3D (void *)(RSND_= GEN3 | RSND_SOC_E) }, + { .compatible =3D "renesas,r9a09g047-sound", .data =3D (void *)(RSND_RZ3 = | RSND_RZG3E) }, {}, }; MODULE_DEVICE_TABLE(of, rsnd_of_match); diff --git a/sound/soc/renesas/rcar/gen.c b/sound/soc/renesas/rcar/gen.c index d1f20cde66be..05d5f656fb01 100644 --- a/sound/soc/renesas/rcar/gen.c +++ b/sound/soc/renesas/rcar/gen.c @@ -464,6 +464,184 @@ static int rsnd_gen1_probe(struct rsnd_priv *priv) return ret_adg | ret_ssi; } =20 +/* + * RZ/G3E Generation + */ +static int rsnd_rzg3e_probe(struct rsnd_priv *priv) +{ + static const struct rsnd_regmap_field_conf conf_ssiu[] =3D { + RSND_GEN_S_REG(SSI_MODE1, 0x804), + RSND_GEN_S_REG(SSI_MODE2, 0x808), + RSND_GEN_S_REG(SSI_MODE3, 0x80c), + RSND_GEN_S_REG(SSI_CONTROL, 0x810), + RSND_GEN_S_REG(SSI_CONTROL2, 0x814), + RSND_GEN_S_REG(SSI_SYS_STATUS0, 0x840), + RSND_GEN_S_REG(SSI_SYS_STATUS1, 0x844), + RSND_GEN_S_REG(SSI_SYS_STATUS2, 0x848), + RSND_GEN_S_REG(SSI_SYS_STATUS3, 0x84c), + RSND_GEN_S_REG(SSI_SYS_INT_ENABLE0, 0x850), + RSND_GEN_S_REG(SSI_SYS_INT_ENABLE1, 0x854), + RSND_GEN_S_REG(SSI_SYS_INT_ENABLE2, 0x858), + RSND_GEN_S_REG(SSI_SYS_INT_ENABLE3, 0x85c), + RSND_GEN_M_REG(SSI_BUSIF0_MODE, 0x0, 0x80), + RSND_GEN_M_REG(SSI_BUSIF0_ADINR, 0x4, 0x80), + RSND_GEN_M_REG(SSI_BUSIF0_DALIGN, 0x8, 0x80), + RSND_GEN_M_REG(SSI_BUSIF1_MODE, 0x20, 0x80), + RSND_GEN_M_REG(SSI_BUSIF1_ADINR, 0x24, 0x80), + RSND_GEN_M_REG(SSI_BUSIF1_DALIGN, 0x28, 0x80), + RSND_GEN_M_REG(SSI_BUSIF2_MODE, 0x40, 0x80), + RSND_GEN_M_REG(SSI_BUSIF2_ADINR, 0x44, 0x80), + RSND_GEN_M_REG(SSI_BUSIF2_DALIGN, 0x48, 0x80), + RSND_GEN_M_REG(SSI_BUSIF3_MODE, 0x60, 0x80), + RSND_GEN_M_REG(SSI_BUSIF3_ADINR, 0x64, 0x80), + RSND_GEN_M_REG(SSI_BUSIF3_DALIGN, 0x68, 0x80), + RSND_GEN_M_REG(SSI_MODE, 0xc, 0x80), + RSND_GEN_M_REG(SSI_CTRL, 0x10, 0x80), + RSND_GEN_M_REG(SSI_INT_ENABLE, 0x18, 0x80), + RSND_GEN_S_REG(SSI9_BUSIF0_MODE, 0x480), + RSND_GEN_S_REG(SSI9_BUSIF0_ADINR, 0x484), + RSND_GEN_S_REG(SSI9_BUSIF0_DALIGN, 0x488), + RSND_GEN_S_REG(SSI9_BUSIF1_MODE, 0x4a0), + RSND_GEN_S_REG(SSI9_BUSIF1_ADINR, 0x4a4), + RSND_GEN_S_REG(SSI9_BUSIF1_DALIGN, 0x4a8), + RSND_GEN_S_REG(SSI9_BUSIF2_MODE, 0x4c0), + RSND_GEN_S_REG(SSI9_BUSIF2_ADINR, 0x4c4), + RSND_GEN_S_REG(SSI9_BUSIF2_DALIGN, 0x4c8), + RSND_GEN_S_REG(SSI9_BUSIF3_MODE, 0x4e0), + RSND_GEN_S_REG(SSI9_BUSIF3_ADINR, 0x4e4), + RSND_GEN_S_REG(SSI9_BUSIF3_DALIGN, 0x4e8), + }; + static const struct rsnd_regmap_field_conf conf_scu[] =3D { + RSND_GEN_M_REG(SRC_I_BUSIF_MODE, 0x0, 0x20), + RSND_GEN_M_REG(SRC_O_BUSIF_MODE, 0x4, 0x20), + RSND_GEN_M_REG(SRC_BUSIF_DALIGN, 0x8, 0x20), + RSND_GEN_M_REG(SRC_ROUTE_MODE0, 0xc, 0x20), + RSND_GEN_M_REG(SRC_CTRL, 0x10, 0x20), + RSND_GEN_M_REG(SRC_INT_ENABLE0, 0x18, 0x20), + RSND_GEN_M_REG(CMD_BUSIF_MODE, 0x184, 0x20), + RSND_GEN_M_REG(CMD_BUSIF_DALIGN, 0x188, 0x20), + RSND_GEN_M_REG(CMD_ROUTE_SLCT, 0x18c, 0x20), + RSND_GEN_M_REG(CMD_CTRL, 0x190, 0x20), + RSND_GEN_S_REG(SCU_SYS_STATUS0, 0x1c8), + RSND_GEN_S_REG(SCU_SYS_INT_EN0, 0x1cc), + RSND_GEN_S_REG(SCU_SYS_STATUS1, 0x1d0), + RSND_GEN_S_REG(SCU_SYS_INT_EN1, 0x1d4), + RSND_GEN_M_REG(SRC_SWRSR, 0x200, 0x40), + RSND_GEN_M_REG(SRC_SRCIR, 0x204, 0x40), + RSND_GEN_M_REG(SRC_ADINR, 0x214, 0x40), + RSND_GEN_M_REG(SRC_IFSCR, 0x21c, 0x40), + RSND_GEN_M_REG(SRC_IFSVR, 0x220, 0x40), + RSND_GEN_M_REG(SRC_SRCCR, 0x224, 0x40), + RSND_GEN_M_REG(SRC_BSDSR, 0x22c, 0x40), + RSND_GEN_M_REG(SRC_BSISR, 0x238, 0x40), + RSND_GEN_M_REG(CTU_SWRSR, 0x500, 0x100), + RSND_GEN_M_REG(CTU_CTUIR, 0x504, 0x100), + RSND_GEN_M_REG(CTU_ADINR, 0x508, 0x100), + RSND_GEN_M_REG(CTU_CPMDR, 0x510, 0x100), + RSND_GEN_M_REG(CTU_SCMDR, 0x514, 0x100), + RSND_GEN_M_REG(CTU_SV00R, 0x518, 0x100), + RSND_GEN_M_REG(CTU_SV01R, 0x51c, 0x100), + RSND_GEN_M_REG(CTU_SV02R, 0x520, 0x100), + RSND_GEN_M_REG(CTU_SV03R, 0x524, 0x100), + RSND_GEN_M_REG(CTU_SV04R, 0x528, 0x100), + RSND_GEN_M_REG(CTU_SV05R, 0x52c, 0x100), + RSND_GEN_M_REG(CTU_SV06R, 0x530, 0x100), + RSND_GEN_M_REG(CTU_SV07R, 0x534, 0x100), + RSND_GEN_M_REG(CTU_SV10R, 0x538, 0x100), + RSND_GEN_M_REG(CTU_SV11R, 0x53c, 0x100), + RSND_GEN_M_REG(CTU_SV12R, 0x540, 0x100), + RSND_GEN_M_REG(CTU_SV13R, 0x544, 0x100), + RSND_GEN_M_REG(CTU_SV14R, 0x548, 0x100), + RSND_GEN_M_REG(CTU_SV15R, 0x54c, 0x100), + RSND_GEN_M_REG(CTU_SV16R, 0x550, 0x100), + RSND_GEN_M_REG(CTU_SV17R, 0x554, 0x100), + RSND_GEN_M_REG(CTU_SV20R, 0x558, 0x100), + RSND_GEN_M_REG(CTU_SV21R, 0x55c, 0x100), + RSND_GEN_M_REG(CTU_SV22R, 0x560, 0x100), + RSND_GEN_M_REG(CTU_SV23R, 0x564, 0x100), + RSND_GEN_M_REG(CTU_SV24R, 0x568, 0x100), + RSND_GEN_M_REG(CTU_SV25R, 0x56c, 0x100), + RSND_GEN_M_REG(CTU_SV26R, 0x570, 0x100), + RSND_GEN_M_REG(CTU_SV27R, 0x574, 0x100), + RSND_GEN_M_REG(CTU_SV30R, 0x578, 0x100), + RSND_GEN_M_REG(CTU_SV31R, 0x57c, 0x100), + RSND_GEN_M_REG(CTU_SV32R, 0x580, 0x100), + RSND_GEN_M_REG(CTU_SV33R, 0x584, 0x100), + RSND_GEN_M_REG(CTU_SV34R, 0x588, 0x100), + RSND_GEN_M_REG(CTU_SV35R, 0x58c, 0x100), + RSND_GEN_M_REG(CTU_SV36R, 0x590, 0x100), + RSND_GEN_M_REG(CTU_SV37R, 0x594, 0x100), + RSND_GEN_M_REG(MIX_SWRSR, 0xd00, 0x40), + RSND_GEN_M_REG(MIX_MIXIR, 0xd04, 0x40), + RSND_GEN_M_REG(MIX_ADINR, 0xd08, 0x40), + RSND_GEN_M_REG(MIX_MIXMR, 0xd10, 0x40), + RSND_GEN_M_REG(MIX_MVPDR, 0xd14, 0x40), + RSND_GEN_M_REG(MIX_MDBAR, 0xd18, 0x40), + RSND_GEN_M_REG(MIX_MDBBR, 0xd1c, 0x40), + RSND_GEN_M_REG(MIX_MDBCR, 0xd20, 0x40), + RSND_GEN_M_REG(MIX_MDBDR, 0xd24, 0x40), + RSND_GEN_M_REG(MIX_MDBER, 0xd28, 0x40), + RSND_GEN_M_REG(DVC_SWRSR, 0xe00, 0x100), + RSND_GEN_M_REG(DVC_DVUIR, 0xe04, 0x100), + RSND_GEN_M_REG(DVC_ADINR, 0xe08, 0x100), + RSND_GEN_M_REG(DVC_DVUCR, 0xe10, 0x100), + RSND_GEN_M_REG(DVC_ZCMCR, 0xe14, 0x100), + RSND_GEN_M_REG(DVC_VRCTR, 0xe18, 0x100), + RSND_GEN_M_REG(DVC_VRPDR, 0xe1c, 0x100), + RSND_GEN_M_REG(DVC_VRDBR, 0xe20, 0x100), + RSND_GEN_M_REG(DVC_VOL0R, 0xe28, 0x100), + RSND_GEN_M_REG(DVC_VOL1R, 0xe2c, 0x100), + RSND_GEN_M_REG(DVC_VOL2R, 0xe30, 0x100), + RSND_GEN_M_REG(DVC_VOL3R, 0xe34, 0x100), + RSND_GEN_M_REG(DVC_VOL4R, 0xe38, 0x100), + RSND_GEN_M_REG(DVC_VOL5R, 0xe3c, 0x100), + RSND_GEN_M_REG(DVC_VOL6R, 0xe40, 0x100), + RSND_GEN_M_REG(DVC_VOL7R, 0xe44, 0x100), + RSND_GEN_M_REG(DVC_DVUER, 0xe48, 0x100), + }; + static const struct rsnd_regmap_field_conf conf_adg[] =3D { + RSND_GEN_S_REG(BRRA, 0x00), + RSND_GEN_S_REG(BRRB, 0x04), + RSND_GEN_S_REG(BRGCKR, 0x08), + RSND_GEN_S_REG(AUDIO_CLK_SEL0, 0x0c), + RSND_GEN_S_REG(AUDIO_CLK_SEL1, 0x10), + RSND_GEN_S_REG(AUDIO_CLK_SEL2, 0x14), + RSND_GEN_S_REG(AUDIO_CLK_SEL3, 0x18), + RSND_GEN_S_REG(DIV_EN, 0x30), + RSND_GEN_S_REG(SRCIN_TIMSEL0, 0x34), + RSND_GEN_S_REG(SRCIN_TIMSEL1, 0x38), + RSND_GEN_S_REG(SRCIN_TIMSEL2, 0x3c), + RSND_GEN_S_REG(SRCIN_TIMSEL3, 0x40), + RSND_GEN_S_REG(SRCIN_TIMSEL4, 0x44), + RSND_GEN_S_REG(SRCOUT_TIMSEL0, 0x48), + RSND_GEN_S_REG(SRCOUT_TIMSEL1, 0x4c), + RSND_GEN_S_REG(SRCOUT_TIMSEL2, 0x50), + RSND_GEN_S_REG(SRCOUT_TIMSEL3, 0x54), + RSND_GEN_S_REG(SRCOUT_TIMSEL4, 0x58), + RSND_GEN_S_REG(CMDOUT_TIMSEL, 0x5c), + }; + static const struct rsnd_regmap_field_conf conf_ssi[] =3D { + RSND_GEN_M_REG(SSICR, 0x00, 0x40), + RSND_GEN_M_REG(SSISR, 0x04, 0x40), + RSND_GEN_M_REG(SSIWSR, 0x20, 0x40), + }; + int ret; + + ret =3D rsnd_gen_regmap_init(priv, 10, RSND_BASE_SCU, "scu", conf_scu); + if (ret < 0) + return ret; + + ret =3D rsnd_gen_regmap_init(priv, 1, RSND_BASE_ADG, "adg", conf_adg); + if (ret < 0) + return ret; + + ret =3D rsnd_gen_regmap_init(priv, 10, RSND_BASE_SSIU, "ssiu", conf_ssiu); + if (ret < 0) + return ret; + + return rsnd_gen_regmap_init(priv, 10, RSND_BASE_SSI, "ssi", conf_ssi); +} + /* * Gen */ @@ -487,6 +665,8 @@ int rsnd_gen_probe(struct rsnd_priv *priv) ret =3D rsnd_gen2_probe(priv); else if (rsnd_is_gen4(priv)) ret =3D rsnd_gen4_probe(priv); + else if (rsnd_is_rzg3e(priv)) + ret =3D rsnd_rzg3e_probe(priv); =20 if (ret < 0) dev_err(dev, "unknown generation R-Car sound device\n"); diff --git a/sound/soc/renesas/rcar/rsnd.h b/sound/soc/renesas/rcar/rsnd.h index cd7e7df62298..7b50e0456cca 100644 --- a/sound/soc/renesas/rcar/rsnd.h +++ b/sound/soc/renesas/rcar/rsnd.h @@ -143,13 +143,16 @@ enum rsnd_reg { AUDIO_CLK_SEL0, AUDIO_CLK_SEL1, AUDIO_CLK_SEL2, + AUDIO_CLK_SEL3, =20 /* SSIU */ SSI_MODE, SSI_MODE0, SSI_MODE1, SSI_MODE2, + SSI_MODE3, SSI_CONTROL, + SSI_CONTROL2, SSI_CTRL, SSI_BUSIF0_MODE, SSI_BUSIF1_MODE, @@ -622,14 +625,28 @@ struct rsnd_priv { struct platform_device *pdev; spinlock_t lock; unsigned long flags; + + /* + * Flags layout: 0x....DCBA + * + * A (bits 3: 0): R-Car generation (Gen1/Gen2/Gen3/Gen4) + * B (bits 7: 4): R-Car SoC variant (e.g. SOC_E for E1/E2/E3) + * C (bits 11: 8): RZ series generation + * D (bits 15:12): RZ series SoC identifier (e.g. RZG3E) + * + * Bits 16+ are used for capability flags. + */ #define RSND_GEN_MASK (0xF << 0) #define RSND_GEN1 (1 << 0) #define RSND_GEN2 (2 << 0) #define RSND_GEN3 (3 << 0) #define RSND_GEN4 (4 << 0) -#define RSND_SOC_MASK (0xFF << 4) -#define RSND_SOC_E (1 << 4) /* E1/E2/E3 */ - +#define RSND_SOC_MASK (0xF << 4) /* nibble B */ +#define RSND_SOC_E (1 << 4) /* E1/E2/E3 */ +#define RSND_RZ_MASK (0xF << 8) /* nibble C */ +#define RSND_RZ3 (3 << 8) +#define RSND_RZ_ID_MASK (0xF << 12) /* nibble D */ +#define RSND_RZG3E (1 << 12) /* * below value will be filled on rsnd_gen_probe() */ @@ -708,6 +725,9 @@ struct rsnd_priv { #define rsnd_is_gen3_e3(priv) (((priv)->flags & \ (RSND_GEN_MASK | RSND_SOC_MASK)) =3D=3D \ (RSND_GEN3 | RSND_SOC_E)) +#define rsnd_is_rzg3e(priv) (((priv)->flags & \ + (RSND_RZ_MASK | RSND_RZ_ID_MASK)) =3D=3D \ + (RSND_RZ3 | RSND_RZG3E)) =20 #define rsnd_flags_has(p, f) ((p)->flags & (f)) #define rsnd_flags_set(p, f) ((p)->flags |=3D (f)) --=20 2.25.1 From nobody Mon Jun 15 09:40:21 2026 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 673E3314D21; Thu, 9 Apr 2026 09:04:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725463; cv=none; b=SZ5Gn1DDtyLoubiC4mINoW9/F1gKeStOMhJ75zatMVId5whBpl4km87CLmrAMQV6fHsQwoeFXIZzCGUAk07NJ/4kuLboXxPqCLp3oX+jXF4Y3uJ4PPGjTCUO7FbGzxWRMF39sYV+DYHQFTiGYI+wx6ep8umQznjkNFeS3UKhkwE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725463; c=relaxed/simple; bh=TaUG1/A+NpWcNgPVkV1kteUWKJQFCJL+3IETzQCtzP0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=mvuT8r+oUTgXjbOxam6vfYTNo7q0X5mnv9gvwVZ3+UtCd9n5D/8knMGzli9+TAzUZf5JZLa8PApSMt4z8vag9OcPTHnpH+3weL5b50RSyeUmEp7pRM9coE8kg6ATEpbFw77IAocIebKnrZdGVERjtAQyC7bBEp2tFvV3P+kq60U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: bN7kFeHzQAWKsFRYxvhJ8g== X-CSE-MsgGUID: NNMHWTa/QxOlaF6Jy0gsjg== Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 09 Apr 2026 18:04:21 +0900 Received: from ubuntu.adwin.renesas.com (unknown [10.226.92.218]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id F01414015FC2; Thu, 9 Apr 2026 18:04:14 +0900 (JST) From: John Madieu To: Kuninori Morimoto , Mark Brown , Liam Girdwood , Geert Uytterhoeven Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Magnus Damm , Philipp Zabel , Claudiu Beznea , Biju Das , john.madieu@gmail.com, linux-sound@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, John Madieu Subject: [PATCH v4 05/12] ASoC: rsnd: Add audmacpp clock and reset support for RZ/G3E Date: Thu, 9 Apr 2026 11:02:54 +0200 Message-ID: <20260409090302.2243305-6-john.madieu.xa@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> References: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" RZ/G3E requires additional audmapp clock and reset lines for Audio DMA-PP operation. Add global audmacpp clock/reset management in rsnd_dma_probe() using optional APIs to remain transparent to other platforms. Signed-off-by: John Madieu --- Changes: =20 v4: - Move audmapp_clk and audmapp_rstc from struct rsnd_priv into struct rsnd_dma_ctrl v3: No changes v2: No changes sound/soc/renesas/rcar/dma.c | 17 +++++++++++++++++ sound/soc/renesas/rcar/rsnd.h | 1 + 2 files changed, 18 insertions(+) diff --git a/sound/soc/renesas/rcar/dma.c b/sound/soc/renesas/rcar/dma.c index 68c859897e68..feab42e3202d 100644 --- a/sound/soc/renesas/rcar/dma.c +++ b/sound/soc/renesas/rcar/dma.c @@ -47,6 +47,9 @@ struct rsnd_dma_ctrl { phys_addr_t ppres; int dmaen_num; int dmapp_num; + /* RZ/G3E: Audio DMAC peri-peri clock and reset */ + struct clk *audmapp_clk; + struct reset_control *audmapp_rstc; }; =20 #define rsnd_priv_to_dmac(p) ((struct rsnd_dma_ctrl *)(p)->dma) @@ -864,6 +867,20 @@ int rsnd_dma_probe(struct rsnd_priv *priv) if (rsnd_is_gen4(priv)) goto audmapp_end; =20 + /* for RZ/G3E */ + dmac->audmapp_rstc =3D + devm_reset_control_get_optional_exclusive_deasserted(dev, "audmapp"); + if (IS_ERR(dmac->audmapp_rstc)) { + return dev_err_probe(dev, PTR_ERR(dmac->audmapp_rstc), + "failed to get audmapp reset\n"); + } + + dmac->audmapp_clk =3D devm_clk_get_optional_enabled(dev, "audmapp"); + if (IS_ERR(dmac->audmapp_clk)) { + return dev_err_probe(dev, PTR_ERR(dmac->audmapp_clk), + "failed to get audmapp clock\n"); + } + res =3D platform_get_resource_byname(pdev, IORESOURCE_MEM, "audmapp"); if (!res) { dev_err(dev, "lack of audmapp in DT\n"); diff --git a/sound/soc/renesas/rcar/rsnd.h b/sound/soc/renesas/rcar/rsnd.h index 7b50e0456cca..28ed90ffe0ab 100644 --- a/sound/soc/renesas/rcar/rsnd.h +++ b/sound/soc/renesas/rcar/rsnd.h @@ -623,6 +623,7 @@ void rsnd_adg_clk_dbg_info(struct rsnd_priv *priv, stru= ct seq_file *m); struct rsnd_priv { =20 struct platform_device *pdev; + spinlock_t lock; unsigned long flags; =20 --=20 2.25.1 From nobody Mon Jun 15 09:40:21 2026 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B247C2BE02C; Thu, 9 Apr 2026 09:04:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725470; cv=none; b=ovX+5bQkkq4mGDriq1rb/39x1M+KF0Cs42WwvCBQRpHmybq6h4/J8KA3RR0H+rR2CdpLOQYGaRFmYEXK2ca54eDgXuWACpjGDIm2BPSrNPk3rRT3eLGwjAi+KF1Noimvv1gjO46mzyObA2VkKrH0IwMwPXd5tY0f2JQxoGPQ/mE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725470; c=relaxed/simple; bh=+VKWukcytNshdTRuXILBXurWU3pvSfsK/vXSLpLHq5E=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=VjrPsgKwv0a8d9Az6oMSAlpqwKs39VqtRRRGGgEowDeEqP4DZeRKUq8ONabD2o3bjGrMiFVNq7fpq553FMiP+sy05FZ+Ol4BWaXwwcoJunM7YmArrIOd9FIx9bF0rxsk0QkrZFXePK2RblRsijd3cltzQXpPJ3AznWWDaGhWOiA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: pOmC7hq4QFCjQf2/lm0i/A== X-CSE-MsgGUID: OgHP40vAQyaYZ38QHLqvTA== Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 09 Apr 2026 18:04:27 +0900 Received: from ubuntu.adwin.renesas.com (unknown [10.226.92.218]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id C3FD24015D82; Thu, 9 Apr 2026 18:04:21 +0900 (JST) From: John Madieu To: Kuninori Morimoto , Mark Brown , Liam Girdwood , Geert Uytterhoeven Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Magnus Damm , Philipp Zabel , Claudiu Beznea , Biju Das , john.madieu@gmail.com, linux-sound@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, John Madieu Subject: [PATCH v4 06/12] ASoC: rsnd: Add RZ/G3E DMA address calculation support Date: Thu, 9 Apr 2026 11:02:55 +0200 Message-ID: <20260409090302.2243305-7-john.madieu.xa@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> References: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" RZ/G3E has different DMA register base addresses and offset calculations compared to R-Car platforms. Add dedicated rsnd_rzg3e_dma_addr() function with dispatch from rsnd_dma_addr(), following the existing per-generation pattern. Signed-off-by: John Madieu --- v4: - Replace raw [3][2][3] DMA address array with named structs rsnd_dma_addr_dir and rsnd_dma_addr_map. Use designated initializers in both rsnd_gen2_dma_addr() and rsnd_rzg3e_dma_addr() v3: No changes v2: No changes sound/soc/renesas/rcar/dma.c | 233 +++++++++++++++++++++++++++-------- 1 file changed, 182 insertions(+), 51 deletions(-) diff --git a/sound/soc/renesas/rcar/dma.c b/sound/soc/renesas/rcar/dma.c index feab42e3202d..e3278ff7e2f0 100644 --- a/sound/soc/renesas/rcar/dma.c +++ b/sound/soc/renesas/rcar/dma.c @@ -481,6 +481,69 @@ static struct rsnd_mod_ops rsnd_dmapp_ops =3D { DEBUG_INFO }; =20 +struct rsnd_dma_addr { + dma_addr_t out_addr; + dma_addr_t in_addr; +}; + +struct rsnd_dma_addr_dir { + struct rsnd_dma_addr capture[3]; + struct rsnd_dma_addr playback[3]; +}; + +struct rsnd_dma_addr_map { + struct rsnd_dma_addr_dir src; + struct rsnd_dma_addr_dir ssi; + struct rsnd_dma_addr_dir ssiu; +}; + +static dma_addr_t +rsnd_dma_addr_lookup(struct rsnd_dai_stream *io, + struct rsnd_mod *mod, + struct rsnd_priv *priv, + const struct rsnd_dma_addr_map *map, + int is_play, int is_from) +{ + struct device *dev =3D rsnd_priv_to_dev(priv); + int is_ssi =3D !!(rsnd_io_to_mod_ssi(io) =3D=3D mod) || + !!(rsnd_io_to_mod_ssiu(io) =3D=3D mod); + int use_src =3D !!rsnd_io_to_mod_src(io); + int use_cmd =3D !!rsnd_io_to_mod_dvc(io) || + !!rsnd_io_to_mod_mix(io) || + !!rsnd_io_to_mod_ctu(io); + int id =3D rsnd_mod_id(mod); + const struct rsnd_dma_addr_dir *dir; + const struct rsnd_dma_addr *addr; + + /* it shouldn't happen */ + if (use_cmd && !use_src) + dev_err(dev, "DVC is selected without SRC\n"); + + /* use SSIU or SSI? */ + if (is_ssi && rsnd_ssi_use_busif(io)) + is_ssi++; + + dev_dbg(dev, "dma%d addr : is_ssi=3D%d use_src=3D%d use_cmd=3D%d\n", + id, is_ssi, use_src, use_cmd); + + switch (is_ssi) { + case 2: + dir =3D &map->ssiu; + break; + case 1: + dir =3D &map->ssi; + break; + default: + dir =3D &map->src; + break; + } + + addr =3D is_play ? &dir->playback[use_src + use_cmd] + : &dir->capture[use_src + use_cmd]; + + return is_from ? addr->out_addr : addr->in_addr; +} + /* * Common DMAC Interface */ @@ -499,7 +562,16 @@ static struct rsnd_mod_ops rsnd_dmapp_ops =3D { * SSIU: 0xec541000 / 0xec100000 / 0xec100000 / 0xec400000 / 0xec400000 * SCU : 0xec500000 / 0xec000000 / 0xec004000 / 0xec300000 / 0xec304000 * CMD : 0xec500000 / / 0xec008000 0xec308000 + * + * ex) G3E case + * mod / DMAC in / DMAC out / DMAC PP in / DMAC pp out + * SSI : 0x13C31000 / 0x13C40000 / 0x13C40000 + * SSIU: 0x13C31000 / 0x13C40000 / 0x13C40000 / 0xEC400000 / 0xEC400000 + * SCU : 0x13C00000 / 0x13C10000 / 0x13C14000 / 0xEC300000 / 0xEC304000 + * CMD : 0x13C00000 / / 0x13C18000 0xEC308000 */ + +/* R-Car DMA address macros */ #define RDMA_SSI_I_N(addr, i) (addr ##_reg - 0x00300000 + (0x40 * i) + 0x8) #define RDMA_SSI_O_N(addr, i) (addr ##_reg - 0x00300000 + (0x40 * i) + 0xc) =20 @@ -520,54 +592,51 @@ static struct rsnd_mod_ops rsnd_dmapp_ops =3D { =20 static dma_addr_t rsnd_gen2_dma_addr(struct rsnd_dai_stream *io, - struct rsnd_mod *mod, - int is_play, int is_from) + struct rsnd_mod *mod, int is_play, int is_from) { struct rsnd_priv *priv =3D rsnd_io_to_priv(io); struct device *dev =3D rsnd_priv_to_dev(priv); phys_addr_t ssi_reg =3D rsnd_gen_get_phy_addr(priv, RSND_BASE_SSI); phys_addr_t src_reg =3D rsnd_gen_get_phy_addr(priv, RSND_BASE_SCU); - int is_ssi =3D !!(rsnd_io_to_mod_ssi(io) =3D=3D mod) || - !!(rsnd_io_to_mod_ssiu(io) =3D=3D mod); - int use_src =3D !!rsnd_io_to_mod_src(io); - int use_cmd =3D !!rsnd_io_to_mod_dvc(io) || - !!rsnd_io_to_mod_mix(io) || - !!rsnd_io_to_mod_ctu(io); - int id =3D rsnd_mod_id(mod); + int id =3D rsnd_mod_id(mod); int busif =3D rsnd_mod_id_sub(rsnd_io_to_mod_ssiu(io)); - struct dma_addr { - dma_addr_t out_addr; - dma_addr_t in_addr; - } dma_addrs[3][2][3] =3D { - /* SRC */ - /* Capture */ - {{{ 0, 0 }, - { RDMA_SRC_O_N(src, id), RDMA_SRC_I_P(src, id) }, - { RDMA_CMD_O_N(src, id), RDMA_SRC_I_P(src, id) } }, - /* Playback */ - {{ 0, 0, }, - { RDMA_SRC_O_P(src, id), RDMA_SRC_I_N(src, id) }, - { RDMA_CMD_O_P(src, id), RDMA_SRC_I_N(src, id) } } + const struct rsnd_dma_addr_map map =3D { + .src =3D { + .capture =3D { + { 0, 0 }, + { RDMA_SRC_O_N(src, id), RDMA_SRC_I_P(src, id) }, + { RDMA_CMD_O_N(src, id), RDMA_SRC_I_P(src, id) }, + }, + .playback =3D { + { 0, 0 }, + { RDMA_SRC_O_P(src, id), RDMA_SRC_I_N(src, id) }, + { RDMA_CMD_O_P(src, id), RDMA_SRC_I_N(src, id) }, + }, }, - /* SSI */ - /* Capture */ - {{{ RDMA_SSI_O_N(ssi, id), 0 }, - { RDMA_SSIU_O_P(ssi, id, busif), 0 }, - { RDMA_SSIU_O_P(ssi, id, busif), 0 } }, - /* Playback */ - {{ 0, RDMA_SSI_I_N(ssi, id) }, - { 0, RDMA_SSIU_I_P(ssi, id, busif) }, - { 0, RDMA_SSIU_I_P(ssi, id, busif) } } + .ssi =3D { + .capture =3D { + { RDMA_SSI_O_N(ssi, id), 0 }, + { RDMA_SSIU_O_P(ssi, id, busif), 0 }, + { RDMA_SSIU_O_P(ssi, id, busif), 0 }, + }, + .playback =3D { + { 0, RDMA_SSI_I_N(ssi, id) }, + { 0, RDMA_SSIU_I_P(ssi, id, busif) }, + { 0, RDMA_SSIU_I_P(ssi, id, busif) }, + }, + }, + .ssiu =3D { + .capture =3D { + { RDMA_SSIU_O_N(ssi, id, busif), 0 }, + { RDMA_SSIU_O_P(ssi, id, busif), 0 }, + { RDMA_SSIU_O_P(ssi, id, busif), 0 }, + }, + .playback =3D { + { 0, RDMA_SSIU_I_N(ssi, id, busif) }, + { 0, RDMA_SSIU_I_P(ssi, id, busif) }, + { 0, RDMA_SSIU_I_P(ssi, id, busif) }, + }, }, - /* SSIU */ - /* Capture */ - {{{ RDMA_SSIU_O_N(ssi, id, busif), 0 }, - { RDMA_SSIU_O_P(ssi, id, busif), 0 }, - { RDMA_SSIU_O_P(ssi, id, busif), 0 } }, - /* Playback */ - {{ 0, RDMA_SSIU_I_N(ssi, id, busif) }, - { 0, RDMA_SSIU_I_P(ssi, id, busif) }, - { 0, RDMA_SSIU_I_P(ssi, id, busif) } } }, }; =20 /* @@ -577,20 +646,80 @@ rsnd_gen2_dma_addr(struct rsnd_dai_stream *io, * out of calculation rule */ if ((id =3D=3D 9) && (busif >=3D 4)) - dev_err(dev, "This driver doesn't support SSI%d-%d, so far", - id, busif); + dev_err(dev, + "This driver doesn't support SSI%d-%d, so far", id, busif); =20 - /* it shouldn't happen */ - if (use_cmd && !use_src) - dev_err(dev, "DVC is selected without SRC\n"); + return rsnd_dma_addr_lookup(io, mod, priv, &map, is_play, is_from); +} =20 - /* use SSIU or SSI ? */ - if (is_ssi && rsnd_ssi_use_busif(io)) - is_ssi++; +/* RZ/G3E DMA address macros */ +#define RDMA_SSI_I_N_G3E(addr, i) (addr ##_reg + 0x0000F000 + (0x1000 * i)) +#define RDMA_SSI_O_N_G3E(addr, i) (addr ##_reg + 0x0000F000 + (0x1000 * i)) + +#define RDMA_SSIU_I_N_G3E(addr, i, j) (addr ##_reg + 0x0000F000 + (0x1000 = * (i)) + (((j) / 4) * 0xA000) + (((j) % 4) * 0x400) - (0x4000 * ((i) / 9) *= ((j) / 4))) +#define RDMA_SSIU_O_N_G3E(addr, i, j) RDMA_SSIU_I_N_G3E(addr, i, j) + +#define RDMA_SSIU_I_P_G3E(addr, i, j) (addr ##_reg + 0xD87CF000 + (0x1000 = * (i)) + (((j) / 4) * 0xA000) + (((j) % 4) * 0x400) - (0x4000 * ((i) / 9) *= ((j) / 4))) +#define RDMA_SSIU_O_P_G3E(addr, i, j) RDMA_SSIU_I_P_G3E(addr, i, j) + +#define RDMA_SRC_I_N_G3E(addr, i) (addr ##_reg + 0x00010000 + (0x400 * i)) +#define RDMA_SRC_O_N_G3E(addr, i) (addr ##_reg + 0x00014000 + (0x400 * i)) + +#define RDMA_SRC_I_P_G3E(addr, i) (addr ##_reg + 0xD8700000 + (0x400 * i)) +#define RDMA_SRC_O_P_G3E(addr, i) (addr ##_reg + 0xD8704000 + (0x400 * i)) + +#define RDMA_CMD_O_N_G3E(addr, i) (addr ##_reg + 0x00018000 + (0x400 * i)) +#define RDMA_CMD_O_P_G3E(addr, i) (addr ##_reg + 0xD8708000 + (0x400 * i)) + +static dma_addr_t +rsnd_rzg3e_dma_addr(struct rsnd_dai_stream *io, + struct rsnd_mod *mod, int is_play, int is_from) +{ + struct rsnd_priv *priv =3D rsnd_io_to_priv(io); + phys_addr_t ssi_reg =3D rsnd_gen_get_phy_addr(priv, RSND_BASE_SSI); + phys_addr_t src_reg =3D rsnd_gen_get_phy_addr(priv, RSND_BASE_SCU); + int id =3D rsnd_mod_id(mod); + int busif =3D rsnd_mod_id_sub(rsnd_io_to_mod_ssiu(io)); + const struct rsnd_dma_addr_map map =3D { + .src =3D { + .capture =3D { + { 0, 0 }, + { RDMA_SRC_O_N_G3E(src, id), RDMA_SRC_I_P_G3E(src, id) }, + { RDMA_CMD_O_N_G3E(src, id), RDMA_SRC_I_P_G3E(src, id) }, + }, + .playback =3D { + { 0, 0 }, + { RDMA_SRC_O_P_G3E(src, id), RDMA_SRC_I_N_G3E(src, id) }, + { RDMA_CMD_O_P_G3E(src, id), RDMA_SRC_I_N_G3E(src, id) }, + }, + }, + .ssi =3D { + .capture =3D { + { RDMA_SSI_O_N_G3E(ssi, id), 0 }, + { RDMA_SSIU_O_P_G3E(ssi, id, busif), 0 }, + { RDMA_SSIU_O_P_G3E(ssi, id, busif), 0 }, + }, + .playback =3D { + { 0, RDMA_SSI_I_N_G3E(ssi, id) }, + { 0, RDMA_SSIU_I_P_G3E(ssi, id, busif) }, + { 0, RDMA_SSIU_I_P_G3E(ssi, id, busif) }, + }, + }, + .ssiu =3D { + .capture =3D { + { RDMA_SSIU_O_N_G3E(ssi, id, busif), 0 }, + { RDMA_SSIU_O_P_G3E(ssi, id, busif), 0 }, + { RDMA_SSIU_O_P_G3E(ssi, id, busif), 0 }, + }, + .playback =3D { + { 0, RDMA_SSIU_I_N_G3E(ssi, id, busif) }, + { 0, RDMA_SSIU_I_P_G3E(ssi, id, busif) }, + { 0, RDMA_SSIU_I_P_G3E(ssi, id, busif) }, + }, + } + }; =20 - return (is_from) ? - dma_addrs[is_ssi][is_play][use_src + use_cmd].out_addr : - dma_addrs[is_ssi][is_play][use_src + use_cmd].in_addr; + return rsnd_dma_addr_lookup(io, mod, priv, &map, is_play, is_from); } =20 /* @@ -639,6 +768,8 @@ static dma_addr_t rsnd_dma_addr(struct rsnd_dai_stream = *io, return 0; else if (rsnd_is_gen4(priv)) return rsnd_gen4_dma_addr(io, mod, is_play, is_from); + else if (rsnd_is_rzg3e(priv)) + return rsnd_rzg3e_dma_addr(io, mod, is_play, is_from); else return rsnd_gen2_dma_addr(io, mod, is_play, is_from); } --=20 2.25.1 From nobody Mon Jun 15 09:40:21 2026 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7562D3A8738; Thu, 9 Apr 2026 09:04:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725477; cv=none; b=XbVwb9qakapxKICxl3Nxxp/t+gU96OCR+mnmPVxqsvmggnxnQP/kb/zQeQpm3eaFoIFgfv1boUxB/yN7KZohgasBroNgr5Lf6Eq9cyDDVIX6gwXHAusejgJ15Oce3nN1ZSs8MA61WtMc4+5JRiwqQRY7db211dAB47vj1ty5KmU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725477; c=relaxed/simple; bh=SlY2IZUzTsmxR4CcT/ib5rjIT1RyjWQSCMfm0g+FTCY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kiYIHasMYsfquIbil/CNN87ckyUI9Fxu5/EUb4bf+ETyym6P6O29viTQKDfi3cHzhjdhTtcx/4x5qubWr/zXYX+QCvuiTFlml7EUuK9YzDwzp4jC5AdePVVE93OBGIerhK9cu4RTD1pFnoujqYLBQCh6gkWTFxFdi7oAC2kvBis= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: GxfsRx4bQYKc2pMY8npCgA== X-CSE-MsgGUID: npVTKl/KSM6azYdV63o/uA== Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 09 Apr 2026 18:04:34 +0900 Received: from ubuntu.adwin.renesas.com (unknown [10.226.92.218]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id C7C9A4015FC2; Thu, 9 Apr 2026 18:04:28 +0900 (JST) From: John Madieu To: Kuninori Morimoto , Mark Brown , Liam Girdwood , Geert Uytterhoeven Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Magnus Damm , Philipp Zabel , Claudiu Beznea , Biju Das , john.madieu@gmail.com, linux-sound@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, John Madieu Subject: [PATCH v4 07/12] ASoC: rsnd: ssui: Add RZ/G3E SSIU BUSIF support Date: Thu, 9 Apr 2026 11:02:56 +0200 Message-ID: <20260409090302.2243305-8-john.madieu.xa@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> References: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add support for the SSIU found on the Renesas RZ/G3E SoC, which provides a different BUSIF layout compared to earlier generations: - SSI0-SSI4: 4 BUSIF instances each (BUSIF0-3) - SSI5-SSI8: 1 BUSIF instance each (BUSIF0 only) - SSI9: 4 BUSIF instances (BUSIF0-3) - Total: 28 BUSIFs RZ/G3E also differs from Gen2/Gen3 implementations in that only two pairs of BUSIF error-status registers are available instead of four, and the SSI always operates in BUSIF mode with no PIO fallback. Rather than scattering SoC-specific checks across functional code, introduce an extra capability flags in the match data: - RSND_SSIU_BUSIF_STATUS_COUNT_2: only two BUSIF error-status register pairs are present. Used in rsnd_ssiu_busif_err_irq_ctrl() and rsnd_ssiu_busif_err_status_clear() to limit register iteration. Future SoCs sharing these constraints can set the flags without requiring code changes. Signed-off-by: John Madieu --- v4: - Move busif_status_count from rsnd_priv into new struct rsnd_ssiu_ctrl, following the rsnd_dma_ctrl pattern for shared non-per-instance module resources - Properly propagate reset control errors via dev_err_probe() instead of silencing them - Update changelog to accurately describe rsnd_is_rzg3e() usage for SoC-specific register handling=20 v3: No changes v2: No changes sound/soc/renesas/rcar/core.c | 3 +- sound/soc/renesas/rcar/rsnd.h | 2 ++ sound/soc/renesas/rcar/ssiu.c | 63 +++++++++++++++++++++++++---------- 3 files changed, 49 insertions(+), 19 deletions(-) diff --git a/sound/soc/renesas/rcar/core.c b/sound/soc/renesas/rcar/core.c index 4544791f3883..cb31af8a34d4 100644 --- a/sound/soc/renesas/rcar/core.c +++ b/sound/soc/renesas/rcar/core.c @@ -107,7 +107,8 @@ static const struct of_device_id rsnd_of_match[] =3D { { .compatible =3D "renesas,rcar_sound-gen4", .data =3D (void *)RSND_GEN4 = }, /* Special Handling */ { .compatible =3D "renesas,rcar_sound-r8a77990", .data =3D (void *)(RSND_= GEN3 | RSND_SOC_E) }, - { .compatible =3D "renesas,r9a09g047-sound", .data =3D (void *)(RSND_RZ3 = | RSND_RZG3E) }, + { .compatible =3D "renesas,r9a09g047-sound", .data =3D (void *)(RSND_RZ3 = | RSND_RZG3E | + RSND_SSIU_BUSIF_STATUS_COUNT_2) }, {}, }; MODULE_DEVICE_TABLE(of, rsnd_of_match); diff --git a/sound/soc/renesas/rcar/rsnd.h b/sound/soc/renesas/rcar/rsnd.h index 28ed90ffe0ab..5cf35a1f3e45 100644 --- a/sound/soc/renesas/rcar/rsnd.h +++ b/sound/soc/renesas/rcar/rsnd.h @@ -648,6 +648,7 @@ struct rsnd_priv { #define RSND_RZ3 (3 << 8) #define RSND_RZ_ID_MASK (0xF << 12) /* nibble D */ #define RSND_RZG3E (1 << 12) +#define RSND_SSIU_BUSIF_STATUS_COUNT_2 BIT(16) /* Only 2 BUSIF error-statu= s register pairs */ /* * below value will be filled on rsnd_gen_probe() */ @@ -666,6 +667,7 @@ struct rsnd_priv { /* * below value will be filled on rsnd_ssi_probe() */ + void *ssiu_ctrl; void *ssi; int ssi_nr; =20 diff --git a/sound/soc/renesas/rcar/ssiu.c b/sound/soc/renesas/rcar/ssiu.c index 0cfa84fe5ea8..f483389868d2 100644 --- a/sound/soc/renesas/rcar/ssiu.c +++ b/sound/soc/renesas/rcar/ssiu.c @@ -29,31 +29,39 @@ struct rsnd_ssiu { i++) =20 /* - * SSI Gen2 Gen3 Gen4 - * 0 BUSIF0-3 BUSIF0-7 BUSIF0-7 - * 1 BUSIF0-3 BUSIF0-7 - * 2 BUSIF0-3 BUSIF0-7 - * 3 BUSIF0 BUSIF0-7 - * 4 BUSIF0 BUSIF0-7 - * 5 BUSIF0 BUSIF0 - * 6 BUSIF0 BUSIF0 - * 7 BUSIF0 BUSIF0 - * 8 BUSIF0 BUSIF0 - * 9 BUSIF0-3 BUSIF0-7 - * total 22 52 8 + * SSI Gen2 Gen3 Gen4 RZ/G3E + * 0 BUSIF0-3 BUSIF0-7 BUSIF0-7 BUSIF0-3 + * 1 BUSIF0-3 BUSIF0-7 BUSIF0-3 + * 2 BUSIF0-3 BUSIF0-7 BUSIF0-3 + * 3 BUSIF0 BUSIF0-7 BUSIF0-3 + * 4 BUSIF0 BUSIF0-7 BUSIF0-3 + * 5 BUSIF0 BUSIF0 BUSIF0 + * 6 BUSIF0 BUSIF0 BUSIF0 + * 7 BUSIF0 BUSIF0 BUSIF0 + * 8 BUSIF0 BUSIF0 BUSIF0 + * 9 BUSIF0-3 BUSIF0-7 BUSIF0-3 + * total 22 52 8 28 */ static const int gen2_id[] =3D { 0, 4, 8, 12, 13, 14, 15, 16, 17, 18 }; static const int gen3_id[] =3D { 0, 8, 16, 24, 32, 40, 41, 42, 43, 44 }; static const int gen4_id[] =3D { 0 }; +static const int rzg3e_id[] =3D { 0, 4, 8, 12, 16, 20, 21, 22, 23, 24 }; + +struct rsnd_ssiu_ctrl { + unsigned int busif_status_count; +}; + +#define rsnd_priv_to_ssiu_ctrl(priv) \ + ((struct rsnd_ssiu_ctrl *)(priv)->ssiu_ctrl) =20 /* enable busif buffer over/under run interrupt. */ #define rsnd_ssiu_busif_err_irq_enable(mod) rsnd_ssiu_busif_err_irq_ctrl(= mod, 1) #define rsnd_ssiu_busif_err_irq_disable(mod) rsnd_ssiu_busif_err_irq_ctrl(= mod, 0) static void rsnd_ssiu_busif_err_irq_ctrl(struct rsnd_mod *mod, int enable) { + struct rsnd_priv *priv =3D rsnd_mod_to_priv(mod); int id =3D rsnd_mod_id(mod); int shift, offset; - int i; =20 switch (id) { case 0: @@ -72,7 +80,7 @@ static void rsnd_ssiu_busif_err_irq_ctrl(struct rsnd_mod = *mod, int enable) return; } =20 - for (i =3D 0; i < 4; i++) { + for (unsigned int i =3D 0; i < rsnd_priv_to_ssiu_ctrl(priv)->busif_status= _count; i++) { enum rsnd_reg reg =3D SSI_SYS_INT_ENABLE((i * 2) + offset); u32 val =3D 0xf << (shift * 4); u32 sys_int_enable =3D rsnd_mod_read(mod, reg); @@ -87,10 +95,10 @@ static void rsnd_ssiu_busif_err_irq_ctrl(struct rsnd_mo= d *mod, int enable) =20 bool rsnd_ssiu_busif_err_status_clear(struct rsnd_mod *mod) { + struct rsnd_priv *priv =3D rsnd_mod_to_priv(mod); bool error =3D false; int id =3D rsnd_mod_id(mod); int shift, offset; - int i; =20 switch (id) { case 0: @@ -109,7 +117,7 @@ bool rsnd_ssiu_busif_err_status_clear(struct rsnd_mod *= mod) goto out; } =20 - for (i =3D 0; i < 4; i++) { + for (unsigned int i =3D 0; i < rsnd_priv_to_ssiu_ctrl(priv)->busif_status= _count; i++) { u32 reg =3D SSI_SYS_STATUS(i * 2) + offset; u32 status =3D rsnd_mod_read(mod, reg); u32 val =3D 0xf << (shift * 4); @@ -160,7 +168,8 @@ static int rsnd_ssiu_init(struct rsnd_mod *mod, /* * SSI_MODE0 */ - rsnd_mod_bset(mod, SSI_MODE0, (1 << id), !use_busif << id); + if (!rsnd_is_rzg3e(priv)) + rsnd_mod_bset(mod, SSI_MODE0, (1 << id), !use_busif << id); =20 /* * SSI_MODE1 / SSI_MODE2 @@ -510,6 +519,8 @@ int rsnd_ssiu_probe(struct rsnd_priv *priv) { struct device *dev =3D rsnd_priv_to_dev(priv); struct device_node *node __free(device_node) =3D rsnd_ssiu_of_node(priv); + struct reset_control *rstc; + struct rsnd_ssiu_ctrl *ctrl; struct rsnd_ssiu *ssiu; struct rsnd_mod_ops *ops; const int *list =3D NULL; @@ -534,8 +545,15 @@ int rsnd_ssiu_probe(struct rsnd_priv *priv) if (!ssiu) return -ENOMEM; =20 + ctrl =3D devm_kzalloc(dev, sizeof(*ctrl), GFP_KERNEL); + if (!ctrl) + return -ENOMEM; + + ctrl->busif_status_count =3D rsnd_flags_has(priv, RSND_SSIU_BUSIF_STATUS_= COUNT_2) ? 2 : 4; + priv->ssiu =3D ssiu; priv->ssiu_nr =3D nr; + priv->ssiu_ctrl =3D ctrl; =20 if (rsnd_is_gen1(priv)) ops =3D &rsnd_ssiu_ops_gen1; @@ -558,12 +576,21 @@ int rsnd_ssiu_probe(struct rsnd_priv *priv) } else if (rsnd_is_gen4(priv)) { list =3D gen4_id; nr =3D ARRAY_SIZE(gen4_id); + } else if (rsnd_is_rzg3e(priv)) { + list =3D rzg3e_id; + nr =3D ARRAY_SIZE(rzg3e_id); } else { dev_err(dev, "unknown SSIU\n"); return -ENODEV; } } =20 + /* Acquire shared reset once for all SSIU modules */ + rstc =3D devm_reset_control_get_optional_shared(dev, "ssi-all"); + if (IS_ERR(rstc)) + return dev_err_probe(dev, PTR_ERR(rstc), + "failed to get ssi-all reset\n"); + for_each_rsnd_ssiu(ssiu, priv, i) { int ret; =20 @@ -586,7 +613,7 @@ int rsnd_ssiu_probe(struct rsnd_priv *priv) } =20 ret =3D rsnd_mod_init(priv, rsnd_mod_get(ssiu), - ops, NULL, NULL, RSND_MOD_SSIU, i); + ops, NULL, rstc, RSND_MOD_SSIU, i); if (ret) return ret; } --=20 2.25.1 From nobody Mon Jun 15 09:40:21 2026 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 3F8D23A8757; Thu, 9 Apr 2026 09:04:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725482; cv=none; b=O5iOZhrOATs7vu/SHIAD7WFovZ6OgyHNE1d0KBy/wee8MeNr5o2g8pyf/1uO/3hWSy/mp/tAR7xNpKTEW3AwgR1d73dfmkxHgc0SL6tB+AH+DMAM74++Z7UI/HLgB8PiCtNHth36gYjG0FX8auztoT4lJz5Bcm6eAxtPPuSBQpE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725482; c=relaxed/simple; bh=b6cGncZF1W8idU5Qzn0Zzj+UloY2Y6USJdbVejWKi40=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QXwHCN5jD0ABA4mv9dV6NIf0JUp4T8XUijV0YDFziRVeK8DgzspFVICqX5Dh13a2x3QLNhMHWldfSian2wc/s5+ocHJ+OiCZu3mju4XzNiQmt8RWGyQ6IkuRW7sKjdl76UoD2kjDLMfkcvnK1JSAFJOYjYjuMXm18HFotGldiNg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: wmcGC9ZhTpWK5Om4CAhT2g== X-CSE-MsgGUID: U9ASP4QXTZyo1h19wHv5wg== Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 09 Apr 2026 18:04:41 +0900 Received: from ubuntu.adwin.renesas.com (unknown [10.226.92.218]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 373C34015D82; Thu, 9 Apr 2026 18:04:34 +0900 (JST) From: John Madieu To: Kuninori Morimoto , Mark Brown , Liam Girdwood , Geert Uytterhoeven Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Magnus Damm , Philipp Zabel , Claudiu Beznea , Biju Das , john.madieu@gmail.com, linux-sound@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, John Madieu Subject: [PATCH v4 08/12] ASoC: rsnd: Add SSI reset support for RZ/G3E platforms Date: Thu, 9 Apr 2026 11:02:57 +0200 Message-ID: <20260409090302.2243305-9-john.madieu.xa@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> References: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add SSI reset support for the Renesas RZ/G3E SoC, which differs from earlier generations in several ways: - The SSI block always operates in BUSIF mode; RZ/G3E does not implement the SSITDR/SSIRDR registers used by R-Car Gen2/Gen3/Gen4 for direct SSI DMA. Consequently, for the RZ/G3E, all audio data must pass through BUSIF. PIO mode remains available for R-Car Gen2/Gen3/Gen4 platforms. - Each SSI instance has its own reset line, exposed using per-SSI names such as "ssi0", "ssi1", etc., rather than a single shared reset. To support these differences, rsnd_ssi_use_busif() always return 1 on RZ/G3E, ensuring that the driver consistently selects the BUSIF DMA path. While at it, update the reset acquisition logic to request the appropriate per-SSI reset controller based on the SSI instance name. Signed-off-by: John Madieu --- Changes: =20 v4: - Clarify in commit message that PIO mode remains available on R-Car Gen2/Gen3/Gen4 platforms v3: No changes v2: No changes sound/soc/renesas/rcar/ssi.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/sound/soc/renesas/rcar/ssi.c b/sound/soc/renesas/rcar/ssi.c index c06cebb36170..c65435551283 100644 --- a/sound/soc/renesas/rcar/ssi.c +++ b/sound/soc/renesas/rcar/ssi.c @@ -1158,6 +1158,7 @@ int __rsnd_ssi_is_pin_sharing(struct rsnd_mod *mod) =20 int rsnd_ssi_probe(struct rsnd_priv *priv) { + struct reset_control *rstc; struct device_node *node; struct device *dev =3D rsnd_priv_to_dev(priv); struct rsnd_mod_ops *ops; @@ -1207,6 +1208,16 @@ int rsnd_ssi_probe(struct rsnd_priv *priv) goto rsnd_ssi_probe_done; } =20 + /* + * RZ/G3E uses per-SSI reset controllers. + * R-Car platforms typically don't have SSI reset controls. + */ + rstc =3D devm_reset_control_get_optional(dev, name); + if (IS_ERR(rstc)) { + ret =3D PTR_ERR(rstc); + goto rsnd_ssi_probe_done; + } + if (of_property_read_bool(np, "shared-pin")) rsnd_flags_set(ssi, RSND_SSI_CLK_PIN_SHARE); =20 @@ -1225,7 +1236,7 @@ int rsnd_ssi_probe(struct rsnd_priv *priv) ops =3D &rsnd_ssi_dma_ops; =20 ret =3D rsnd_mod_init(priv, rsnd_mod_get(ssi), ops, clk, - NULL, RSND_MOD_SSI, i); + rstc, RSND_MOD_SSI, i); if (ret) goto rsnd_ssi_probe_done; =20 --=20 2.25.1 From nobody Mon Jun 15 09:40:21 2026 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B02173A8FEA; Thu, 9 Apr 2026 09:04:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725489; cv=none; b=nodRLJzXBu0bhG++dslhXDMFlI9OteNgu/NCNJ3xB7YBr9tL0pbVek7h3tLo2Ci65442mYwHLRcaRIdAO+IXtfV1g+22wnMmKf0SL5x2OZjb2ZEFMOJ3bqZI60Vi9c6BuBy0cVo3MviTM0qZCCq+WTAtsiPiUCFSXEcIDMBRe28= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725489; c=relaxed/simple; bh=OY1miL1Qg3i6xM35MRzgYqSgdOqtFnW54Gi9iW9ZcTE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=pAEwvOEmBI1psxcg93rs5tAdyS3wx/4oqnbPsmPbd9AHNsM77qok3Rxc3M+7WFwY8F/LOA46Pb4N68pfVG6OY8AcPI4zFeG2Zt0oGeEcSSuEC9VEB05zywI3saEj5NQKhsguEM2vV0avP7mdLSj4Z+wK5opU1hJAPOO7uNNcDUU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: E4bs7u+lS/i0dgkEsTJluw== X-CSE-MsgGUID: AnG8+Kt9QAqqB0ika975aA== Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 09 Apr 2026 18:04:47 +0900 Received: from ubuntu.adwin.renesas.com (unknown [10.226.92.218]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 8C9B54015FC2; Thu, 9 Apr 2026 18:04:41 +0900 (JST) From: John Madieu To: Kuninori Morimoto , Mark Brown , Liam Girdwood , Geert Uytterhoeven Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Magnus Damm , Philipp Zabel , Claudiu Beznea , Biju Das , john.madieu@gmail.com, linux-sound@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, John Madieu Subject: [PATCH v4 09/12] ASoC: rsnd: Add ADG reset support for RZ/G3E Date: Thu, 9 Apr 2026 11:02:58 +0200 Message-ID: <20260409090302.2243305-10-john.madieu.xa@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> References: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" RZ/G3E requires the ADG reset line to be deasserted for the audio subsystem to operate. The ADG module clock is already managed via rsnd_adg_clk_enable/disable() through adg->adg, so no additional clock handling is needed. Add support for the optional "adg" reset control on Renesas RZ/G3E SoC. Signed-off-by: John Madieu --- Changes: =20 v4: - Collapse dev_err_probe() and rsnd_mod_init() calls to single lines v3: No changes v2: No changes sound/soc/renesas/rcar/adg.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sound/soc/renesas/rcar/adg.c b/sound/soc/renesas/rcar/adg.c index 0105c60a144e..813ad5eabba6 100644 --- a/sound/soc/renesas/rcar/adg.c +++ b/sound/soc/renesas/rcar/adg.c @@ -771,6 +771,7 @@ void rsnd_adg_clk_dbg_info(struct rsnd_priv *priv, stru= ct seq_file *m) =20 int rsnd_adg_probe(struct rsnd_priv *priv) { + struct reset_control *rstc; struct rsnd_adg *adg; struct device *dev =3D rsnd_priv_to_dev(priv); int ret; @@ -779,8 +780,11 @@ int rsnd_adg_probe(struct rsnd_priv *priv) if (!adg) return -ENOMEM; =20 - ret =3D rsnd_mod_init(priv, &adg->mod, &adg_ops, - NULL, NULL, 0, 0); + rstc =3D devm_reset_control_get_optional_exclusive(dev, "adg"); + if (IS_ERR(rstc)) + return dev_err_probe(dev, PTR_ERR(rstc), "failed to get adg reset\n"); + + ret =3D rsnd_mod_init(priv, &adg->mod, &adg_ops, NULL, rstc, 0, 0); if (ret) return ret; =20 --=20 2.25.1 From nobody Mon Jun 15 09:40:21 2026 Received: from relmlie6.idc.renesas.com (relmlor2.renesas.com [210.160.252.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 981CC3AC0F6; Thu, 9 Apr 2026 09:04:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725495; cv=none; b=V6XwRFed1A/JMjSzSWgzkTv15ZTAsOGbOv9WJaiDAYNayqV17ryCzML3F+kvHqjJVfjSKQmLuIq2JIN/tYd0OrAZkM3OTueJED5UsZn2fUNbl9X9NH62fOVIr8pxEojo53fgqIn/u63viACnpE1CdOfUnYxa9GeeRAiJs9deQSE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725495; c=relaxed/simple; bh=EC2ieDAPT4FNKIi/vsfmuia2yJOVr0mu0NdDoJhAWyk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=MI4jq6zQyFGVKLz2YUwfTcWZcgLG2r7d8KR7D3zoQbJcANh/gx5cRkCuUF8R4ugCuv/O+xH5KWda3AhPg8VTOljYyr7t4LWvfm0lvi+rcSycxjmmkMtiFrMhje4+mvu59Cqs5utRHJ/+MSlj48p6YOECSp6KZebMl1DYXDDU/So= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: J4igTsJ8QTOLLbjGJ4OOLg== X-CSE-MsgGUID: tErgP0HQQHm7BpYs20ZjNw== Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie6.idc.renesas.com with ESMTP; 09 Apr 2026 18:04:53 +0900 Received: from ubuntu.adwin.renesas.com (unknown [10.226.92.218]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 08E474015FC4; Thu, 9 Apr 2026 18:04:47 +0900 (JST) From: John Madieu To: Kuninori Morimoto , Mark Brown , Liam Girdwood , Geert Uytterhoeven Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Magnus Damm , Philipp Zabel , Claudiu Beznea , Biju Das , john.madieu@gmail.com, linux-sound@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, John Madieu Subject: [PATCH v4 10/12] ASoC: rsnd: adg: Add per-SSI ADG and SSIF supply clock management Date: Thu, 9 Apr 2026 11:02:59 +0200 Message-ID: <20260409090302.2243305-11-john.madieu.xa@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> References: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" RZ/G3E's ADG module requires explicit clock management for SSI audio interfaces that differs from R-Car Gen2/Gen3/Gen4: - Per-SSI ADG clocks (adg.ssi.N) for each SSI module - A shared SSIF supply clock for the SSI subsystem These clocks are acquired using optional APIs, making them transparent to platforms that do not require them. Clock prepare/unprepare is handled in rsnd_adg_clk_control(), which is called from probe, remove, suspend and resume (all sleepable contexts). The trigger path (atomic context) only calls clk_enable/clk_disable, which is atomic-safe and requires no additional splitting. Signed-off-by: John Madieu --- v4: - Move clk_prepare/unprepare for per-SSI ADG and SSIF supply clocks into rsnd_adg_clk_control() instead of separate prepare/unprepare functions, centralizing clock lifecycle management - Return proper errors on clk_enable() failure instead of dev_warn() - Eliminates hw_params prepare leak concern since prepare now happens once at probe/resume v3: No changes v2: - Split clock handling into prepare/enable phases for atomic context safety sound/soc/renesas/rcar/adg.c | 91 +++++++++++++++++++++++++++++++++++- 1 file changed, 89 insertions(+), 2 deletions(-) diff --git a/sound/soc/renesas/rcar/adg.c b/sound/soc/renesas/rcar/adg.c index 813ad5eabba6..9cae3bbefa55 100644 --- a/sound/soc/renesas/rcar/adg.c +++ b/sound/soc/renesas/rcar/adg.c @@ -19,6 +19,9 @@ #define CLKOUT3 3 #define CLKOUTMAX 4 =20 +/* Maximum SSI count for per-SSI clocks */ +#define ADG_SSI_MAX 10 + #define BRGCKR_31 (1 << 31) #define BRRx_MASK(x) (0x3FF & x) =20 @@ -34,6 +37,9 @@ struct rsnd_adg { struct clk *adg; struct clk *clkin[CLKINMAX]; struct clk *clkout[CLKOUTMAX]; + /* RZ/G3E: per-SSI ADG clocks (adg.ssi.0 through adg.ssi.9) */ + struct clk *clk_adg_ssi[ADG_SSI_MAX]; + struct clk *clk_ssif_supply; struct clk *null_clk; struct clk_onecell_data onecell; struct rsnd_mod mod; @@ -343,8 +349,16 @@ int rsnd_adg_clk_query(struct rsnd_priv *priv, unsigne= d int rate) =20 int rsnd_adg_ssi_clk_stop(struct rsnd_mod *ssi_mod) { + struct rsnd_priv *priv =3D rsnd_mod_to_priv(ssi_mod); + struct rsnd_adg *adg =3D rsnd_priv_to_adg(priv); + int id =3D rsnd_mod_id(ssi_mod); + rsnd_adg_set_ssi_clk(ssi_mod, 0); =20 + /* RZ/G3E: only disable here, unprepare is done in hw_free */ + clk_disable(adg->clk_adg_ssi[id]); + clk_disable(adg->clk_ssif_supply); + return 0; } =20 @@ -354,7 +368,8 @@ int rsnd_adg_ssi_clk_try_start(struct rsnd_mod *ssi_mod= , unsigned int rate) struct rsnd_adg *adg =3D rsnd_priv_to_adg(priv); struct device *dev =3D rsnd_priv_to_dev(priv); struct rsnd_mod *adg_mod =3D rsnd_mod_get(adg); - int data; + int id =3D rsnd_mod_id(ssi_mod); + int ret, data; u32 ckr =3D 0; =20 data =3D rsnd_adg_clk_query(priv, rate); @@ -376,6 +391,22 @@ int rsnd_adg_ssi_clk_try_start(struct rsnd_mod *ssi_mo= d, unsigned int rate) (ckr) ? adg->brg_rate[ADG_HZ_48] : adg->brg_rate[ADG_HZ_441]); =20 + /* + * RZ/G3E: enable per-SSI and supply clocks + */ + ret =3D clk_enable(adg->clk_adg_ssi[id]); + if (ret) { + dev_err(dev, "Cannot enable adg.ssi.%d ADG clock\n", id); + return ret; + } + + ret =3D clk_enable(adg->clk_ssif_supply); + if (ret) { + dev_err(dev, "Cannot enable SSIF supply clock\n"); + clk_disable(adg->clk_adg_ssi[id]); + return ret; + } + return 0; } =20 @@ -424,9 +455,35 @@ int rsnd_adg_clk_control(struct rsnd_priv *priv, int e= nable) if (ret < 0) rsnd_adg_clk_disable(priv); =20 + /* RZ/G3E: per-SSI ADG and SSIF supply clocks */ + if (enable) { + for (i =3D 0; i < ADG_SSI_MAX; i++) { + ret =3D clk_prepare(adg->clk_adg_ssi[i]); + if (ret < 0) { + while (--i >=3D 0) + clk_unprepare(adg->clk_adg_ssi[i]); + rsnd_adg_clk_disable(priv); + return ret; + } + } + ret =3D clk_prepare(adg->clk_ssif_supply); + if (ret < 0) { + for (i =3D 0; i < ADG_SSI_MAX; i++) + clk_unprepare(adg->clk_adg_ssi[i]); + rsnd_adg_clk_disable(priv); + return ret; + } + } + /* disable adg */ - if (!enable) + if (!enable) { + /* RZ/G3E: unprepare per-SSI and supply clocks */ + clk_unprepare(adg->clk_ssif_supply); + for (i =3D 0; i < ADG_SSI_MAX; i++) + clk_unprepare(adg->clk_adg_ssi[i]); + clk_disable_unprepare(adg->adg); + } =20 return ret; } @@ -769,6 +826,31 @@ void rsnd_adg_clk_dbg_info(struct rsnd_priv *priv, str= uct seq_file *m) #define rsnd_adg_clk_dbg_info(priv, m) #endif =20 +static int rsnd_adg_get_ssi_clks(struct rsnd_priv *priv) +{ + struct rsnd_adg *adg =3D rsnd_priv_to_adg(priv); + struct device *dev =3D rsnd_priv_to_dev(priv); + char name[16]; + int i; + + /* SSIF supply clock */ + adg->clk_ssif_supply =3D devm_clk_get_optional(dev, "ssif_supply"); + if (IS_ERR(adg->clk_ssif_supply)) + return dev_err_probe(dev, PTR_ERR(adg->clk_ssif_supply), + "failed to get ssif_supply clock\n"); + + /* Per-SSI ADG clocks */ + for (i =3D 0; i < ADG_SSI_MAX; i++) { + snprintf(name, sizeof(name), "adg.ssi.%d", i); + adg->clk_adg_ssi[i] =3D devm_clk_get_optional(dev, name); + if (IS_ERR(adg->clk_adg_ssi[i])) + return dev_err_probe(dev, PTR_ERR(adg->clk_adg_ssi[i]), + "failed to get %s clock\n", name); + } + + return 0; +} + int rsnd_adg_probe(struct rsnd_priv *priv) { struct reset_control *rstc; @@ -798,6 +880,11 @@ int rsnd_adg_probe(struct rsnd_priv *priv) if (ret) return ret; =20 + /* RZ/G3E-specific: per-SSI ADG and SSIF supply clocks */ + ret =3D rsnd_adg_get_ssi_clks(priv); + if (ret) + return ret; + ret =3D rsnd_adg_clk_enable(priv); if (ret) return ret; --=20 2.25.1 From nobody Mon Jun 15 09:40:21 2026 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id F24C93A9DA6; Thu, 9 Apr 2026 09:04:59 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725501; cv=none; b=tagdD5t2DTmY/Z7JTG4ceb3po3qYNJ2zXUlaI9s7Um0/MAjkW/B62D48i6dIvntD6Wkipd+DZxyg8EI/l7w+8KUgXJW33yy2IG1wi4RN8rMza6y11rgrrva4/r4j3+hbROKLsQkndhviEszmm44c2f3dpOjmayAOQhaAgloBWuY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725501; c=relaxed/simple; bh=cLGLr+r89gQqbTNIHaqbN911i6HiTCoOhoRnMMvrI8M=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TTDPOByAa1WNl2DNjnIJSyBOnsp8W2/XHpuLHqZO7ZDmPwN98443VOdmFTER8+e4n1Inv4BZjJUNT1oGIdqt6QpvbiaWcIvsPCrW3fi1si20hT+vqoHRaUgvipRHmy0s8m5MbzH8km+nNghZcS4KmUNUDiwmqTOnrrMEbFNUilA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: OL/D5ys5RqauwuWJnhvYLw== X-CSE-MsgGUID: VybBkJ10QCu+BfFIT1j71A== Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 09 Apr 2026 18:04:59 +0900 Received: from ubuntu.adwin.renesas.com (unknown [10.226.92.218]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 031C74015D82; Thu, 9 Apr 2026 18:04:53 +0900 (JST) From: John Madieu To: Kuninori Morimoto , Mark Brown , Liam Girdwood , Geert Uytterhoeven Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Magnus Damm , Philipp Zabel , Claudiu Beznea , Biju Das , john.madieu@gmail.com, linux-sound@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, John Madieu Subject: [PATCH v4 11/12] ASoC: rsnd: src: Add SRC reset and clock support for RZ/G3E Date: Thu, 9 Apr 2026 11:03:00 +0200 Message-ID: <20260409090302.2243305-12-john.madieu.xa@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> References: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The RZ/G3E SoC requires explicit SCU (Sampling Rate Converter Unit) reset and clock management unlike previous R-Car generations: - scu_clk: SCU module clock - scu_clkx2: SCU double-rate clock - scu_supply_clk: SCU supply clock Without these clocks enabled, the SRC module cannot operate on RZ/G3E. Add support for the shared SCU reset controller used by the SRC modules on the Renesas RZ/G3E SoC. All SRC instances are gated by the same "scu" reset line. Signed-off-by: John Madieu --- Changes: =20 v4: - Move shared SCU clocks (scu, scu_x2, scu_supply) from rsnd_priv variables into new struct rsnd_src_ctrl, following the rsnd_dma_ctrl pattern for shared non-per-instance module resources - Keep original declaration order for struct device_node *node v3: No changes v2: No changes sound/soc/renesas/rcar/rsnd.h | 1 + sound/soc/renesas/rcar/src.c | 59 ++++++++++++++++++++++++++++++++++- 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/sound/soc/renesas/rcar/rsnd.h b/sound/soc/renesas/rcar/rsnd.h index 5cf35a1f3e45..8f8e86cb6e62 100644 --- a/sound/soc/renesas/rcar/rsnd.h +++ b/sound/soc/renesas/rcar/rsnd.h @@ -680,6 +680,7 @@ struct rsnd_priv { /* * below value will be filled on rsnd_src_probe() */ + void *src_ctrl; void *src; int src_nr; =20 diff --git a/sound/soc/renesas/rcar/src.c b/sound/soc/renesas/rcar/src.c index 8b58cc20e7a8..651ed378c4f7 100644 --- a/sound/soc/renesas/rcar/src.c +++ b/sound/soc/renesas/rcar/src.c @@ -54,6 +54,14 @@ struct rsnd_src { ((pos) =3D (struct rsnd_src *)(priv)->src + i); \ i++) =20 +struct rsnd_src_ctrl { + struct clk *scu; + struct clk *scu_x2; + struct clk *scu_supply; +}; + +#define rsnd_priv_to_src_ctrl(priv) \ + ((struct rsnd_src_ctrl *)(priv)->src_ctrl) =20 /* * image of SRC (Sampling Rate Converter) @@ -516,6 +524,7 @@ static int rsnd_src_init(struct rsnd_mod *mod, struct rsnd_priv *priv) { struct rsnd_src *src =3D rsnd_mod_to_src(mod); + struct device *dev =3D rsnd_priv_to_dev(priv); int ret; =20 /* reset sync convert_rate */ @@ -526,6 +535,12 @@ static int rsnd_src_init(struct rsnd_mod *mod, if (ret < 0) return ret; =20 + ret =3D clk_prepare_enable(rsnd_priv_to_src_ctrl(priv)->scu_supply); + if (ret) { + dev_err(dev, "Cannot enable scu_supply_clk\n"); + return ret; + } + rsnd_src_activation(mod); =20 rsnd_src_init_convert_rate(io, mod); @@ -549,6 +564,8 @@ static int rsnd_src_quit(struct rsnd_mod *mod, src->sync.val =3D src->current_sync_rate =3D 0; =20 + clk_disable_unprepare(rsnd_priv_to_src_ctrl(priv)->scu_supply); + return 0; } =20 @@ -713,6 +730,8 @@ int rsnd_src_probe(struct rsnd_priv *priv) { struct device_node *node; struct device *dev =3D rsnd_priv_to_dev(priv); + struct reset_control *rstc; + struct rsnd_src_ctrl *src_ctrl; struct rsnd_src *src; struct clk *clk; char name[RSND_SRC_NAME_SIZE]; @@ -728,6 +747,12 @@ int rsnd_src_probe(struct rsnd_priv *priv) goto rsnd_src_probe_done; } =20 + src_ctrl =3D devm_kzalloc(dev, sizeof(*src_ctrl), GFP_KERNEL); + if (!src_ctrl) { + ret =3D -ENOMEM; + goto rsnd_src_probe_done; + } + src =3D devm_kcalloc(dev, nr, sizeof(*src), GFP_KERNEL); if (!src) { ret =3D -ENOMEM; @@ -736,6 +761,28 @@ int rsnd_src_probe(struct rsnd_priv *priv) =20 priv->src_nr =3D nr; priv->src =3D src; + priv->src_ctrl =3D src_ctrl; + + src_ctrl->scu =3D devm_clk_get_optional_enabled(dev, "scu"); + if (IS_ERR(src_ctrl->scu)) { + ret =3D dev_err_probe(dev, PTR_ERR(src_ctrl->scu), + "failed to get scu clock\n"); + goto rsnd_src_probe_done; + } + + src_ctrl->scu_x2 =3D devm_clk_get_optional_enabled(dev, "scu_x2"); + if (IS_ERR(src_ctrl->scu_x2)) { + ret =3D dev_err_probe(dev, PTR_ERR(src_ctrl->scu_x2), + "failed to get scu_x2 clock\n"); + goto rsnd_src_probe_done; + } + + src_ctrl->scu_supply =3D devm_clk_get_optional(dev, "scu_supply"); + if (IS_ERR(src_ctrl->scu_supply)) { + ret =3D dev_err_probe(dev, PTR_ERR(src_ctrl->scu_supply), + "failed to get scu_supply clock\n"); + goto rsnd_src_probe_done; + } =20 i =3D 0; for_each_child_of_node_scoped(node, np) { @@ -759,6 +806,16 @@ int rsnd_src_probe(struct rsnd_priv *priv) goto rsnd_src_probe_done; } =20 + /* + * RZ/G3E uses a shared SCU reset controller for all SRC modules. + * R-Car platforms typically don't have SRC reset controls. + */ + rstc =3D devm_reset_control_get_optional_shared(dev, "scu"); + if (IS_ERR(rstc)) { + ret =3D PTR_ERR(rstc); + goto rsnd_src_probe_done; + } + clk =3D devm_clk_get(dev, name); if (IS_ERR(clk)) { ret =3D PTR_ERR(clk); @@ -766,7 +823,7 @@ int rsnd_src_probe(struct rsnd_priv *priv) } =20 ret =3D rsnd_mod_init(priv, rsnd_mod_get(src), - &rsnd_src_ops, clk, NULL, RSND_MOD_SRC, i); + &rsnd_src_ops, clk, rstc, RSND_MOD_SRC, i); if (ret) goto rsnd_src_probe_done; =20 --=20 2.25.1 From nobody Mon Jun 15 09:40:21 2026 Received: from relmlie5.idc.renesas.com (relmlor1.renesas.com [210.160.252.171]) by smtp.subspace.kernel.org (Postfix) with ESMTP id AA29A3A8FF6; Thu, 9 Apr 2026 09:05:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.160.252.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725507; cv=none; b=Zbbah8N8lDhducEXwjRfJFlsuDxMMq21nqNHVgGYQvctcOJZ5n5hs+5R3SL9ZoTk9IaIG2L1EuuPoUqaUGKMXa2RBiX6FT/u9duuyIOubuPJSwtv7ZNCN22nJBydQHXMJJ1bEuJv/62csSDZg7zhzNBn5Q9GC/Oba0e77duKk5s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1775725507; c=relaxed/simple; bh=jFEeeJw53ejQ1F9bOIGt9cktS/3dF0GiHEJoYEMvEOs=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kbqzgawt6MxspNUvfZ0TC+8o9V5Q970WAhxqMMOCcevkx/jIGG2yp1rHuvHUxJas1mC4HKlrHN8cdQuF+wFOtj31PISm9RTxF7iOjMcdBrTzhMKDpU4+VBkrYkDCELc9LHn55CaZdmQe40y5cUMzFTt6UoKvFOWRRT/vfds8fDg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com; spf=pass smtp.mailfrom=bp.renesas.com; arc=none smtp.client-ip=210.160.252.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=bp.renesas.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=bp.renesas.com X-CSE-ConnectionGUID: odRpacj5Q0un0Dndzis7Lg== X-CSE-MsgGUID: PUW8TekuSTC0B8d3AQlRdA== Received: from unknown (HELO relmlir5.idc.renesas.com) ([10.200.68.151]) by relmlie5.idc.renesas.com with ESMTP; 09 Apr 2026 18:05:05 +0900 Received: from ubuntu.adwin.renesas.com (unknown [10.226.92.218]) by relmlir5.idc.renesas.com (Postfix) with ESMTP id 012A34015D82; Thu, 9 Apr 2026 18:04:59 +0900 (JST) From: John Madieu To: Kuninori Morimoto , Mark Brown , Liam Girdwood , Geert Uytterhoeven Cc: Rob Herring , Krzysztof Kozlowski , Conor Dooley , Jaroslav Kysela , Takashi Iwai , Magnus Damm , Philipp Zabel , Claudiu Beznea , Biju Das , john.madieu@gmail.com, linux-sound@vger.kernel.org, linux-renesas-soc@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, John Madieu Subject: [PATCH v4 12/12] ASoC: rsnd: Add system suspend/resume support Date: Thu, 9 Apr 2026 11:03:01 +0200 Message-ID: <20260409090302.2243305-13-john.madieu.xa@bp.renesas.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> References: <20260409090302.2243305-1-john.madieu.xa@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Add per-module suspend/resume functions following the existing driver architecture where each module manages its own resources in its own file. core.c provides common clock/reset helpers and orchestrates the calls in the correct order (reverse probe for suspend, probe order for resume). Infrastructure clocks (ADG, audmacpp, SCU) are managed globally using optional APIs to remain transparent to platforms that don't specify these clocks/resets. Signed-off-by: John Madieu --- Changes: =20 v4: - Absorb rsnd_adg_mod_get() helper directly instead of a separate preparatory patch - Distribute suspend/resume declarations into their respective IP sections in rsnd.h v3: No changes v2: - Distribute suspend/resume into per-module files (ssi.c, ssiu.c, src.c, ctu.c, mix.c, dvc.c, adg.c, dma.c) instead of monolithic loops in core.c, following Morimoto-san's architecture suggestion sound/soc/renesas/rcar/adg.c | 26 +++++++++++++++++++++ sound/soc/renesas/rcar/core.c | 43 +++++++++++++++++++++++++++++++++-- sound/soc/renesas/rcar/ctu.c | 20 ++++++++++++++++ sound/soc/renesas/rcar/dma.c | 20 ++++++++++++++++ sound/soc/renesas/rcar/dvc.c | 20 ++++++++++++++++ sound/soc/renesas/rcar/mix.c | 20 ++++++++++++++++ sound/soc/renesas/rcar/rsnd.h | 18 +++++++++++++++ sound/soc/renesas/rcar/src.c | 26 +++++++++++++++++++++ sound/soc/renesas/rcar/ssi.c | 20 ++++++++++++++++ sound/soc/renesas/rcar/ssiu.c | 20 ++++++++++++++++ 10 files changed, 231 insertions(+), 2 deletions(-) diff --git a/sound/soc/renesas/rcar/adg.c b/sound/soc/renesas/rcar/adg.c index 9cae3bbefa55..8c0c8bc92ab3 100644 --- a/sound/soc/renesas/rcar/adg.c +++ b/sound/soc/renesas/rcar/adg.c @@ -908,3 +908,29 @@ void rsnd_adg_remove(struct rsnd_priv *priv) /* It should be called after rsnd_adg_clk_disable() */ rsnd_adg_null_clk_clean(priv); } + +static struct rsnd_mod *rsnd_adg_mod_get(struct rsnd_priv *priv) +{ + struct rsnd_adg *adg =3D rsnd_priv_to_adg(priv); + + if (!adg) + return NULL; + + return rsnd_mod_get(adg); +} + +void rsnd_adg_suspend(struct rsnd_priv *priv) +{ + struct rsnd_mod *mod =3D rsnd_adg_mod_get(priv); + + if (mod) + rsnd_suspend_clk_reset(mod->clk, mod->rstc); +} + +void rsnd_adg_resume(struct rsnd_priv *priv) +{ + struct rsnd_mod *mod =3D rsnd_adg_mod_get(priv); + + if (mod) + rsnd_resume_clk_reset(mod->clk, mod->rstc); +} diff --git a/sound/soc/renesas/rcar/core.c b/sound/soc/renesas/rcar/core.c index cb31af8a34d4..cb7fb26f8972 100644 --- a/sound/soc/renesas/rcar/core.c +++ b/sound/soc/renesas/rcar/core.c @@ -963,7 +963,8 @@ static int rsnd_soc_hw_rule_channels(struct snd_pcm_hw_= params *params, static const struct snd_pcm_hardware rsnd_pcm_hardware =3D { .info =3D SNDRV_PCM_INFO_INTERLEAVED | SNDRV_PCM_INFO_MMAP | - SNDRV_PCM_INFO_MMAP_VALID, + SNDRV_PCM_INFO_MMAP_VALID | + SNDRV_PCM_INFO_RESUME, .buffer_bytes_max =3D 64 * 1024, .period_bytes_min =3D 32, .period_bytes_max =3D 8192, @@ -2059,11 +2060,35 @@ static void rsnd_remove(struct platform_device *pde= v) remove_func[i](priv); } =20 +void rsnd_suspend_clk_reset(struct clk *clk, struct reset_control *rstc) +{ + clk_unprepare(clk); + reset_control_assert(rstc); +} + +void rsnd_resume_clk_reset(struct clk *clk, struct reset_control *rstc) +{ + reset_control_deassert(rstc); + clk_prepare(clk); +} + static int rsnd_suspend(struct device *dev) { struct rsnd_priv *priv =3D dev_get_drvdata(dev); =20 + /* + * Reverse order of probe: + * ADG -> DVC -> MIX -> CTU -> SRC -> SSIU -> SSI -> DMA + */ rsnd_adg_clk_disable(priv); + rsnd_adg_suspend(priv); + rsnd_dvc_suspend(priv); + rsnd_mix_suspend(priv); + rsnd_ctu_suspend(priv); + rsnd_src_suspend(priv); + rsnd_ssiu_suspend(priv); + rsnd_ssi_suspend(priv); + rsnd_dma_suspend(priv); =20 return 0; } @@ -2072,7 +2097,21 @@ static int rsnd_resume(struct device *dev) { struct rsnd_priv *priv =3D dev_get_drvdata(dev); =20 - return rsnd_adg_clk_enable(priv); + /* + * Same order as probe: + * DMA -> SSI -> SSIU -> SRC -> CTU -> MIX -> DVC -> ADG + */ + rsnd_dma_resume(priv); + rsnd_ssi_resume(priv); + rsnd_ssiu_resume(priv); + rsnd_src_resume(priv); + rsnd_ctu_resume(priv); + rsnd_mix_resume(priv); + rsnd_dvc_resume(priv); + rsnd_adg_resume(priv); + rsnd_adg_clk_enable(priv); + + return 0; } =20 static const struct dev_pm_ops rsnd_pm_ops =3D { diff --git a/sound/soc/renesas/rcar/ctu.c b/sound/soc/renesas/rcar/ctu.c index 81bba6a1af6e..73795d5b2817 100644 --- a/sound/soc/renesas/rcar/ctu.c +++ b/sound/soc/renesas/rcar/ctu.c @@ -383,3 +383,23 @@ void rsnd_ctu_remove(struct rsnd_priv *priv) rsnd_mod_quit(rsnd_mod_get(ctu)); } } + +void rsnd_ctu_suspend(struct rsnd_priv *priv) +{ + struct rsnd_ctu *ctu; + int i; + + for_each_rsnd_ctu(ctu, priv, i) + rsnd_suspend_clk_reset(rsnd_mod_get(ctu)->clk, + rsnd_mod_get(ctu)->rstc); +} + +void rsnd_ctu_resume(struct rsnd_priv *priv) +{ + struct rsnd_ctu *ctu; + int i; + + for_each_rsnd_ctu(ctu, priv, i) + rsnd_resume_clk_reset(rsnd_mod_get(ctu)->clk, + rsnd_mod_get(ctu)->rstc); +} diff --git a/sound/soc/renesas/rcar/dma.c b/sound/soc/renesas/rcar/dma.c index e3278ff7e2f0..b9138c5076cb 100644 --- a/sound/soc/renesas/rcar/dma.c +++ b/sound/soc/renesas/rcar/dma.c @@ -1029,3 +1029,23 @@ int rsnd_dma_probe(struct rsnd_priv *priv) /* dummy mem mod for debug */ return rsnd_mod_init(NULL, &mem, &mem_ops, NULL, NULL, 0, 0); } + +void rsnd_dma_suspend(struct rsnd_priv *priv) +{ + struct rsnd_dma_ctrl *dmac =3D rsnd_priv_to_dmac(priv); + + if (dmac) { + clk_disable_unprepare(dmac->audmapp_clk); + rsnd_suspend_clk_reset(NULL, dmac->audmapp_rstc); + } +} + +void rsnd_dma_resume(struct rsnd_priv *priv) +{ + struct rsnd_dma_ctrl *dmac =3D rsnd_priv_to_dmac(priv); + + if (dmac) { + rsnd_resume_clk_reset(NULL, dmac->audmapp_rstc); + clk_prepare_enable(dmac->audmapp_clk); + } +} diff --git a/sound/soc/renesas/rcar/dvc.c b/sound/soc/renesas/rcar/dvc.c index bf7146ceb5f6..0e81fdf0e97b 100644 --- a/sound/soc/renesas/rcar/dvc.c +++ b/sound/soc/renesas/rcar/dvc.c @@ -386,3 +386,23 @@ void rsnd_dvc_remove(struct rsnd_priv *priv) rsnd_mod_quit(rsnd_mod_get(dvc)); } } + +void rsnd_dvc_suspend(struct rsnd_priv *priv) +{ + struct rsnd_dvc *dvc; + int i; + + for_each_rsnd_dvc(dvc, priv, i) + rsnd_suspend_clk_reset(rsnd_mod_get(dvc)->clk, + rsnd_mod_get(dvc)->rstc); +} + +void rsnd_dvc_resume(struct rsnd_priv *priv) +{ + struct rsnd_dvc *dvc; + int i; + + for_each_rsnd_dvc(dvc, priv, i) + rsnd_resume_clk_reset(rsnd_mod_get(dvc)->clk, + rsnd_mod_get(dvc)->rstc); +} diff --git a/sound/soc/renesas/rcar/mix.c b/sound/soc/renesas/rcar/mix.c index 566e9b2a488c..42bb07ade3c8 100644 --- a/sound/soc/renesas/rcar/mix.c +++ b/sound/soc/renesas/rcar/mix.c @@ -350,3 +350,23 @@ void rsnd_mix_remove(struct rsnd_priv *priv) rsnd_mod_quit(rsnd_mod_get(mix)); } } + +void rsnd_mix_suspend(struct rsnd_priv *priv) +{ + struct rsnd_mix *mix; + int i; + + for_each_rsnd_mix(mix, priv, i) + rsnd_suspend_clk_reset(rsnd_mod_get(mix)->clk, + rsnd_mod_get(mix)->rstc); +} + +void rsnd_mix_resume(struct rsnd_priv *priv) +{ + struct rsnd_mix *mix; + int i; + + for_each_rsnd_mix(mix, priv, i) + rsnd_resume_clk_reset(rsnd_mod_get(mix)->clk, + rsnd_mod_get(mix)->rstc); +} diff --git a/sound/soc/renesas/rcar/rsnd.h b/sound/soc/renesas/rcar/rsnd.h index 8f8e86cb6e62..31c501c3b024 100644 --- a/sound/soc/renesas/rcar/rsnd.h +++ b/sound/soc/renesas/rcar/rsnd.h @@ -267,6 +267,8 @@ u32 rsnd_get_busif_shift(struct rsnd_dai_stream *io, st= ruct rsnd_mod *mod); int rsnd_dma_attach(struct rsnd_dai_stream *io, struct rsnd_mod *mod, struct rsnd_mod **dma_mod); int rsnd_dma_probe(struct rsnd_priv *priv); +void rsnd_dma_suspend(struct rsnd_priv *priv); +void rsnd_dma_resume(struct rsnd_priv *priv); struct dma_chan *rsnd_dma_request_channel(struct device_node *of_node, cha= r *name, struct rsnd_mod *mod, char *x); =20 @@ -429,6 +431,8 @@ int rsnd_mod_init(struct rsnd_priv *priv, enum rsnd_mod_type type, int id); void rsnd_mod_quit(struct rsnd_mod *mod); +void rsnd_suspend_clk_reset(struct clk *clk, struct reset_control *rstc); +void rsnd_resume_clk_reset(struct clk *clk, struct reset_control *rstc); struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io, struct rsnd_mod *mod); void rsnd_mod_interrupt(struct rsnd_mod *mod, @@ -606,6 +610,8 @@ int rsnd_adg_ssi_clk_stop(struct rsnd_mod *ssi_mod); int rsnd_adg_ssi_clk_try_start(struct rsnd_mod *ssi_mod, unsigned int rate= ); int rsnd_adg_probe(struct rsnd_priv *priv); void rsnd_adg_remove(struct rsnd_priv *priv); +void rsnd_adg_suspend(struct rsnd_priv *priv); +void rsnd_adg_resume(struct rsnd_priv *priv); int rsnd_adg_set_src_timesel_gen2(struct rsnd_mod *src_mod, struct rsnd_dai_stream *io, unsigned int in_rate, @@ -804,6 +810,8 @@ extern const char * const volume_ramp_rate[]; */ int rsnd_ssi_probe(struct rsnd_priv *priv); void rsnd_ssi_remove(struct rsnd_priv *priv); +void rsnd_ssi_suspend(struct rsnd_priv *priv); +void rsnd_ssi_resume(struct rsnd_priv *priv); struct rsnd_mod *rsnd_ssi_mod_get(struct rsnd_priv *priv, int id); int rsnd_ssi_use_busif(struct rsnd_dai_stream *io); u32 rsnd_ssi_multi_secondaries_runtime(struct rsnd_dai_stream *io); @@ -827,6 +835,8 @@ int rsnd_ssiu_attach(struct rsnd_dai_stream *io, struct rsnd_mod *mod); int rsnd_ssiu_probe(struct rsnd_priv *priv); void rsnd_ssiu_remove(struct rsnd_priv *priv); +void rsnd_ssiu_suspend(struct rsnd_priv *priv); +void rsnd_ssiu_resume(struct rsnd_priv *priv); void rsnd_parse_connect_ssiu(struct rsnd_dai *rdai, struct device_node *playback, struct device_node *capture); @@ -838,6 +848,8 @@ bool rsnd_ssiu_busif_err_status_clear(struct rsnd_mod *= mod); */ int rsnd_src_probe(struct rsnd_priv *priv); void rsnd_src_remove(struct rsnd_priv *priv); +void rsnd_src_suspend(struct rsnd_priv *priv); +void rsnd_src_resume(struct rsnd_priv *priv); struct rsnd_mod *rsnd_src_mod_get(struct rsnd_priv *priv, int id); =20 #define rsnd_src_get_in_rate(priv, io) rsnd_src_get_rate(priv, io, 1) @@ -857,6 +869,8 @@ unsigned int rsnd_src_get_rate(struct rsnd_priv *priv, */ int rsnd_ctu_probe(struct rsnd_priv *priv); void rsnd_ctu_remove(struct rsnd_priv *priv); +void rsnd_ctu_suspend(struct rsnd_priv *priv); +void rsnd_ctu_resume(struct rsnd_priv *priv); struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *priv, int id); #define rsnd_ctu_of_node(priv) rsnd_parse_of_node(priv, RSND_NODE_CTU) #define rsnd_parse_connect_ctu(rdai, playback, capture) \ @@ -869,6 +883,8 @@ struct rsnd_mod *rsnd_ctu_mod_get(struct rsnd_priv *pri= v, int id); */ int rsnd_mix_probe(struct rsnd_priv *priv); void rsnd_mix_remove(struct rsnd_priv *priv); +void rsnd_mix_suspend(struct rsnd_priv *priv); +void rsnd_mix_resume(struct rsnd_priv *priv); struct rsnd_mod *rsnd_mix_mod_get(struct rsnd_priv *priv, int id); #define rsnd_mix_of_node(priv) rsnd_parse_of_node(priv, RSND_NODE_MIX) #define rsnd_parse_connect_mix(rdai, playback, capture) \ @@ -881,6 +897,8 @@ struct rsnd_mod *rsnd_mix_mod_get(struct rsnd_priv *pri= v, int id); */ int rsnd_dvc_probe(struct rsnd_priv *priv); void rsnd_dvc_remove(struct rsnd_priv *priv); +void rsnd_dvc_suspend(struct rsnd_priv *priv); +void rsnd_dvc_resume(struct rsnd_priv *priv); struct rsnd_mod *rsnd_dvc_mod_get(struct rsnd_priv *priv, int id); #define rsnd_dvc_of_node(priv) rsnd_parse_of_node(priv, RSND_NODE_DVC) #define rsnd_parse_connect_dvc(rdai, playback, capture) \ diff --git a/sound/soc/renesas/rcar/src.c b/sound/soc/renesas/rcar/src.c index 651ed378c4f7..aac749f917bf 100644 --- a/sound/soc/renesas/rcar/src.c +++ b/sound/soc/renesas/rcar/src.c @@ -848,3 +848,29 @@ void rsnd_src_remove(struct rsnd_priv *priv) rsnd_mod_quit(rsnd_mod_get(src)); } } + +void rsnd_src_suspend(struct rsnd_priv *priv) +{ + struct rsnd_src *src; + int i; + + for_each_rsnd_src(src, priv, i) + rsnd_suspend_clk_reset(rsnd_mod_get(src)->clk, + rsnd_mod_get(src)->rstc); + + clk_disable_unprepare(rsnd_priv_to_src_ctrl(priv)->scu_x2); + clk_disable_unprepare(rsnd_priv_to_src_ctrl(priv)->scu); +} + +void rsnd_src_resume(struct rsnd_priv *priv) +{ + struct rsnd_src *src; + int i; + + clk_prepare_enable(rsnd_priv_to_src_ctrl(priv)->scu); + clk_prepare_enable(rsnd_priv_to_src_ctrl(priv)->scu_x2); + + for_each_rsnd_src(src, priv, i) + rsnd_resume_clk_reset(rsnd_mod_get(src)->clk, + rsnd_mod_get(src)->rstc); +} diff --git a/sound/soc/renesas/rcar/ssi.c b/sound/soc/renesas/rcar/ssi.c index c65435551283..072e66bda9e7 100644 --- a/sound/soc/renesas/rcar/ssi.c +++ b/sound/soc/renesas/rcar/ssi.c @@ -1261,3 +1261,23 @@ void rsnd_ssi_remove(struct rsnd_priv *priv) rsnd_mod_quit(rsnd_mod_get(ssi)); } } + +void rsnd_ssi_suspend(struct rsnd_priv *priv) +{ + struct rsnd_ssi *ssi; + int i; + + for_each_rsnd_ssi(ssi, priv, i) + rsnd_suspend_clk_reset(rsnd_mod_get(ssi)->clk, + rsnd_mod_get(ssi)->rstc); +} + +void rsnd_ssi_resume(struct rsnd_priv *priv) +{ + struct rsnd_ssi *ssi; + int i; + + for_each_rsnd_ssi(ssi, priv, i) + rsnd_resume_clk_reset(rsnd_mod_get(ssi)->clk, + rsnd_mod_get(ssi)->rstc); +} diff --git a/sound/soc/renesas/rcar/ssiu.c b/sound/soc/renesas/rcar/ssiu.c index f483389868d2..83de5247d43f 100644 --- a/sound/soc/renesas/rcar/ssiu.c +++ b/sound/soc/renesas/rcar/ssiu.c @@ -630,3 +630,23 @@ void rsnd_ssiu_remove(struct rsnd_priv *priv) rsnd_mod_quit(rsnd_mod_get(ssiu)); } } + +void rsnd_ssiu_suspend(struct rsnd_priv *priv) +{ + struct rsnd_ssiu *ssiu; + int i; + + for_each_rsnd_ssiu(ssiu, priv, i) + rsnd_suspend_clk_reset(rsnd_mod_get(ssiu)->clk, + rsnd_mod_get(ssiu)->rstc); +} + +void rsnd_ssiu_resume(struct rsnd_priv *priv) +{ + struct rsnd_ssiu *ssiu; + int i; + + for_each_rsnd_ssiu(ssiu, priv, i) + rsnd_resume_clk_reset(rsnd_mod_get(ssiu)->clk, + rsnd_mod_get(ssiu)->rstc); +} --=20 2.25.1