Tegra210 audio graph card
Subsystems (4)
v5 cover Tegra210 audio graph card
This series adds audio graph based sound card support for Tegra210 platforms like Jetson-TX1 an Jetson-Nano. The following preparatory audio graph enhancement series is already merged.
* https://patchwork.kernel.org/project/alsa-devel/list/?series=375629&state=*
Following are the summary of changes:
* Add graph/audio-graph based schemas or schema updates for Tegra210 component and machine drivers.
* Add Tegra audio graph machine driver.
* Add required DT support for Jetson-TX1/Nano.
This work is based on earlier discussion of DPCM usage for Tegra and simple card driver updates.
* https://lkml.org/lkml/2020/4/30/519
* https://lkml.org/lkml/2020/6/27/4
This series has dependency over following graph and audio-graph series.
* http://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]/
* https://patchwork.kernel.org/project/alsa-devel/list/?series=382009&state=*
Changelog
=========
v4 -> v5
--------
* Audio graph related changes were sent in separate v5 series as mentioned above and are dropped from current series.
* Graph and audio graph doc patches are dropped from this series and are sent separately as mentioned above.
* Minor change with phandle label for TX1 and Nano platform DT files.
* No changes in other patches.
v3 -> v4
--------
* Added new patches to convert graph.txt and audio-graph-card.txt to corresponding json-schema files. Later these references are used in Tegra audio graph schema.
* AHUB component binding docs are updated to reflect the usage of ports/port/endpoint
* More common stuff is moved into graph_parse_of() and this is used by both generic and Tegra audio graph.
* DT binding for Tegra audio graph is updated to included "ports { }"
* As per the suggestion 'void *data' member is dropped from 'asoc_simple_priv' and instead container method is used to maintain required custom data internal to Tegra audio graph.
v2 -> v3
--------
* Dropped new compatible addition in generic graph driver after reviewing it with Morimoto-san. Instead added Tegra audio graph driver and new compatibles are added in the same.
* Added new patches to expose new members for customization in audio graph driver.
* Added new patch for Tegra audio graph driver and related documentation.
* Minor change in below commit where mutex version of helper is used "ASoC: audio-graph: Identify 'no_pcm' DAI links for DPCM"
* DT binding is updated to use the newly exposed compatibles
* No changes in other patches
v1 -> v2
--------
* Re-organized ports/endpoints description for ADMAIF and XBAR. Updated DT patches accordingly.
* After above change, multiple Codec endpoint support is not required and hence dropped for now. This will be considered separately if at all required in future.
* Re-ordered patches in the series.
Sameer Pujar (6):
ASoC: dt-bindings: tegra: Add graph bindings
ASoC: dt-bindings: tegra: Add json-schema for Tegra audio graph card
ASoC: tegra: Add audio graph based card driver
arm64: defconfig: Enable Tegra audio graph card driver
arm64: tegra: Audio graph header for Tegra210
arm64: tegra: Audio graph sound card for Jetson Nano and TX1
.../sound/nvidia,tegra-audio-graph-card.yaml | 187 +++++++++++++++ .../bindings/sound/nvidia,tegra186-dspk.yaml | 6 + .../bindings/sound/nvidia,tegra210-admaif.yaml | 6 + .../bindings/sound/nvidia,tegra210-ahub.yaml | 13 +- .../bindings/sound/nvidia,tegra210-dmic.yaml | 6 + .../bindings/sound/nvidia,tegra210-i2s.yaml | 6 + .../boot/dts/nvidia/tegra210-audio-graph.dtsi | 153 ++++++++++++ arch/arm64/boot/dts/nvidia/tegra210-p2371-2180.dts | 262 +++++++++++++++++++++ arch/arm64/boot/dts/nvidia/tegra210-p3450-0000.dts | 146 ++++++++++++ arch/arm64/configs/defconfig | 1 + sound/soc/tegra/Kconfig | 9 + sound/soc/tegra/Makefile | 2 + sound/soc/tegra/tegra_audio_graph_card.c | 255 ++++++++++++++++++++ 13 files changed, 1050 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml create mode 100644 arch/arm64/boot/dts/nvidia/tegra210-audio-graph.dtsi create mode 100644 sound/soc/tegra/tegra_audio_graph_card.c
Signature · 1 line
2.7.4
PATCH v5 1/6 ASoC: dt-bindings: tegra: Add graph bindings
Add device tree binding properties of generic graph to ASoC component devices. This allows to define audio ports out of these components or DAIs and audio graph based sound card can be realised with this.
--- .../devicetree/bindings/sound/nvidia,tegra186-dspk.yaml | 6 ++++++ .../devicetree/bindings/sound/nvidia,tegra210-admaif.yaml | 6 ++++++ .../devicetree/bindings/sound/nvidia,tegra210-ahub.yaml | 13 +++++++++++-- .../devicetree/bindings/sound/nvidia,tegra210-dmic.yaml | 6 ++++++ .../devicetree/bindings/sound/nvidia,tegra210-i2s.yaml | 6 ++++++ 5 files changed, 35 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml +6 -0
@@ -55,6 +55,12 @@ properties: The name can be "DSPK1" or "DSPKx", where x depends on the maximum available instances on a Tegra SoC. + ports: + $ref: /schemas/graph.yaml#/properties/ports + + port: + $ref: /schemas/sound/audio-graph.yaml#/properties/port + required: - compatible - reg
Documentation/devicetree/bindings/sound/nvidia,tegra210-admaif.yaml +6 -0
@@ -37,6 +37,12 @@ properties: dma-names: true + ports: + $ref: /schemas/graph.yaml#/properties/ports + + port: + $ref: /schemas/sound/audio-graph.yaml#/properties/port + if: properties: compatible:
Documentation/devicetree/bindings/sound/nvidia,tegra210-ahub.yaml +11 -2
@@ -56,6 +56,16 @@ properties: ranges: true + ports: + $ref: /schemas/graph.yaml#/properties/ports + + port: + $ref: /schemas/sound/audio-graph.yaml#/properties/port + +patternProperties: + "@[0-9a-f]+$": + type: object + required: - compatible - reg
@@ -67,8 +77,7 @@ required: - "#size-cells" - ranges -additionalProperties: - type: object +additionalProperties: false examples: - |
Documentation/devicetree/bindings/sound/nvidia,tegra210-dmic.yaml +6 -0
@@ -56,6 +56,12 @@ properties: The name can be "DMIC1" or "DMIC2" ... "DMICx", where x depends on the maximum available instances on a Tegra SoC. + ports: + $ref: /schemas/graph.yaml#/properties/ports + + port: + $ref: /schemas/sound/audio-graph.yaml#/properties/port + required: - compatible - reg
Documentation/devicetree/bindings/sound/nvidia,tegra210-i2s.yaml +6 -0
@@ -74,6 +74,12 @@ properties: The name can be "I2S1" or "I2S2" ... "I2Sx", where x depends on the maximum available instances on a Tegra SoC. + ports: + $ref: /schemas/graph.yaml#/properties/ports + + port: + $ref: /schemas/sound/audio-graph.yaml#/properties/port + required: - compatible - reg
Signature · 1 line
2.7.4
Rob Herring
maintainerRe: [PATCH v5 1/6] ASoC: dt-bindings: tegra: Add graph bindings
Quoted 3 lines · Sameer Pujar
Add device tree binding properties of generic graph to ASoC component devices. This allows to define audio ports out of these components or DAIs and audio graph based sound card can be realised with this.
This is all dependent on graph.yaml being applied which hasn't happened yet. I guess I'll need to provide a branch as there's multiple subsystems needing it.
Quoted 15 lines
Signed-off-by Sameer Pujar <[email protected]>--- .../devicetree/bindings/sound/nvidia,tegra186-dspk.yaml | 6 ++++++ .../devicetree/bindings/sound/nvidia,tegra210-admaif.yaml | 6 ++++++ .../devicetree/bindings/sound/nvidia,tegra210-ahub.yaml | 13 +++++++++++-- .../devicetree/bindings/sound/nvidia,tegra210-dmic.yaml | 6 ++++++ .../devicetree/bindings/sound/nvidia,tegra210-i2s.yaml | 6 ++++++ 5 files changed, 35 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml +0
-0
Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml properties: · line 59
Quoted 5 lines
Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml +2
-0@@ -55,6 +55,12 @@ properties: The name can be "DSPK1" or "DSPKx", where x depends on the maximum available instances on a Tegra SoC. + ports: + $ref: /schemas/graph.yaml#/properties/ports
If you have 'ports', then that means you have multiple ports and you have to enumerate what each port is.
Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml properties: · line 62
Quoted 3 lines
Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml +3
-0+ + port: + $ref: /schemas/sound/audio-graph.yaml#/properties/port
If you only have 1 port then, you can use 'port'.
So listing both is an error.
Quoted 89 lines
Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml +1
-0+ required: - compatible - regDocumentation/devicetree/bindings/sound/nvidia,tegra210-admaif.yaml +6
-0@@ -37,6 +37,12 @@ properties: dma-names: true + ports: + $ref: /schemas/graph.yaml#/properties/ports + + port: + $ref: /schemas/sound/audio-graph.yaml#/properties/port + if: properties: compatible:Documentation/devicetree/bindings/sound/nvidia,tegra210-ahub.yaml +11
-2@@ -56,6 +56,16 @@ properties: ranges: true + ports: + $ref: /schemas/graph.yaml#/properties/ports + + port: + $ref: /schemas/sound/audio-graph.yaml#/properties/port + +patternProperties: + "@[0-9a-f]+$": + type: object + required: - compatible - reg@@ -67,8 +77,7 @@ required: - "#size-cells" - ranges -additionalProperties: - type: object +additionalProperties: false examples: - |Documentation/devicetree/bindings/sound/nvidia,tegra210-dmic.yaml +6
-0@@ -56,6 +56,12 @@ properties: The name can be "DMIC1" or "DMIC2" ... "DMICx", where x depends on the maximum available instances on a Tegra SoC. + ports: + $ref: /schemas/graph.yaml#/properties/ports + + port: + $ref: /schemas/sound/audio-graph.yaml#/properties/port + required: - compatible - regDocumentation/devicetree/bindings/sound/nvidia,tegra210-i2s.yaml +6
-0@@ -74,6 +74,12 @@ properties: The name can be "I2S1" or "I2S2" ... "I2Sx", where x depends on the maximum available instances on a Tegra SoC. + ports: + $ref: /schemas/graph.yaml#/properties/ports + + port: + $ref: /schemas/sound/audio-graph.yaml#/properties/port + required: - compatible - regSignature · 1 line
2.7.4
Re: [PATCH v5 1/6] ASoC: dt-bindings: tegra: Add graph bindings
Hi Rob,
Quoted 30 lines
Quoted 3 lines
Add device tree binding properties of generic graph to ASoC component devices. This allows to define audio ports out of these components or DAIs and audio graph based sound card can be realised with this.
This is all dependent on
graph.yamlbeing applied which hasn't happened yet. I guess I'll need to provide a branch as there's multiple subsystems needing it.Quoted 14 lines
Signed-off-by Sameer Pujar <[email protected]>--- .../devicetree/bindings/sound/nvidia,tegra186-dspk.yaml | 6 ++++++ .../devicetree/bindings/sound/nvidia,tegra210-admaif.yaml | 6 ++++++ .../devicetree/bindings/sound/nvidia,tegra210-ahub.yaml | 13 +++++++++++-- .../devicetree/bindings/sound/nvidia,tegra210-dmic.yaml | 6 ++++++ .../devicetree/bindings/sound/nvidia,tegra210-i2s.yaml | 6 ++++++ 5 files changed, 35 insertions(+), 2 deletions(-)Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml +0
-0Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml properties: · line 60
Quoted 6 lines
Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml +2
-0@@ -55,6 +55,12 @@ properties: The name can be "DSPK1" or "DSPKx", where x depends on the maximum available instances on a Tegra SoC. + ports: + $ref: /schemas/graph.yaml#/properties/portsIf you have 'ports', then that means you have multiple ports and you have to enumerate what each port is.
Quoted 7 lines
Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml properties: · line 62
Quoted 3 lines
Documentation/devicetree/bindings/sound/nvidia,tegra186-dspk.yaml +3
-0+ + port: + $ref: /schemas/sound/audio-graph.yaml#/properties/portIf you only have 1 port then, you can use 'port'.
So listing both is an error.
Since "ASoC: graph card schema rework" series is merged now, referencing "audio-graph-port.yaml" should be sufficient here?
...
PATCH v5 2/6 ASoC: dt-bindings: tegra: Add json-schema for Tegra audio graph card
In reply to Sameer PujarAdd YAML schema for Tegra audio graph sound card DT bindings. It uses the same DT bindings provided by generic audio graph driver. Along with this few standard clock DT bindings are added which are specifically required for Tegra audio.
--- .../sound/nvidia,tegra-audio-graph-card.yaml | 187 +++++++++++++++++++++ 1 file changed, 187 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml
Documentation/devicetree/bindings/sound/nvidia,tegra-audio-graph-card.yaml new file +187 -0
@@ -0,0 +1,187 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/nvidia,tegra-audio-graph-card.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Audio Graph based Tegra sound card driver + +description: | + This is based on generic audio graph card driver along with additional + customizations for Tegra platforms. It uses the same bindings with + additional standard clock DT bindings required for Tegra. + +maintainers: + - Jon Hunter <[email protected]> + - Sameer Pujar <[email protected]> + +allOf: + - $ref: "audio-graph.yaml#" + +properties: + compatible: + enum: + - nvidia,tegra210-audio-graph-card + - nvidia,tegra186-audio-graph-card + + clocks: + minItems: 2 + + clock-names: + minItems: 2 + items: + - const: pll_a + - const: plla_out0 + + assigned-clocks: + minItems: 1 + maxItems: 3 + + assigned-clock-parents: + minItems: 1 + maxItems: 3 + + assigned-clock-rates: + minItems: 1 + maxItems: 3 + +required: + - clocks + - clock-names + - assigned-clocks + - assigned-clock-parents + +unevaluatedProperties: false + +examples: + - | + #include<dt-bindings/clock/tegra210-car.h> + + tegra_sound { + compatible = "nvidia,tegra210-audio-graph-card"; + + clocks = <&tegra_car TEGRA210_CLK_PLL_A>, + <&tegra_car TEGRA210_CLK_PLL_A_OUT0>; + clock-names = "pll_a", "plla_out0"; + + assigned-clocks = <&tegra_car TEGRA210_CLK_PLL_A>, + <&tegra_car TEGRA210_CLK_PLL_A_OUT0>, + <&tegra_car TEGRA210_CLK_EXTERN1>; + assigned-clock-parents = <0>, <0>, <&tegra_car TEGRA210_CLK_PLL_A_OUT0>; + assigned-clock-rates = <368640000>, <49152000>, <12288000>; + + dais = /* FE */ + <&admaif1_port>, + /* Router */ + <&xbar_i2s1_port>, + /* I/O DAP Ports */ + <&i2s1_port>; + + label = "jetson-tx1-ape"; + }; + + // The ports are defined for AHUB and its child devices. + ahub@702d0800 { + compatible = "nvidia,tegra210-ahub"; + reg = <0x702d0800 0x800>; + clocks = <&tegra_car TEGRA210_CLK_D_AUDIO>; + clock-names = "ahub"; + assigned-clocks = <&tegra_car TEGRA210_CLK_D_AUDIO>; + assigned-clock-parents = <&tegra_car TEGRA210_CLK_PLL_A_OUT0>; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x702d0000 0x702d0000 0x0000e400>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0x0>; + xbar_admaif1_ep: endpoint { + remote-endpoint = <&admaif1_ep>; + }; + }; + + // ... + + xbar_i2s1_port: port@a { + reg = <0xa>; + xbar_i2s1_ep: endpoint { + remote-endpoint = <&i2s1_cif_ep>; + }; + }; + }; + + admaif@702d0000 { + compatible = "nvidia,tegra210-admaif"; + reg = <0x702d0000 0x800>; + dmas = <&adma 1>, <&adma 1>, + <&adma 2>, <&adma 2>, + <&adma 3>, <&adma 3>, + <&adma 4>, <&adma 4>, + <&adma 5>, <&adma 5>, + <&adma 6>, <&adma 6>, + <&adma 7>, <&adma 7>, + <&adma 8>, <&adma 8>, + <&adma 9>, <&adma 9>, + <&adma 10>, <&adma 10>; + dma-names = "rx1", "tx1", + "rx2", "tx2", + "rx3", "tx3", + "rx4", "tx4", + "rx5", "tx5", + "rx6", "tx6", + "rx7", "tx7", + "rx8", "tx8", + "rx9", "tx9", + "rx10", "tx10"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + admaif1_port: port@0 { + reg = <0x0>; + admaif1_ep: endpoint { + remote-endpoint = <&xbar_admaif1_ep>; + }; + }; + + // More ADMAIF ports to follow + }; + }; + + i2s@702d1000 { + compatible = "nvidia,tegra210-i2s"; + clocks = <&tegra_car TEGRA210_CLK_I2S0>; + clock-names = "i2s"; + assigned-clocks = <&tegra_car TEGRA210_CLK_I2S0>; + assigned-clock-parents = <&tegra_car TEGRA210_CLK_PLL_A_OUT0>; + assigned-clock-rates = <1536000>; + reg = <0x702d1000 0x100>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0x0>; + + i2s1_cif_ep: endpoint { + remote-endpoint = <&xbar_i2s1_ep>; + }; + }; + + i2s1_port: port@1 { + reg = <0x1>; + + i2s1_dap: endpoint { + dai-format = "i2s"; + }; + }; + }; + }; + }; + +...
Signature · 1 line
2.7.4
PATCH v5 3/6 ASoC: tegra: Add audio graph based card driver
In reply to Sameer PujarAdd Tegra audio machine driver which is based on generic audio graph card driver. It re-uses most of the common stuff from audio graph driver and uses the same DT binding. Required Tegra specific customizations are done in the driver and additional DT bindings are required for clock handling.
Details on the customizations done:
- Update PLL rates at runtime: Tegra HW supports multiple sample rates (multiples of 8x and 11.025x) and both of these groups require different PLL rates. Hence there is a requirement to update this at runtime. This is achieved by providing a custom 'snd_soc_ops' and in hw_param() callback PLL rate is updated as per the sample rate.
- Internal structure 'tegra_audio_graph_data' is used to maintain clock handles of PLL.
- The 'force_dpcm' flag is set to use DPCM for all DAI links.
- The 'component_chaining' flag is set to use DPCM with component model.
--- sound/soc/tegra/Kconfig | 9 ++ sound/soc/tegra/Makefile | 2 + sound/soc/tegra/tegra_audio_graph_card.c | 255 +++++++++++++++++++++++++++++++ 3 files changed, 266 insertions(+) create mode 100644 sound/soc/tegra/tegra_audio_graph_card.c
sound/soc/tegra/Kconfig +9 -0
@@ -117,6 +117,15 @@ config SND_SOC_TEGRA210_ADMAIF channel. Buffer size is configurable for each ADMAIIF channel. Say Y or M if you want to add support for Tegra210 ADMAIF module. +config SND_SOC_TEGRA_AUDIO_GRAPH_CARD + tristate "Audio Graph Card based Tegra driver" + depends on SND_AUDIO_GRAPH_CARD + help + Config to enable Tegra audio machine driver based on generic + audio graph driver. It is a thin driver written to customize + few things for Tegra audio. Most of the code is re-used from + audio graph driver and the same DT bindings are used. + config SND_SOC_TEGRA_RT5640 tristate "SoC Audio support for Tegra boards using an RT5640 codec" depends on SND_SOC_TEGRA && I2C && GPIOLIB
sound/soc/tegra/Makefile +2 -0
@@ -38,6 +38,7 @@ snd-soc-tegra-trimslice-objs := trimslice.o snd-soc-tegra-alc5632-objs := tegra_alc5632.o snd-soc-tegra-max98090-objs := tegra_max98090.o snd-soc-tegra-sgtl5000-objs := tegra_sgtl5000.o +snd-soc-tegra-audio-graph-card-objs := tegra_audio_graph_card.o obj-$(CONFIG_SND_SOC_TEGRA_RT5640) += snd-soc-tegra-rt5640.o obj-$(CONFIG_SND_SOC_TEGRA_RT5677) += snd-soc-tegra-rt5677.o
@@ -48,3 +49,4 @@ obj-$(CONFIG_SND_SOC_TEGRA_TRIMSLICE) += snd-soc-tegra-trimslice.o obj-$(CONFIG_SND_SOC_TEGRA_ALC5632) += snd-soc-tegra-alc5632.o obj-$(CONFIG_SND_SOC_TEGRA_MAX98090) += snd-soc-tegra-max98090.o obj-$(CONFIG_SND_SOC_TEGRA_SGTL5000) += snd-soc-tegra-sgtl5000.o +obj-$(CONFIG_SND_SOC_TEGRA_AUDIO_GRAPH_CARD) += snd-soc-tegra-audio-graph-card.o
sound/soc/tegra/tegra_audio_graph_card.c new file +255 -0
255 lines not on this page · raw message
Signature · 1 line
2.7.4
Jon Hunter
maintainerRe: [PATCH v5 3/6] ASoC: tegra: Add audio graph based card driver
Quoted 123 lines · Sameer Pujar
Add Tegra audio machine driver which is based on generic audio graph card driver. It re-uses most of the common stuff from audio graph driver and uses the same DT binding. Required Tegra specific customizations are done in the driver and additional DT bindings are required for clock handling.
Details on the customizations done:
- Update PLL rates at runtime: Tegra HW supports multiple sample rates (multiples of 8x and 11.025x) and both of these groups require different PLL rates. Hence there is a requirement to update this at runtime. This is achieved by providing a custom '
snd_soc_ops' and inhw_param()callback PLL rate is updated as per the sample rate.- Internal structure '
tegra_audio_graph_data' is used to maintain clock handles of PLL.- The '
force_dpcm' flag is set to use DPCM for all DAI links.- The '
component_chaining' flag is set to use DPCM with component model.Signed-off-by Sameer Pujar <[email protected]>--- sound/soc/tegra/Kconfig | 9 ++ sound/soc/tegra/Makefile | 2 + sound/soc/tegra/tegra_audio_graph_card.c | 255 +++++++++++++++++++++++++++++++ 3 files changed, 266 insertions(+) create mode 100644 sound/soc/tegra/tegra_audio_graph_card.csound/soc/tegra/Kconfig +9
-0@@ -117,6 +117,15 @@ config SND_SOC_TEGRA210_ADMAIF channel. Buffer size is configurable for each ADMAIIF channel. Say Y or M if you want to add support for Tegra210 ADMAIF module. +config SND_SOC_TEGRA_AUDIO_GRAPH_CARD + tristate "Audio Graph Card based Tegra driver" + depends on SND_AUDIO_GRAPH_CARD + help + Config to enable Tegra audio machine driver based on generic + audio graph driver. It is a thin driver written to customize + few things for Tegra audio. Most of the code is re-used from + audio graph driver and the same DT bindings are used. + config SND_SOC_TEGRA_RT5640 tristate "SoC Audio support for Tegra boards using an RT5640 codec" depends on SND_SOC_TEGRA && I2C && GPIOLIBsound/soc/tegra/Makefile +2
-0@@ -38,6 +38,7 @@ snd-soc-tegra-trimslice-objs := trimslice.o snd-soc-tegra-alc5632-objs := tegra_alc5632.o snd-soc-tegra-max98090-objs := tegra_max98090.o snd-soc-tegra-sgtl5000-objs := tegra_sgtl5000.o +snd-soc-tegra-audio-graph-card-objs := tegra_audio_graph_card.o obj-$(CONFIG_SND_SOC_TEGRA_RT5640) += snd-soc-tegra-rt5640.o obj-$(CONFIG_SND_SOC_TEGRA_RT5677) += snd-soc-tegra-rt5677.o@@ -48,3 +49,4 @@ obj-$(CONFIG_SND_SOC_TEGRA_TRIMSLICE) += snd-soc-tegra-trimslice.o obj-$(CONFIG_SND_SOC_TEGRA_ALC5632) += snd-soc-tegra-alc5632.o obj-$(CONFIG_SND_SOC_TEGRA_MAX98090) += snd-soc-tegra-max98090.o obj-$(CONFIG_SND_SOC_TEGRA_SGTL5000) += snd-soc-tegra-sgtl5000.o +obj-$(CONFIG_SND_SOC_TEGRA_AUDIO_GRAPH_CARD) += snd-soc-tegra-audio-graph-card.osound/soc/tegra/tegra_audio_graph_card.c new file +52
-0@@ -0,0 +1,255 @@ +// SPDX-License-Identifier: GPL-2.0-only +// +// tegra_audio_graph_card.c - Audio Graph based Tegra Machine Driver +// +// Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved. + +#include <linux/math64.h> +#include <linux/module.h> +#include <linux/of_device.h> +#include <linux/platform_device.h> +#include <sound/graph_card.h> +#include <sound/pcm_params.h> + +#define MAX_PLLA_OUT0_DIV 128 + +#define simple_to_tegra_priv (simple) \ + container_of(simple, struct tegra_audio_priv, simple) + +enum srate_type { +/* +* Sample rates multiple of 8000 Hz and below are supported: +* ( 8000, 16000, 32000, 48000, 96000, 192000 Hz ) +*/ + x8_RATE, + +/* +* Sample rates multiple of 11025 Hz and below are supported: +* ( 11025, 22050, 44100, 88200, 176400 Hz ) +*/ + x11_RATE, + +NUM_RATE_TYPE , +}; + +struct tegra_audio_priv { +struct asoc_simple_priv simple; +struct clk *clk_plla_out0; +struct clk *clk_plla; +}; + +/* Tegra audio chip data */ +struct tegra_audio_cdata { +unsigned int plla_rates[NUM_RATE_TYPE ]; +unsigned int plla_out0_rates[NUM_RATE_TYPE ]; +}; + +/* Setup PLL clock as per the given sample rate */ +static int tegra_audio_graph_update_pll (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) +{ +struct snd_soc_pcm_runtime *rtd =asoc_substream_to_rtd (substream); +struct asoc_simple_priv *simple =snd_soc_card_get_drvdata (rtd->card);
sound/soc/tegra/tegra_audio_graph_card.c line 62
Quoted 10 lines
sound/soc/tegra/tegra_audio_graph_card.c new file +10
-0+struct tegra_audio_priv *priv =simple_to_tegra_priv (simple); +struct device *dev = rtd->card->dev; +const struct tegra_audio_cdata *data =of_device_get_match_data (dev); +unsigned int plla_rate, plla_out0_rate, bclk; +unsigned int srate =params_rate (params); +int err; + +/* There is nothing to configure */ +if (!data) +return 0 ;
Seems like this should never happen and so if it did this is an error. Any reason why we don't return an error here?
Cheers
Jon
Signature · 1 line
nvpublic
Re: [PATCH v5 3/6] ASoC: tegra: Add audio graph based card driver
Quoted 129 lines
Quoted 129 lines
Add Tegra audio machine driver which is based on generic audio graph card driver. It re-uses most of the common stuff from audio graph driver and uses the same DT binding. Required Tegra specific customizations are done in the driver and additional DT bindings are required for clock handling.
Details on the customizations done:
- Update PLL rates at runtime: Tegra HW supports multiple sample rates (multiples of 8x and 11.025x) and both of these groups require different PLL rates. Hence there is a requirement to update this at runtime. This is achieved by providing a custom '
snd_soc_ops' and inhw_param()callback PLL rate is updated as per the sample rate.- Internal structure '
tegra_audio_graph_data' is used to maintain clock handles of PLL.- The '
force_dpcm' flag is set to use DPCM for all DAI links.- The '
component_chaining' flag is set to use DPCM with component model.Signed-off-by Sameer Pujar <[email protected]>--- sound/soc/tegra/Kconfig | 9 ++ sound/soc/tegra/Makefile | 2 + sound/soc/tegra/tegra_audio_graph_card.c | 255 +++++++++++++++++++++++++++++++ 3 files changed, 266 insertions(+)create mode 100644
sound/soc/tegra/tegra_audio_graph_card.csound/soc/tegra/Kconfig +9
-0@@ -117,6 +117,15 @@ config SND_SOC_TEGRA210_ADMAIF channel. Buffer size is configurable for each ADMAIIF channel. Say Y or M if you want to add support for Tegra210 ADMAIF module. +config SND_SOC_TEGRA_AUDIO_GRAPH_CARD + tristate "Audio Graph Card based Tegra driver" + depends on SND_AUDIO_GRAPH_CARD + help + Config to enable Tegra audio machine driver based on generic + audio graph driver. It is a thin driver written to customize + few things for Tegra audio. Most of the code is re-used from + audio graph driver and the same DT bindings are used. + config SND_SOC_TEGRA_RT5640 tristate "SoC Audio support for Tegra boards using an RT5640 codec" depends on SND_SOC_TEGRA && I2C && GPIOLIBsound/soc/tegra/Makefile +2
-0@@ -38,6 +38,7 @@ snd-soc-tegra-trimslice-objs := trimslice.o snd-soc-tegra-alc5632-objs := tegra_alc5632.o snd-soc-tegra-max98090-objs := tegra_max98090.o snd-soc-tegra-sgtl5000-objs := tegra_sgtl5000.o +snd-soc-tegra-audio-graph-card-objs := tegra_audio_graph_card.o obj-$(CONFIG_SND_SOC_TEGRA_RT5640) += snd-soc-tegra-rt5640.o obj-$(CONFIG_SND_SOC_TEGRA_RT5677) += snd-soc-tegra-rt5677.o@@ -48,3 +49,4 @@ obj-$(CONFIG_SND_SOC_TEGRA_TRIMSLICE) += snd-soc-tegra-trimslice.o obj-$(CONFIG_SND_SOC_TEGRA_ALC5632) += snd-soc-tegra-alc5632.o obj-$(CONFIG_SND_SOC_TEGRA_MAX98090) += snd-soc-tegra-max98090.o obj-$(CONFIG_SND_SOC_TEGRA_SGTL5000) += snd-soc-tegra-sgtl5000.o +obj-$(CONFIG_SND_SOC_TEGRA_AUDIO_GRAPH_CARD) += snd-soc-tegra-audio-graph-card.osound/soc/tegra/tegra_audio_graph_card.c new file +57
-0@@ -0,0 +1,255 @@ +// SPDX-License-Identifier: GPL-2.0-only +// +// tegra_audio_graph_card.c - Audio Graph based Tegra Machine Driver +// +// Copyright (c) 2020 NVIDIA CORPORATION. All rights reserved. + +#include <linux/math64.h> +#include <linux/module.h> +#include <linux/of_device.h> +#include <linux/platform_device.h> +#include <sound/graph_card.h> +#include <sound/pcm_params.h> + +#define MAX_PLLA_OUT0_DIV 128 + +#define simple_to_tegra_priv (simple) \ + container_of(simple, struct tegra_audio_priv, simple) + +enum srate_type { +/* +* Sample rates multiple of 8000 Hz and below are supported: +* ( 8000, 16000, 32000, 48000, 96000, 192000 Hz ) +*/ + x8_RATE, + +/* +* Sample rates multiple of 11025 Hz and below are supported: +* ( 11025, 22050, 44100, 88200, 176400 Hz ) +*/ + x11_RATE, + +NUM_RATE_TYPE , +}; + +struct tegra_audio_priv { +struct asoc_simple_priv simple; +struct clk *clk_plla_out0; +struct clk *clk_plla; +}; + +/* Tegra audio chip data */ +struct tegra_audio_cdata { +unsigned int plla_rates[NUM_RATE_TYPE ]; +unsigned int plla_out0_rates[NUM_RATE_TYPE ]; +}; + +/* Setup PLL clock as per the given sample rate */ +static int tegra_audio_graph_update_pll (struct snd_pcm_substream *substream, +struct snd_pcm_hw_params *params) +{ +struct snd_soc_pcm_runtime *rtd =asoc_substream_to_rtd (substream); +struct asoc_simple_priv *simple =snd_soc_card_get_drvdata (rtd->card); +struct tegra_audio_priv *priv =simple_to_tegra_priv (simple); +struct device *dev = rtd->card->dev; +const struct tegra_audio_cdata *data =of_device_get_match_data (dev); +unsigned int plla_rate, plla_out0_rate, bclk; +unsigned int srate =params_rate (params);
Quoted 8 lines
sound/soc/tegra/tegra_audio_graph_card.c line 62
Quoted 5 lines
sound/soc/tegra/tegra_audio_graph_card.c new file +5
-0+int err; + +/* There is nothing to configure */ +if (!data) +return 0 ;Seems like this should never happen and so if it did this is an error. Any reason why we don't return an error here?
I was thinking it is OK for platforms to use fixed PLL rates and in such cases they don't have to define chip data. But yes currently there is no case for it and I will simply drop this check in v6.
PATCH v5 4/6 arm64: defconfig: Enable Tegra audio graph card driver
In reply to Sameer PujarThis commit enables Tegra audio graph card driver which is based on the generic audio-graph card driver. This is intended to be used on platforms based on Tegra210 and later chips.
--- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
@@ -722,6 +722,7 @@ CONFIG_SND_SOC_TEGRA210_DMIC=m CONFIG_SND_SOC_TEGRA210_I2S=m CONFIG_SND_SOC_TEGRA186_DSPK=m CONFIG_SND_SOC_TEGRA210_ADMAIF=m +CONFIG_SND_SOC_TEGRA_AUDIO_GRAPH_CARD=m CONFIG_SND_SOC_AK4613=m CONFIG_SND_SOC_ES7134=m CONFIG_SND_SOC_ES7241=m
Signature · 1 line
2.7.4
PATCH v5 5/6 arm64: tegra: Audio graph header for Tegra210
In reply to Sameer PujarExpose a header which describes DT bindings required to use audio-graph based sound card. All Tegra210 based platforms can include this header and add platform specific information. Currently, from SoC point of view, all links are exposed for ADMAIF, AHUB, I2S and DMIC components.
--- .../boot/dts/nvidia/tegra210-audio-graph.dtsi | 153 +++++++++++++++++++++ 1 file changed, 153 insertions(+) create mode 100644 arch/arm64/boot/dts/nvidia/tegra210-audio-graph.dtsi
arch/arm64/boot/dts/nvidia/tegra210-audio-graph.dtsi new file +153 -0
@@ -0,0 +1,153 @@ +// SPDX-License-Identifier: GPL-2.0 + +/ { + tegra_sound { + status = "disabled"; + + clocks = <&tegra_car TEGRA210_CLK_PLL_A>, + <&tegra_car TEGRA210_CLK_PLL_A_OUT0>; + clock-names = "pll_a", "plla_out0"; + + assigned-clocks = <&tegra_car TEGRA210_CLK_PLL_A>, + <&tegra_car TEGRA210_CLK_PLL_A_OUT0>, + <&tegra_car TEGRA210_CLK_EXTERN1>; + assigned-clock-parents = <0>, <0>, <&tegra_car TEGRA210_CLK_PLL_A_OUT0>; + assigned-clock-rates = <368640000>, <49152000>, <12288000>; + }; +}; + +&tegra_admaif { + ports { + #address-cells = <1>; + #size-cells = <0>; + + admaif1_port: port@0 { + reg = <0>; + admaif1_ep: endpoint { + remote-endpoint = <&xbar_admaif1_ep>; + }; + }; + admaif2_port: port@1 { + reg = <1>; + admaif2_ep: endpoint { + remote-endpoint = <&xbar_admaif2_ep>; + }; + }; + admaif3_port: port@2 { + reg = <2>; + admaif3_ep: endpoint { + remote-endpoint = <&xbar_admaif3_ep>; + }; + }; + admaif4_port: port@3 { + reg = <3>; + admaif4_ep: endpoint { + remote-endpoint = <&xbar_admaif4_ep>; + }; + }; + admaif5_port: port@4 { + reg = <4>; + admaif5_ep: endpoint { + remote-endpoint = <&xbar_admaif5_ep>; + }; + }; + admaif6_port: port@5 { + reg = <5>; + admaif6_ep: endpoint { + remote-endpoint = <&xbar_admaif6_ep>; + }; + }; + admaif7_port: port@6 { + reg = <6>; + admaif7_ep: endpoint { + remote-endpoint = <&xbar_admaif7_ep>; + }; + }; + admaif8_port: port@7 { + reg = <7>; + admaif8_ep: endpoint { + remote-endpoint = <&xbar_admaif8_ep>; + }; + }; + admaif9_port: port@8 { + reg = <8>; + admaif9_ep: endpoint { + remote-endpoint = <&xbar_admaif9_ep>; + }; + }; + admaif10_port: port@9 { + reg = <9>; + admaif10_ep: endpoint { + remote-endpoint = <&xbar_admaif10_ep>; + }; + }; + }; +}; + +&tegra_ahub { + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0x0>; + xbar_admaif1_ep: endpoint { + remote-endpoint = <&admaif1_ep>; + }; + }; + port@1 { + reg = <0x1>; + xbar_admaif2_ep: endpoint { + remote-endpoint = <&admaif2_ep>; + }; + }; + port@2 { + reg = <0x2>; + xbar_admaif3_ep: endpoint { + remote-endpoint = <&admaif3_ep>; + }; + }; + port@3 { + reg = <0x3>; + xbar_admaif4_ep: endpoint { + remote-endpoint = <&admaif4_ep>; + }; + }; + port@4 { + reg = <0x4>; + xbar_admaif5_ep: endpoint { + remote-endpoint = <&admaif5_ep>; + }; + }; + port@5 { + reg = <0x5>; + xbar_admaif6_ep: endpoint { + remote-endpoint = <&admaif6_ep>; + }; + }; + port@6 { + reg = <0x6>; + xbar_admaif7_ep: endpoint { + remote-endpoint = <&admaif7_ep>; + }; + }; + port@7 { + reg = <0x7>; + xbar_admaif8_ep: endpoint { + remote-endpoint = <&admaif8_ep>; + }; + }; + port@8 { + reg = <0x8>; + xbar_admaif9_ep: endpoint { + remote-endpoint = <&admaif9_ep>; + }; + }; + port@9 { + reg = <0x9>; + xbar_admaif10_ep: endpoint { + remote-endpoint = <&admaif10_ep>; + }; + }; + }; +};
Signature · 1 line
2.7.4
PATCH v5 6/6 arm64: tegra: Audio graph sound card for Jetson Nano and TX1
In reply to Sameer PujarEnable support for audio-graph based sound card on Jetson-Nano and Jetson-TX1. Depending on the platform, required I/O interfaces are enabled.
* Jetson-Nano: Enable I2S3, I2S4, DMIC1 and DMIC2.
* Jetson-TX1: Enable all I2S and DMIC interfaces.
--- arch/arm64/boot/dts/nvidia/tegra210-p2371-2180.dts | 262 +++++++++++++++++++++ arch/arm64/boot/dts/nvidia/tegra210-p3450-0000.dts | 146 ++++++++++++ 2 files changed, 408 insertions(+)
arch/arm64/boot/dts/nvidia/tegra210-p2371-2180.dts +262 -0
@@ -3,6 +3,7 @@ #include "tegra210-p2180.dtsi" #include "tegra210-p2597.dtsi" +#include "tegra210-audio-graph.dtsi" / { model = "NVIDIA Jetson TX1 Developer Kit";
@@ -127,4 +128,265 @@ status = "okay"; }; }; + + tegra_sound { + status = "okay"; + + compatible = "nvidia,tegra210-audio-graph-card"; + + dais = /* FE */ + <&admaif1_port>, <&admaif2_port>, <&admaif3_port>, + <&admaif4_port>, <&admaif5_port>, <&admaif6_port>, + <&admaif7_port>, <&admaif8_port>, <&admaif9_port>, + <&admaif10_port>, + /* Router */ + <&xbar_i2s1_port>, <&xbar_i2s2_port>, <&xbar_i2s3_port>, + <&xbar_i2s4_port>, <&xbar_i2s5_port>, <&xbar_dmic1_port>, + <&xbar_dmic2_port>, <&xbar_dmic3_port>, + /* I/O DAP Ports */ + <&i2s1_port>, <&i2s2_port>, <&i2s3_port>, <&i2s4_port>, + <&i2s5_port>, <&dmic1_port>, <&dmic2_port>, <&dmic3_port>; + + label = "jetson-tx1-ape"; + }; +}; + +&tegra_admaif { + status = "okay"; +}; + +&tegra_ahub { + status = "okay"; + + ports { + xbar_i2s1_port: port@a { + reg = <0xa>; + xbar_i2s1_ep: endpoint { + remote-endpoint = <&i2s1_cif_ep>; + }; + }; + xbar_i2s2_port: port@b { + reg = <0xb>; + xbar_i2s2_ep: endpoint { + remote-endpoint = <&i2s2_cif_ep>; + }; + }; + xbar_i2s3_port: port@c { + reg = <0xc>; + xbar_i2s3_ep: endpoint { + remote-endpoint = <&i2s3_cif_ep>; + }; + }; + xbar_i2s4_port: port@d { + reg = <0xd>; + xbar_i2s4_ep: endpoint { + remote-endpoint = <&i2s4_cif_ep>; + }; + }; + xbar_i2s5_port: port@e { + reg = <0xe>; + xbar_i2s5_ep: endpoint { + remote-endpoint = <&i2s5_cif_ep>; + }; + }; + xbar_dmic1_port: port@f { + reg = <0xf>; + xbar_dmic1_ep: endpoint { + remote-endpoint = <&dmic1_cif_ep>; + }; + }; + xbar_dmic2_port: port@10 { + reg = <0x10>; + xbar_dmic2_ep: endpoint { + remote-endpoint = <&dmic2_cif_ep>; + }; + }; + xbar_dmic3_port: port@11 { + reg = <0x11>; + xbar_dmic3_ep: endpoint { + remote-endpoint = <&dmic3_cif_ep>; + }; + }; + }; +}; + +&tegra_i2s1 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + i2s1_cif_ep: endpoint { + remote-endpoint = <&xbar_i2s1_ep>; + }; + }; + i2s1_port: port@1 { + reg = <1>; + i2s1_dap_ep: endpoint { + dai-format = "i2s"; + /* Placeholder for external Codec */ + }; + }; + }; +}; + +&tegra_i2s2 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + i2s2_cif_ep: endpoint { + remote-endpoint = <&xbar_i2s2_ep>; + }; + }; + i2s2_port: port@1 { + reg = <1>; + i2s2_dap_ep: endpoint { + dai-format = "i2s"; + /* Placeholder for external Codec */ + }; + }; + }; +}; + +&tegra_i2s3 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + i2s3_cif_ep: endpoint { + remote-endpoint = <&xbar_i2s3_ep>; + }; + }; + i2s3_port: port@1 { + reg = <1>; + i2s3_dap_ep: endpoint { + dai-format = "i2s"; + /* Placeholder for external Codec */ + }; + }; + }; +}; + +&tegra_i2s4 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + i2s4_cif_ep: endpoint { + remote-endpoint = <&xbar_i2s4_ep>; + }; + }; + i2s4_port: port@1 { + reg = <1>; + i2s4_dap_ep: endpoint { + dai-format = "i2s"; + /* Placeholder for external Codec */ + }; + }; + }; +}; + +&tegra_i2s5 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + i2s5_cif_ep: endpoint { + remote-endpoint = <&xbar_i2s5_ep>; + }; + }; + i2s5_port: port@1 { + reg = <1>; + i2s5_dap_ep: endpoint { + dai-format = "i2s"; + /* Placeholder for external Codec */ + }; + }; + }; +}; + +&tegra_dmic1 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + dmic1_cif_ep: endpoint { + remote-endpoint = <&xbar_dmic1_ep>; + }; + }; + dmic1_port: port@1 { + reg = <1>; + dmic1_dap_ep: endpoint { + /* Placeholder for external Codec */ + }; + }; + }; +}; + +&tegra_dmic2 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + dmic2_cif_ep: endpoint { + remote-endpoint = <&xbar_dmic2_ep>; + }; + }; + dmic2_port: port@1 { + reg = <1>; + dmic2_dap_ep: endpoint { + /* Placeholder for external Codec */ + }; + }; + }; +}; + +&tegra_dmic3 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + dmic3_cif_ep: endpoint { + remote-endpoint = <&xbar_dmic3_ep>; + }; + }; + dmic3_port: port@1 { + reg = <1>; + dmic3_dap_ep: endpoint { + /* Placeholder for external Codec */ + }; + }; + }; };
arch/arm64/boot/dts/nvidia/tegra210-p3450-0000.dts +146 -0
156 lines not on this page · raw message
Signature · 1 line
2.7.4
Quoted 11 lines · Sameer Pujar
This series adds audio graph based sound card support for Tegra210 platforms like Jetson-TX1 an Jetson-Nano. The following preparatory audio graph enhancement series is already merged.
* https://patchwork.kernel.org/project/alsa-devel/list/?series=375629&state=*Following are the summary of changes:
* Add graph/audio-graph based schemas or schema updates for Tegra210 component and machine drivers.
* Add Tegra audio graph machine driver.
* Add required DT support for Jetson-TX1/Nano.
Quoted 8 lines
This work is based on earlier discussion of DPCM usage for Tegra and simple card driver updates.
* https://lkml.org/lkml/2020/4/30/519
* https://lkml.org/lkml/2020/6/27/4This series has dependency over following graph and audio-graph series.
* http://patchwork.ozlabs.org/project/devicetree-bindings/patch/[email protected]/
* https://patchwork.kernel.org/project/alsa-devel/list/?series=382009&state=*
Only one minor comment, but this looks good to me. Otherwise for the series ...
Cheers
Jon
Signature · 1 line
nvpublic