ASRC support on Tegra186 and later
Subsystems (4)
cover ASRC support on Tegra186 and later
This series adds support for Asynchronous Sample Rate Converter (ASRC) module on Tegra186 and later generations of SoCs. ASRC is a client of AHUB. The driver and DT support is added to make it work with Tegra audio graph card. The module can be plugged into audio path using ALSA mixer controls.
ASRC supports two modes of operation, where it gets the ratio info from SW and ratio detector module. Presently the support is added for SW mode.
Sameer Pujar (6):
ASoC: tegra: Add binding doc for ASRC module
ASoC: tegra: Add Tegra186 based ASRC driver
ASoC: tegra: AHUB routes for ASRC module
arm64: defconfig: Build Tegra ASRC module
arm64: tegra: Add ASRC device on Tegra186 and later
arm64: tegra: Enable ASRC on various platforms
.../bindings/sound/nvidia,tegra186-asrc.yaml | 81 ++ .../bindings/sound/nvidia,tegra210-ahub.yaml | 4 + arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts | 223 +++++ arch/arm64/boot/dts/nvidia/tegra186.dtsi | 7 + arch/arm64/boot/dts/nvidia/tegra194-p2972-0000.dts | 223 +++++ .../arm64/boot/dts/nvidia/tegra194-p3509-0000.dtsi | 223 +++++ arch/arm64/boot/dts/nvidia/tegra194.dtsi | 8 + .../dts/nvidia/tegra234-p3737-0000+p3701-0000.dts | 223 +++++ arch/arm64/boot/dts/nvidia/tegra234.dtsi | 8 + arch/arm64/configs/defconfig | 1 + sound/soc/tegra/Kconfig | 12 + sound/soc/tegra/Makefile | 2 + sound/soc/tegra/tegra186_asrc.c | 1045 ++++++++++++++++++++ sound/soc/tegra/tegra186_asrc.h | 113 +++ sound/soc/tegra/tegra210_ahub.c | 82 +- 15 files changed, 2254 insertions(+), 1 deletion(-) create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra186-asrc.yaml create mode 100644 sound/soc/tegra/tegra186_asrc.c create mode 100644 sound/soc/tegra/tegra186_asrc.h
Signature · 1 line
2.7.4
PATCH 1/6 ASoC: tegra: Add binding doc for ASRC module
This patch adds YAML schema for DT bindings of Asynchronous Sample Rate Converter (ASRC) module. It will be registered as an ASoC component and can be plugged into an audio path as per need via ALSA mixer controls. The bindings are applicable on Tegra186 and later where the ASRC device is present.
--- .../bindings/sound/nvidia,tegra186-asrc.yaml | 81 ++++++++++++++++++++++ .../bindings/sound/nvidia,tegra210-ahub.yaml | 4 ++ 2 files changed, 85 insertions(+) create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra186-asrc.yaml
Documentation/devicetree/bindings/sound/nvidia,tegra186-asrc.yaml new file +81 -0
@@ -0,0 +1,81 @@ +# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) +%YAML 1.2 +--- +$id: http://devicetree.org/schemas/sound/nvidia,tegra186-asrc.yaml# +$schema: http://devicetree.org/meta-schemas/core.yaml# + +title: Tegra186 ASRC Device Tree Bindings + +description: | + Asynchronous Sample Rate Converter (ASRC) converts the sampling frequency + of the input signal from one frequency to another. It can handle over a + wide range of sample rate ratios (freq_in/freq_out) from 1:24 to 24:1. + ASRC has two modes of operation. One where ratio can be programmed in SW + and the other where it gets the information from ratio estimator module. + + It supports sample rate conversions in the range of 8 to 192 kHz and + supports 6 streams upto 12 total channels. The input data size can be + 16, 24 and 32 bits. + +maintainers: + - Jon Hunter <[email protected]> + - Mohan Kumar <[email protected]> + - Sameer Pujar <[email protected]> + +allOf: + - $ref: name-prefix.yaml# + +properties: + $nodename: + pattern: "^asrc@[0-9a-f]*$" + + compatible: + oneOf: + - const: nvidia,tegra186-asrc + - items: + - enum: + - nvidia,tegra234-asrc + - nvidia,tegra194-asrc + - const: nvidia,tegra186-asrc + + reg: + maxItems: 1 + + sound-name-prefix: + pattern: "^ASRC[1-9]$" + + ports: + $ref: /schemas/graph.yaml#/properties/ports + description: | + ASRC has seven input ports and six output ports. Accordingly ACIF + (Audio Client Interfaces) port nodes are defined to represent the + ASRC inputs (port 0 to 6) and outputs (port 7 to 12). These are + connected to corresponding ports on AHUB (Audio Hub). Additional + input (port 6) is for receiving ratio information from estimator. + + patternProperties: + '^port@[0-6]': + $ref: audio-graph-port.yaml# + unevaluatedProperties: false + description: ASRC ACIF input ports + '^port@[7-9]|1[1-2]': + $ref: audio-graph-port.yaml# + unevaluatedProperties: false + description: ASRC ACIF output ports + +required: + - compatible + - reg + +additionalProperties: false + +examples: + - | + + asrc@2910000 { + compatible = "nvidia,tegra186-asrc"; + reg = <0x2910000 0x2000>; + sound-name-prefix = "ASRC1"; + }; + +...
Documentation/devicetree/bindings/sound/nvidia,tegra210-ahub.yaml +4 -0
@@ -106,6 +106,10 @@ patternProperties: type: object $ref: nvidia,tegra210-mixer.yaml# + '^asrc@[0-9a-f]+$': + type: object + $ref: nvidia,tegra186-asrc.yaml# + required: - compatible - reg
Signature · 1 line
2.7.4
PATCH 2/6 ASoC: tegra: Add Tegra186 based ASRC driver
In reply to Sameer PujarAsynchronous Sample Rate Converter (ASRC) converts the sampling frequency of the input signal from one frequency to another. It can handle over a wide range of sample rate ratios (freq_in/freq_out) from 1:24 to 24:1.
ASRC has two modes of operation. One where ratio can be programmed in SW and the other where it gets the information from ratio estimator module. The latter mode above can help address the cases where the sample rate is not known at the stream set up time or is potentially time varying. In addition, the ratio between input and output sample rate can be any arbitrary number and the input and output clocks could be derived from asynchronous clocks.
This patch registers ASRC driver with ASoC framework. The component driver exposes DAPM widgets, routes and kcontrols for the device. The DAI driver exposes ASRC interfaces, which can be used to connect different components in the ASoC layer. Makefile and Kconfig support is added to allow build the driver.
--- sound/soc/tegra/Kconfig | 12 + sound/soc/tegra/Makefile | 2 + sound/soc/tegra/tegra186_asrc.c | 1045 +++++++++++++++++++++++++++++++++++++++ sound/soc/tegra/tegra186_asrc.h | 113 +++++ 4 files changed, 1172 insertions(+) create mode 100644 sound/soc/tegra/tegra186_asrc.c create mode 100644 sound/soc/tegra/tegra186_asrc.h
sound/soc/tegra/Kconfig +12 -0
@@ -85,6 +85,18 @@ config SND_SOC_TEGRA210_I2S compatible devices. Say Y or M if you want to add support for Tegra210 I2S module. +config SND_SOC_TEGRA186_ASRC + tristate "Tegra186 ASRC module" + help + Config to enable the Asynchronous Sample Rate Converter (ASRC), + which converts the sampling frequency of the input signal from + one frequency to another. It can handle over a wide range of + sample rate ratios (freq_in/freq_out) from 1:24 to 24:1. + ASRC has two modes of operation. One where ratio can be programmed + in SW and the other where it gets information from ratio estimator + module. + Say Y or M if you want to add support for Tegra186 ASRC module. + config SND_SOC_TEGRA186_DSPK tristate "Tegra186 DSPK module" help
sound/soc/tegra/Makefile +2 -0
@@ -11,6 +11,7 @@ snd-soc-tegra30-i2s-objs := tegra30_i2s.o snd-soc-tegra210-ahub-objs := tegra210_ahub.o snd-soc-tegra210-dmic-objs := tegra210_dmic.o snd-soc-tegra210-i2s-objs := tegra210_i2s.o +snd-soc-tegra186-asrc-objs := tegra186_asrc.o snd-soc-tegra186-dspk-objs := tegra186_dspk.o snd-soc-tegra210-admaif-objs := tegra210_admaif.o snd-soc-tegra210-mvc-objs := tegra210_mvc.o
@@ -29,6 +30,7 @@ obj-$(CONFIG_SND_SOC_TEGRA30_I2S) += snd-soc-tegra30-i2s.o obj-$(CONFIG_SND_SOC_TEGRA210_DMIC) += snd-soc-tegra210-dmic.o obj-$(CONFIG_SND_SOC_TEGRA210_AHUB) += snd-soc-tegra210-ahub.o obj-$(CONFIG_SND_SOC_TEGRA210_I2S) += snd-soc-tegra210-i2s.o +obj-$(CONFIG_SND_SOC_TEGRA186_ASRC) += snd-soc-tegra186-asrc.o obj-$(CONFIG_SND_SOC_TEGRA186_DSPK) += snd-soc-tegra186-dspk.o obj-$(CONFIG_SND_SOC_TEGRA210_ADMAIF) += snd-soc-tegra210-admaif.o obj-$(CONFIG_SND_SOC_TEGRA210_MVC) += snd-soc-tegra210-mvc.o
sound/soc/tegra/tegra186_asrc.c new file +1045 -0
1,045 lines not on this page · raw message
sound/soc/tegra/tegra186_asrc.h new file +113 -0
113 lines not on this page · raw message
Signature · 1 line
2.7.4
PATCH 3/6 ASoC: tegra: AHUB routes for ASRC module
In reply to Sameer PujarAdd AHUB routes for ASRC module. The ASRC module can be plugged into audio path as per the need. The routing controls can be used to setup the audio path with ASRC similar to the already existing routes. The routes are added to Tegra186 and later Tegra SoCs where ASRC module is present.
--- sound/soc/tegra/tegra210_ahub.c | 82 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-)
sound/soc/tegra/tegra210_ahub.c +81 -1
@@ -280,6 +280,20 @@ static struct snd_soc_dai_driver tegra186_ahub_dais[] = { DAI(MIXER1 TX3),DAI (MIXER1TX4 ),DAI (MIXER1TX5 ), +/* XBAR -> ASRC -> XBAR */ +DAI (ASRC1RX1 ), +DAI (ASRC1TX1 ), +DAI (ASRC1RX2 ), +DAI (ASRC1TX2 ), +DAI (ASRC1RX3 ), +DAI (ASRC1TX3 ), +DAI (ASRC1RX4 ), +DAI (ASRC1TX4 ), +DAI (ASRC1RX5 ), +DAI (ASRC1TX5 ), +DAI (ASRC1RX6 ), +DAI (ASRC1TX6 ), + DAI(ASRC1 RX7), };static const char *const tegra210_ahub_mux_texts[] = {
@@ -388,6 +402,12 @@ static const char * const tegra186_ahub_mux_texts[] = {"MIXER1 TX3" ,"MIXER1 TX4" ,"MIXER1 TX5" , +"ASRC1 TX1" , +"ASRC1 TX2" , +"ASRC1 TX3" , +"ASRC1 TX4" , +"ASRC1 TX5" , + "ASRC1 TX6", }; static const unsigned int tegra210_ahub_mux_values[] = {
@@ -513,6 +533,13 @@ static const unsigned int tegra186_ahub_mux_values[] = {MUX_VALUE (1 ,2 ),MUX_VALUE (1 ,3 ),MUX_VALUE (1 ,4 ), +/* ASRC */ +MUX_VALUE (3 ,24 ), +MUX_VALUE (3 ,25 ), +MUX_VALUE (3 ,26 ), +MUX_VALUE (3 ,27 ), +MUX_VALUE (3 ,28 ), + MUX_VALUE(3, 29), };/* Controls for t210 */
@@ -623,6 +650,13 @@ MUX_ENUM_CTRL_DECL_186(t186_mixer17_tx, 0x26);MUX_ENUM_CTRL_DECL_186 (t186_mixer18_tx,0x27 );MUX_ENUM_CTRL_DECL_186 (t186_mixer19_tx,0x28 );MUX_ENUM_CTRL_DECL_186 (t186_mixer110_tx,0x29 ); +MUX_ENUM_CTRL_DECL_186 (t186_asrc11_tx,0x6c ); +MUX_ENUM_CTRL_DECL_186 (t186_asrc12_tx,0x6d ); +MUX_ENUM_CTRL_DECL_186 (t186_asrc13_tx,0x6e ); +MUX_ENUM_CTRL_DECL_186 (t186_asrc14_tx,0x6f ); +MUX_ENUM_CTRL_DECL_186 (t186_asrc15_tx,0x70 ); +MUX_ENUM_CTRL_DECL_186 (t186_asrc16_tx,0x71 ); +MUX_ENUM_CTRL_DECL_186 (t186_asrc17_tx,0x72 );/* Controls for t234 */ MUX_ENUM_CTRL_DECL_234 (t234_mvc1_tx,0x44 );
@@ -651,6 +685,13 @@ MUX_ENUM_CTRL_DECL_234(t234_admaif17_tx, 0x60);MUX_ENUM_CTRL_DECL_234 (t234_admaif18_tx,0x61 );MUX_ENUM_CTRL_DECL_234 (t234_admaif19_tx,0x62 );MUX_ENUM_CTRL_DECL_234 (t234_admaif20_tx,0x63 ); +MUX_ENUM_CTRL_DECL_234 (t234_asrc11_tx,0x64 ); +MUX_ENUM_CTRL_DECL_234 (t234_asrc12_tx,0x65 ); +MUX_ENUM_CTRL_DECL_234 (t234_asrc13_tx,0x66 ); +MUX_ENUM_CTRL_DECL_234 (t234_asrc14_tx,0x67 ); +MUX_ENUM_CTRL_DECL_234 (t234_asrc15_tx,0x68 ); +MUX_ENUM_CTRL_DECL_234 (t234_asrc16_tx,0x69 ); +MUX_ENUM_CTRL_DECL_234 (t234_asrc17_tx,0x6a );/* * The number of entries in, and order of, this array is closely tied to the
@@ -813,6 +854,19 @@ static const struct snd_soc_dapm_widget tegra186_ahub_widgets[] = {TX_WIDGETS ("MIXER1 TX3" ),TX_WIDGETS ("MIXER1 TX4" ),TX_WIDGETS ("MIXER1 TX5" ), +WIDGETS ("ASRC1 RX1" , t186_asrc11_tx), +WIDGETS ("ASRC1 RX2" , t186_asrc12_tx), +WIDGETS ("ASRC1 RX3" , t186_asrc13_tx), +WIDGETS ("ASRC1 RX4" , t186_asrc14_tx), +WIDGETS ("ASRC1 RX5" , t186_asrc15_tx), +WIDGETS ("ASRC1 RX6" , t186_asrc16_tx), +WIDGETS ("ASRC1 RX7" , t186_asrc17_tx), +TX_WIDGETS ("ASRC1 TX1" ), +TX_WIDGETS ("ASRC1 TX2" ), +TX_WIDGETS ("ASRC1 TX3" ), +TX_WIDGETS ("ASRC1 TX4" ), +TX_WIDGETS ("ASRC1 TX5" ), + TX_WIDGETS("ASRC1 TX6"), }; static const struct snd_soc_dapm_widget tegra234_ahub_widgets[] = {
@@ -909,6 +963,19 @@ static const struct snd_soc_dapm_widget tegra234_ahub_widgets[] = {TX_WIDGETS ("MIXER1 TX3" ),TX_WIDGETS ("MIXER1 TX4" ),TX_WIDGETS ("MIXER1 TX5" ), +WIDGETS ("ASRC1 RX1" , t234_asrc11_tx), +WIDGETS ("ASRC1 RX2" , t234_asrc12_tx), +WIDGETS ("ASRC1 RX3" , t234_asrc13_tx), +WIDGETS ("ASRC1 RX4" , t234_asrc14_tx), +WIDGETS ("ASRC1 RX5" , t234_asrc15_tx), +WIDGETS ("ASRC1 RX6" , t234_asrc16_tx), +WIDGETS ("ASRC1 RX7" , t234_asrc17_tx), +TX_WIDGETS ("ASRC1 TX1" ), +TX_WIDGETS ("ASRC1 TX2" ), +TX_WIDGETS ("ASRC1 TX3" ), +TX_WIDGETS ("ASRC1 TX4" ), +TX_WIDGETS ("ASRC1 TX5" ), + TX_WIDGETS("ASRC1 TX6"), };#define TEGRA_COMMON_MUX_ROUTES (name) \
@@ -975,7 +1042,13 @@ static const struct snd_soc_dapm_widget tegra234_ahub_widgets[] = { { name " Mux", "ADX4 TX1", "ADX4 TX1 XBAR-RX" }, \ { name " Mux", "ADX4 TX2", "ADX4 TX2 XBAR-RX" }, \ { name " Mux", "ADX4 TX3", "ADX4 TX3 XBAR-RX" }, \ - { name " Mux", "ADX4 TX4", "ADX4 TX4 XBAR-RX" }, + { name " Mux", "ADX4 TX4", "ADX4 TX4 XBAR-RX" }, \ + { name " Mux", "ASRC1 TX1", "ASRC1 TX1 XBAR-RX" }, \ + { name " Mux", "ASRC1 TX2", "ASRC1 TX2 XBAR-RX" }, \ + { name " Mux", "ASRC1 TX3", "ASRC1 TX3 XBAR-RX" }, \ + { name " Mux", "ASRC1 TX4", "ASRC1 TX4 XBAR-RX" }, \ + { name " Mux", "ASRC1 TX5", "ASRC1 TX5 XBAR-RX" }, \ + { name " Mux", "ASRC1 TX6", "ASRC1 TX6 XBAR-RX" }, #define TEGRA210_MUX_ROUTES(name) \TEGRA_COMMON_MUX_ROUTES (name)
@@ -1135,6 +1208,13 @@ static const struct snd_soc_dapm_route tegra186_ahub_routes[] = { TEGRA186_MUX_ROUTES("MIXER1 RX8") TEGRA186_MUX_ROUTES("MIXER1 RX9") TEGRA186_MUX_ROUTES("MIXER1 RX10") + TEGRA186_MUX_ROUTES("ASRC1 RX1") + TEGRA186_MUX_ROUTES("ASRC1 RX2") + TEGRA186_MUX_ROUTES("ASRC1 RX3") + TEGRA186_MUX_ROUTES("ASRC1 RX4") + TEGRA186_MUX_ROUTES("ASRC1 RX5") + TEGRA186_MUX_ROUTES("ASRC1 RX6") +TEGRA186_MUX_ROUTES ("ASRC1 RX7" ) };static const struct snd_soc_component_driver tegra210_ahub_component = {
Signature · 1 line
2.7.4
PATCH 4/6 arm64: defconfig: Build Tegra ASRC module
In reply to Sameer PujarAsynchronous Sample Rate Converter (ASRC) module is a client of AHUB on Tegra186 and later SoCs. To use this module enable the driver build.
--- arch/arm64/configs/defconfig | 1 + 1 file changed, 1 insertion(+)
arch/arm64/configs/defconfig +1 -0
@@ -798,6 +798,7 @@ CONFIG_SND_SOC_TEGRA=m CONFIG_SND_SOC_TEGRA210_AHUB=m CONFIG_SND_SOC_TEGRA210_DMIC=m CONFIG_SND_SOC_TEGRA210_I2S=m +CONFIG_SND_SOC_TEGRA186_ASRC=m CONFIG_SND_SOC_TEGRA186_DSPK=m CONFIG_SND_SOC_TEGRA210_ADMAIF=m CONFIG_SND_SOC_TEGRA210_MVC=m
Signature · 1 line
2.7.4
PATCH 5/6 arm64: tegra: Add ASRC device on Tegra186 and later
In reply to Sameer PujarAsynchronous Sample Rate Converter (ASRC) is a client of AHUB and is present on Tegra186 and later generations of Tegra SoC. Add this device on the relevant SoC DTSI files.
--- arch/arm64/boot/dts/nvidia/tegra186.dtsi | 7 +++++++ arch/arm64/boot/dts/nvidia/tegra194.dtsi | 8 ++++++++ arch/arm64/boot/dts/nvidia/tegra234.dtsi | 8 ++++++++ 3 files changed, 23 insertions(+)
arch/arm64/boot/dts/nvidia/tegra186.dtsi +7 -0
@@ -516,6 +516,13 @@ sound-name-prefix = "MIXER1"; status = "disabled"; }; + + tegra_asrc: asrc@2910000 { + compatible = "nvidia,tegra186-asrc"; + reg = <0x2910000 0x2000>; + sound-name-prefix = "ASRC1"; + status = "disabled"; + }; }; };
arch/arm64/boot/dts/nvidia/tegra194.dtsi +8 -0
@@ -569,6 +569,14 @@ sound-name-prefix = "MIXER1"; status = "disabled"; }; + + tegra_asrc: asrc@2910000 { + compatible = "nvidia,tegra194-asrc", + "nvidia,tegra186-asrc"; + reg = <0x2910000 0x2000>; + sound-name-prefix = "ASRC1"; + status = "disabled"; + }; }; };
arch/arm64/boot/dts/nvidia/tegra234.dtsi +8 -0
@@ -378,6 +378,14 @@ iommus = <&smmu_niso0 TEGRA234_SID_APE>; status = "disabled"; }; + + tegra_asrc: asrc@2910000 { + compatible = "nvidia,tegra234-asrc", + "nvidia,tegra186-asrc"; + reg = <0x2910000 0x2000>; + sound-name-prefix = "ASRC1"; + status = "disabled"; + }; }; adma: dma-controller@2930000 {
Signature · 1 line
2.7.4
PATCH 6/6 arm64: tegra: Enable ASRC on various platforms
In reply to Sameer PujarEnable ASRC module usage on various Jetson Platforms. This can be plugged into an audio path using ALSA mixer controls.
--- arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts | 223 +++++++++++++++++++++ arch/arm64/boot/dts/nvidia/tegra194-p2972-0000.dts | 223 +++++++++++++++++++++ .../arm64/boot/dts/nvidia/tegra194-p3509-0000.dtsi | 223 +++++++++++++++++++++ .../dts/nvidia/tegra234-p3737-0000+p3701-0000.dts | 223 +++++++++++++++++++++ 4 files changed, 892 insertions(+)
arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts +223 -0
@@ -811,6 +811,110 @@ remote-endpoint = <&mixer_out5_ep>; }; }; + + xbar_asrc_in1_port: port@63 { + reg = <0x63>; + + xbar_asrc_in1_ep: endpoint { + remote-endpoint = <&asrc_in1_ep>; + }; + }; + + port@64 { + reg = <0x64>; + + xbar_asrc_out1_ep: endpoint { + remote-endpoint = <&asrc_out1_ep>; + }; + }; + + xbar_asrc_in2_port: port@65 { + reg = <0x65>; + + xbar_asrc_in2_ep: endpoint { + remote-endpoint = <&asrc_in2_ep>; + }; + }; + + port@66 { + reg = <0x66>; + + xbar_asrc_out2_ep: endpoint { + remote-endpoint = <&asrc_out2_ep>; + }; + }; + + xbar_asrc_in3_port: port@67 { + reg = <0x67>; + + xbar_asrc_in3_ep: endpoint { + remote-endpoint = <&asrc_in3_ep>; + }; + }; + + port@68 { + reg = <0x68>; + + xbar_asrc_out3_ep: endpoint { + remote-endpoint = <&asrc_out3_ep>; + }; + }; + + xbar_asrc_in4_port: port@69 { + reg = <0x69>; + + xbar_asrc_in4_ep: endpoint { + remote-endpoint = <&asrc_in4_ep>; + }; + }; + + port@6a { + reg = <0x6a>; + + xbar_asrc_out4_ep: endpoint { + remote-endpoint = <&asrc_out4_ep>; + }; + }; + + xbar_asrc_in5_port: port@6b { + reg = <0x6b>; + + xbar_asrc_in5_ep: endpoint { + remote-endpoint = <&asrc_in5_ep>; + }; + }; + + port@6c { + reg = <0x6c>; + + xbar_asrc_out5_ep: endpoint { + remote-endpoint = <&asrc_out5_ep>; + }; + }; + + xbar_asrc_in6_port: port@6d { + reg = <0x6d>; + + xbar_asrc_in6_ep: endpoint { + remote-endpoint = <&asrc_in6_ep>; + }; + }; + + port@6e { + reg = <0x6e>; + + xbar_asrc_out6_ep: endpoint { + remote-endpoint = <&asrc_out6_ep>; + }; + }; + + xbar_asrc_in7_port: port@6f { + reg = <0x6f>; + + xbar_asrc_in7_ep: endpoint { + remote-endpoint = <&asrc_in7_ep>; + }; + }; }; admaif@290f000 {
@@ -1935,6 +2039,119 @@ }; }; }; + + asrc@2910000 { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0x0>; + + asrc_in1_ep: endpoint { + remote-endpoint = <&xbar_asrc_in1_ep>; + }; + }; + + port@1 { + reg = <0x1>; + + asrc_in2_ep: endpoint { + remote-endpoint = <&xbar_asrc_in2_ep>; + }; + }; + + port@2 { + reg = <0x2>; + + asrc_in3_ep: endpoint { + remote-endpoint = <&xbar_asrc_in3_ep>; + }; + }; + + port@3 { + reg = <0x3>; + + asrc_in4_ep: endpoint { + remote-endpoint = <&xbar_asrc_in4_ep>; + }; + }; + + port@4 { + reg = <0x4>; + + asrc_in5_ep: endpoint { + remote-endpoint = <&xbar_asrc_in5_ep>; + }; + }; + + port@5 { + reg = <0x5>; + + asrc_in6_ep: endpoint { + remote-endpoint = <&xbar_asrc_in6_ep>; + }; + }; + + port@6 { + reg = <0x6>; + + asrc_in7_ep: endpoint { + remote-endpoint = <&xbar_asrc_in7_ep>; + }; + }; + + asrc_out1_port: port@7 { + reg = <0x7>; + + asrc_out1_ep: endpoint { + remote-endpoint = <&xbar_asrc_out1_ep>; + }; + }; + + asrc_out2_port: port@8 { + reg = <0x8>; + + asrc_out2_ep: endpoint { + remote-endpoint = <&xbar_asrc_out2_ep>; + }; + }; + + asrc_out3_port: port@9 { + reg = <0x9>; + + asrc_out3_ep: endpoint { + remote-endpoint = <&xbar_asrc_out3_ep>; + }; + }; + + asrc_out4_port: port@a { + reg = <0xa>; + + asrc_out4_ep: endpoint { + remote-endpoint = <&xbar_asrc_out4_ep>; + }; + }; + + asrc_out5_port: port@b { + reg = <0xb>; + + asrc_out5_ep: endpoint { + remote-endpoint = <&xbar_asrc_out5_ep>; + }; + }; + + asrc_out6_port: port@c { + reg = <0xc>; + + asrc_out6_ep: endpoint { + remote-endpoint = <&xbar_asrc_out6_ep>; + }; + }; + }; + }; }; };
@@ -2331,6 +2548,10 @@ <&xbar_mixer_in5_port>, <&xbar_mixer_in6_port>, <&xbar_mixer_in7_port>, <&xbar_mixer_in8_port>, <&xbar_mixer_in9_port>, <&xbar_mixer_in10_port>, + <&xbar_asrc_in1_port>, <&xbar_asrc_in2_port>, + <&xbar_asrc_in3_port>, <&xbar_asrc_in4_port>, + <&xbar_asrc_in5_port>, <&xbar_asrc_in6_port>, + <&xbar_asrc_in7_port>, /* HW accelerators */ <&sfc1_out_port>, <&sfc2_out_port>, <&sfc3_out_port>, <&sfc4_out_port>,
@@ -2348,6 +2569,8 @@ <&mixer_out1_port>, <&mixer_out2_port>, <&mixer_out3_port>, <&mixer_out4_port>, <&mixer_out5_port>, + <&asrc_out1_port>, <&asrc_out2_port>, <&asrc_out3_port>, + <&asrc_out4_port>, <&asrc_out5_port>, <&asrc_out6_port>, /* I/O */ <&i2s1_port>, <&i2s2_port>, <&i2s3_port>, <&i2s4_port>, <&i2s5_port>, <&i2s6_port>, <&dmic1_port>, <&dmic2_port>,
arch/arm64/boot/dts/nvidia/tegra194-p2972-0000.dts +223 -0
247 lines not on this page · raw message
arch/arm64/boot/dts/nvidia/tegra194-p3509-0000.dtsi +223 -0
247 lines not on this page · raw message
arch/arm64/boot/dts/nvidia/tegra234-p3737-0000+p3701-0000.dts +223 -0
247 lines not on this page · raw message
Signature · 1 line
2.7.4
Mark Brown
maintainerRe: [PATCH 2/6] ASoC: tegra: Add Tegra186 based ASRC driver
In reply to Sameer Pujarsound/soc/tegra/tegra186_asrc.c line 123
Quoted 11 lines · Sameer Pujar
sound/soc/tegra/tegra186_asrc.c new file +11
-0+regcache_cache_only (asrc->regmap, false); +regcache_sync (asrc->regmap); + +/* Setup global registers */ +regmap_write (asrc->regmap,TEGRA186_ASRC_GLOBAL_SOFT_RESET ,0x1 ); +regmap_write (asrc->regmap,TEGRA186_ASRC_GLOBAL_SCRATCH_ADDR , +TEGRA186_ASRC_ARAM_START_ADDR ); +regmap_write (asrc->regmap,TEGRA186_ASRC_GLOBAL_INT_MASK ,0x01 ); +regmap_write (asrc->regmap,TEGRA186_ASRC_GLOBAL_ENB , +TEGRA186_ASRC_GLOBAL_EN ); +regmap_write (asrc->regmap,TEGRA186_ASRC_GLOBAL_INT_CLEAR ,0x01 );
This seems weird - we resync the cache, then do a soft reset (which presumably desyncs the cache) and then explicitly restore a bunch of things (hopefully everything that was in the cached state?). This is certainly very much not idiomatic and looks worrying. Are you sure that the device is getting anything out of the register cache?
Quoted 7 lines
sound/soc/tegra/tegra186_asrc.c new file +7
-0+static int tegra186_asrc_put_ratio_source (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{ +struct soc_enum *asrc_private = + (struct soc_enum *)kcontrol->private_value; +struct snd_soc_component *cmpnt =snd_soc_kcontrol_component (kcontrol); +struct tegra186_asrc *asrc =snd_soc_component_get_drvdata (cmpnt);
sound/soc/tegra/tegra186_asrc.c line 288
Quoted 10 lines
sound/soc/tegra/tegra186_asrc.c new file +10
-0+unsigned int id = asrc_private->reg /TEGRA186_ASRC_STREAM_STRIDE ; + + asrc->lane[id].ratio_source = ucontrol->value.enumerated.item[0 ]; + +regmap_update_bits (asrc->regmap, asrc_private->reg, +TEGRA186_ASRC_STREAM_RATIO_TYPE_MASK , + asrc->lane[id].ratio_source); + +return 1 ; +}
This should only return 1 if the value actually changed, you can use regmap_update_bits_check() to detect the change. Current mixer-test ought to spot this.
sound/soc/tegra/tegra186_asrc.c line 679
Quoted 7 lines
sound/soc/tegra/tegra186_asrc.c new file +7
-0+static const struct snd_kcontrol_new tegra186_asrc_controls[] = { +/* Controls for integer part of ratio */ +SOC_SINGLE_EXT ("Ratio1 Integer Part" , +ASRC_STREAM_REG (TEGRA186_ASRC_RATIO_INT_PART ,0 ), +0 ,TEGRA186_ASRC_STREAM_RATIO_INT_PART_MASK ,0 , + tegra186_asrc_get_ratio_int, + tegra186_asrc_put_ratio_int),
Can't the driver work out the ratios based on...
sound/soc/tegra/tegra186_asrc.c line 751
Quoted 4 lines
sound/soc/tegra/tegra186_asrc.c new file +4
-0+/* Source of ratio provider */ +SOC_ENUM_EXT ("Ratio1 Source" , src_select1, + tegra186_asrc_get_ratio_source, + tegra186_asrc_put_ratio_source),
...the sources? Or does it need to be configured before either side is ready in which case this might be the best we can do for now.
Re: [PATCH 2/6] ASoC: tegra: Add Tegra186 based ASRC driver
Quoted 18 lines · Mark Brown
sound/soc/tegra/tegra186_asrc.c line 123
Quoted 11 lines · Sameer Pujar
sound/soc/tegra/tegra186_asrc.c new file +11
-0+regcache_cache_only (asrc->regmap, false); +regcache_sync (asrc->regmap); + +/* Setup global registers */ +regmap_write (asrc->regmap,TEGRA186_ASRC_GLOBAL_SOFT_RESET ,0x1 ); +regmap_write (asrc->regmap,TEGRA186_ASRC_GLOBAL_SCRATCH_ADDR , +TEGRA186_ASRC_ARAM_START_ADDR ); +regmap_write (asrc->regmap,TEGRA186_ASRC_GLOBAL_INT_MASK ,0x01 ); +regmap_write (asrc->regmap,TEGRA186_ASRC_GLOBAL_ENB , +TEGRA186_ASRC_GLOBAL_EN ); +regmap_write (asrc->regmap,TEGRA186_ASRC_GLOBAL_INT_CLEAR ,0x01 );This seems weird - we resync the cache, then do a soft reset (which presumably desyncs the cache) and then explicitly restore a bunch of things (hopefully everything that was in the cached state?). This is certainly very much not idiomatic and looks worrying. Are you sure that the device is getting anything out of the register cache?
Let me recheck this part. It may not be required to setup these registers for every RPM resume. Thanks for pointing this.
Quoted 12 lines
Quoted 12 lines
sound/soc/tegra/tegra186_asrc.c new file +12
-0+static int tegra186_asrc_put_ratio_source (struct snd_kcontrol *kcontrol, +struct snd_ctl_elem_value *ucontrol) +{ +struct soc_enum *asrc_private = + (struct soc_enum *)kcontrol->private_value; +struct snd_soc_component *cmpnt =snd_soc_kcontrol_component (kcontrol); +struct tegra186_asrc *asrc =snd_soc_component_get_drvdata (cmpnt); +unsigned int id = asrc_private->reg /TEGRA186_ASRC_STREAM_STRIDE ; + + asrc->lane[id].ratio_source = ucontrol->value.enumerated.item[0 ]; + + regmap_update_bits(asrc->regmap, asrc_private->reg,
Quoted 8 lines
sound/soc/tegra/tegra186_asrc.c line 288
Quoted 5 lines
sound/soc/tegra/tegra186_asrc.c new file +5
-0+TEGRA186_ASRC_STREAM_RATIO_TYPE_MASK , + asrc->lane[id].ratio_source); + +return 1 ; +}This should only return 1 if the value actually changed, you can use
regmap_update_bits_check()to detect the change. Current mixer-test ought to spot this.
Will fix this.
Quoted 9 lines
sound/soc/tegra/tegra186_asrc.c line 679
Quoted 7 lines
sound/soc/tegra/tegra186_asrc.c new file +7
-0+static const struct snd_kcontrol_new tegra186_asrc_controls[] = { +/* Controls for integer part of ratio */ +SOC_SINGLE_EXT ("Ratio1 Integer Part" , +ASRC_STREAM_REG (TEGRA186_ASRC_RATIO_INT_PART ,0 ), +0 ,TEGRA186_ASRC_STREAM_RATIO_INT_PART_MASK ,0 , + tegra186_asrc_get_ratio_int, + tegra186_asrc_put_ratio_int),Can't the driver work out the ratios based on...
Quoted 6 lines
sound/soc/tegra/tegra186_asrc.c line 751
Quoted 4 lines
sound/soc/tegra/tegra186_asrc.c new file +4
-0+/* Source of ratio provider */ +SOC_ENUM_EXT ("Ratio1 Source" , src_select1, + tegra186_asrc_get_ratio_source, + tegra186_asrc_put_ratio_source),...the sources? Or does it need to be configured before either side is ready in which case this might be the best we can do for now.
The ratio needs to be updated before start of the stream and this programming via controls is required only when the ratio source is SW. When ratio detector module is used (support is not yet added), the ratio is automatically updated by HW.
Mark Brown
maintainerRe: [PATCH 2/6] ASoC: tegra: Add Tegra186 based ASRC driver
Quoted 11 lines · Sameer Pujar
Quoted 9 lines · Mark Brown
sound/soc/tegra/tegra186_asrc.c line 751
Quoted 4 lines · Sameer Pujar
sound/soc/tegra/tegra186_asrc.c new file +4
-0+/* Source of ratio provider */ +SOC_ENUM_EXT ("Ratio1 Source" , src_select1, + tegra186_asrc_get_ratio_source, + tegra186_asrc_put_ratio_source),...the sources? Or does it need to be configured before either side is ready in which case this might be the best we can do for now.
Quoted 4 lines
The ratio needs to be updated before start of the stream and this programming via controls is required only when the ratio source is SW. When ratio detector module is used (support is not yet added), the ratio is automatically updated by HW.
OK, that's not ideal but should be fine for now. Ideally we'd have the rate detector support introduced in the same release.