Skip to content
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
4 changes: 2 additions & 2 deletions test-case/check-capture.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
## default duration is 10s
## default loop count is 3
## Case step:
## 1. Parse TPLG file to get pipeline with type of "record" and "both"
## 1. Parse TPLG file to get pipeline with type of "record"
## 2. Specify the audio parameters
## 3. Run arecord on each pipeline with parameters
## Expect result:
Expand Down Expand Up @@ -55,7 +55,7 @@ file_prefix=${OPT_VALUE_lst['f']}

func_lib_setup_kernel_last_line
func_lib_check_sudo
func_pipeline_export $tplg "type:capture,both"
func_pipeline_export $tplg "type:capture"

for round in $(seq 1 $round_cnt)
do
Expand Down
6 changes: 3 additions & 3 deletions test-case/check-kmod-load-unload-after-playback.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
## check kernel module removal/insert process with playback before and after
## Case step:
## 1. enter loop for module remove / insert test
## 2. for each pcm type == playback or both:
## 2. for each pcm type == playback:
## start playback of duration OPT_VALUE_lst['d]'
## 3. check for playback errors
## 4. remove all loaded modules listed in sof_remove.sh
Expand All @@ -19,7 +19,7 @@
## (only once, not per PCM)
## 8. check for successful sof-firmware boot
## 9. check for dmesg errors
## 10. for each pcm type == playback or both:
## 10. for each pcm type == playback:
## start playback of duration OPT_VALUE_lst['d]'
## 11. check for playback errors
## 12. loop to beginning (max OPT_VALUE_lst['l'])
Expand Down Expand Up @@ -50,7 +50,7 @@ tplg=${OPT_VALUE_lst['t']}
loop_cnt=${OPT_VALUE_lst['l']}
pb_duration=${OPT_VALUE_lst['d']}

func_pipeline_export $tplg "type:playback,both"
func_pipeline_export $tplg "type:playback"

func_lib_check_sudo
# overwirte the subscript: test-case LOG_ROOT environment
Expand Down
2 changes: 1 addition & 1 deletion test-case/check-pause-resume.sh
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ esac

[[ -z $file_name ]] && file_name=$dummy_file

func_pipeline_export $tplg "type:$test_mode,both"
func_pipeline_export $tplg "type:$test_mode"
func_lib_setup_kernel_last_line
for idx in $(seq 0 $(expr $PIPELINE_COUNT - 1))
do
Expand Down
4 changes: 2 additions & 2 deletions test-case/check-playback.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
## default duration is 10s
## default loop count is 3
## Case step:
## 1. Parse TPLG file to get pipeline with type of "play" and "both"
## 1. Parse TPLG file to get pipeline with type of "play"
## 2. Specify the audio parameters
## 3. Run aplay on each pipeline with parameters
## Expect result:
Expand Down Expand Up @@ -63,7 +63,7 @@ fi

func_lib_setup_kernel_last_line
func_lib_check_sudo
func_pipeline_export $tplg "type:playback,both"
func_pipeline_export $tplg "type:playback"

for round in $(seq 1 $round_cnt)
do
Expand Down
2 changes: 1 addition & 1 deletion test-case/check-runtime-pm-status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ runtime_status="/sys/bus/pci/devices/0000:$(lspci |awk '/[Aa]udio/ {print $1;}')
dlogc "Runtime status check: cat $runtime_status"

[[ ${OPT_VALUE_lst['s']} -eq 1 ]] && func_lib_start_log_collect
func_pipeline_export $tplg "type:playback,both"
func_pipeline_export $tplg "type:playback"
func_lib_setup_kernel_last_line
#TODO: need to go through both playback and capture
for idx in $(seq 0 $(expr $PIPELINE_COUNT - 1))
Expand Down
2 changes: 1 addition & 1 deletion test-case/check-signal-stop-start.sh
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func_stop_start_pipeline()
done
}

func_pipeline_export $tplg "type:$test_mode,both"
func_pipeline_export $tplg "type:$test_mode"
for idx in $(seq 0 $(expr $PIPELINE_COUNT - 1))
do
channel=$(func_pipeline_parse_value $idx channel)
Expand Down
2 changes: 1 addition & 1 deletion test-case/check-suspend-resume-with-audio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ else
fi
[[ -z $file_name ]] && file_name=$dummy_file

func_pipeline_export $tplg "type:${OPT_VALUE_lst['m']},both"
func_pipeline_export $tplg "type:${OPT_VALUE_lst['m']}"

