Repository navigation
Volume: Use ramp tokens and define the ramp tokens in all topologies - #1373
Conversation
|
@emilchudzik @zrombel This is the fix for issue #1297. Does the CI test set the volume new() IPC parameters initial_ramp and ramp? The parameter ramp should be set to 0 (SOF_VOLUME_LINEAR) and initial_ramp to e.g. 250 to preserve the current linear ramp slope. If initial_ramp is left to zero the volume jumps directly to new gain value and it could trigger an error in CI testst. |
There was a problem hiding this comment.
Can be done in one trace message.
There was a problem hiding this comment.
Oh, sorry, that's something I was about to remove. But on the other hand it could be useful to preserve and cleanup like you suggest.
There was a problem hiding this comment.
Can be done in one trace message.
There was a problem hiding this comment.
The trace in params() is redundant, they are available in new().
There was a problem hiding this comment.
Adding ABS macro would be useful.
There was a problem hiding this comment.
Can be done in one trace message.
There was a problem hiding this comment.
These are something to remove. I was just checking that the code is sane with these.
There was a problem hiding this comment.
These would be removed, or maybe converted to tracev().
There was a problem hiding this comment.
Can be done in one trace message.
There was a problem hiding this comment.
Also these are not needed. The t_us recompute is just for trace and can be removed also.
There was a problem hiding this comment.
This could be tracev().
|
@singalsu at this point in test we are using ramp=SOF_VOLUME_LINEAR and initial_ramp=0. I tested this PR manually and initial_ramp parameter seems to work correctly. We will set initial_ramp to 250 for current tests and prepare cases to test initial_ramp parameter. I see that at this point only SOF_VOLUME_LINEAR is supported. @singalsu do you plan to implement other ramp shapes in this PR? |
|
@zrombel Good, thanks for adding ramp time into tests! This PR will support only linear ramp. I'll enter an enhancement issue for logaritmic ramp and do it later. It's simple to add but will need exp() function into SOF math library. The zero crossings timed volume updates need more work (replace vol_work) but are possible and feasible also (avoid clicks when adjusting). Those could have another enhancement issue. |
c5b115f to
92ef599
Compare
|
@tlauda I've now addressed your comments. I'm not totally sure why MIN() and MAX() are done like they are now but I followed the example with new ABS() function. I didn't add saturation to ABS. We could have a saturating inline function as well like abs_int32(). This macro is for generic use known not to wrap. |
92ef599 to
b44c7f7
Compare
|
The code is same as in previous PR version. I updated the commit title and improved a bit the commit body text. |
There was a problem hiding this comment.
@singalsu is this comment correct? where is ramp_length_ms in the macro below?
There was a problem hiding this comment.
Yep, need to fix this comment.
There was a problem hiding this comment.
@singalsu for my understanding when will this ever happen? the target volume is limited to VOL_MAX or VOL_MIN. so the delta can ever be maximum of VOL_ZERO_DB isnt it?
There was a problem hiding this comment.
@ranj063 This happens pretty often when volume control is above 0 dB. This step re-calculate is the beef of the slow gain settling fix (while kernel does not provide the used min/max range).
VOL_MAX is +42 dB so the the linear mute->unity gain equal transition is only e.g. 0 dB -> +6 dB jump. Such and much larger volume transitions can be made by pressing keys 0 - 9 in alsamixer ASCII graphics view.
|
does this need corresponding driver change? @singalsu |
@wenqingfu I dont think so. The volume tokens are already parsed by the driver. |
|
@wenqingfu To me this approach appears to work fine without kernel update. I can enter an enhancement issue for Linux to pass the actual min/max range per volume instance so we could have always constant rate ramp. But I feel the priority for enhance is low. FW could be compatible current and such future kernel by checking if min and max from IPC. If both are zeros like today use this slope recalculation to never exceed slope max time. When max > 0 use max - min directly for step calculate. There would be a bit more FW changes anyway if I implement the log ramp. I checked meanwhile that doing fractional log() function is fairly straightforward. It doesn't take many series iterations to compute to less than 0.1 dB error. Currently attempt to set log ramp in topology fails cleanly when instantiating topology. |
This patch adds code to handle volume ramp type and ramp length parameters from topology. The previous hard coded 250 ms ramp related macros are removed. Since the kernel does not (yet) provide the volume min/max into as IPC for new() the code assumes the ramp length is the length of the mute to 0 dB gain transition. If a volume transition is larger than that, what can happen in a high gain configuration, the ramp is shortened to exceed the passed time parameter. So in other words the large transitions will use a variable rate slope. Signed-off-by: Seppo Ingalsuo <[email protected]>
This patch adds volume configuration tokens as fifth parameter for pga.m. All the topologies those use W_PGA() are updated to use a linear (type=0) ramp with length of 250 ms. Signed-off-by: Seppo Ingalsuo <[email protected]>
b44c7f7 to
d57830e
Compare
|
@singalsu does min/max range require an ABI change ? |
|
@lgirdwood There's no need for ABI change, the fields are just zeros now. I think I should implement in FW side the code to utilize the min/max when it will be made available by kernel driver. It's easy to make such test driver version with fixed values to test. For actual kernel work to extract the volume scale I've filed an enhancement issue. |
This PR consists of two commits. The first contains the changes for volume component. The second updates all topologies to define the volume ramp tokens. This approach does not need kernel update.
I removed the [RFC][Do not merge] labels since the code now seems to pass the CI tests.