Skip to content

RFC ASoC: Intel: AVS - Audio DSP for cAVS

Cezary Rojewski alsa-devel 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest37 patches 19 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/37ALSA: hda: Add snd_hdac_ext_bus_link_at() helperinclude/sound/hdaudio_ext.h sound/hda/ext/hdac_ext_controller.c+22 -100 replies
2/37ALSA: hda: Update and expose snd_hda_codec_device_init()include/sound/hda_codec.h sound/pci/hda/hda_codec.c+32 -150 replies
3/37ALSA: hda: Update and expose codec register proceduresinclude/sound/hda_codec.h sound/pci/hda/hda_codec.c sound/pci/hda/hda_local.h +1 more+31 -120 replies
4/37ALSA: hda: Expose codec cleanup and power-save functionsinclude/sound/hda_codec.h sound/pci/hda/hda_codec.c sound/pci/hda/hda_local.h+15 -30 replies
5/37ALSA: hda: Add helper macros for DSP capable devicesinclude/sound/hdaudio.h include/sound/hdaudio_ext.h+51 -00 replies
6/37ASoC: Export DAI register and widget ctor and dctor functionsinclude/sound/soc-dapm.h sound/soc/soc-core.c sound/soc/soc-dapm.c+17 -02 replies
7/37ASoC: Intel: Introduce AVS driversound/soc/intel/Kconfig sound/soc/intel/Makefile sound/soc/intel/avs/Makefile +3 more+213 -00 replies
8/37ASoC: Intel: avs: Inter process communicationsound/soc/intel/avs/Makefile sound/soc/intel/avs/avs.h sound/soc/intel/avs/ipc.c +2 more+706 -10 replies
9/37ASoC: Intel: avs: Add code loading requestssound/soc/intel/avs/Makefile sound/soc/intel/avs/messages.c sound/soc/intel/avs/messages.h+88 -10 replies
10/37ASoC: Intel: avs: Add pipeline management requestssound/soc/intel/avs/messages.c sound/soc/intel/avs/messages.h+132 -00 replies
11/37ASoC: Intel: avs: Add module management requestssound/soc/intel/avs/ipc.c sound/soc/intel/avs/messages.c sound/soc/intel/avs/messages.h+268 -10 replies
12/37ASoC: Intel: avs: Add power management requestssound/soc/intel/avs/messages.c sound/soc/intel/avs/messages.h+59 -00 replies
13/37ASoC: Intel: avs: Add ROM requestssound/soc/intel/avs/messages.c sound/soc/intel/avs/messages.h+32 -00 replies
14/37ASoC: Intel: avs: Add basefw runtime-parameter requestssound/soc/intel/avs/messages.c sound/soc/intel/avs/messages.h+394 -00 replies
15/37ASoC: Intel: avs: Firmware resources management utilitiessound/soc/intel/avs/Makefile sound/soc/intel/avs/avs.h sound/soc/intel/avs/utils.c+312 -10 replies
16/37ASoC: Intel: avs: Declare module configuration typessound/soc/intel/avs/messages.c sound/soc/intel/avs/messages.h+269 -00 replies
17/37ASoC: Intel: avs: Dynamic firmware resources managementsound/soc/intel/avs/avs.h sound/soc/intel/avs/dsp.c+186 -02 replies
18/37ASoC: Intel: avs: Topology parsinginclude/uapi/sound/intel/avs/tokens.h sound/soc/intel/Kconfig sound/soc/intel/avs/Makefile +3 more+1909 -12 replies
19/37ASoC: Intel: avs: Path managementDocumentation/ABI/testing/sysfs-bus-pci-devices-avs sound/soc/intel/Kconfig sound/soc/intel/avs/Makefile +3 more+1117 -10 replies
20/37ASoC: Intel: avs: Conditional-path supportinclude/uapi/sound/intel/avs/tokens.h sound/soc/intel/avs/path.c sound/soc/intel/avs/path.h +2 more+454 -10 replies
21/37ASoC: Intel: avs: General code loading flowsound/soc/intel/avs/Makefile sound/soc/intel/avs/avs.h sound/soc/intel/avs/core.c +3 more+425 -10 replies
22/37ASoC: Intel: avs: Implement CLDMA transfersound/soc/intel/avs/Makefile sound/soc/intel/avs/cldma.c sound/soc/intel/avs/cldma.h +1 more+360 -00 replies
23/37ASoC: Intel: avs: Code loading over CLDMAsound/soc/intel/avs/avs.h sound/soc/intel/avs/loader.c+162 -00 replies
24/37ASoC: Intel: avs: Code loading over HDAsound/soc/intel/Kconfig sound/soc/intel/avs/avs.h sound/soc/intel/avs/loader.c+212 -00 replies
25/37ASoC: Intel: avs: Generic soc component driverinclude/sound/soc-acpi.h sound/soc/intel/avs/Makefile sound/soc/intel/avs/pcm.c+284 -10 replies
26/37ASoC: Intel: avs: Generic PCM FE operationssound/soc/intel/avs/pcm.c sound/soc/intel/avs/topology.c+351 -20 replies
27/37ASoC: Intel: avs: non-HDA PCM BE operationssound/soc/intel/avs/avs.h sound/soc/intel/avs/pcm.c+263 -10 replies
28/37ASoC: Intel: avs: HDA PCM BE operationssound/soc/intel/avs/avs.h sound/soc/intel/avs/pcm.c+351 -00 replies
29/37ASoC: Intel: avs: Coredump and recovery flowsound/soc/intel/Kconfig sound/soc/intel/avs/avs.h sound/soc/intel/avs/ipc.c +1 more+93 -30 replies
30/37ASoC: Intel: avs: Prepare for firmware tracingsound/soc/intel/avs/avs.h sound/soc/intel/avs/ipc.c sound/soc/intel/avs/messages.c +3 more+111 -00 replies
31/37ASoC: Intel: avs: D0ix power state supportsound/soc/intel/avs/avs.h sound/soc/intel/avs/dsp.c sound/soc/intel/avs/ipc.c+125 -20 replies
32/37ASoC: Intel: avs: Event tracingsound/soc/intel/avs/Makefile sound/soc/intel/avs/dsp.c sound/soc/intel/avs/ipc.c +2 more+232 -30 replies
33/37ASoC: Intel: avs: Machine board registrationsound/soc/intel/avs/Makefile sound/soc/intel/avs/avs.h sound/soc/intel/avs/board_selection.c+463 -10 replies
34/37ASoC: Intel: avs: PCI driver implementationsound/soc/intel/Kconfig sound/soc/intel/avs/avs.h sound/soc/intel/avs/core.c +2 more+503 -40 replies
35/37ASoC: Intel: avs: Power managementsound/soc/intel/avs/core.c+124 -00 replies
36/37ASoC: Intel: avs: SKL-based platforms supportsound/soc/intel/avs/Makefile sound/soc/intel/avs/avs.h sound/soc/intel/avs/core.c +3 more+180 -00 replies
37/37ASoC: Intel: avs: APL-based platforms supportsound/soc/intel/avs/Makefile sound/soc/intel/avs/apl.c sound/soc/intel/avs/avs.h +4 more+304 -10 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [RFC 00/37] ASoC: Intel: AVS - Audio DSP for cAVS

