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
volume: Set max volume value from IPC for volume module #120
volume: Set max volume value from IPC for volume module #120
Conversation
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.
LGTM, just would like to verify that the kernel/topology actually fill this value. @ranj063 can you look at this?
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.
Please say why in the commit message.
@kakulesza @plbossart @singalsu |
In that case this parameter should not be in the IPC structure?
…On 07/17/2018 05:52 PM, Ranjani Sridharan wrote:
@kakulesza <https://github.com/kakulesza> @plbossart
<https://github.com/plbossart> @singalsu <https://github.com/singalsu>
I think we should leave this MAX_VOLUME in the firmware unchanged.
Seppo added this as an extra level of protection to prevent arithmetic
overflows. The driver is oblivious to the fixed point notation used in
the firmware. So technically a user could set MAX_VOLUME in
topology/kernel that is greater than the max value supported in the
firmware and this will lead to overflows.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#120 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABGIazbYnbO9VZJQmHxq7ktPOPBADHUSks5uHmqpgaJpZM4VTAtX>.
|
@plbossart does it make sense to maybe keep it there in case the ipc->max_volume is < VOL_MAX? |
@ranj063 But do we really want to get rid of the possibility of set other max volume level during module is creating? Maybe better is validation for ipc->max_volume value? |
@kakulesza sure yes, I think that makes sense. We should validate the ipc max value and then set it accordingly. But we should keep in mind that this value might not be set in by topology/driver and might be 0. |
@ranj063 I understand the problem. But whether possibility of setting max value to 0 makes sense? As a result, we get the module which mute all of pipeline. Can treat 0 value as a not set by topology/driver? Then we would not have a validation problem - for 0 FW would set the default value (VOL_MAX). |
@kakulesza , @ranj063 my feeling is that all volumes should default to 0dB gain during init(). |
@lgirdwood In this case I can validate and set min/max volumes in volume_prepare() and set default volumes to 0 in volume_new(). But can I make max_volume assumption that it'll be set to 0 only if topology/driver don't pass this value? |
@kakulesza I'm ok for min/max value setting in prepare(), and 0dB (not 0) in init(). |
@lgirdwood @kakulesza the current VOL_MAX setting in the firmware corresponds to 0dB value which is what is set during init. |
@ranj063 we cannot assume VOL_MAX is 0dB, what about a volume with a max gain of 3dB ? This should be defined in the volume topology (part of TLV table) and it may be something we have to come back too after 1.2 |
It would be better to initialize volume to 0 dB than IPC defined or DSP specific max possible gain. The max gain should be eventually much larger than the current 0 dB. Perhaps define also VOL_ZERO_DB or VOL_UNITY_GAIN macro (whatever preferred) and use it in this initialization code? |
…module Set volume minimum/maximum level from IPC. If IPC max_value = 0 or IPC max_value < min_value then max_volume = VOL_ZERO_DB (default value). Signed-off-by: Kamil Kulesza <kamil.kulesza@linux.intel.com>
15d839f
to
d0f427c
Compare
@singalsu @lgirdwood I added VOL_ZERO_DB macro as init value and set min/max volume values form IPC. Also i placed vol_set_min_max_levels() in new() instead prepare() because I guess that min/max should be a module property (not stream). Additionally, I had added commit message. |
volume: Set max volume value from sof_ipc_comp_volume IPC for volume module
Signed-off-by: Kamil Kulesza kamil.kulesza@linux.intel.com