mbox series

[RFC,00/13] ASoC: qcom: Add AudioReach support

Message ID 20210607152836.17154-1-srinivas.kandagatla@linaro.org
Headers show
Series ASoC: qcom: Add AudioReach support | expand

Message

Srinivas Kandagatla June 7, 2021, 3:28 p.m. UTC
This patchset adds ASoC driver support to configure signal processing
framework ("AudioReach") which is integral part of Qualcomm next
generation audio SDK and will be deployed on upcoming Qualcomm chipsets.
It makes use of ASoC Topology to load graphs on to the DSP which is then
managed by APM (Audio Processing Manager) service to prepare/start/stop.

Here is simpified high-level block diagram of AudioReach:

 ___________________________________________________________
|                 CPU (Application Processor)               |
|  +---------+          +---------+         +---------+     |
|  |  q6apm  |          |  q6apm  |         | q6afe   |     |
|  |   dais  | <------> |         | <-----> | bedais  |     |
|  +---------+          +---------+         +---------+     |
|                            ^  ^                           |
|                            |  |           +---------+     |
|  +---------+               v  +---------->|topology |     |
|  | q6prm   |          +---------+         |         |     |
|  |         |<-------->|   GPR   |         +---------+     |
|  +---------+          +---------+                         |
|                            ^                              |
|____________________________|______________________________|
                             |  
                             | RPMSG (IPC over GLINK)              
 ____________________________|______________________________
|                            |                              |
|    +-----------------------+                              |
|    |                       |                              |
|    v                       v              q6 (Audio DSP)  |
|+-----+    +----------------------------------+            |
|| PRM |    | APM (Audio Processing Manager)   |            |
|+-----+    |  . Graph Management              |            |  
|           |  . Command Handing               |            |  
|           |  . Event Management              |            |  
|           |  ...                             |            |  
|           +----------------------------------+            |  
|                            ^                              |
|____________________________|______________________________|
                             |  
                             |   LPASS AIF
 ____________________________|______________________________
|                            |            Audio I/O         |
|                            v                              |
|   +--------------------------------------------------+    |
|    |                Audio devices                     |   |
|    | CODEC | HDMI-TX | PCM  | SLIMBUS | I2S |MI2S |...|   |
|    |                                                  |   |
|    +--------------------------------------------------+   |
|___________________________________________________________|

AudioReach has constructs of sub-graph, container and modules.
Each sub-graph can have N containers and each Container can have N Modules
and connections between them can be linear or non-linear.
An audio function can be realized with one or many connected
sub-graphs. There are also control/event paths between modules that can
be wired up while building graph to achieve various control mechanism
between modules. These concepts of Sub-Graph, Containers and Modules
are represented in ASoC topology.

Here is simple I2S graph with a Write Shared Memory and a
Volume control module within a single Subgraph (1) with one Container (1)
and 5 modules.

  ____________________________________________________________
 |                        Sub-Graph [1]                       |
 |  _______________________________________________________   |
 | |                       Container [1]                   |  |
 | | [WR_SH] -> [PCM DEC] -> [PCM CONV] -> [VOL]-> [I2S-EP]|  |
 | |_______________________________________________________|  |
 |____________________________________________________________|

For now this graph is split into two subgraphs to achieve dpcm like below:
 ________________________________________________    _________________
|                Sub-Graph [1]                   |  |  Sub-Graph [2]  |
|  ____________________________________________  |  |  _____________  |
| |              Container [1]                 | |  | |Container [2]| |
| | [WR_SH] -> [PCM DEC] -> [PCM CONV] -> [VOL]| |  | |   [I2S-EP]  | |
| |____________________________________________| |  | |_____________| |
|________________________________________________|  |_________________|

                                                      _________________
                                                    |  Sub-Graph [3]  |
                                                    |  _____________  |
                                                    | |Container [3]| |
                                                    | |  [DMA-EP]   | |
                                                    | |_____________| |
                                                    |_________________|


This patchset adds very minimal support for AudioReach which includes
supporting sub-graphs containing CODEC DMA ports and simple PCM
Decoder/Encoder and Logger Modules. Additional capabilities will
be built over time to expose features offered by AudioReach. 

This patchset is Tested on SM8250 SoC based Qualcomm Robotics Platform RB5
and SM9250 MTP with WSA881X Smart Speaker Amplifiers, DMICs connected via
VA Macro and WCD938x Codec connected via TX and RX Macro.

Sample WIP ASoC graphs are available at 
https://git.linaro.org/people/srinivas.kandagatla/audioreach-topology.git/

Thanks,
srini

Srinivas Kandagatla (13):
  soc: dt-bindings: qcom: add gpr bindings
  soc: qcom: add gpr driver support
  ASoC: qcom: dt-bindings: add bindings Audio Processing manager
  ASoC: qcom: audioreach: add basic pkt alloc support
  ASoC: qcom: audioreach: add q6apm support
  ASoC: qcom: audioreach: add module configuration command helpers
  ASoC: qcom: audioreach: add topology support
  ASoC: qcom: audioreach: add q6apm-dai support
  ASoC: qcom: audioreach: add bedai support
  ASoC: qcom: dt-bindings: add bindings for Proxy Resource Manager
  ASoC: qcom: audioreach: add q6prm support
  ASoC: qcom: dt-bindings: add audioreach soundcard compatibles
  ASoC: qcom: sm8250: Add audioreach support

 .../bindings/soc/qcom/qcom,gpr.yaml           |   74 ++
 .../devicetree/bindings/sound/qcom,q6apm.yaml |   72 ++
 .../devicetree/bindings/sound/qcom,q6prm.yaml |   43 +
 .../bindings/sound/qcom,sm8250.yaml           |   43 +
 drivers/soc/qcom/Kconfig                      |    9 +
 drivers/soc/qcom/Makefile                     |    1 +
 drivers/soc/qcom/gpr.c                        |  487 ++++++++
 include/dt-bindings/soc/qcom,gpr.h            |   18 +
 include/dt-bindings/sound/qcom,q6apm.h        |  215 ++++
 include/dt-bindings/sound/qcom,q6prm.h        |  205 ++++
 include/linux/soc/qcom/gpr.h                  |  127 ++
 include/uapi/sound/snd_ar_tokens.h            |  200 +++
 sound/soc/qcom/Kconfig                        |   20 +
 sound/soc/qcom/Makefile                       |    1 +
 sound/soc/qcom/audioreach/Makefile            |   12 +
 sound/soc/qcom/audioreach/audioreach.c        | 1082 +++++++++++++++++
 sound/soc/qcom/audioreach/audioreach.h        |  649 ++++++++++
 sound/soc/qcom/audioreach/q6apm-bedai.c       |  377 ++++++
 sound/soc/qcom/audioreach/q6apm-dai.c         |  494 ++++++++
 sound/soc/qcom/audioreach/q6apm.c             |  962 +++++++++++++++
 sound/soc/qcom/audioreach/q6apm.h             |  171 +++
 sound/soc/qcom/audioreach/q6prm.c             |  412 +++++++
 sound/soc/qcom/audioreach/topology.c          |  848 +++++++++++++
 sound/soc/qcom/sm8250.c                       |  144 ++-
 24 files changed, 6665 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,gpr.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/qcom,q6apm.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/qcom,q6prm.yaml
 create mode 100644 drivers/soc/qcom/gpr.c
 create mode 100644 include/dt-bindings/soc/qcom,gpr.h
 create mode 100644 include/dt-bindings/sound/qcom,q6apm.h
 create mode 100644 include/dt-bindings/sound/qcom,q6prm.h
 create mode 100644 include/linux/soc/qcom/gpr.h
 create mode 100644 include/uapi/sound/snd_ar_tokens.h
 create mode 100644 sound/soc/qcom/audioreach/Makefile
 create mode 100644 sound/soc/qcom/audioreach/audioreach.c
 create mode 100644 sound/soc/qcom/audioreach/audioreach.h
 create mode 100644 sound/soc/qcom/audioreach/q6apm-bedai.c
 create mode 100644 sound/soc/qcom/audioreach/q6apm-dai.c
 create mode 100644 sound/soc/qcom/audioreach/q6apm.c
 create mode 100644 sound/soc/qcom/audioreach/q6apm.h
 create mode 100644 sound/soc/qcom/audioreach/q6prm.c
 create mode 100644 sound/soc/qcom/audioreach/topology.c

Comments

Rob Herring (Arm) June 18, 2021, 8:16 p.m. UTC | #1
On Mon, Jun 07, 2021 at 04:28:26PM +0100, Srinivas Kandagatla wrote:
> This patch adds bindings support for Qualcomm Audio Processing Manager
> service in Audio DSP.
> 
> Audio Process Manager is one of the static service in DSP which is
> responsible for Command/response handling, graph Management
> and Control/Event management between modules.
> 
> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> ---
>  .../devicetree/bindings/sound/qcom,q6apm.yaml | 72 +++++++++++++++++++
>  1 file changed, 72 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/sound/qcom,q6apm.yaml
> 
> diff --git a/Documentation/devicetree/bindings/sound/qcom,q6apm.yaml b/Documentation/devicetree/bindings/sound/qcom,q6apm.yaml
> new file mode 100644
> index 000000000000..9906ef935206
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/sound/qcom,q6apm.yaml
> @@ -0,0 +1,72 @@
> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
> +%YAML 1.2
> +---
> +$id: "http://devicetree.org/schemas/sound/qcom,q6apm.yaml#"
> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
> +
> +title: Qualcomm Audio Process Manager binding
> +
> +maintainers:
> +  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
> +
> +description: |
> +  This binding describes the Qualcomm Audio Process Manager service in DSP
> +
> +properties:
> +  compatible:
> +    const: qcom,q6apm
> +
> +  reg:
> +    maxItems: 1
> +
> +#APM Services
> +patternProperties:
> +  "^.*@[0-9a-f]+$":

You can drop '^.*'.

> +    type: object
> +    description:
> +      APM devices use subnodes for services.
> +
> +    properties:
> +      compatible:
> +        enum:
> +          - qcom,q6apm-dai
> +          - qcom,q6apm-bedai
> +
> +      iommus:
> +        maxItems: 1
> +
> +      "#sound-dai-cels":

cells?

How is this optional?

> +        const: 1
> +
> +    required:
> +      - compatible
> +      - reg
> +
> +    additionalProperties: false
> +
> +required:
> +  - compatible
> +  - reg
> +
> +additionalProperties: true

This needs to be false and fix whatever is missing.

> +
> +examples:
> +  - |
> +    gpr {
> +        #address-cells = <1>;
> +        #size-cells = <0>;
> +        gprservice@1 {
> +          compatible = "qcom,q6apm";
> +          reg = <1>;
> +
> +          q6apm-dai {

This doesn't match what you have in the schema at all.

> +            compatible = "qcom,q6apm-dai";
> +            #sound-dai-cels = <1>;
> +          };
> +
> +          q6apm-bedai {
> +            compatible = "qcom,q6apm-bedai";
> +            #sound-dai-cels = <1>;
> +          };
> +        };
> +    };
> -- 
> 2.21.0
> 
>
Srinivas Kandagatla July 12, 2021, 8:20 a.m. UTC | #2
On 18/06/2021 21:16, Rob Herring wrote:
> On Mon, Jun 07, 2021 at 04:28:26PM +0100, Srinivas Kandagatla wrote:
>> This patch adds bindings support for Qualcomm Audio Processing Manager
>> service in Audio DSP.
>>
>> Audio Process Manager is one of the static service in DSP which is
>> responsible for Command/response handling, graph Management
>> and Control/Event management between modules.
>>
>> Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>> ---
>>   .../devicetree/bindings/sound/qcom,q6apm.yaml | 72 +++++++++++++++++++
>>   1 file changed, 72 insertions(+)
>>   create mode 100644 Documentation/devicetree/bindings/sound/qcom,q6apm.yaml
>>
>> diff --git a/Documentation/devicetree/bindings/sound/qcom,q6apm.yaml b/Documentation/devicetree/bindings/sound/qcom,q6apm.yaml
>> new file mode 100644
>> index 000000000000..9906ef935206
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/sound/qcom,q6apm.yaml
>> @@ -0,0 +1,72 @@
>> +# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
>> +%YAML 1.2
>> +---
>> +$id: "http://devicetree.org/schemas/sound/qcom,q6apm.yaml#"
>> +$schema: "http://devicetree.org/meta-schemas/core.yaml#"
>> +
>> +title: Qualcomm Audio Process Manager binding
>> +
>> +maintainers:
>> +  - Srinivas Kandagatla <srinivas.kandagatla@linaro.org>
>> +
>> +description: |
>> +  This binding describes the Qualcomm Audio Process Manager service in DSP
>> +
>> +properties:
>> +  compatible:
>> +    const: qcom,q6apm
>> +
>> +  reg:
>> +    maxItems: 1
>> +
>> +#APM Services
>> +patternProperties:
>> +  "^.*@[0-9a-f]+$":
> 
> You can drop '^.*'.

Thanks Rob for review,

will fix this along other comments in next spin.

--srini

> 
>> +    type: object
>> +    description:
>> +      APM devices use subnodes for services.
>> +
>> +    properties:
>> +      compatible:
>> +        enum:
>> +          - qcom,q6apm-dai
>> +          - qcom,q6apm-bedai
>> +
>> +      iommus:
>> +        maxItems: 1
>> +
>> +      "#sound-dai-cels":
> 
> cells?
> 
> How is this optional?
> 
>> +        const: 1
>> +
>> +    required:
>> +      - compatible
>> +      - reg
>> +
>> +    additionalProperties: false
>> +
>> +required:
>> +  - compatible
>> +  - reg
>> +
>> +additionalProperties: true
> 
> This needs to be false and fix whatever is missing.
> 
>> +
>> +examples:
>> +  - |
>> +    gpr {
>> +        #address-cells = <1>;
>> +        #size-cells = <0>;
>> +        gprservice@1 {
>> +          compatible = "qcom,q6apm";
>> +          reg = <1>;
>> +
>> +          q6apm-dai {
> 
> This doesn't match what you have in the schema at all.
> 
>> +            compatible = "qcom,q6apm-dai";
>> +            #sound-dai-cels = <1>;
>> +          };
>> +
>> +          q6apm-bedai {
>> +            compatible = "qcom,q6apm-bedai";
>> +            #sound-dai-cels = <1>;
>> +          };
>> +        };
>> +    };
>> -- 
>> 2.21.0
>>
>>