mbox series

[v8,00/22] ASoC: qcom: Add AudioReach support

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

Message

Srinivas Kandagatla Sept. 27, 2021, 1:55 p.m. UTC
Many thanks for reviewing v7 This version addresses all the comments
raised as part of v8 review.

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 simplified high-level block diagram of AudioReach:

 ___________________________________________________________
|                 CPU (Application Processor)               |
|  +---------+          +---------+         +----------+    |
|  |  q6apm  |          |  q6apm  |         |  q6apm   |    |
|  |   dais  | <------> |         | <-----> |lpass-dais|    |
|  +---------+          +---------+         +----------+    |
|                            ^  ^                           |
|                            |  |           +---------+     |
|  +---------+               v  +---------->|topology |     |
|  | q6prm   |          +---------+         |         |     |
|  |         |<-------->|   GPR   |         +---------+     |
|  +---------+          +---------+                         |
|       ^                    ^                              |
|       |                    |                              |
|  +----------+              |                              |
|  |   q6prm  |              |                              |
|  |lpass-clks|              |                              |
|  +----------+              |                              |
|____________________________|______________________________|
                             |  
                             | 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 and HDMI audio
via I2S.

First 10 Patches are mostly reorganization existing Old QDSP Audio
Framework code and bindings so that we could reuse them on AudioReach.

ASoC topology graphs for DragonBoard RB5 and SM8250 MTP are available at 
https://git.linaro.org/people/srinivas.kandagatla/audioreach-topology.git/
and Qualcomm AudioReach DSP headers are available at:
https://source.codeaurora.org/quic/la/platform/vendor/opensource/arspf-headers

Note: There is one false positive warning in this patchset:
audioreach.c:80:45: warning: array of flexible structures

Thanks,
srini

Changes since v7:
- removed returning errors in dsp command callbacks as it has no effect
- removed uncessary err prints 
- removed default topology file as its impossible to have one for all boards.
- removed references of Elite in commit log
- return correct error codes returned from functions.


