Skip to content

Commit

Permalink
Volume reset for alsabat testing (#1010)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* 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 <[email protected]>

* 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 <[email protected]>

---------

Signed-off-by: Keqiao Zhang <[email protected]>
  • Loading branch information
keqiaozhang authored Mar 28, 2023
1 parent fbd2257 commit ba2f6c5
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
10 changes: 7 additions & 3 deletions case-lib/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
3 changes: 3 additions & 0 deletions test-case/check-alsabat.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion test-case/volume-basic-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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."

0 comments on commit ba2f6c5

Please sign in to comment.