You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[CML]Volume changed response delay about 3-5s during DMIC recording #1297
CMLApplies to Comet Lake platformGLKApplies to Gemini Lake platformHDAApplies to HD-Audio bus for codec connectionbugSomething isn't working as expected
This is because the firmware volume uses a linear ramp that is hardcoded to be 250 ms from mute to 0 dB. Now that capture max is +30 dB (~32 times unity gain - 0 dB) the ramp could take up to 8 seconds.
I did not include modification to volume scale increase PR because this is a separate issue. To fix this there are a number of options
Implement to driver and topology and FW the volume ramp customization, the tokens exist in ASoC. The fix could use log ramp type that's by nature faster or faster linear ramp parameters for high gain volume instances.
In FW as small update move ramp compute to vol_work() launch code to on the fly compute the step size to maintain 250 ms ramp time for any change
@emilchudzik What is your VOL_MAX? If it's 65536 (linear 1.0 gain) the ramp time is the 250 ms as earlier. The slow settling of gain happens when volume is set much higher.
Max volume for Q8.16 is 2^23 - 1 = 8388607 so the ramp can take longer. However that's a very large gain (+42 dB or 128x linear) and practical gains would be always lower and ramp times a bit shorter. Though this is issue is relevant. If a mic would need a high gain e.g. start of captured utterance would be very silent with such slow ramp.
@singalsu maybe we should limit the maximum ramp time to e.g. 250ms, no matter how max volume we target to tune to? It introduce bad user experience that you want to change a volume but you have to wait for 3 seconds until it is done.
@wenqingfu I'll implement PR set to support volume ramp tokens passing to FW volume component. Then we can specify the ramp per volume instance and have similar fast settling for high gain volume instances as we have for current attenuate-only volume instances.
Small update, I will have one day break due to local bank holiday. The driver and topology defines the tokens so I was able to compile a new topology with volume ramp specification. However it looks like in kernel the ramp tokens are not passed to FW so I'll debug the driver next (the FW side changes are known and quite simple).
@lgirdwood@tlauda@wenqingfu I get now the volume ramp parameters passed to DSP. The kernel is as such OK. I just had problems with my m4 macros edits in topology to attach the ramp tokens for volume controllers.
@lgirdwood Yep there will be topology PR. I seem to need to update nearly all topologies due to parameter add for pga.m4. I've updated so far only one topology for testing.
I'm still wondering if I should provide from driver the volume instance specific vol max/min values. Currently I'm working with code that makes every transition ramp take the topology defined time (250 ms). That's a bit slow for very small volume change perhaps.
With max/min information I could make the worst case transition to take the defined time and a smaller transition a fraction of it (constant rate ramp). However retrieving that information within driver can be a bit tricky. I'm not sure about order of things in parsing topology.
@singalsu topology should define ramp for each PGA control. This should be loaded by driver during topology loading and sent to FW. Parsing order doesn't matter as volume is all parsed at once and wont be sent to FW unless all PGA are completely parsed.
@singalsu volume ramp step and type are already included and parsed in the driver. So you could just add the tokens in tpology and everything should be taken care of, right?
@ranj063 Yes, I have that part working already. I messed a day or two with m4 macros but I got it finally. Now the tokens appear correctly to firmware.
I have now a working solution, next cleanup of code and doing the update to rest of topologies (I've updated and tested only sof-apl-dmic-2ch.tplg). I gave up with logarithmic ramp FW code so it will be only linear ramp with topology adjustable ramp length.
Logarithmic ramp and and the other ramp types implementation could be added as FW enhancement issues into Github. The logaritmic update is simple but length estimation is somewhat tricky.
CMLApplies to Comet Lake platformGLKApplies to Gemini Lake platformHDAApplies to HD-Audio bus for codec connectionbugSomething isn't working as expected
Activity
singalsu commentedon Apr 23, 2019
This is because the firmware volume uses a linear ramp that is hardcoded to be 250 ms from mute to 0 dB. Now that capture max is +30 dB (~32 times unity gain - 0 dB) the ramp could take up to 8 seconds.
I did not include modification to volume scale increase PR because this is a separate issue. To fix this there are a number of options
Implement to driver and topology and FW the volume ramp customization, the tokens exist in ASoC. The fix could use log ramp type that's by nature faster or faster linear ramp parameters for high gain volume instances.
In FW as small update move ramp compute to vol_work() launch code to on the fly compute the step size to maintain 250 ms ramp time for any change
@lgirdwood @tlauda @plbossart What would you prefer?
lgirdwood commentedon Apr 23, 2019
@singalsu IPC supports ramp meta data
So we are probably missing from topology, kernel parsing and FW volume init ?
singalsu commentedon Apr 23, 2019
@lgirdwood Yes, those are missing.
emilchudzik commentedon Apr 23, 2019
In our python tests (windows + slim driver) we use ramp meta data and it works good.
Below example for test with changing volume on DMIC:
For SSP it works also fine.
singalsu commentedon Apr 23, 2019
@emilchudzik What is your VOL_MAX? If it's 65536 (linear 1.0 gain) the ramp time is the 250 ms as earlier. The slow settling of gain happens when volume is set much higher.
zrombel commentedon Apr 23, 2019
For Python tests we are using VOL_MAX = 65536, and in test that waveform comes from volume sequence is: 65536, 16384, 32768, 49152.
zrombel commentedon Apr 23, 2019
I've set VOL_MAX to 524288 and volume sequence to [524288, 131072, 262144, 393216] and now ramp has length of about 1,5s.

singalsu commentedon Apr 23, 2019
Max volume for Q8.16 is 2^23 - 1 = 8388607 so the ramp can take longer. However that's a very large gain (+42 dB or 128x linear) and practical gains would be always lower and ramp times a bit shorter. Though this is issue is relevant. If a mic would need a high gain e.g. start of captured utterance would be very silent with such slow ramp.
singalsu commentedon Apr 24, 2019
@kv2019i FYI
keyonjie commentedon Apr 24, 2019
@singalsu maybe we should limit the maximum ramp time to e.g. 250ms, no matter how max volume we target to tune to? It introduce bad user experience that you want to change a volume but you have to wait for 3 seconds until it is done.
singalsu commentedon Apr 24, 2019
@keyonjie Yes that would be a simple and easy to do fix just in FW side. I'd like to get feedback what approach we should take to address this.
10 remaining items
singalsu commentedon Apr 29, 2019
@wenqingfu I'll implement PR set to support volume ramp tokens passing to FW volume component. Then we can specify the ramp per volume instance and have similar fast settling for high gain volume instances as we have for current attenuate-only volume instances.
singalsu commentedon Apr 30, 2019
Small update, I will have one day break due to local bank holiday. The driver and topology defines the tokens so I was able to compile a new topology with volume ramp specification. However it looks like in kernel the ramp tokens are not passed to FW so I'll debug the driver next (the FW side changes are known and quite simple).
singalsu commentedon May 3, 2019
@lgirdwood @tlauda @wenqingfu I get now the volume ramp parameters passed to DSP. The kernel is as such OK. I just had problems with my m4 macros edits in topology to attach the ramp tokens for volume controllers.
Next I will work with FW part.
lgirdwood commentedon May 3, 2019
@singalsu tahnsk, any PRs for topology ?
singalsu commentedon May 3, 2019
@lgirdwood Yep there will be topology PR. I seem to need to update nearly all topologies due to parameter add for pga.m4. I've updated so far only one topology for testing.
I'm still wondering if I should provide from driver the volume instance specific vol max/min values. Currently I'm working with code that makes every transition ramp take the topology defined time (250 ms). That's a bit slow for very small volume change perhaps.
With max/min information I could make the worst case transition to take the defined time and a smaller transition a fraction of it (constant rate ramp). However retrieving that information within driver can be a bit tricky. I'm not sure about order of things in parsing topology.
lgirdwood commentedon May 3, 2019
@singalsu topology should define ramp for each PGA control. This should be loaded by driver during topology loading and sent to FW. Parsing order doesn't matter as volume is all parsed at once and wont be sent to FW unless all PGA are completely parsed.
ranj063 commentedon May 3, 2019
@singalsu volume ramp step and type are already included and parsed in the driver. So you could just add the tokens in tpology and everything should be taken care of, right?
singalsu commentedon May 3, 2019
@lgirdwood OK, then I should be able to get the linear max/min values from TLV volume scale computation.
Edit: More specifically I need the volume scale limits at time of parsing the ramp tokens to avoid creating new IPC for it.
singalsu commentedon May 3, 2019
@ranj063 Yes, I have that part working already. I messed a day or two with m4 macros but I got it finally. Now the tokens appear correctly to firmware.
wenqingfu commentedon May 6, 2019
any PR submitted yet? @singalsu
singalsu commentedon May 6, 2019
I have now a working solution, next cleanup of code and doing the update to rest of topologies (I've updated and tested only sof-apl-dmic-2ch.tplg). I gave up with logarithmic ramp FW code so it will be only linear ramp with topology adjustable ramp length.
Logarithmic ramp and and the other ramp types implementation could be added as FW enhancement issues into Github. The logaritmic update is simple but length estimation is somewhat tricky.
singalsu commentedon May 6, 2019
@wenqingfu I made an early [RFC] PR #1373 to review the volume enhance and start testing. I need to cleanup a bit the code.
YvonneYang2 commentedon May 10, 2019
Test on CML labtop, no obvious volume delay via DMIC capture.
Test enviroment as below:
Rander UCM https://github.com/RanderWang/intel-UCM
Kernel repo:d698c4f
https://github.com/thesofproject/linux/tree/release/sof-v5.0
Firmware repo: 030c81c
https://github.com/thesofproject/sof/commits/master |
Topology: https://github.com/thesofproject/sof/commits/master . Same as above SOF repo
file: tools/topology/sof-hda-generic.m4, sof-hda-generic-2ch.tplg
singalsu commentedon May 10, 2019
Thanks @YvonneYang2 confirming this. The PR is now merged so it was the expected result. We can close this now!