Srinivas Kandagatla (22):
  soc: dt-bindings: qcom: apr: convert to yaml
  soc: dt-bindings: qcom: apr: deprecate qcom,apr-domain property
  soc: qcom: apr: make code more reuseable
  soc: dt-bindings: qcom: add gpr bindings
  soc: qcom: apr: Add GPR support
  ASoC: dt-bindings: move LPASS dai related bindings out of q6afe
  ASoC: dt-bindings: move LPASS clocks related bindings out of q6afe
  ASoC: dt-bindings: rename q6afe.h to q6dsp-lpass-ports.h
  ASoC: qdsp6: q6afe-dai: move lpass audio ports to common file
  ASoC: qdsp6: q6afe-clocks: move audio-clocks to common file
  ASoC: dt-bindings: q6dsp: add q6apm-lpass-dai compatible
  ASoC: dt-bindings: lpass-clocks: add q6prm clocks compatible
  ASoC: dt-bindings: add q6apm digital audio stream bindings
  ASoC: qdsp6: audioreach: add basic pkt alloc support
  ASoC: qdsp6: audioreach: add q6apm support
  ASoC: qdsp6: audioreach: add module configuration command helpers
  ASoC: qdsp6: audioreach: add Kconfig and Makefile
  ASoC: qdsp6: audioreach: add topology support
  ASoC: qdsp6: audioreach: add q6apm-dai support
  ASoC: qdsp6: audioreach: add q6apm lpass dai support
  ASoC: qdsp6: audioreach: add q6prm support
  ASoC: qdsp6: audioreach: add support for q6prm-clocks

 .../devicetree/bindings/soc/qcom/qcom,apr.txt |  134 --
 .../bindings/soc/qcom/qcom,apr.yaml           |  177 +++
 .../devicetree/bindings/sound/qcom,q6afe.txt  |  181 ---
 .../bindings/sound/qcom,q6apm-dai.yaml        |   53 +
 .../sound/qcom,q6dsp-lpass-clocks.yaml        |   77 ++
 .../sound/qcom,q6dsp-lpass-ports.yaml         |  205 +++
 drivers/soc/qcom/Kconfig                      |    2 +-
 drivers/soc/qcom/apr.c                        |  287 ++++-
 include/dt-bindings/soc/qcom,gpr.h            |   19 +
 include/dt-bindings/sound/qcom,q6afe.h        |  203 +--
 .../sound/qcom,q6dsp-lpass-ports.h            |  208 +++
 include/linux/soc/qcom/apr.h                  |   70 +-
 include/uapi/sound/snd_ar_tokens.h            |  208 +++
 sound/soc/qcom/Kconfig                        |   22 +
 sound/soc/qcom/qdsp6/Makefile                 |   11 +-
 sound/soc/qcom/qdsp6/audioreach.c             | 1135 +++++++++++++++++
 sound/soc/qcom/qdsp6/audioreach.h             |  726 +++++++++++
 sound/soc/qcom/qdsp6/q6afe-clocks.c           |  187 +--
 sound/soc/qcom/qdsp6/q6afe-dai.c              |  687 +---------
 sound/soc/qcom/qdsp6/q6apm-dai.c              |  415 ++++++
 sound/soc/qcom/qdsp6/q6apm-lpass-dais.c       |  260 ++++
 sound/soc/qcom/qdsp6/q6apm.c                  |  823 ++++++++++++
 sound/soc/qcom/qdsp6/q6apm.h                  |  152 +++
 sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c     |  186 +++
 sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.h     |   30 +
 sound/soc/qcom/qdsp6/q6dsp-lpass-ports.c      |  627 +++++++++
 sound/soc/qcom/qdsp6/q6dsp-lpass-ports.h      |   22 +
 sound/soc/qcom/qdsp6/q6prm-clocks.c           |   85 ++
 sound/soc/qcom/qdsp6/q6prm.c                  |  202 +++
 sound/soc/qcom/qdsp6/q6prm.h                  |   78 ++
 sound/soc/qcom/qdsp6/topology.c               | 1113 ++++++++++++++++
 31 files changed, 7170 insertions(+), 1415 deletions(-)
 delete mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,apr.txt
 create mode 100644 Documentation/devicetree/bindings/soc/qcom/qcom,apr.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/qcom,q6apm-dai.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/qcom,q6dsp-lpass-clocks.yaml
 create mode 100644 Documentation/devicetree/bindings/sound/qcom,q6dsp-lpass-ports.yaml
 create mode 100644 include/dt-bindings/soc/qcom,gpr.h
 create mode 100644 include/dt-bindings/sound/qcom,q6dsp-lpass-ports.h
 create mode 100644 include/uapi/sound/snd_ar_tokens.h
 create mode 100644 sound/soc/qcom/qdsp6/audioreach.c
 create mode 100644 sound/soc/qcom/qdsp6/audioreach.h
 create mode 100644 sound/soc/qcom/qdsp6/q6apm-dai.c
 create mode 100644 sound/soc/qcom/qdsp6/q6apm-lpass-dais.c
 create mode 100644 sound/soc/qcom/qdsp6/q6apm.c
 create mode 100644 sound/soc/qcom/qdsp6/q6apm.h
 create mode 100644 sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.c
 create mode 100644 sound/soc/qcom/qdsp6/q6dsp-lpass-clocks.h
 create mode 100644 sound/soc/qcom/qdsp6/q6dsp-lpass-ports.c
 create mode 100644 sound/soc/qcom/qdsp6/q6dsp-lpass-ports.h
 create mode 100644 sound/soc/qcom/qdsp6/q6prm-clocks.c
 create mode 100644 sound/soc/qcom/qdsp6/q6prm.c
 create mode 100644 sound/soc/qcom/qdsp6/q6prm.h
 create mode 100644 sound/soc/qcom/qdsp6/topology.c

-- 
2.21.0

Comments

Pierre-Louis Bossart Sept. 27, 2021, 4:32 p.m. UTC | #1
> Srinivas Kandagatla (22):

>   soc: dt-bindings: qcom: apr: convert to yaml

>   soc: dt-bindings: qcom: apr: deprecate qcom,apr-domain property

>   soc: qcom: apr: make code more reuseable

>   soc: dt-bindings: qcom: add gpr bindings

>   soc: qcom: apr: Add GPR support

>   ASoC: dt-bindings: move LPASS dai related bindings out of q6afe

>   ASoC: dt-bindings: move LPASS clocks related bindings out of q6afe

>   ASoC: dt-bindings: rename q6afe.h to q6dsp-lpass-ports.h

>   ASoC: qdsp6: q6afe-dai: move lpass audio ports to common file

>   ASoC: qdsp6: q6afe-clocks: move audio-clocks to common file

>   ASoC: dt-bindings: q6dsp: add q6apm-lpass-dai compatible

