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

Topology: Use pipe-volume-switch-capture in nocodec topologies #3509

Closed
wants to merge 1 commit into from

Conversation

singalsu
Copy link
Collaborator

@singalsu singalsu commented Oct 9, 2020

This patch replaces use of pipe-volume-capture macro to
pipe-volume-switch-capture in nocodec topologies for APL, CNL, ICL,
and TGL based platforms. It allows to test of volume component
mute switch control in SSP loopback that is used by default in
nocodec topologies. The testing of mute switch feature is simplest
to do with loopback topologies. Nocodec topologies are not in
mainstream usage so this is the safest option to enable testing.

The mute switch add should be possible to all capture topologies but
it can be done later once it is confirmed it is safe to do (avoid
accidental muted audio or problems with UCM).

Signed-off-by: Seppo Ingalsuo [email protected]

@plbossart
Copy link
Member

The mute switch add should be possible to all capture topologies but
it can be done later once it is confirmed it is safe to do (avoid
accidental muted audio or problems with UCM).

@ranj063 @juimonen isn't the only way to enable a switch control that did not exist previously to make it 'on' by default in the topology?

@singalsu I am also not sure if we want to expose these controls in UCM, we tend to only set controls in UCM when they differ from the defaults. Except for DMIC, I also see no benefits in doing a mute at the firmware level from userspace.

@singalsu
Copy link
Collaborator Author

singalsu commented Oct 9, 2020

This is a short term change to address testing needs. It's a lot harder to test Dmic0 and Dmic1 mute switch acoustically. Since the mute switch is missing from topologies need to add them to some. So I chose the nocodec topologies. I don't think CI uses the tools/test/topology pipelines (only testbench does) so there would be extra effort to load for CI some of them for loopback volume control tests.

I'd like have modular pipe-processingX-capture.m4 macros so we can safely change any endpoint processing between e.g. volume, eqiir-volume, etc. without getting issues. If we should not expose mute switches for all capture pipeline PGAs they need to be controllable by a middle-level topology macro so we enable them only for DMIC.

@singalsu
Copy link
Collaborator Author

CI passed, I'll change this to ready.

@singalsu singalsu marked this pull request as ready for review October 12, 2020 09:56
This patch replaces use of pipe-volume-capture macro or
pipe-low-latency-capture to pipe-volume-switch-capture in nocodec
topologies for APL, BDW, CHT, CNL, ICL, and TGL based platforms. It
allows to test of volume component mute switch control in SSP loopback
that is used by default in nocodec topologies. The testing of mute
switch feature is simplest to do with loopback topologies. Nocodec
topologies are not in mainstream usage so this is the safest option to
enable testing.

The mute switch add should be possible to all capture topologies but
it can be done later once it is confirmed it is safe to do (avoid
accidental muted audio or problems with UCM).

Signed-off-by: Seppo Ingalsuo <[email protected]>
@singalsu singalsu force-pushed the add_volume_switch_to_nocodec_capture branch from c5fd83d to 5984236 Compare October 12, 2020 10:35
@lgirdwood
Copy link
Member

@singalsu can you check CI "timeout" on BYT. Looks like a BAT fail but could be quality. If you need a WAV just rerun CI.

@marc-hb
Copy link
Collaborator

marc-hb commented Oct 12, 2020

@singalsu can you check CI "timeout" on BYT.

Please always add the CI URL in the comments when discussing CI failures because they become incredibly hard to find after the next force-push: https://sof-ci.01.org/sofpr/PR3509/build7426/devicetest/

Looks like a BAT fail but could be quality. If you need a WAV just rerun CI.

Is this long standing thesofproject/sof-test#379 ?

@singalsu
Copy link
Collaborator Author

singalsu commented Oct 13, 2020

@lgirdwood I could not find the wav files. I checked the alsabat script output print and it found sine wave frequencies so apparently it wasn't muted. Adding of the mute switch could cause muted audios if alsactl would restore previously unknown switch to "off".

The test that I'm developing shows that on BYT the channels get swapped randomly. Maybe that causes the issue that CI step reported.

Edit: Here's the part of the report:

BAT analysis: signal has 65536 frames at 44100 Hz, 1 channels, 2 bytes per sample.

Channel 1 - Checking for target frequency 997.00 Hz
Amplitude: 48895.2; Percentage: [149]
Detected peak at 997.26 Hz of 34.68 dB
 Total 40.3 dB from 985.82 to 1006.00 Hz
 PASS: Peak detected at target frequency
