Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reset all PGA volume to 0dB #953

Merged
merged 3 commits into from
Sep 8, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions case-lib/lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -768,4 +768,14 @@ set_alsa_settings()
esac
}

reset_PGA_volume()
{
# set all PGA* volume to 0dB
amixer -Dhw:0 scontrols | sed -e "s/^.*'\(.*\)'.*/\1/" |grep PGA |

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for IPC4 the volume control are named as gain, I think you should also grep gain here.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are right. But the volume-base-test.sh only support PGA control ATM. The volume test is skipped on all our IPC4 platforms. I can submit another PR for IPC4.

while read -r mixer_name
do
amixer -Dhw:0 -- sset "$mixer_name" 0dB
done
}

start_test
11 changes: 6 additions & 5 deletions test-case/volume-basic-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ dlogc "aplay -D $dev -c $channel -r $rate -f $fmt /dev/zero &"
aplay -D "$dev" -c "$channel" -r "$rate" -f "$fmt" /dev/zero &

sleep 1
[[ ! $(pidof aplay) ]] && die "$pid process is terminated too early"
[[ ! $(pidof aplay) ]] && die "aplay process is terminated too early"

sofcard=${SOFCARD:-0}
pgalist=($(amixer -c"$sofcard" controls | grep -i PGA | sed 's/ /_/g;' | awk -Fname= '{print $2}'))
Expand All @@ -67,12 +67,12 @@ do
setup_kernel_check_point
dlogi "===== Round($i/$maxloop) ====="
# TODO: need to check command effect
for i in "${pgalist[@]}"
for kctl in "${pgalist[@]}"
do
volctrl=$(echo "$i" | sed 's/_/ /g;')
volctrl=$(echo "$kctl" | sed 's/_/ /g;')
dlogi "$volctrl"

for vol in ${volume_array[@]}; do
for vol in "${volume_array[@]}"; do
dlogc "amixer -c$sofcard cset name='$volctrl' $vol"
amixer -c"$sofcard" cset name="$volctrl" "$vol" > /dev/null ||
func_error_exit "amixer return error, test failed"
Expand All @@ -89,4 +89,5 @@ done
#clean up background aplay
pkill -9 aplay

exit 0
dlogi "Reset all PGA volume to 0dB"
reset_PGA_volume || die "Failed to reset some PGA volume to 0dB."