if [ "${OPT_VALUE_lst['T']}" ]; then
opt="-l ${OPT_VALUE_lst['l']} -T ${OPT_VALUE_lst['T']}"
Expand Down
4 changes: 2 additions & 2 deletions test-case/check-xrun-injection.sh
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ interval=${OPT_VALUE_lst['i']}

func_lib_setup_kernel_last_line
func_lib_check_sudo
func_pipeline_export $tplg "type:playback,capture,both"
func_pipeline_export $tplg "type:playback,capture"

case $test_mode in
"playback")
Expand Down Expand Up @@ -83,7 +83,7 @@ func_xrun_injection()
done
}

func_pipeline_export $tplg "type:$test_mode,both"
func_pipeline_export $tplg "type:$test_mode"
for idx in $(seq 0 $(expr $PIPELINE_COUNT - 1))
do
channel=$(func_pipeline_parse_value $idx channel)
Expand Down
10 changes: 5 additions & 5 deletions test-case/multiple-pipeline-capture.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
## Pick up pipelines from TPLG file for max count
## Rule:
## a. fill pipeline need match max count
## b. fill pipeline type order: capture & both > playback
## b. fill pipeline type order: capture > playback
## c. if pipeline in TPLG is not enough of count, max count is pipeline count
## Case step:
## 1. Parse TPLG file to get pipeline count to decide max count is parameter or pipeline count
## 2. load capture & both for arecord to fill pipeline count
## 2. load capture for arecord to fill pipeline count
## 3. load playback for aplay fill pipeline count
## 4. wait for 0.5s for process already loaded
## 5. check process status & process count
Expand Down Expand Up @@ -57,8 +57,8 @@ func_lib_setup_kernel_last_line
declare -A APP_LST DEV_LST
APP_LST['playback']='aplay'
DEV_LST['playback']='/dev/zero'
APP_LST['capture,both']='arecord'
DEV_LST['capture,both']='/dev/null'
APP_LST['capture']='arecord'
DEV_LST['capture']='/dev/null'

tmp_count=$max_count

Expand Down Expand Up @@ -107,7 +107,7 @@ do
sudo dmesg -C

# start capture:
func_run_pipeline_with_type "capture,both"
func_run_pipeline_with_type "capture"
func_run_pipeline_with_type "playback"

dlogi "pipeline start sleep 0.5s for device wakeup"
Expand Down
10 changes: 5 additions & 5 deletions test-case/multiple-pipeline-playback.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@
## Pick up pipelines from TPLG file for max count
## Rule:
## a. fill pipeline need match max count
## b. fill pipeline type order: playback & both > capture
## b. fill pipeline type order: playback > capture
## c. if pipeline in TPLG is not enough of count, max count is pipeline count
## Case step:
## 1. Parse TPLG file to get pipeline count to decide max count is parameter or pipeline count
## 2. load playback & both for aplay to fill pipeline count
## 2. load playback for aplay to fill pipeline count
## 3. load capture for arecord to fill pipeline count
## 4. wait for 0.5s for process already loaded
## 5. check process status & process count
Expand Down Expand Up @@ -55,8 +55,8 @@ func_lib_setup_kernel_last_line

# now small function define
declare -A APP_LST DEV_LST
APP_LST['playback,both']='aplay'
DEV_LST['playback,both']='/dev/zero'
APP_LST['playback']='aplay'
DEV_LST['playback']='/dev/zero'
APP_LST['capture']='arecord'
DEV_LST['capture']='/dev/null'

Expand Down Expand Up @@ -107,7 +107,7 @@ do
sudo dmesg -C

# start capture:
func_run_pipeline_with_type "playback,both"
func_run_pipeline_with_type "playback"
func_run_pipeline_with_type "capture"

dlogi "pipeline start sleep 0.5s for device wakeup"
Expand Down
2 changes: 1 addition & 1 deletion test-case/test-speaker.sh
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func_opt_parse_option $*
tplg=${OPT_VALUE_lst['t']}
[[ ${OPT_VALUE_lst['s']} -eq 1 ]] && func_lib_start_log_collect

func_pipeline_export $tplg "type:playback,both"
func_pipeline_export $tplg "type:playback"
tcnt=${OPT_VALUE_lst['l']}
func_lib_setup_kernel_last_line
for idx in $(seq 0 $(expr $PIPELINE_COUNT - 1))
Expand Down
4 changes: 2 additions & 2 deletions test-case/volume-basic-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ func_error_exit()
}

[[ -z $tplg ]] && dlogw "Missing tplg file needed to run" && exit 1
func_pipeline_export $tplg "type:playback,both"
func_pipeline_export $tplg "type:playback"
[[ ${OPT_VALUE_lst['s']} -eq 1 ]] && func_lib_start_log_collect

[[ $PIPELINE_COUNT -eq 0 ]] && dlogw "Missing playback/both pipeline needed to run the aplay" && exit 1
[[ $PIPELINE_COUNT -eq 0 ]] && dlogw "Missing playback pipeline for aplay to run" && exit 1
channel=$(func_pipeline_parse_value 0 channel)
rate=$(func_pipeline_parse_value 0 rate)
fmt=$(func_pipeline_parse_value 0 fmt)
Expand Down
41 changes: 36 additions & 5 deletions tools/sof-tplgreader.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,33 @@ def _key2str(self, cap, key):
def loadFile(self, filename, sofcard=0):
tplg_parser = TplgParser()
parsed_tplg = tplg_parser.parse(filename)
formatter = TplgFormatter(parsed_tplg)
# ignore the last element, for it is tplg name
for item in parsed_tplg[:-1]:
if "pcm" not in item:
continue
for pcm in item['pcm']:
pipeline_dict = {}
pipeline_dict['pcm'] = pcm["pcm_name"]
pipeline_dict['id'] = str(pcm["pcm_id"])
pipeline_dict['type'] = TplgFormatter.get_pcm_type(pcm)
pcm_type = TplgFormatter.get_pcm_type(pcm)
# if we find None type pcm, there must be errors in topology
if pipeline_dict['type'] == "None":
if pcm_type == "None":
print("type of %s is neither playback nor capture, please check your"
"topology source file" % pcm["pcm_name"])
exit(1)
pgas = formatter.find_comp_for_pcm(pcm, 'PGA')
eqs = formatter.find_comp_for_pcm(pcm, 'EQ')
pipeline_dict = {}
pipeline_dict['pcm'] = pcm["pcm_name"]
pipeline_dict['id'] = str(pcm["pcm_id"])
pipeline_dict['type'] = TplgFormatter.get_pcm_type(pcm)
cap = pcm["caps"][pcm['capture']]
pga = pgas[pcm['capture']]
if pga != []:
pga_names = [i['name'] for i in pga]
pipeline_dict['pga'] = " ".join(pga_names)
eq = eqs[pcm['capture']]
if eq != []:
eq_names = [i['name'] for i in eq]
pipeline_dict['eq'] = " ".join(eq_names)
# supported formats of playback pipeline in formats[0]
# supported formats of capture pipeline in formats[1]
formats = TplgFormatter.get_pcm_fmt(pcm)
Expand All @@ -46,6 +58,25 @@ def loadFile(self, filename, sofcard=0):
pipeline_dict['fmt'] = pipeline_dict['fmts'].split(' ')[0]
pipeline_dict['rate_min'], pipeline_dict['rate_max'] = self._key2str(cap, 'rate')
pipeline_dict['ch_min'], pipeline_dict['ch_max'] = self._key2str(cap, 'channels')
if pcm_type == "both":
pipeline_dict["type"] = "capture"
# copy pipeline and change values
pb_pipeline_dict = pipeline_dict.copy()
pb_pipeline_dict["type"] = "playback"
cap = pcm["caps"][pcm['playback']]
pga = pgas[pcm['capture']]
Comment thread
aiChaoSONG marked this conversation as resolved.
Resolved
if pga != []:
pga_names = [i['name'] for i in pga]
pipeline_dict['pga'] = " ".join(pga_names)
eq = eqs[pcm['capture']]
if eq != []:
eq_names = [i['name'] for i in eq]
pipeline_dict['eq'] = " ".join(eq_names)
pb_pipeline_dict["fmts"] = " ".join(formats[pcm['playback']])
pipeline_dict['fmt'] = pipeline_dict['fmts'].split(' ')[0]
pb_pipeline_dict['rate_min'], pb_pipeline_dict['rate_max'] = self._key2str(cap, 'rate')
pb_pipeline_dict['ch_min'], pb_pipeline_dict['ch_max'] = self._key2str(cap, 'channels')
Comment thread
aiChaoSONG marked this conversation as resolved.
Resolved
self._pipeline_lst.append(pb_pipeline_dict)
self._pipeline_lst.append(pipeline_dict)

# format pipeline, this change for script direct access 'rate' 'channel' 'dev'
Expand Down