Detected peak at 2991.10 Hz of 30.68 dB
 Total 41.0 dB from 2989.08 to 2991.77 Hz
Detected peak at 4984.94 Hz of 28.30 dB
 Total 41.2 dB from 4984.94 to 4985.61 Hz
Detected peak at 6978.78 Hz of 25.80 dB
 Total 41.5 dB from 6978.10 to 6980.12 Hz
Detected peak at 8973.29 Hz of 23.76 dB
 Total 41.6 dB from 8972.62 to 8973.96 Hz
Detected peak at 10967.13 Hz of 23.45 dB
 Total 41.7 dB from 10967.13 to 10967.13 Hz
Detected peak at 12960.97 Hz of 22.33 dB
 Total 41.7 dB from 12960.97 to 12960.97 Hz
Detected peak at 14954.81 Hz of 20.43 dB
 Total 41.8 dB from 14954.81 to 14954.81 Hz
Detected at least 8 signal(s) in total

Return value is -1003
2020-10-12 11:00:51 UTC [REMOTE_ERROR] Starting func_exit_handler(), exit status=21, FUNCNAME stack:
2020-10-12 11:00:51 UTC [REMOTE_ERROR]  main()  @  /home/ubuntu/sof-test/test-case/check-alsabat.sh
2020-10-12 11:00:51 UTC [REMOTE_INFO] pkill -TERM sof-logger
Terminated

@singalsu
Copy link
Collaborator Author

SOFCI TEST

@singalsu
Copy link
Collaborator Author

singalsu commented Oct 14, 2020

I'm not able to repeat the timeout on my Minnowboard. Here's my run of the same test case with this PR included to topology:

root@turbomutu:/home/singalsu/softest/test_2020-10-12/sof-test/test-case# ./check-alsabat.sh -p hw:0,0 -c hw:0,0
2020-10-14 11:44:19 UTC [INFO] Starting /usr/local/bin/sof-logger -t -l /etc/sof/sof-byt.ldc -o /home/singalsu/softest/test_2020-10-12/sof-test/logs/check-alsabat/2020-10-14-14:44:17-5197/slogger.txt
2020-10-14 11:44:19 UTC [INFO] check the PCMs before alsabat test
2020-10-14 11:44:21 UTC [COMMAND] alsabat -Pplughw:0,0 --standalone -n 240000 -F 997
alsa-utils version 1.2.2

Entering playback thread (ALSA).
Get period size: 1896  buffer size: 15038
Playing generated audio sine wave
2020-10-14 11:44:22 UTC [COMMAND] alsabat -Cplughw:0,0 -F 997
alsa-utils version 1.2.2

Entering capture thread (ALSA).
Get period size: 1896  buffer size: 15038
Recording ...
Capture completed.

BAT analysis: signal has 65536 frames at 44100 Hz, 1 channels, 2 bytes per sample.

Channel 1 - Checking for target frequency 997,00 Hz
Amplitude: 28485,9; Percentage: [86]
Detected peak at 997,26 Hz of 37,84 dB
 Total 42,4 dB from 990,53 to 1002,64 Hz
 PASS: Peak detected at target frequency
Detected at least 1 signal(s) in total

Return value is 0
2020-10-14 11:44:26 UTC [INFO] pkill -TERM sof-logger
Terminated
Playback completed.

Return value is 0
2020-10-14 11:44:27 UTC [INFO] nlines=304 /home/singalsu/softest/test_2020-10-12/sof-test/logs/check-alsabat/2020-10-14-14:44:17-5197/slogger.txt
2020-10-14 11:44:28 UTC [INFO] Test Result: PASS!

I think I have an idea what happens with the test now. I get one sine wave detected while CI detects 997 Hz and harmonics. The audio is clipped likely. The tests those I have run on my Minnowboard have left the PGAs to 0 dB position.

@aiChaoSONG @xiulipan @lgirdwood The pipe-volume-switch-capture.m4 has a wider volume scale than pipe-low-latency-capture.m4. The alsabat test should set the volume gains to 0 dB instead of maximum if it depends on unity gain. What do you think?

@singalsu
Copy link
Collaborator Author

Yep, this confirms. I think the alsabat test needs to be improved to set properly the volume.