>   ASoC: dt-bindings: lpass-clocks: add q6prm clocks compatible

>   ASoC: dt-bindings: add q6apm digital audio stream bindings

>   ASoC: qdsp6: audioreach: add basic pkt alloc support

>   ASoC: qdsp6: audioreach: add q6apm support

>   ASoC: qdsp6: audioreach: add module configuration command helpers

>   ASoC: qdsp6: audioreach: add Kconfig and Makefile

>   ASoC: qdsp6: audioreach: add topology support

>   ASoC: qdsp6: audioreach: add q6apm-dai support

>   ASoC: qdsp6: audioreach: add q6apm lpass dai support

>   ASoC: qdsp6: audioreach: add q6prm support

>   ASoC: qdsp6: audioreach: add support for q6prm-clocks


I added a couple of minor comments, at this point other reviewers should
start looking at this patchset.

For patches 5, 9, 10, 14..22 (everything except dt-bindings which I
didn't even look at):

Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Bjorn Andersson Sept. 28, 2021, 3:19 a.m. UTC | #2
On Mon 27 Sep 08:55 CDT 2021, Srinivas Kandagatla wrote:
[..]
> Srinivas Kandagatla (22):

>   soc: dt-bindings: qcom: apr: convert to yaml

>   soc: dt-bindings: qcom: apr: deprecate qcom,apr-domain property

>   soc: qcom: apr: make code more reuseable

>   soc: dt-bindings: qcom: add gpr bindings

>   soc: qcom: apr: Add GPR support


These patches has been merged into the Qualcomm drivers-for-5.16 tree
and an immutable tag is available at:

https://git.kernel.org/pub/scm/linux/kernel/git/qcom/linux.git tags/20210927135559.738-6-srinivas.kandagatla@linaro.org

Regards,
Bjorn
Bjorn Andersson Sept. 28, 2021, 3:20 a.m. UTC | #3
On Mon, 27 Sep 2021 14:55:37 +0100, Srinivas Kandagatla wrote:
> Many thanks for reviewing v7 This version addresses all the comments

> raised as part of v8 review.

> 

> 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.

> 

> [...]


Applied, thanks!

[01/22] soc: dt-bindings: qcom: apr: convert to yaml
        commit: 985f62a9a13175217978a797cd8f1f26216b2c87
[02/22] soc: dt-bindings: qcom: apr: deprecate qcom,apr-domain property
        commit: 1ff63d5465d0b0bf4e69562096b2d3ec9ff1a116
[03/22] soc: qcom: apr: make code more reuseable
        commit: 99139b80c1b3d73026ed8be2de42c52e2976ab64
[04/22] soc: dt-bindings: qcom: add gpr bindings
        commit: 974c6faf7667e551d202712470ca210c14ca249d
[05/22] soc: qcom: apr: Add GPR support
        commit: ec1471a898cca38af6b8956a83ebc1297214546f

Best regards,
-- 
Bjorn Andersson <bjorn.andersson@linaro.org>
Srinivas Kandagatla Sept. 28, 2021, 8:47 a.m. UTC | #4
Hi Bjorn,

On 28/09/2021 04:20, Bjorn Andersson wrote:
> On Mon, 27 Sep 2021 14:55:37 +0100, Srinivas Kandagatla wrote:

>> Many thanks for reviewing v7 This version addresses all the comments

>> raised as part of v8 review.

>>

>> 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.

>>

>> [...]

> 

> Applied, thanks!

> 

> [01/22] soc: dt-bindings: qcom: apr: convert to yaml

>          commit: 985f62a9a13175217978a797cd8f1f26216b2c87

> [02/22] soc: dt-bindings: qcom: apr: deprecate qcom,apr-domain property

>          commit: 1ff63d5465d0b0bf4e69562096b2d3ec9ff1a116

> [03/22] soc: qcom: apr: make code more reuseable

>          commit: 99139b80c1b3d73026ed8be2de42c52e2976ab64

> [04/22] soc: dt-bindings: qcom: add gpr bindings

>          commit: 974c6faf7667e551d202712470ca210c14ca249d

> [05/22] soc: qcom: apr: Add GPR support

>          commit: ec1471a898cca38af6b8956a83ebc1297214546f

> 

Just in case you missed, rest of the series depend on some of the GRP 
apis in these patches.

Am not sure how Mark would prefer to take the rest of series.

--srini

> Best regards,

>