File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 4848#include <sof/work.h>
4949#include <sof/clock.h>
5050#include "volume.h"
51-
51+ #include <sof/math/numbers.h>
5252/**
5353 * \brief Synchronize host mmap() volume with real value.
5454 * \param[in,out] cd Volume component private data.
@@ -192,15 +192,16 @@ static struct comp_dev *volume_new(struct sof_ipc_comp *comp)
192192 comp_set_drvdata (dev , cd );
193193 work_init (& cd -> volwork , vol_work , dev , WORK_ASYNC );
194194
195+ /* set volume min/max levels */
196+ vol_set_min_max_levels (cd , ipc_vol -> min_value , ipc_vol -> max_value );
197+
195198 /* set the default volumes */
196199 for (i = 0 ; i < PLATFORM_MAX_CHANNELS ; i ++ ) {
197- cd -> volume [i ] = VOL_ZERO_DB ;
198- cd -> tvolume [i ] = VOL_ZERO_DB ;
200+ cd -> volume [i ] = MAX (MIN (cd -> max_volume ,
201+ VOL_ZERO_DB ), cd -> min_volume );
202+ cd -> tvolume [i ] = cd -> volume [i ];
199203 }
200204
201- /* set volume min/max levels */
202- vol_set_min_max_levels (cd , ipc_vol -> min_value , ipc_vol -> max_value );
203-
204205 dev -> state = COMP_STATE_READY ;
205206 return dev ;
206207}
You can’t perform that action at this time.
0 commit comments