root@turbomutu:/home/singalsu/softest/test_2020-10-12/sof-test/test-case# amixer cset name='PGA2.0 2 Master Capture Volume' 100%
numid=2,iface=MIXER,name='PGA2.0 2 Master Capture Volume'
  ; type=INTEGER,access=rw---R--,values=2,min=0,max=80,step=0
  : values=80,80
  | dBscale-min=-50.00dB,step=1.00dB,mute=1
root@turbomutu:/home/singalsu/softest/test_2020-10-12/sof-test/test-case# ./check-alsabat.sh -p hw:0,0 -c hw:0,0
2020-10-14 12:01:38 UTC [INFO] Starting /usr/local/bin/sof-logger -t -l /etc/sof/sof-byt.ldc -o /home/singalsu/softest/test_2020-10-12/sof-test/logs/check-alsabat/2020-10-14-15:01:37-19795/slogger.txt
2020-10-14 12:01:38 UTC [INFO] check the PCMs before alsabat test
2020-10-14 12:01:40 UTC [COMMAND] alsabat -Pplughw:0,0 --standalone -n 240000 -F 997
alsa-utils version 1.2.2

Entering playback thread (ALSA).
Get period size: 1896  buffer size: 15038
Playing generated audio sine wave
2020-10-14 12:01:41 UTC [COMMAND] alsabat -Cplughw:0,0 -F 997
alsa-utils version 1.2.2

Entering capture thread (ALSA).
Get period size: 1896  buffer size: 15038
Recording ...
Capture completed.

BAT analysis: signal has 65536 frames at 44100 Hz, 1 channels, 2 bytes per sample.

Channel 1 - Checking for target frequency 997,00 Hz
Amplitude: 48895,3; Percentage: [149]
WARNING: Signal overflow!
Detected peak at 997,26 Hz of 34,68 dB
 Total 40,3 dB from 985,82 to 1006,00 Hz
 PASS: Peak detected at target frequency
Detected peak at 2991,10 Hz of 30,68 dB
 Total 41,0 dB from 2989,08 to 2991,77 Hz
 FAIL: Peak freq too high 2991,10 Hz
Detected peak at 4984,94 Hz of 28,30 dB
 Total 41,2 dB from 4984,94 to 4985,61 Hz
 FAIL: Peak freq too high 4984,94 Hz
Detected peak at 6978,78 Hz of 25,80 dB
 Total 41,5 dB from 6978,10 to 6980,12 Hz
 FAIL: Peak freq too high 6978,78 Hz
Detected peak at 8973,29 Hz of 23,77 dB
 Total 41,6 dB from 8972,62 to 8973,96 Hz
 FAIL: Peak freq too high 8973,29 Hz
Detected peak at 10967,13 Hz of 23,45 dB
 Total 41,7 dB from 10967,13 to 10967,13 Hz
 FAIL: Peak freq too high 10967,13 Hz
Detected peak at 12960,97 Hz of 22,33 dB
 Total 41,7 dB from 12960,97 to 12960,97 Hz
 FAIL: Peak freq too high 12960,97 Hz
Detected peak at 14954,81 Hz of 20,43 dB
 Total 41,8 dB from 14954,81 to 14954,81 Hz
 FAIL: Peak freq too high 14954,81 Hz
Detected at least 8 signal(s) in total

Return value is -1003
2020-10-14 12:01:45 UTC [ERROR] Starting func_exit_handler(), exit status=21, FUNCNAME stack:
2020-10-14 12:01:45 UTC [ERROR]  main()  @  ./check-alsabat.sh
2020-10-14 12:01:45 UTC [INFO] pkill -TERM sof-logger
Terminated
Playback completed.

Return value is 0
2020-10-14 12:01:47 UTC [INFO] nlines=406 /home/singalsu/softest/test_2020-10-12/sof-test/logs/check-alsabat/2020-10-14-15:01:37-19795/slogger.txt
2020-10-14 12:01:47 UTC [INFO] Unknown exit code: 21

@singalsu
Copy link
Collaborator Author

The fix for the alsabat test step is under development in thesofproject/sof-test#437 .

@lgirdwood
Copy link
Member

The fix for the alsabat test step is under development in thesofproject/sof-test#437 .

@singalsu great - please rerun CI here when CI fix is merged and ping me to merge this.

@singalsu
Copy link
Collaborator Author

This PR was created incorrectly from a SOF branch and not my own repo located branch. I'll close this and create new.

@singalsu singalsu closed this Jan 25, 2021
@singalsu singalsu deleted the add_volume_switch_to_nocodec_capture branch January 27, 2021 09:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants