Skip to content

RFC soc-pcm: Add separate snd_pcm_runtime for BEs

Codrin Ciubotariu alsa-devel lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 RFC Latest6 patches 6 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/6ALSA: core: pcm: Create helpers to allocate/free struct snd_pcm_runtimeinclude/sound/pcm.h sound/core/pcm.c+52 -320 replies
2/6ALSA: pcm: Export constraints initialization functionsinclude/sound/pcm.h sound/core/pcm_native.c+7 -20 replies
3/6ALSA: pcm: Check for substream->ops before substream->ops->mmapsound/core/pcm_native.c+1 -10 replies
4/6ALSA: pcm: Create function for snd_pcm_runtime initializationinclude/sound/pcm.h sound/core/pcm_native.c+61 -490 replies
5/6ASoC: soc-pcm: Create new snd_pcm_runtime for BE DAIssound/soc/soc-pcm.c+90 -360 replies
6/6ASoC: dmaengine: Allocate buffer if substream is unmanagedsound/soc/soc-generic-dmaengine-pcm.c+18 -00 replies

Reviews trailers per patch

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

Read the v1 thread

Cover letter [RFC PATCH 0/6] soc-pcm: Add separate snd_pcm_runtime for BEs

This patchset adds a different snd_pcm_runtime in the BE's substream, replacing the FE's snd_pcm_runtime. With a different structure, the BE HW capabilities and constraints will no longer merge with the FE ones. This allows for error detection if the be_hw_params_fixup() applies HW parameters not supported by the BE DAIs. Also, it calculates values needed for mem-to-dev/dev-to-mem DMA transfers, such as buffer size and period size, if needed.

The first 4 patches are preparatory patches, that just group and export functions used to allocate and initialize the snd_pcm_runtime. Also, the functions that set and apply the HW constraints are exported.
The 5th patch does (almost) everything need to create the new snd_pcm_runtime for BEs, which includes allocation, initializing the HW capabilities, HW constraints and HW parameters. The BE HW parameters are no longer copied from the FE. They are recalculated, based on HW capabilities, constraints and the be_hw_params_fixup() callback.
The 6th and last patch basically adds support for the PCM generic dmaengine to be used as a platform driver for BE DAI links. It allocates a buffer, needed by the DMA transfers that do not support dev-to-dev transfers between FE and BE DAIs.

This is a superset of
https://mailman.alsa-project.org/pipermail/alsa-devel/2021-March/182630.html
which only handles the BE HW constraints. This patchset aims to be more complete, defining a a snd_pcm_runtime between each FE and BE and can be used between any DAI link connection. I am sure I am not handling all the needed members of snd_pcm_runtime (such as handling struct snd_pcm_mmap_status *status), but I would like to have your feedback regarding this idea.

Codrin Ciubotariu (6):
ALSA: core: pcm: Create helpers to allocate/free struct
snd_pcm_runtime
ALSA: pcm: Export constraints initialization functions
ALSA: pcm: Check for substream->ops before substream->ops->mmap
ALSA: pcm: Create function for snd_pcm_runtime initialization
ASoC: soc-pcm: Create new snd_pcm_runtime for BE DAIs
ASoC: dmaengine: Allocate buffer if substream is unmanaged

 include/sound/pcm.h                   |   7 ++
 sound/core/pcm.c                      |  82 ++++++++++-------
 sound/core/pcm_native.c               | 116 +++++++++++++-----------
 sound/soc/soc-generic-dmaengine-pcm.c |  18 ++++
 sound/soc/soc-pcm.c                   | 126 ++++++++++++++++++--------
 5 files changed, 229 insertions(+), 120 deletions(-)
Signature · 1 line
2.27.0