Repository navigation
[CML][HDA] arecord cannot record the 48K rate audio correctly with DMIC16 #836
Copy link
Copy link
Closed
Labels
CMLApplies to Comet Lake platformApplies to Comet Lake platformHDAApplies to HD-Audio bus for codec connectionApplies to HD-Audio bus for codec connectionbugSomething isn't workingSomething isn't working
Description
Summary
arecord can record the sound with following parameters (channel: 2, fmt: s16_le, rate: 48000), and no error occurred during the recording phase.
But when try to playback the record wav with the same parameters, the sound changes to very sharp, likes frequency has changed.
To Reproduce
- arecord -Dhw:0,7 -f s16_le -r 48000 -c 2 test.wav -vv -i
- aplay -Dhw:0,0 -f s16_le -r 48000 -c 2 test.wav
Actual result
Incorrect sound heard.
Test Recipe
Kernel: 2de29fa [thesofproject/linux: topic/sof-dev] +[RanderWang/linux: cml-validation-20190415] d04ccf4 + bfb0729 + 8a2b13a + 63ceb8f + db89510
Firmware: bardliao/sof@00bbb11 + bardliao/sof@5738003
Topology: sof-hda-generic.tplg
sof-logger log
326 0 2 DMA 129574.062500 3.177083 src/drivers/dw/dma.c:408 dw-dma 0 request channel
327 0 2 IPC 129701.354167 127.291664 src/ipc/handler.c:541 ipc: hdr 0x80010000 tx (144) > rx (120)
328 0 2 IPC 129704.791667 3.437500 src/ipc/handler.c:544 ipc: dai 2,1 -> config
329 0 2 DAI 129708.177083 3.385417 src/lib/dai.c:87 dai_get(), d = 0xbe05c794, sref = 2
330 0 2 DMIC 129711.458333 3.281250 rs/intel/cavs/dmic.c:1124 dmic_set_config(), dai->index = 1
331 0 2 DMIC 129717.552083 6.093750 rs/intel/cavs/dmic.c:1195 dmic_set_config(), prm config->dmic.num_pdm_active = 1
332 0 2 DMIC 129720.416667 2.864583 rs/intel/cavs/dmic.c:1197 dmic_set_config(), prm pdmclk_min = 500000, pdmclk_max = 4800000
333 0 2 DMIC 129723.385417 2.968750 rs/intel/cavs/dmic.c:1199 dmic_set_config(), prm duty_min = 40, duty_max = 60
334 0 2 DMIC 129726.250000 2.864583 rs/intel/cavs/dmic.c:1201 dmic_set_config(), prm fifo_fs = 16000, fifo_bits = 16
335 0 2 DMIC 129790.989583 64.739586 rs/intel/cavs/dmic.c:1243 dmic_set_config(), cfg clkdiv = 10, mcic = 25
336 0 2 DMIC 129794.062500 3.072917 rs/intel/cavs/dmic.c:1245 dmic_set_config(), cfg mfir_a = 2, mfir_b = 6
337 0 2 DMIC 129796.875000 2.812500 rs/intel/cavs/dmic.c:1246 dmic_set_config(), cfg cic_shift = 3
338 0 2 DMIC 129799.687500 2.812500 rs/intel/cavs/dmic.c:1248 dmic_set_config(), cfg fir_a_shift = 0, cfg.fir_b_shift = 1
339 0 2 DMIC 129802.656250 2.968750 rs/intel/cavs/dmic.c:1250 dmic_set_config(), cfg fir_a_length = 101, fir_b_length = 249
340 0 2 DMIC 129805.989583 3.333333 rs/intel/cavs/dmic.c:912 configure_registers(), OUTCONTROL0 = 37224448
341 0 2 DMIC 129808.802083 2.812500 rs/intel/cavs/dmic.c:923 configure_registers(), OUTCONTROL1 = 36700160
342 0 2 DMIC 129811.927083 3.125000 rs/intel/cavs/dmic.c:977 configure_registers(), CIC_CONTROL = 65539
343 0 2 DMIC 129814.791667 2.864583 rs/intel/cavs/dmic.c:982 configure_registers(), CIC_CONFIG = 184555520
344 0 2 DMIC 129817.760417 2.968750 rs/intel/cavs/dmic.c:998 configure_registers(), MIC_CONTROL = 2048
345 0 2 DMIC 129820.781250 3.020833 rs/intel/cavs/dmic.c:1009 configure_registers(), FIR_CONTROL_A = 19
346 0 2 DMIC 129823.750000 2.968750 rs/intel/cavs/dmic.c:1015 configure_registers(), FIR_CONFIG_A = 65636
347 0 2 DMIC 129826.562500 2.812500 rs/intel/cavs/dmic.c:1020 configure_registers(), DC_OFFSET_LEFT_A = 0
348 0 2 DMIC 129829.531250 2.968750 rs/intel/cavs/dmic.c:1025 configure_registers(), DC_OFFSET_RIGHT_A = 0
349 0 2 DMIC 129832.447917 2.916667 rs/intel/cavs/dmic.c:1029 configure_registers(), OUT_GAIN_LEFT_A = 0
350 0 2 DMIC 129835.260417 2.812500 rs/intel/cavs/dmic.c:1033 configure_registers(), OUT_GAIN_RIGHT_A = 0
351 0 2 DMIC 129838.229167 2.968750 rs/intel/cavs/dmic.c:1044 configure_registers(), FIR_CONTROL_B = 19
352 0 2 DMIC 129841.093750 2.864583 rs/intel/cavs/dmic.c:1050 configure_registers(), FIR_CONFIG_B = 328184
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
CMLApplies to Comet Lake platformApplies to Comet Lake platformHDAApplies to HD-Audio bus for codec connectionApplies to HD-Audio bus for codec connectionbugSomething isn't workingSomething isn't working
Activity
wenqingfu commentedon Apr 15, 2019
still worth attaching a dmesg log. @stevyan thanks.
stevyan commentedon Apr 16, 2019
Attach the dmesg log as reference.
arecord_dmesg.log
singalsu commentedon Apr 16, 2019
You should try with command
time arecord -Dhw:0,7 -f s16_le -r 48000 -c 2 test.wav -d 10 -vv -iIf time reports something else then the 10 seconds duration for arecord then the used sample rate wasn't what was requested.
Probably the recording happened with 16 kHz since the second DAI is usually configured in topology for 16 kHz rate. Also attaching the recorded test.wav file would be nice in this kind of error reports.
If in the topology the PCM capability is edited from min, max 48000, 48000 into 8000, 96000 you should be able to do a working 16 kHz recording.
Currently the PCM capability is set to min, max 48000, 48000 because there's another issue happening if we allow the 8k-96k or 16k-48k range. Sound servers probe the PCM capability and if the DAI then doesn't capture successfully with some requested rate they report errors. Maybe that error needs another type of fix maybe at DAI component params() call when the capture starts (check the actual sample rate vs. what was configured for DMIC in topology, make the call return -EINVAL in that case).
stevyan commentedon Apr 17, 2019
libinyang commentedon Apr 17, 2019
DMIC only supports 16KHz. It doesn't support 48KHz because of the HW/FW limitation.
libinyang commentedon Apr 20, 2019
This issue can be fixed thesofproject/sof#1271 and bardliao/sof@e8d5622
singalsu commentedon Apr 25, 2019
@libinyang I would like to add that the DMIC driver supports for both DAI most of the usual N*8 kHz 8 - 96 kHz sample rates. Though not all combinations are possible when >1 DAI are created due to HW internal dependencies. But it supports capture only with the rate that was defined in topology for the DAI.
libinyang commentedon Apr 25, 2019
@singalsu I think that the driver has already supported all the sample rates? The limitation comes from the topology.
singalsu commentedon Apr 25, 2019
@libinyang Yep, that's correct.
mengdonglin commentedon May 7, 2019
@libinyang @ClarexZhou Please close this issue if it's fixed.
ClarexZhou commentedon May 7, 2019
Retest on latest CML, behevior is changed: Warning note is shown when trying to use 48khz, and cover to 16khz to record. Recorded file also can be played normally. But the recorded actual time is wrong, 3 times than expected.
ClarexZhou commentedon May 7, 2019
@libinyang , please comment on this.
ClarexZhou commentedon May 7, 2019
Recording time is right when capturing via 16khz.
libinyang commentedon May 7, 2019
So record with 16KHz is OK now. It is the application behavior that record with 48KHz will record 3 times length. So let's close this bug now.