Skip to content

[CML]Volume changed response delay about 3-5s during DMIC recording #1297

Closed

Description

@ClarexZhou

Describe the bug
Volume changed response delay about 3-5s during DMIC recording

To Reproduce

  1. arecord -Dhw:0,6 -r48000 -c2 -fs16_le a.wav -vv -i
  2. Open another Terminal, alsamixer->F4, quickly change volume between 0-max100 (PGA10.0 for Dhw:0,6 )
  3. check arecord process (recorded db *%) during volume change

Expected behavior
Volume change should become effective quickly

Environment
Kernel repo https://github.com/thesofproject/linux/tree/release/sof-v5.0
Made from:
9086043 [thesofproject/linux: topic/sof-dev]
+575038e

  • 53cfc0d
  • 39d0823
  • 1b65a44
  • 98554b9
  • 1a44fac
  • 6e4d133
  • 2a816f7
  • 569f460
  • f273121
  • 8cbbf45
  • 8de4c6
  • f891831
  • e5ced5b
  • 0ad31d4
  • f5f69bd
  • 5df2c93
  • 8594d32
  • c48713b

Firmware repo https://github.com/RanderWang/sof/tree/cml-linux-20190423
Made from:
0c93261 [thesofproject/sof: master]

  • adf4db3 [RanderWang/sof: cml-linux-20190423]
  • 1c8cbd1 [RanderWang/sof: cml-linux-20190423]

Topology: https://github.com/RanderWang/sof/tree/cml-linux-20190423
file: tools/topology/sof-hda-generic.m4, sof-hda-generic-2ch.tplg

volumeChange_Dmesg.log
volumerChange_logger.log

Activity

  1. added
    bug
    CML
    on Apr 23, 2019
  2. singalsu commented on Apr 23, 2019

    @singalsu
    Collaborator

    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?

  3. self-assigned this
    on Apr 23, 2019
  4. lgirdwood commented on Apr 23, 2019

    @lgirdwood
    Member

    @singalsu IPC supports ramp meta data

    /* volume ramping types */
    enum sof_volume_ramp {
    	SOF_VOLUME_LINEAR	= 0,
    	SOF_VOLUME_LOG,
    	SOF_VOLUME_LINEAR_ZC,
    	SOF_VOLUME_LOG_ZC,
    };
    
    /* generic volume component */
    struct sof_ipc_comp_volume {
    	struct sof_ipc_comp comp;
    	struct sof_ipc_comp_config config;
    	uint32_t channels;
    	uint32_t min_value;
    	uint32_t max_value;
    	uint32_t ramp;		/**< SOF_VOLUME_ */
    	uint32_t initial_ramp;	/**< ramp space in ms */
    } __attribute__((packed));

    So we are probably missing from topology, kernel parsing and FW volume init ?

  5. singalsu commented on Apr 23, 2019

    @singalsu
    Collaborator

    @lgirdwood Yes, those are missing.

  6. emilchudzik commented on Apr 23, 2019

    @emilchudzik
    Contributor

    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:

      min_value=vol.VOL_MIN,
      max_value=vol.VOL_MAX,
      ramp=VolumeRamp.SOF_VOLUME_LINEAR,
      initial_ramp=1
    ...
      vol_lvls = [vol.VOL_MAX, vol.VOL_MAX//4, vol.VOL_MAX//2, int(vol.VOL_MAX*0.75)]
    

    image

    For SSP it works also fine.

  7. singalsu commented on Apr 23, 2019

    @singalsu
    Collaborator

    @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.

  8. zrombel commented on Apr 23, 2019

    @zrombel

    For Python tests we are using VOL_MAX = 65536, and in test that waveform comes from volume sequence is: 65536, 16384, 32768, 49152.

  9. zrombel commented on Apr 23, 2019

    @zrombel

    I've set VOL_MAX to 524288 and volume sequence to [524288, 131072, 262144, 393216] and now ramp has length of about 1,5s.
    image

  10. singalsu commented on Apr 23, 2019

    @singalsu
    Collaborator

    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.

  11. added
    HDA
    on Apr 24, 2019
  12. singalsu commented on Apr 24, 2019

    @singalsu
    Collaborator
  13. keyonjie commented on Apr 24, 2019

    @keyonjie
    Contributor

    @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.

  14. singalsu commented on Apr 24, 2019

    @singalsu
    Collaborator

    @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.

  15. 10 remaining items

  16. singalsu commented on Apr 29, 2019

    @singalsu
    Collaborator

    @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.

  17. singalsu commented on Apr 30, 2019

    @singalsu
    Collaborator

    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).

  18. singalsu commented on May 3, 2019

    @singalsu
    Collaborator

    @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.

  19. lgirdwood commented on May 3, 2019

    @lgirdwood
    Member

    @singalsu tahnsk, any PRs for topology ?

  20. singalsu commented on May 3, 2019

    @singalsu
    Collaborator

    @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.

  21. lgirdwood commented on May 3, 2019

    @lgirdwood
    Member

    @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.

  22. ranj063 commented on May 3, 2019

    @ranj063
    Collaborator

    @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?

  23. singalsu commented on May 3, 2019

    @singalsu
    Collaborator

    @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.

  24. singalsu commented on May 3, 2019

    @singalsu
    Collaborator

    @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.

  25. wenqingfu commented on May 6, 2019

    @wenqingfu

    any PR submitted yet? @singalsu

  26. singalsu commented on May 6, 2019

    @singalsu
    Collaborator

    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.

  27. singalsu commented on May 6, 2019

    @singalsu
    Collaborator

    @wenqingfu I made an early [RFC] PR #1373 to review the volume enhance and start testing. I need to cleanup a bit the code.

  28. singalsu commented on May 10, 2019

    @singalsu
    Collaborator

    Thanks @YvonneYang2 confirming this. The PR is now merged so it was the expected result. We can close this now!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

CMLGLKHDAbug

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions