sof icon indicating copy to clipboard operation
sof copied to clipboard

[BUG] Volume control with different value for channels fails, gain ramp in second channel fails

Open singalsu opened this issue 1 year ago • 5 comments

Describe the bug Non-symmetrical volume controls are not always working correctly. In this case one volume command got ignored.

Also in channel 2 the gain ramp seem to be omitted sometimes. In such case the gain jumps directly to new gain without normal soft transition.

To Reproduce Prepare a script in DUT e.g. ~/bin/test_capture_volume.sh with content

#!/bin/bash

amixer -c0 cset name='DMIC Raw Capture Volume' 45
sleep 1
amixer -c0 cset name='DMIC Raw Capture Volume' 45,40
sleep 1
amixer -c0 cset name='DMIC Raw Capture Volume' 40,45
sleep 1
amixer -c0 cset name='DMIC Raw Capture Volume' 0
sleep 1
amixer -c0 cset name='DMIC Raw Capture Volume' 45,45
sleep 1
amixer -c0 cset name='DMIC Raw Capture Volume' 1,45
sleep 1
amixer -c0 cset name='DMIC Raw Capture Volume' 45,1
sleep 1
amixer -c0 cset name='DMIC Raw Capture Volume' 45
sleep 1

Open three shell windows to DUT. From one window other device play long enough steady sine wave from DUT speaker or other speaker to DUT microphones. E.g. $ aplay -Dhw:0,0 sine.wav

Launch from two shell windows first capture command, and immediately after the gains adjust script.

$ arecord -Dhw:0,6 -f S32_LE -r 48000 -c 2 -d 10 rec.wav
$ test_capture_volume.sh

Steps to reproduce the behavior: (e.g. list commands or actions used to reproduce the bug)

Reproduction Rate 100%

Expected behavior Audio signal envelope should follow follow volume commands and every volume transition should be soft.

Impact Annoyance

Environment

  1. Branch name and commit hash of the 2 repositories: sof (firmware/topology) and linux (kernel driver).
    • Kernel: {SHA} topic/sof-dev 21a82bd3df0a
    • SOF: {SHA} main 8bfb4896c
  2. Name of the topology file
    • Topology: {FILE} sof-hda-generic-2ch.tplg
  3. Name of the platform(s) on which the bug is observed.
    • Platform: {PLATFORM} TGL-H notebook

Screenshots or console output

Here in the highlighed part of the wav file the volume command "amixer -c0 cset name='DMIC Raw Capture Volume' 1,45" failed. Screenshot from 2024-01-30 15-50-06

It can be also seen that the volume ramp is missing from channel 2 just after 8s time in the waveform. gh_volume_fail_issue.wav.gz

singalsu avatar Jan 30 '24 14:01 singalsu

@singalsu is this something you can self assign and fix (maybe via testbench or plugin if ready/faster ?)

lgirdwood avatar Jan 31 '24 15:01 lgirdwood

@singalsu is this something you can self assign and fix (maybe via testbench or plugin if ready/faster ?)

I'll check with @btian1 his findings, if no solution before CNY I can continue.

singalsu avatar Feb 02 '24 08:02 singalsu

@btian1 @singalsu any update ?

lgirdwood avatar Feb 19 '24 14:02 lgirdwood

The issue can be repeated in playback side with a simple control sequence:

amixer cset name='Post Mixer Analog Playback Volume' 45
sleep 1
amixer cset name='Post Mixer Analog Playback Volume' 1,45
sleep 1
amixer cset name='Post Mixer Analog Playback Volume' 45,1
sleep 1
amixer cset name='Post Mixer Analog Playback Volume' 45

Screenshot from 2024-03-14 16-05-55

Seems there's in 2nd channel (#1) some wrong gain in the highlighted area. I'll try debug that with added traces.

singalsu avatar Mar 14 '24 14:03 singalsu

Fix work in progress: https://github.com/thesofproject/sof/pull/8950

singalsu avatar Mar 14 '24 17:03 singalsu

Fixed by #8950.

singalsu avatar Apr 12 '24 17:04 singalsu