From ba2f6c503c2d7188412bae36fe0b35817aca78e0 Mon Sep 17 00:00:00 2001 From: Keqiao Zhang Date: Tue, 28 Mar 2023 10:07:31 +0800 Subject: [PATCH] Volume reset for alsabat testing (#1010) * lib.sh: rename function reset_PGA_volume to a more generic name the volume ctl name PGA is for IPC3, IPC4 uses keyword gain. so rename the function to a more generic name to cover IPC4. Signed-off-by: Keqiao Zhang * lib.sh: add IPC4 gain volume ctl support in volume reset function No all IPC4 gain controls can set 0dB directly, maybe there're some problems there. As the alternative, use 100% for IPC4 gain. Will be unified after the problem is fixed. Signed-off-by: Keqiao Zhang * lib.sh: reset all sof volume to 0dB before alsabat testing We have aligned that to use 0dB for all sof volume controls in CI test. Signed-off-by: Keqiao Zhang --------- Signed-off-by: Keqiao Zhang --- case-lib/lib.sh | 10 +++++++--- test-case/check-alsabat.sh | 3 +++ test-case/volume-basic-test.sh | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/case-lib/lib.sh b/case-lib/lib.sh index 376743dc..f6a63410 100644 --- a/case-lib/lib.sh +++ b/case-lib/lib.sh @@ -827,13 +827,17 @@ set_alsa_settings() esac } -reset_PGA_volume() +reset_sof_volume() { # set all PGA* volume to 0dB - amixer -Dhw:0 scontrols | sed -e "s/^.*'\(.*\)'.*/\1/" |grep PGA | + amixer -Dhw:0 scontrols | sed -e "s/^.*'\(.*\)'.*/\1/" |grep -E 'PGA|gain' | while read -r mixer_name do - amixer -Dhw:0 -- sset "$mixer_name" 0dB + if is_ipc4; then + amixer -Dhw:0 -- sset "$mixer_name" 100% + else + amixer -Dhw:0 -- sset "$mixer_name" 0dB + fi done } diff --git a/test-case/check-alsabat.sh b/test-case/check-alsabat.sh index 96c0e753..c6e9c0b7 100755 --- a/test-case/check-alsabat.sh +++ b/test-case/check-alsabat.sh @@ -68,6 +68,9 @@ fi check_locale_for_alsabat +# reset sof volume to 0dB +reset_sof_volume + # If MODEL is defined, set proper gain for the platform if [ -z "$MODEL" ]; then # treat as warning only diff --git a/test-case/volume-basic-test.sh b/test-case/volume-basic-test.sh index 2199ce42..6a378c27 100755 --- a/test-case/volume-basic-test.sh +++ b/test-case/volume-basic-test.sh @@ -90,4 +90,4 @@ done pkill -9 aplay dlogi "Reset all PGA volume to 0dB" -reset_PGA_volume || die "Failed to reset some PGA volume to 0dB." +reset_sof_volume || die "Failed to reset some PGA volume to 0dB."