From f9c6de054d54b2f5a741ef91d4487608e908e67e Mon Sep 17 00:00:00 2001 From: Peter Ujfalusi Date: Wed, 5 Jun 2024 16:16:20 +0300 Subject: [PATCH] topology2: Add new token 'playback_pause_supported' and set it true for nocodec only We need to face with reality that the pause/resume is a feature that is not well tested - end users are using audio via audio servers and they don't use pause/resume, causing constant issues with no real life benefit: With IPC4 multiple pause/resume will make the delay reporting way off from the known universe, causing reported delays in tens or hundreds of years. Looks like suspend/resume with paused stream has been broken for a long time and just got noticed (since it was not tested). Pause on capture has never been supported, but it was advertised on playback by the kernel. Add a new token to allow selected PCMs to be allowed to advertise pause support (playback_pause_supported) and keep it false by default. For testing purposes enable the pause support for nocodec topologies. Signed-off-by: Peter Ujfalusi Link: https://github.com/thesofproject/linux/issues/5035 --- tools/topology/topology2/cavs-nocodec.conf | 11 +++++++++++ tools/topology/topology2/include/common/pcm.conf | 12 ++++++++++++ tools/topology/topology2/include/common/tokens.conf | 6 ++++-- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/tools/topology/topology2/cavs-nocodec.conf b/tools/topology/topology2/cavs-nocodec.conf index c017252201ac..c31bc26bc134 100644 --- a/tools/topology/topology2/cavs-nocodec.conf +++ b/tools/topology/topology2/cavs-nocodec.conf @@ -916,6 +916,8 @@ Object.PCM.pcm [ name "$SSP0_PCM_NAME" id $SSP0_PCM_ID direction "duplex" + playback_pause_supported "true" + capture_pause_supported "true" Object.Base.fe_dai.1 { name "$SSP0_PCM_NAME" } @@ -941,6 +943,7 @@ IncludeByKey.PASSTHROUGH { name "$SSP0_CAPTURE_PCM" id $SSP0_CAPTURE_PCM_ID direction "capture" + capture_pause_supported "true" Object.Base.fe_dai.1 { name "$SSP0_CAPTURE_PCM" } @@ -953,6 +956,7 @@ IncludeByKey.PASSTHROUGH { name "$DMIC0_PCM_0_NAME" id 27 direction "capture" + capture_pause_supported "true" Object.Base.fe_dai."$DMIC0_PCM_0_NAME" {} Object.PCM.pcm_caps."capture" { @@ -967,6 +971,7 @@ IncludeByKey.PASSTHROUGH { name "$DMIC0_PCM_1_NAME" id 28 direction "capture" + capture_pause_supported "true" Object.Base.fe_dai."$DMIC0_PCM_1_NAME" {} Object.PCM.pcm_caps."capture" { @@ -981,6 +986,8 @@ IncludeByKey.PASSTHROUGH { name "$SSP2_PCM_NAME" id 2 direction "duplex" + playback_pause_supported "true" + capture_pause_supported "true" Object.Base.fe_dai.1 { name "$SSP2_PCM_NAME" } @@ -1012,6 +1019,8 @@ IncludeByKey.PASSTHROUGH { name "$SSP2_PCM_NAME" id 2 direction "duplex" + playback_pause_supported "true" + capture_pause_supported "true" Object.Base.fe_dai.1 { name "$SSP2_PCM_NAME" } @@ -1374,6 +1383,8 @@ IncludeByKey.SSP1_ENABLED { name "$SSP1_PCM_NAME" id 1 direction "duplex" + playback_pause_supported "true" + capture_pause_supported "true" Object.Base.fe_dai.1 { name "$SSP1_PCM_NAME" } diff --git a/tools/topology/topology2/include/common/pcm.conf b/tools/topology/topology2/include/common/pcm.conf index 1ba79ff852b2..01e9358bf758 100644 --- a/tools/topology/topology2/include/common/pcm.conf +++ b/tools/topology/topology2/include/common/pcm.conf @@ -44,6 +44,16 @@ Class.PCM."pcm" { token_ref "stream.bool" } + DefineAttribute."playback_pause_supported" { + # Token reference and type + token_ref "stream.bool" + } + + DefineAttribute."capture_pause_supported" { + # Token reference and type + token_ref "stream.bool" + } + attributes { !constructor [ "name" @@ -60,4 +70,6 @@ Class.PCM."pcm" { # Default values for PCM attributes compress "false" + playback_pause_supported "false" + capture_pause_supported "false" } diff --git a/tools/topology/topology2/include/common/tokens.conf b/tools/topology/topology2/include/common/tokens.conf index d52934128c81..dadfc162483c 100644 --- a/tools/topology/topology2/include/common/tokens.conf +++ b/tools/topology/topology2/include/common/tokens.conf @@ -129,8 +129,10 @@ Object.Base.VendorToken { "13" { name "stream" - playback_compatible_d0i3 "1200" - capture_compatible_d0i3 "1201" + playback_compatible_d0i3 1200 + capture_compatible_d0i3 1201 + playback_pause_supported 1202 + capture_pause_supported 1203 } "14" {