From 7dd76db0a8208a0d69d4f81daaa0878ec322dcc4 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Mon, 6 May 2019 20:32:29 +0300 Subject: [PATCH] Topology: Add volume ramp tokens into topologies This patch adds volume configuration tokens as fifth parameter for pga.m. All the topologies those use W_PGA() are updated to use a linear (type=0) ramp with length of 250 ms. Signed-off-by: Seppo Ingalsuo --- tools/topology/m4/pga.m4 | 3 ++- tools/topology/sof/pipe-eq-volume-playback.m4 | 12 +++++++++++- tools/topology/sof/pipe-low-latency-capture.m4 | 12 +++++++++++- tools/topology/sof/pipe-low-latency-playback.m4 | 14 ++++++++++++-- tools/topology/sof/pipe-pcm-media.m4 | 12 +++++++++++- tools/topology/sof/pipe-src-playback.m4 | 13 ++++++++++++- tools/topology/sof/pipe-tone.m4 | 12 +++++++++++- tools/topology/sof/pipe-volume-capture-16khz.m4 | 12 +++++++++++- tools/topology/sof/pipe-volume-capture.m4 | 12 +++++++++++- tools/topology/sof/pipe-volume-playback.m4 | 13 ++++++++++++- 10 files changed, 104 insertions(+), 11 deletions(-) diff --git a/tools/topology/m4/pga.m4 b/tools/topology/m4/pga.m4 index af2583f2d..816026866 100644 --- a/tools/topology/m4/pga.m4 +++ b/tools/topology/m4/pga.m4 @@ -33,9 +33,10 @@ define(`W_PGA', ` data [' ` "'N_PGA($1)`_data_w"' ` "'N_PGA($1)`_data_str"' +` "'$5`"' ` ]' ` mixer [' - $5 + $6 ` ]' `}') diff --git a/tools/topology/sof/pipe-eq-volume-playback.m4 b/tools/topology/sof/pipe-eq-volume-playback.m4 index 1f42be459..a0cc54958 100644 --- a/tools/topology/sof/pipe-eq-volume-playback.m4 +++ b/tools/topology/sof/pipe-eq-volume-playback.m4 @@ -29,6 +29,16 @@ C_CONTROLMIXER(Master Playback Volume, PIPELINE_ID, LIST(` ', KCONTROL_CHANNEL(FL, 1, 0), KCONTROL_CHANNEL(FR, 1, 1))) +# +# Volume configuration +# + +W_VENDORTUPLES(playback_pga_tokens, sof_volume_tokens, +LIST(` ', `SOF_TKN_VOLUME_RAMP_STEP_TYPE "0"' + ` ', `SOF_TKN_VOLUME_RAMP_STEP_MS "250"')) + +W_DATA(playback_pga_conf, playback_pga_tokens) + # Use coefficients for flat frequency response include(`eq_iir_coef_flat.m4') @@ -62,7 +72,7 @@ C_CONTROLBYTES(EQFIR, PIPELINE_ID, W_PCM_PLAYBACK(PCM_ID, Passthrough Playback, 2, 0) # "Volume" has 2 source and 2 sink periods -W_PGA(0, PIPELINE_FORMAT, 2, 2, LIST(` ', "PIPELINE_ID Master Playback Volume")) +W_PGA(0, PIPELINE_FORMAT, 2, 2, playback_pga_conf, LIST(` ', "PIPELINE_ID Master Playback Volume")) # "EQ 0" has 2 sink period and 2 source periods W_EQ_IIR(0, PIPELINE_FORMAT, 2, 2, LIST(` ', "EQIIR")) diff --git a/tools/topology/sof/pipe-low-latency-capture.m4 b/tools/topology/sof/pipe-low-latency-capture.m4 index d4a6b4a8c..7d44c78f2 100644 --- a/tools/topology/sof/pipe-low-latency-capture.m4 +++ b/tools/topology/sof/pipe-low-latency-capture.m4 @@ -23,6 +23,16 @@ C_CONTROLMIXER(PCM PCM_ID Capture Volume, PIPELINE_ID, Channel register and shift for Front Left/Right, LIST(` ', KCONTROL_CHANNEL(FL, 0, 0), KCONTROL_CHANNEL(FR, 0, 1))) +# +# Volume configuration +# + +W_VENDORTUPLES(capture_pga_tokens, sof_volume_tokens, +LIST(` ', `SOF_TKN_VOLUME_RAMP_STEP_TYPE "0"' + ` ', `SOF_TKN_VOLUME_RAMP_STEP_MS "250"')) + +W_DATA(capture_pga_conf, capture_pga_tokens) + # # Components and Buffers # @@ -32,7 +42,7 @@ C_CONTROLMIXER(PCM PCM_ID Capture Volume, PIPELINE_ID, W_PCM_CAPTURE(PCM_ID, Low Latency Capture, 0, 2) # "Capture Volume" has 2 sink and source periods for host and DAI ping-pong -W_PGA(0, PIPELINE_FORMAT, 2, 2, LIST(` ', "PIPELINE_ID PCM PCM_ID Capture Volume")) +W_PGA(0, PIPELINE_FORMAT, 2, 2, capture_pga_conf, LIST(` ', "PIPELINE_ID PCM PCM_ID Capture Volume")) # Capture Buffers W_BUFFER(0, COMP_BUFFER_SIZE(2, diff --git a/tools/topology/sof/pipe-low-latency-playback.m4 b/tools/topology/sof/pipe-low-latency-playback.m4 index 6e3bf94d6..1fe0fa1b6 100644 --- a/tools/topology/sof/pipe-low-latency-playback.m4 +++ b/tools/topology/sof/pipe-low-latency-playback.m4 @@ -48,6 +48,16 @@ C_CONTROLMIXER(Master Playback Volume, PIPELINE_ID, Channel register and shift for Front Left/Right, LIST(` ', KCONTROL_CHANNEL(FL, 1, 0), KCONTROL_CHANNEL(FR, 1, 1))) +# +# Volume configuration +# + +W_VENDORTUPLES(playback_pga_tokens, sof_volume_tokens, +LIST(` ', `SOF_TKN_VOLUME_RAMP_STEP_TYPE "0"' + ` ', `SOF_TKN_VOLUME_RAMP_STEP_MS "250"')) + +W_DATA(playback_pga_conf, playback_pga_tokens) + # # Components and Buffers # @@ -57,10 +67,10 @@ C_CONTROLMIXER(Master Playback Volume, PIPELINE_ID, W_PCM_PLAYBACK(PCM_ID, Low Latency Playback, 2, 0) # "Playback Volume" has 2 sink periods and 2 source periods for host ping-pong -W_PGA(0, PIPELINE_FORMAT, 2, 2, LIST(` ', "PIPELINE_ID PCM PCM_ID Playback Volume")) +W_PGA(0, PIPELINE_FORMAT, 2, 2, playback_pga_conf, LIST(` ', "PIPELINE_ID PCM PCM_ID Playback Volume")) # "Master Playback Volume" has 2 source and 2 sink periods for DAI ping-pong -W_PGA(1, PIPELINE_FORMAT, 2, 2, LIST(` ', "PIPELINE_ID Master Playback Volume")) +W_PGA(1, PIPELINE_FORMAT, 2, 2, playback_pga_conf, LIST(` ', "PIPELINE_ID Master Playback Volume")) # Mixer 0 has 2 sink and source periods. W_MIXER(0, PIPELINE_FORMAT, 2, 2) diff --git a/tools/topology/sof/pipe-pcm-media.m4 b/tools/topology/sof/pipe-pcm-media.m4 index 79bebcc12..0979c4303 100644 --- a/tools/topology/sof/pipe-pcm-media.m4 +++ b/tools/topology/sof/pipe-pcm-media.m4 @@ -36,6 +36,16 @@ W_VENDORTUPLES(media_src_tokens, sof_src_tokens, LIST(` ', `SOF_TKN_SRC_RATE_OU W_DATA(media_src_conf, media_src_tokens) +# +# Volume Configuration +# + +W_VENDORTUPLES(playback_pga_tokens, sof_volume_tokens, +LIST(` ', `SOF_TKN_VOLUME_RAMP_STEP_TYPE "0"' + ` ', `SOF_TKN_VOLUME_RAMP_STEP_MS "250"')) + +W_DATA(playback_pga_conf, playback_pga_tokens) + # # Components and Buffers # @@ -45,7 +55,7 @@ W_DATA(media_src_conf, media_src_tokens) W_PCM_PLAYBACK(PCM_ID, Media Playback, 2, 0) # "Playback Volume" has 2 sink period and 2 source periods for host ping-pong -W_PGA(0, PIPELINE_FORMAT, 2, 2, LIST(` ', "PIPELINE_ID PCM PCM_ID Playback Volume")) +W_PGA(0, PIPELINE_FORMAT, 2, 2, playback_pga_conf, LIST(` ', "PIPELINE_ID PCM PCM_ID Playback Volume")) # "SRC 0" has 2 sink and source periods. W_SRC(0, PIPELINE_FORMAT, 2, 2, media_src_conf) diff --git a/tools/topology/sof/pipe-src-playback.m4 b/tools/topology/sof/pipe-src-playback.m4 index 371118d03..abbff836d 100644 --- a/tools/topology/sof/pipe-src-playback.m4 +++ b/tools/topology/sof/pipe-src-playback.m4 @@ -45,8 +45,19 @@ W_DATA(media_src_conf, media_src_tokens) # "SRC" has 3 source and 3 sink periods W_SRC(0, PIPELINE_FORMAT, 3, 3, media_src_conf) +# +# Volume Configuration +# + +W_VENDORTUPLES(playback_pga_tokens, sof_volume_tokens, +LIST(` ', `SOF_TKN_VOLUME_RAMP_STEP_TYPE "0"' + ` ', `SOF_TKN_VOLUME_RAMP_STEP_MS "250"')) + + +W_DATA(playback_pga_conf, playback_pga_tokens) + # "Volume" has 2 source and 2 sink periods -W_PGA(0, PIPELINE_FORMAT, 2, 2, LIST(` ', "PIPELINE_ID Master Playback Volume")) +W_PGA(0, PIPELINE_FORMAT, 2, 2, playback_pga_conf, LIST(` ', "PIPELINE_ID Master Playback Volume")) # Playback Buffers W_BUFFER(0, COMP_BUFFER_SIZE(3, diff --git a/tools/topology/sof/pipe-tone.m4 b/tools/topology/sof/pipe-tone.m4 index 120c7a21d..4bad5afe7 100644 --- a/tools/topology/sof/pipe-tone.m4 +++ b/tools/topology/sof/pipe-tone.m4 @@ -37,6 +37,16 @@ C_CONTROLMIXER(Tone Switch, PIPELINE_ID, Channel register and shift for Front Left/Right, LIST(` ', KCONTROL_CHANNEL(FL, 2, 0), KCONTROL_CHANNEL(FR, 2, 1))) +# +# Volume configuration +# + +W_VENDORTUPLES(playback_pga_tokens, sof_volume_tokens, +LIST(` ', `SOF_TKN_VOLUME_RAMP_STEP_TYPE "0"' + ` ', `SOF_TKN_VOLUME_RAMP_STEP_MS "250"')) + +W_DATA(playback_pga_conf, playback_pga_tokens) + # # Components and Buffers # @@ -45,7 +55,7 @@ C_CONTROLMIXER(Tone Switch, PIPELINE_ID, W_TONE(0, PIPELINE_FORMAT, 2, 0, LIST(` ', "PIPELINE_ID Tone Switch")) # "Tone Volume" has 2 sink period and 2 source periods -W_PGA(0, PIPELINE_FORMAT, 2, 2, LIST(` ', "PIPELINE_ID Tone Volume")) +W_PGA(0, PIPELINE_FORMAT, 2, 2, playback_pga_conf, LIST(` ', "PIPELINE_ID Tone Volume")) # Low Latency Buffers W_BUFFER(0,COMP_BUFFER_SIZE(2, diff --git a/tools/topology/sof/pipe-volume-capture-16khz.m4 b/tools/topology/sof/pipe-volume-capture-16khz.m4 index 0b33e2000..649e7c60b 100644 --- a/tools/topology/sof/pipe-volume-capture-16khz.m4 +++ b/tools/topology/sof/pipe-volume-capture-16khz.m4 @@ -28,6 +28,16 @@ C_CONTROLMIXER(Master Capture Volume, PIPELINE_ID, Channel register and shift for Front Left/Right, LIST(` ', KCONTROL_CHANNEL(FL, 1, 0), KCONTROL_CHANNEL(FR, 1, 1))) +# +# Volume configuration +# + +W_VENDORTUPLES(playback_pga_tokens, sof_volume_tokens, +LIST(` ', `SOF_TKN_VOLUME_RAMP_STEP_TYPE "0"' + ` ', `SOF_TKN_VOLUME_RAMP_STEP_MS "250"')) + +W_DATA(playback_pga_conf, playback_pga_tokens) + # # Components and Buffers # @@ -37,7 +47,7 @@ C_CONTROLMIXER(Master Capture Volume, PIPELINE_ID, W_PCM_CAPTURE(PCM_ID, Passthrough Capture, 0, 2) # "Volume" has 2 source and 2 sink periods -W_PGA(0, PIPELINE_FORMAT, 2, 2, LIST(` ', "PIPELINE_ID Master Capture Volume")) +W_PGA(0, PIPELINE_FORMAT, 2, 2, playback_pga_conf, LIST(` ', "PIPELINE_ID Master Capture Volume")) # Capture Buffers W_BUFFER(0, COMP_BUFFER_SIZE(2, diff --git a/tools/topology/sof/pipe-volume-capture.m4 b/tools/topology/sof/pipe-volume-capture.m4 index 7f2d27aaa..ebe0d4818 100644 --- a/tools/topology/sof/pipe-volume-capture.m4 +++ b/tools/topology/sof/pipe-volume-capture.m4 @@ -25,6 +25,16 @@ C_CONTROLMIXER(Master Capture Volume, PIPELINE_ID, Channel register and shift for Front Left/Right, LIST(` ', KCONTROL_CHANNEL(FL, 1, 0), KCONTROL_CHANNEL(FR, 1, 1))) +# +# Volume Configuration +# + +W_VENDORTUPLES(capture_pga_tokens, sof_volume_tokens, +LIST(` ', `SOF_TKN_VOLUME_RAMP_STEP_TYPE "0"' + ` ', `SOF_TKN_VOLUME_RAMP_STEP_MS "250"')) + +W_DATA(capture_pga_conf, capture_pga_tokens) + # # Components and Buffers # @@ -34,7 +44,7 @@ C_CONTROLMIXER(Master Capture Volume, PIPELINE_ID, W_PCM_CAPTURE(PCM_ID, Passthrough Capture, 0, 2) # "Volume" has 2 source and 2 sink periods -W_PGA(0, PIPELINE_FORMAT, 2, 2, LIST(` ', "PIPELINE_ID Master Capture Volume")) +W_PGA(0, PIPELINE_FORMAT, 2, 2, capture_pga_conf, LIST(` ', "PIPELINE_ID Master Capture Volume")) # Capture Buffers W_BUFFER(0, COMP_BUFFER_SIZE(2, diff --git a/tools/topology/sof/pipe-volume-playback.m4 b/tools/topology/sof/pipe-volume-playback.m4 index 00d596829..8a8b5caae 100644 --- a/tools/topology/sof/pipe-volume-playback.m4 +++ b/tools/topology/sof/pipe-volume-playback.m4 @@ -25,6 +25,16 @@ C_CONTROLMIXER(Master Playback Volume, PIPELINE_ID, Channel register and shift for Front Left/Right, LIST(` ', KCONTROL_CHANNEL(FL, 1, 0), KCONTROL_CHANNEL(FR, 1, 1))) +# +# Volume configuration +# + +W_VENDORTUPLES(playback_pga_tokens, sof_volume_tokens, +LIST(` ', `SOF_TKN_VOLUME_RAMP_STEP_TYPE "0"' + ` ', `SOF_TKN_VOLUME_RAMP_STEP_MS "250"')) + +W_DATA(playback_pga_conf, playback_pga_tokens) + # # Components and Buffers # @@ -33,8 +43,9 @@ C_CONTROLMIXER(Master Playback Volume, PIPELINE_ID, # with 2 sink and 0 source periods W_PCM_PLAYBACK(PCM_ID, Passthrough Playback, 2, 0) + # "Volume" has 2 source and 2 sink periods -W_PGA(0, PIPELINE_FORMAT, 2, 2, LIST(` ', "PIPELINE_ID Master Playback Volume")) +W_PGA(0, PIPELINE_FORMAT, 2, 2, playback_pga_conf, LIST(` ', "PIPELINE_ID Master Playback Volume")) # Playback Buffers W_BUFFER(0, COMP_BUFFER_SIZE(2,