Unverified Commit 2a07ef63 authored by Mark Brown's avatar Mark Brown
Browse files

Merge series "Extend AHUB audio support for Tegra210 and later" from Sameer...

Merge series "Extend AHUB audio support for Tegra210 and later" from Sameer Pujar <spujar@nvidia.com>:

Earlier as part of series [0], support for ADMAIF and I/O modules (such
as I2S, DMIC and DSPK) was added. This series aims at exposing some of
the AHUB internal modules (listed below), which can be used for audio
pre or post processing.

  * SFC (Sampling Frequency Converter)
  * MVC (Master Volume Control)
  * AMX (Audio Multiplexer)
  * ADX (Audio Demultiplexer)
  * Mixer

These modules can be plugged into audio paths and relevant processing
can be done. The MUX routes are extended to allow add or remove above
modules in the path via mixer controls. This is similar to how specific
ADMAIF channels are connected to relevant I/O module instances at the
moment.

Some of these modules can alter PCM parameters. Consider example of
resampler (44.1 -> 48 kHz) in the path.

  aplay(44.1 kHz) -> ADMAIF -> SFC -> (48 kHz) I2S -> (48kHz) Codec

The modules following SFC should be using converted sample rate and DAIs
need to be configured accordingly. The audio-graph driver provides a
mechanism to fixup the new parameters which can be specified in DT for a
given DAI. Then core uses these new values via fixup callback and then
pass it to respective DAIs hw_param() callback. The "convert-rate",
described in [1], property can be used when there is rate conversion in
the audio path. Similarly "convert-channels" can be used when there is
channel conversion in the path. There is no "convert-xxx" property for
sample size conversions. It can be added if necessary.

[0] https://www.lkml.org/lkml/2020/7/21/1357
[1] Documentation/devicetree/bindings/sound/audio-graph-port.yaml

Changelog
=========

v1 -> v2
--------
 * Put comments for soft reset application in the drivers.
 * Split out mute/volume control logic in put() calls of MVC driver and
   use separate callbacks for the respective kcontrols.
 * Update kcontrol put() callback in MVC driver to return 1 whenever
   there is change. Similar change is done in other drivers too.
 * Use name-prefix.yaml reference for the driver documentation now.
 * Add sound-name-prefix pattern for MIXER driver and use prefix
   accordingly in DT.

Sameer Pujar (13):
  ASoC: soc-pcm: Don't reconnect an already active BE
  ASoC: simple-card-utils: Increase maximum DAI links limit to 512
  ASoC: audio-graph: Fixup CPU endpoint hw_params in a BE<->BE link
  ASoC: dt-bindings: tegra: Few more Tegra210 AHUB modules
  ASoC: tegra: Add routes for few AHUB modules
  ASoC: tegra: Add Tegra210 based MVC driver
  ASoC: tegra: Add Tegra210 based SFC driver
  ASoC: tegra: Add Tegra210 based AMX driver
  ASoC: tegra: Add Tegra210 based ADX driver
  ASoC: tegra: Add Tegra210 based Mixer driver
  arm64: defconfig: Enable few Tegra210 based AHUB drivers
  arm64: tegra: Add few AHUB devices for Tegra210 and later
  arm64: tegra: Extend APE audio support on Jetson platforms

 .../bindings/sound/nvidia,tegra210-adx.yaml        |   76 +
 .../bindings/sound/nvidia,tegra210-ahub.yaml       |   20 +
 .../bindings/sound/nvidia,tegra210-amx.yaml        |   76 +
 .../bindings/sound/nvidia,tegra210-mixer.yaml      |   74 +
 .../bindings/sound/nvidia,tegra210-mvc.yaml        |   76 +
 .../bindings/sound/nvidia,tegra210-sfc.yaml        |   73 +
 arch/arm64/boot/dts/nvidia/tegra186-p2771-0000.dts | 1554 ++++++++-
 arch/arm64/boot/dts/nvidia/tegra186.dtsi           |  120 +
 arch/arm64/boot/dts/nvidia/tegra194-p2972-0000.dts | 1493 +++++++-
 .../arm64/boot/dts/nvidia/tegra194-p3509-0000.dtsi | 1520 ++++++++-
 arch/arm64/boot/dts/nvidia/tegra194.dtsi           |  116 +
 arch/arm64/boot/dts/nvidia/tegra210-p2371-2180.dts |  876 +++++
 arch/arm64/boot/dts/nvidia/tegra210-p3450-0000.dts |  876 +++++
 arch/arm64/boot/dts/nvidia/tegra210.dtsi           |   77 +
 arch/arm64/configs/defconfig                       |    5 +
 include/sound/simple_card_utils.h                  |    2 +-
 sound/soc/generic/audio-graph-card.c               |    4 +-
 sound/soc/soc-pcm.c                                |    4 +
 sound/soc/tegra/Kconfig                            |   48 +
 sound/soc/tegra/Makefile                           |   10 +
 sound/soc/tegra/tegra210_adx.c                     |  531 +++
 sound/soc/tegra/tegra210_adx.h                     |   72 +
 sound/soc/tegra/tegra210_ahub.c                    |  511 ++-
 sound/soc/tegra/tegra210_amx.c                     |  600 ++++
 sound/soc/tegra/tegra210_amx.h                     |   93 +
 sound/soc/tegra/tegra210_mixer.c                   |  674 ++++
 sound/soc/tegra/tegra210_mixer.h                   |  100 +
 sound/soc/tegra/tegra210_mvc.c                     |  645 ++++
 sound/soc/tegra/tegra210_mvc.h                     |  117 +
 sound/soc/tegra/tegra210_sfc.c                     | 3549 ++++++++++++++++++++
 sound/soc/tegra/tegra210_sfc.h                     |   78 +
 31 files changed, 13647 insertions(+), 423 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra210-adx.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra210-amx.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra210-mixer.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra210-mvc.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/nvidia,tegra210-sfc.yaml
 create mode 100644 sound/soc/tegra/tegra210_adx.c
 create mode 100644 sound/soc/tegra/tegra210_adx.h
 create mode 100644 sound/soc/tegra/tegra210_amx.c
 create mode 100644 sound/soc/tegra/tegra210_amx.h
 create mode 100644 sound/soc/tegra/tegra210_mixer.c
 create mode 100644 sound/soc/tegra/tegra210_mixer.h
 create mode 100644 sound/soc/tegra/tegra210_mvc.c
 create mode 100644 sound/soc/tegra/tegra210_mvc.h
 create mode 100644 sound/soc/tegra/tegra210_sfc.c
 create mode 100644 sound/soc/tegra/tegra210_sfc.h

--
2.7.4
parents 0f9a84b2 05bb3d5e
Loading
Loading
Loading
Loading
+76 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/nvidia,tegra210-adx.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Tegra210 ADX Device Tree Bindings

description: |
  The Audio Demultiplexer (ADX) block takes an input stream with up to
  16 channels and demultiplexes it into four output streams of up to 16
  channels each. A byte RAM helps to form output frames by any combination
  of bytes from the input frame. Its design is identical to that of byte
  RAM in the AMX except that the data flow direction is reversed.

maintainers:
  - Jon Hunter <jonathanh@nvidia.com>
  - Mohan Kumar <mkumard@nvidia.com>
  - Sameer Pujar <spujar@nvidia.com>

allOf:
  - $ref: name-prefix.yaml#

properties:
  $nodename:
    pattern: "^adx@[0-9a-f]*$"

  compatible:
    oneOf:
      - const: nvidia,tegra210-adx
      - items:
          - enum:
              - nvidia,tegra194-adx
              - nvidia,tegra186-adx
          - const: nvidia,tegra210-adx

  reg:
    maxItems: 1

  sound-name-prefix:
    pattern: "^ADX[1-9]$"

  ports:
    $ref: /schemas/graph.yaml#/properties/ports
    description: |
      ADX has one input and four outputs. Accordingly ACIF (Audio Client
      Interface) port nodes are defined to represent ADX input (port 0)
      and outputs (ports 1 to 4). These are connected to corresponding
      ports on AHUB (Audio Hub).
    properties:
      port@0:
        $ref: audio-graph-port.yaml#
        unevaluatedProperties: false
        description: ADX ACIF input port
    patternProperties:
      '^port@[1-4]':
        $ref: audio-graph-port.yaml#
        unevaluatedProperties: false
        description: ADX ACIF output ports

required:
  - compatible
  - reg

additionalProperties: false

examples:
  - |

    adx@702d3800 {
        compatible = "nvidia,tegra210-adx";
        reg = <0x702d3800 0x100>;
        sound-name-prefix = "ADX1";
    };

...
+20 −0
Original line number Diff line number Diff line
@@ -85,6 +85,26 @@ patternProperties:
    type: object
    $ref: nvidia,tegra186-dspk.yaml#

  '^mvc@[0-9a-f]+$':
    type: object
    $ref: nvidia,tegra210-mvc.yaml#

  '^sfc@[0-9a-f]+$':
    type: object
    $ref: nvidia,tegra210-sfc.yaml#

  '^amx@[0-9a-f]+$':
    type: object
    $ref: nvidia,tegra210-amx.yaml#

  '^adx@[0-9a-f]+$':
    type: object
    $ref: nvidia,tegra210-adx.yaml#

  '^amixer@[0-9a-f]+$':
    type: object
    $ref: nvidia,tegra210-mixer.yaml#

required:
  - compatible
  - reg
+76 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/nvidia,tegra210-amx.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Tegra210 AMX Device Tree Bindings

description: |
  The Audio Multiplexer (AMX) block can multiplex up to four input streams
  each of which can have maximum 16 channels and generate an output stream
  with maximum 16 channels. A byte RAM helps to form an output frame by
  any combination of bytes from the input frames.

maintainers:
  - Jon Hunter <jonathanh@nvidia.com>
  - Mohan Kumar <mkumard@nvidia.com>
  - Sameer Pujar <spujar@nvidia.com>

allOf:
  - $ref: name-prefix.yaml#

properties:
  $nodename:
    pattern: "^amx@[0-9a-f]*$"

  compatible:
    oneOf:
      - const: nvidia,tegra210-amx
      - items:
          - const: nvidia,tegra186-amx
          - const: nvidia,tegra210-amx
      - const: nvidia,tegra194-amx

  reg:
    maxItems: 1

  sound-name-prefix:
    pattern: "^AMX[1-9]$"

  ports:
    $ref: /schemas/graph.yaml#/properties/ports
    description: |
      AMX has four inputs and one output. Accordingly ACIF (Audio Client
      Interfaces) port nodes are defined to represent AMX inputs (port 0
      to 3) and output (port 4). These are connected to corresponding
      ports on AHUB (Audio Hub).

    patternProperties:
      '^port@[0-3]':
        $ref: audio-graph-port.yaml#
        unevaluatedProperties: false
        description: AMX ACIF input ports

    properties:
      port@4:
        $ref: audio-graph-port.yaml#
        unevaluatedProperties: false
        description: AMX ACIF output port

required:
  - compatible
  - reg

additionalProperties: false

examples:
  - |

    amx@702d3000 {
        compatible = "nvidia,tegra210-amx";
        reg = <0x702d3000 0x100>;
        sound-name-prefix = "AMX1";
    };

...
+74 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/nvidia,tegra210-mixer.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Tegra210 Mixer Device Tree Bindings

description: |
  The Mixer supports mixing of up to ten 7.1 audio input streams and
  generate five outputs (each of which can be any combination of the
  ten input streams).

maintainers:
  - Jon Hunter <jonathanh@nvidia.com>
  - Mohan Kumar <mkumard@nvidia.com>
  - Sameer Pujar <spujar@nvidia.com>

allOf:
  - $ref: name-prefix.yaml#

properties:
  $nodename:
    pattern: "^amixer@[0-9a-f]*$"

  compatible:
    oneOf:
      - const: nvidia,tegra210-amixer
      - items:
          - enum:
              - nvidia,tegra194-amixer
              - nvidia,tegra186-amixer
          - const: nvidia,tegra210-amixer

  reg:
    maxItems: 1

  sound-name-prefix:
    pattern: "^MIXER[1-9]$"

  ports:
    $ref: /schemas/graph.yaml#/properties/ports
    description: |
      Mixer has ten inputs and five outputs. Accordingly ACIF (Audio
      Client Interfaces) port nodes are defined to represent Mixer
      inputs (port 0 to 9) and outputs (port 10 to 14). These are
      connected to corresponding ports on AHUB (Audio Hub).

    patternProperties:
      '^port@[0-9]':
        $ref: audio-graph-port.yaml#
        unevaluatedProperties: false
        description: Mixer ACIF input ports
      '^port@[10-14]':
        $ref: audio-graph-port.yaml#
        unevaluatedProperties: false
        description: Mixer ACIF output ports

required:
  - compatible
  - reg

additionalProperties: false

examples:
  - |

    amixer@702dbb00 {
        compatible = "nvidia,tegra210-amixer";
        reg = <0x702dbb00 0x800>;
        sound-name-prefix = "MIXER1";
    };

...
+76 −0
Original line number Diff line number Diff line
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/sound/nvidia,tegra210-mvc.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#

title: Tegra210 MVC Device Tree Bindings

description: |
  The Master Volume Control (MVC) provides gain or attenuation to a digital
  signal path. It can be used in input or output signal path for per-stream
  volume control or it can be used as master volume control. The MVC block
  has one input and one output. The input digital stream can be mono or
  multi-channel (up to 7.1 channels) stream. An independent mute control is
  also included in the MVC block.

maintainers:
  - Jon Hunter <jonathanh@nvidia.com>
  - Mohan Kumar <mkumard@nvidia.com>
  - Sameer Pujar <spujar@nvidia.com>

allOf:
  - $ref: name-prefix.yaml#

properties:
  $nodename:
    pattern: "^mvc@[0-9a-f]*$"

  compatible:
    oneOf:
      - const: nvidia,tegra210-mvc
      - items:
          - enum:
              - nvidia,tegra194-mvc
              - nvidia,tegra186-mvc
          - const: nvidia,tegra210-mvc

  reg:
    maxItems: 1

  sound-name-prefix:
    pattern: "^MVC[1-9]$"

  ports:
    $ref: /schemas/graph.yaml#/properties/ports
    properties:
      port@0:
        $ref: audio-graph-port.yaml#
        unevaluatedProperties: false
        description: |
          MVC ACIF (Audio Client Interface) input port. This is connected
          to corresponding ACIF output port on AHUB (Audio Hub).

      port@1:
        $ref: audio-graph-port.yaml#
        unevaluatedProperties: false
        description: |
          MVC ACIF output port. This is connected to corresponding ACIF
          input port on AHUB.

required:
  - compatible
  - reg

additionalProperties: false

examples:
  - |

    mvc@702da000 {
        compatible = "nvidia,tegra210-mvc";
        reg = <0x702da000 0x200>;
        sound-name-prefix = "MVC1";
    };

...
Loading