• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1#!/bin/bash
2
3#/*
4# * Copyright (C) 2013-2016 Intel Corporation
5# *
6# * This program is free software; you can redistribute it and/or modify
7# * it under the terms of the GNU General Public License as published by
8# * the Free Software Foundation; either version 2 of the License, or
9# * (at your option) any later version.
10# *
11# * This program is distributed in the hope that it will be useful,
12# * but WITHOUT ANY WARRANTY; without even the implied warranty of
13# * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14# * GNU General Public License for more details.
15# *
16# */
17
18#set test freq table (HZ)
19freq_table="10 31 73 155 380 977 1932 4119 8197 16197"
20
21#set test number of channels
22test_channel=2
23
24#get device number for DP
25DP_device_num=0
26$ABAT_TEST_PATH/dp_audio_subdevice_number.sh
27DP_device_num=$?
28if [ $DP_device_num = 77 ]; then
29	echo "Prompt: Can not get device with DP audio or \
30show the wrong connection type as HDMI in ELD info"
31	exit 1
32fi
33
34#To get DP audio device number
35DP_card_number=$(aplay -l | grep "HDMI 0" | cut -b 6)
36if [ "$DP_card_number" = "" ]; then
37	echo "Error: Can not get Display audio card."
38	exit 1
39fi
40
41DP_device="hw:$DP_card_number,$DP_device_num"
42echo $device
43sleep 2
44
45#get Analog audio record card number
46record_card_number=$(arecord -l | grep "Analog" | cut -b 6)
47if [ "$record_card_number" = "" ]; then
48	echo "Can not get record card number."
49	exit 1
50fi
51
52#get Analog audio record device number
53record_device_number=$(arecord -l | grep "Analog"| cut -d " " -f 8 |cut -b 1)
54echo $record_device_number
55if [ "$record_device_number" = "" ]; then
56        echo "Can not get record device number"
57        exit 1
58fi
59
60#Notice: to loopback the DP audio output to the analog audio input
61record_device="hw:$record_card_number,$record_device_number"
62test_flag=0
63
64echo -e "\e[31m Notice: to loopback the DP audio \
65output to the analog audio input"
66echo -e "\e[0m"
67read -p "Press enter to continue"
68
69#call alsabat to do the test for each frequency in the freq_table
70for freq in $freq_table
71	do
72		alsabat -P $DP_device -C plug$record_device -c $test_channel -F $freq
73		if [ $? = 0 ]; then
74			echo "Test target frequency:$freq for DP audio playback--Passed" \
75>> $ABAT_TEST_LOG_FILE
76		else
77			echo "Test target frequency:$freq for DP audio playback--Failed" \
78>> $ABAT_TEST_LOG_FILE
79			test_flag=1
80		fi
81	done
82
83exit $test_flag
84