Repository navigation
[BUG] plain arecord issue found when testing RT711 headset recording on TGLU_SKU0A3E_SDW #3804
Copy link
Copy link
Closed
Labels
P1Blocker bugs or important featuresBlocker bugs or important featuresbugSomething isn't workingSomething isn't workingcodecCodec HW or driver restrictionCodec HW or driver restriction
Description
Describe the bug
We observed this issue after upgrading Ubuntu from 20.04 to 22.04. The issue is that when testing plain arecord on headset, the Max peak will be reached to 100% in verbose logs, it should be 0%.
arecord -D hw:0,1 -r 48000 -c 2 -f S16_LE -vvv -i /dev/null -d 10
Recording WAVE '/dev/null' : Signed 16 bit Little Endian, Rate 48000 Hz, Stereo
Hardware PCM card 0 'sof-soundwire' device 1 subdevice 0
Its setup is:
stream : CAPTURE
access : RW_INTERLEAVED
format : S16_LE
subformat : STD
channels : 2
rate : 48000
exact rate : 48000 (48000/1)
msbits : 16
buffer_size : 16384
period_size : 4096
period_time : 85333
tstamp_mode : NONE
tstamp_type : MONOTONIC
period_step : 1
avail_min : 4096
period_event : 0
start_threshold : 1
stop_threshold : 16384
silence_threshold: 0
silence_size : 0
boundary : 4611686018427387904
appl_ptr : 0
hw_ptr : 0
Max peak (8192 samples): 0x00000515 # 3%
Max peak (8192 samples): 0x00000713 ## 5%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00007fff #################### 99%
Max peak (8192 samples): 0x00007fff #################### 99%
Max peak (8192 samples): 0x00007fff #################### 99%
Max peak (8192 samples): 0x00007fff #################### 99%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
Max peak (8192 samples): 0x00008000 #################### 100%
....
Checked the amixer setting, this issue is related to control 'rt711 ADC 08 Capture Volume'. The default value set in UCM2 is 63.
please refer to https://github.com/alsa-project/alsa-ucm-conf/blob/master/ucm2/codecs/rt711/init.conf.
The issue will disappear if I change the volume to 0: amixer -c sofsoundwire cset name='rt711 ADC 08 Capture Volume' 0
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
P1Blocker bugs or important featuresBlocker bugs or important featuresbugSomething isn't workingSomething isn't workingcodecCodec HW or driver restrictionCodec HW or driver restriction
Activity
keqiaozhang commentedon Aug 8, 2022
@shumingfan , could you please take a look at this issue? We have a similar issue on RT714:#3766 and we changed the
rt714 FU02 Capture Volumeto 0dB.shumingfan commentedon Aug 8, 2022
@keqiaozhang I can't reproduce this issue on SKU_0A5D which installed Ubuntu 22.04.
Could you test the DP loopback to check if this issue still exists or not?
$ cd /sys/kernel/debug/soundwire/master-0-0/intel-sdw/
$ echo 4 > cdns-pdi-loopback-target
$ echo 3 > cdns-pdi-loopback-source
// aplay first
$ aplay -D hw:0,0 -f dat /dev/zero
// arecord test
$ arecord -D hw:0,1 -r 48000 -c 2 -f S16_LE -vvv -i /dev/null -d 10
keqiaozhang commentedon Aug 8, 2022
@shumingfan, I still can reproduce the issue with above steps.
plbossart commentedon Aug 8, 2022
@bardliao can you chime in out this one reported by @keqiaozhang and @shumingfan? it's my understanding that if we have an issue with the loopback, then the problem is NOT the codec settings. The loopback will discard the data from the codec . Am I right?
shumingfan commentedon Aug 8, 2022
@keqiaozhang Thanks for the testing.
@plbossart I also think this problem is not the codec settings.
The DP loopback makes the capture data equal to the playback data.
bardliao commentedon Aug 8, 2022
@plbossart @shumingfan @keqiaozhang Sure, I will look into it.
keqiaozhang commentedon Aug 9, 2022
@shumingfan I have checked with Bard. First we need to set the PGA* capture volume to 0dB:
Then even with the default value of
rt711 ADC 08 Capture Volumeset in UCM2, the Max peak will not reach to 100%.For the loopback mode. I did the wrong steps before, I need to keep the playback running when doing the capture.
But the target and source ID you provided are also not right.
I tested with below steps and loopback works:
plbossart commentedon Aug 9, 2022
Why is this needed @keqiaozhang ? All the PGA volumes should be set to 0dB already, If this is not the case, then something or someone changed those settings in the past. We should NEVER have any PGA gains set to anything other than 0dB
bardliao commentedon Aug 9, 2022
@plbossart 50 is 0dB, and it was 80 which is 30dB while we met the issue.
plbossart commentedon Aug 9, 2022
@bardliao why was it set to 80, that's what I don't understand.
keqiaozhang commentedon Aug 16, 2022
It seems that
volume-basic-test-100.shchanges all PGA* volume to Max.[EDIT]: I will add a function to restore the PGA* volume at end of
volume-basic-test.shplbossart commentedon Aug 18, 2022
@keqiaozhang all PGA volumes should be set to 0dB or 100%. We should do this with a script so that any changes in names or topology are supported. So far I only found this hack but I am sure it can be improved:
keqiaozhang commentedon Aug 29, 2022
I have submitted thesofproject/sof-test#953. Please help to review.
plbossart commentedon Sep 12, 2022
can we close this issue @keqiaozhang ?
keqiaozhang commentedon Sep 13, 2022
This issue is fixed by thesofproject/sof-test#953. Closing this issue.