A continuation of cleanup work of Intel SST solutions found in sound/soc/intel/. With two major chapters released last year catpt [1] and removal of haswell solution [2], time has come for Skylake-driver.

Througout 2019, 2020 and 2021 Skylake-driver has had many fixes applied and even attempts of refactors as seen in fundamental overhaul [3], IPC flow adjustments [4] and LARGE_CONFIG overhaul [5] series. Unfortunately, story repeats itself - problems are found within the core of a driver. Painting it with different colors does not change the fact that is it still a house of cards. As changes needed to address those issues would make Skylake solution incompatible with its previous revisions, a decision has been made to provide a new solution instead. In time it would deprecate and replace Skylake-driver.

That solution has been called AVS - from AudioDSP architecture name:
Audio-Voice-Speech. It is meant to provide support for the exact same range of platforms as its predecessor: SKL, KBL, AML and APL.

Several functions found within HDAudio and ASoC framework have been exported and are re-used later by the avs-driver to prevent code being duplicated in this solution. All of these act as driver dependencies and are found at the beginning of the series to make it clear what's needed for avs-driver to compile.

Note: this series is dependent upon NHLT-series [6] which was recently merged by Takashi to his for-next branch yet is unavailable on current broonie/for-next.

Note: this series does not add fully functional driver as its size would get out of control. Focus is put on adding new code. A SND_SOC_INTEL_SKYLAKE_FAMILY=n dependency is added so no probing attempts are performed. Until all patches are merged, Skylake-driver remains the recommended option. Series which will later follow this one, focus on filling all the remaining functionality gaps and provide filesystems support. Also, a range of machine boards will be added to match range of configurations supported by the avs-driver. Once avs-driver and its collaterals are merged, skylake-driver deprecation and removal process begins, along with all other components that are connected to it e.g.: skylake-driver-only machine boards.

As AudioDSP firmware which avs-driver communicates with supports a wide range of audio formats, module configurations and multi-pipeline streams, couple of new concepts are introduce to enable all those functionalities:

- Path template and path variants
- Runtime path
- Conditional path
- Granular sound cards (as opposed to 'super-cards')

These are later better explained by their respective patches:
'Topology parsing', 'Path management', 'Conditional-path support' and 'Machine board registration'.

A 'path' represents a DSP side of audio stream in runtime - is a logical container for pipelines which are themselves composed of modules - processing units. Due to high range of possible audio format combinations, there can be more variants of given path (and thus, its pipelines and modules) than total number of pipelines and module instances which firmware supports concurrently, all the instance IDs are allocated dynamically with help of IDA interface. 'Path templates' come from topology file and describe a pattern which is later used to actually create runtime 'path'.

To support modern audio usecases such as WaveOnVoice and EchoReference, conditional paths concept came into existence. These work similarly to standard paths except are a consequence of other paths being created or deleted, rather then being created when userspace app opens specific FE for streaming. Their state machine is controlled by source and sink paths which created them in the first place.

Granular machine boards is a contrast to 'super-card' idea which is currently widely used throughout Intel ASoC drivers. Major reasons are:
complexity reduction (each board now focuses on a single, concrete device) and overall reduction of topology file size when entire configuration is taken into account. This has functional benefits too:
one card failing won't prevent others from probing and being operative.

Changes [internal] RFC v2 -> [public] RFC v1:
- dropped any sysfs related changes from this series, moved to follow up one
- dropped entire subscription-mechanism found in ipc.c. Handlers that are delegated to service certain firmware notifications are now called directly
- fixed kernel doc for snd_soc_dapm_new_dai_widgets() as reported by ikp
- prefixed snd_hda_codec_device_init() as suggested by Amadeo
- improved comments for d0ix transitions for APL-based platforms as suggested by Pierre
- a ton of spelling related fixes in most of the commit messages
- fixed remaining warnings pointed by scan-build (variable assigned but not used)
- replaced most of 'cAVS X.Y' expression usages with 'platform-based' equivalents as suggested by Pierre e.g.: cAVS 1.5 -> SKL-based

Changes [internal] RFC v1 -> [internal] RFC v2:

- fixed memleak caused by lack of kfree(vols) if memory allocation fails in avs_peakvol_create() as reported by Curtis
- fixed missing 'i' iterator incrementation in avs_widget_ready() causing reference loss as reported by Curtis
- replace hardcode: 0x40 usage with snd_hdac_calc_stream_format as suggested by Curtis.
In consequence, readability for all code loading (CL) procedues has increased and such approach auto-documents the CL stream preparation

- updated behavior of all index-fetching functions found in utils.c:
avs_module_entry_index(), avs_module_id_entry_index() and follow ups:
avs_get_module_entry(), avs_get_module_id_entry() to better conform to linux-kernel standard when no entry is found (return -ENOENT) rather than C++ standard (return -1, what in kernel case translated to -EPERM) as suggested by Curtis and Peter
- several suggestions have been made regarding spacing, and so far, I've agreed and applied with all of them. None proposed seemed out of place or redundant

- avs_path_stop() renamed to avs_path_pause() pipeline states are represented by RESET/PAUSED/RUNNING. avs_path_reset() and avs_path_run() were already there and avs_path_stop() just didn't look cohesive
- added missing parsers for num_output_pin and num_input_pin which are required for custom modules such as WAVES or DSM
- dropped 'priv_param_length' from custom module descriptor as this field is obsolete in firmware

- parse_dictionary() has been split into parse_dictionary_header() and parse_dictionary_entries() to drop code duplication present in several parsing function which could not re-use entire parse_dictionary()
- added avs_tplg_vendor_array_lookup_next() and avs_tplg_vendor_entry_next() to drop code duplicated present in several parsing functions. This change greatly impacted readability of all parsers
- parsing helpers such avs_tplg_vendor_array_lookup() now return offset by updating specified in function argument list u32 *offset variable. This is to address problem when u32 offset would be greater than max int, which is the return type for these functions
- AVS_DEFINE_PTR_PARSER() macro has been introduced to drop code duplication for all ptr-parsing users

- all struct avs_path_module creators have had their declaration
updated: function argument *owner ceased to exist as it could already be accessed by mod->owner

- fixed the order of operation for conditional paths (e.g.: echo reference) so these are no longer controlled by "source" path and instead are impacted by state changes of source and sink paths both. Previously only source path e.g. playback sourcing echo reference would trigger RUNNING status for conditional path. Equivalent RUNNING on WoV path which is in this case sink path, would not do so, leading to order-of-operation problems. Behavior has been changed to: both source and sink need to be RUNNING for conditional path to be set to RUNNING too. PAUSED for either source or sink will cause PAUSED transition for conditional path.
- to achieve the above, path states are now saved in 'state' i.e. new u32 field for struct avs_path

- resigned from fw_filename field usage in favour of newly added tplg_filename for machine board descriptors as suggested by Pierre
- platform descriptor fields have had their names update better reflect their purpose as suggested by Pierre
- fixed comp_list missing locking when manipulated
- all message senders now accept request as pointer as suggeseted by Peter
- resigned of AZX_ usage for all ADSP-related registers, leaving them only for HOST memory space related operations
- fixed disable path for core DSP operations: power/reset/stall as reported by Peter

- safety when locking between received responses (reply vs notification) has been lowered as suggested by Pierre. Most usages are not performed in IRQ context and none is done in hard-IRQ one
- s/master/main/ plus AVS_MAIN_CORE_MASK has replaced ->master_mask
- several functions have had their logging updated - logs have been moved to lower level functions as suggested by Pierre
- hdac_ext_stream usage has been streamlined to estream, hdac_streams are represented by hstream instead
- hw_params() are resilient to scenarios when they are called mutliple times as reported by Pierre
- avs_dsp_enable() now collapses if any of its steps fails as reported by Pierre and Peter
- avs_module_ida_empty() now returns value of type bool as suggested by Bard

[1]: https://www.spinics.net/lists/alsa-devel/msg116440.html
[2]: https://www.spinics.net/lists/alsa-devel/msg116901.html
[3]: https://www.spinics.net/lists/alsa-devel/msg94199.html
[4]: https://www.spinics.net/lists/alsa-devel/msg92588.html
[5]: https://lore.kernel.org/all/[email protected]/
[6]: https://lore.kernel.org/all/[email protected]/T/

Cezary Rojewski (37):
ALSA: hda: Add snd_hdac_ext_bus_link_at() helper
ALSA: hda: Update and expose snd_hda_codec_device_init()
ALSA: hda: Update and expose codec register procedures
ALSA: hda: Expose codec cleanup and power-save functions
ALSA: hda: Add helper macros for DSP capable devices
ASoC: Export DAI register and widget ctor and dctor functions
ASoC: Intel: Introduce AVS driver
ASoC: Intel: avs: Inter process communication
ASoC: Intel: avs: Add code loading requests
ASoC: Intel: avs: Add pipeline management requests
ASoC: Intel: avs: Add module management requests
ASoC: Intel: avs: Add power management requests
ASoC: Intel: avs: Add ROM requests
ASoC: Intel: avs: Add basefw runtime-parameter requests
ASoC: Intel: avs: Firmware resources management utilities
ASoC: Intel: avs: Declare module configuration types
ASoC: Intel: avs: Dynamic firmware resources management
ASoC: Intel: avs: Topology parsing
ASoC: Intel: avs: Path management
ASoC: Intel: avs: Conditional-path support
ASoC: Intel: avs: General code loading flow
ASoC: Intel: avs: Implement CLDMA transfer
ASoC: Intel: avs: Code loading over CLDMA
ASoC: Intel: avs: Code loading over HDA
ASoC: Intel: avs: Generic soc component driver
ASoC: Intel: avs: Generic PCM FE operations
ASoC: Intel: avs: non-HDA PCM BE operations
ASoC: Intel: avs: HDA PCM BE operations
ASoC: Intel: avs: Coredump and recovery flow
ASoC: Intel: avs: Prepare for firmware tracing
ASoC: Intel: avs: D0ix power state support
ASoC: Intel: avs: Event tracing
ASoC: Intel: avs: Machine board registration
ASoC: Intel: avs: PCI driver implementation
ASoC: Intel: avs: Power management
ASoC: Intel: avs: SKL-based platforms support
ASoC: Intel: avs: APL-based platforms support

 .../ABI/testing/sysfs-bus-pci-devices-avs     |   24 +
 include/sound/hda_codec.h                     |   11 +-
 include/sound/hdaudio.h                       |    2 +
 include/sound/hdaudio_ext.h                   |   50 +
 include/sound/soc-acpi.h                      |    2 +
 include/sound/soc-dapm.h                      |    1 +
 include/uapi/sound/intel/avs/tokens.h         |  147 ++
 sound/hda/ext/hdac_ext_controller.c           |   31 +-
 sound/pci/hda/hda_codec.c                     |   93 +-
 sound/pci/hda/hda_local.h                     |    2 -
 sound/soc/codecs/hdac_hda.c                   |    2 +-
 sound/soc/intel/Kconfig                       |   19 +
 sound/soc/intel/Makefile                      |    1 +
 sound/soc/intel/avs/Makefile                  |   12 +
 sound/soc/intel/avs/apl.c                     |  244 +++
 sound/soc/intel/avs/avs.h                     |  331 ++++
 sound/soc/intel/avs/board_selection.c         |  459 +++++
 sound/soc/intel/avs/cldma.c                   |  328 ++++
 sound/soc/intel/avs/cldma.h                   |   29 +
 sound/soc/intel/avs/core.c                    |  737 +++++++
 sound/soc/intel/avs/dsp.c                     |  326 ++++
 sound/soc/intel/avs/ipc.c                     |  612 ++++++
 sound/soc/intel/avs/loader.c                  |  672 +++++++
 sound/soc/intel/avs/messages.c                |  674 +++++++
 sound/soc/intel/avs/messages.h                |  813 ++++++++
 sound/soc/intel/avs/path.c                    | 1287 +++++++++++++
 sound/soc/intel/avs/path.h                    |   85 +
 sound/soc/intel/avs/pcm.c                     | 1240 ++++++++++++
 sound/soc/intel/avs/registers.h               |   83 +
 sound/soc/intel/avs/skl.c                     |  127 ++
 sound/soc/intel/avs/topology.c                | 1700 +++++++++++++++++
 sound/soc/intel/avs/topology.h                |  207 ++
 sound/soc/intel/avs/trace.c                   |   34 +
 sound/soc/intel/avs/trace.h                   |  158 ++
 sound/soc/intel/avs/utils.c                   |  305 +++
 sound/soc/soc-core.c                          |    1 +
 sound/soc/soc-dapm.c                          |   15 +
 37 files changed, 10824 insertions(+), 40 deletions(-)
 create mode 100644 Documentation/ABI/testing/sysfs-bus-pci-devices-avs
 create mode 100644 include/uapi/sound/intel/avs/tokens.h
 create mode 100644 sound/soc/intel/avs/Makefile
 create mode 100644 sound/soc/intel/avs/apl.c
 create mode 100644 sound/soc/intel/avs/avs.h
 create mode 100644 sound/soc/intel/avs/board_selection.c
 create mode 100644 sound/soc/intel/avs/cldma.c
 create mode 100644 sound/soc/intel/avs/cldma.h
 create mode 100644 sound/soc/intel/avs/core.c
 create mode 100644 sound/soc/intel/avs/dsp.c
 create mode 100644 sound/soc/intel/avs/ipc.c
 create mode 100644 sound/soc/intel/avs/loader.c
 create mode 100644 sound/soc/intel/avs/messages.c
 create mode 100644 sound/soc/intel/avs/messages.h
 create mode 100644 sound/soc/intel/avs/path.c
 create mode 100644 sound/soc/intel/avs/path.h
 create mode 100644 sound/soc/intel/avs/pcm.c
 create mode 100644 sound/soc/intel/avs/registers.h
 create mode 100644 sound/soc/intel/avs/skl.c
 create mode 100644 sound/soc/intel/avs/topology.c
 create mode 100644 sound/soc/intel/avs/topology.h
 create mode 100644 sound/soc/intel/avs/trace.c
 create mode 100644 sound/soc/intel/avs/trace.h
 create mode 100644 sound/soc/intel/avs/utils.c
Signature · 1 line
2.25.1