From 1f907f00927174943bf2fe84d9c56ebe308df3c0 Mon Sep 17 00:00:00 2001 From: Seppo Ingalsuo Date: Fri, 10 Jan 2020 13:27:36 +0200 Subject: [PATCH] Volume: Avoid unnecessary error trace about limiting to VOL_MIN The trace issue is only cosmetic since VOL_MIN is currently defined to zero. There linear gain value was not altered despite the emitted trace. With this change the limiting no more happens for input value zero. The related trace messages are improved to show the defined limits for easier adjust the offending topology volume scale if this happens. The string split style is also updated to current. Signed-off-by: Seppo Ingalsuo --- src/audio/volume/volume.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/audio/volume/volume.c b/src/audio/volume/volume.c index 6a2dbcfcfd01..080c4a3a9ae1 100644 --- a/src/audio/volume/volume.c +++ b/src/audio/volume/volume.c @@ -276,7 +276,7 @@ static int volume_params(struct comp_dev *dev, * \param[in] chan Channel number. * \param[in] vol Target volume. */ -static inline int volume_set_chan(struct comp_dev *dev, int chan, uint32_t vol) +static inline int volume_set_chan(struct comp_dev *dev, int chan, int32_t vol) { struct comp_data *cd = comp_get_drvdata(dev); struct sof_ipc_comp_volume *pga = @@ -292,17 +292,17 @@ static inline int volume_set_chan(struct comp_dev *dev, int chan, uint32_t vol) * multiplication overflow with the 32 bit value. Non-zero MIN option * can be useful to prevent totally muted small volume gain. */ - if (v <= VOL_MIN) { + if (v < VOL_MIN) { /* No need to fail, just trace the event. */ - trace_volume_error_with_ids(dev, "volume_set_chan: Limited " - "request %d to VOL_MIN.", v); + trace_volume_error_with_ids(dev, "volume_set_chan: Limited request %d" + " to min. %d", v, VOL_MIN); v = VOL_MIN; } if (v > VOL_MAX) { /* No need to fail, just trace the event. */ - trace_volume_error_with_ids(dev, "volume_set_chan: Limited " - "request %d to VOL_MAX.", v); + trace_volume_error_with_ids(dev, "volume_set_chan: Limited request %d" + " to max. %d", v, VOL_MAX); v = VOL_MAX; }