-
Notifications
You must be signed in to change notification settings - Fork 321
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Audio: Volume: Handle all volume ramp types #8207
Audio: Volume: Handle all volume ramp types #8207
Conversation
@ranj063 @kv2019i Does this change prevent topology to work with IPC4 reference firmware - and does it matter? If that is the case, then we need to also re-order for IPC4 the table sof/src/include/ipc/topology.h Line 151 in 036da2a
For performance reasons we want to enable topology to select also other (lighter) ramp types. |
@@ -151,7 +159,7 @@ Class.Widget."gain" { | |||
uuid "A8:A9:BC:61:D0:18:18:4A:8E:7B:26:39:21:98:04:B7" | |||
no_pm "true" | |||
cpc 10183 | |||
curve_type "fade" | |||
curve_type "windows_fade" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it still default as fade, right? how to make it configurable?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, but it should be another PR (change default to "linear" and have e.g. in nocodec topologies this set into "windows_fade" to keep it tested).
The intention with this patch is to fix wrong IPC sent to firmware.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just heard that windows does not use tplg conf definiton, so I fully agree with Seppo's comments: default set to linear
and left windows fade to nocodec tplg.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR keeps operation unchanged with windows fade as default, just re-arranged the enum values.
I'd like to make a separate PR to change the default type to linear and change nocodec topology to use the windows fade curve.
@singalsu im not sure if this will affect the ref fw. But AFAIK this wouldnt be the first thing that breaks the ref fw. Maybe we should limit to testing just the passthrough pipelines with the ref fw to avoid any issues. |
We could
What should we do? |
23fb338
to
fb4db2b
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, the condition enum def is a problem. Can we have a separate enum for IPC4?
src/include/ipc/topology.h
Outdated
@@ -156,6 +166,7 @@ enum sof_volume_ramp { | |||
SOF_VOLUME_WINDOWS_FADE, | |||
SOF_VOLUME_WINDOWS_NO_FADE, | |||
}; | |||
#endif |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ouch, this is a problem. We have these definitions also in Linux kernel and we can't have #ifdef for IPC version. So if we need separate definitions, we need to use a different name.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kv2019i The kernel treats this as generic u32
There is this header but it's not used. Could we remove it instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kv2019i As other fix approach could duplicate all ramp types to
sof/src/audio/volume/peak_volume.h
Line 44 in b608ec8
enum ipc4_curve_type { |
enum ipc4_peak_volume_param
to enum sof_volume_ramp
. What do you prefer?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@singalsu Can we have separate enums for IPC3 and IPC4 and also remove the unused enum in kernel? I think that would be the cleanest (no ifdefs in headers, no mismatch between definitions between kernel and FW).
fb4db2b
to
655f5c7
Compare
Re-request review from everyone since the patch is now very different. Hopefully like @kv2019i suggested. Since the code now touches a part with known issue I included also fix for code that prevented other than windows fade to work in ipc4 build. |
IPC4_AUDIO_CURVE_TYPE_LINEAR, | ||
IPC4_AUDIO_CURVE_TYPE_LOG, | ||
IPC4_AUDIO_CURVE_TYPE_LINEAR_ZC, | ||
IPC4_AUDIO_CURVE_TYPE_LOG_ZC, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I like this sequence, 0, with windows fade, and then linear.
it brings:
- compatible with windows.
- easy to remove later curve type.
#endif | ||
#if CONFIG_COMP_VOLUME_LINEAR_RAMP | ||
case SOF_VOLUME_LINEAR: | ||
case SOF_VOLUME_LINEAR_ZC: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does LINEAR_ZC also use same ramp?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes both use the linear equation.
cd->initial_ramp = Q_MULTSR_32X32((int64_t)curve_duration, | ||
Q_CONVERT_FLOAT(1.0 / 10000, 31), 0, 31, 0); | ||
if (cd->ramp_type == SOF_VOLUME_WINDOWS_NO_FADE) | ||
cd->initial_ramp = 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'd like to add:
cd->ramp_finished = true;
to fast skip the ramp in process.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, good catch, I'll add it and test it.
Actually the old SOF definition is conflicted with windows usage. This PR makes it aligned with windows enum CurveType
{
AUDIO_CURVE_TYPE_NONE = 0,
AUDIO_CURVE_TYPE_WINDOWS_FADE = 1
}; |
655f5c7
to
8947ed1
Compare
8947ed1
to
92aa144
Compare
@kv2019i did enum get fixed to your approval ? |
"46 successful and 1 failing checks" , rebase and retry with same patch. |
This patch adds to enum ipc4_curve_type in peak_volume.h ramp types for linear and logarithmic with and without zero crossings detect. The conversion function ipc4_curve_type_convert() converts the type into enum sof_volume_ramp for use in volume.c. The set_volume_ipc4() is changed to use the convert function and the restriction to select other than windows fade type also is removed. Signed-off-by: Seppo Ingalsuo <[email protected]>
The windows fade, windows no fade, and linear and handled the switch-case statement change into volume.c. In IPC4 the ramp can be disabled with zero curve duration or with no fade type. The ramp duration convert multiplication can be passed with the no fade type. Signed-off-by: Seppo Ingalsuo <[email protected]>
This patch adds the other SOF volume ramp types linear and logarithmic with and without zero crossings detect mode to gain widget class. The names of fade values are changed to be similar as in enum sof_volume_ramp, since there is a specific curve shape required for Windows OS. Signed-off-by: Seppo Ingalsuo <[email protected]>
92aa144
to
ff098ce
Compare
Unrelated Zephyr build issue. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @singalsu , looks good now!
The first patch adds a conversion from IPC4 to SOF volume ramp types.
The second patch changes further volume to be able to handle the supported ramp types.
The third patch adds to gain.conf the other supported ramp types. The default is kept as windows fade.