[Sound-open-firmware] [PATCH] Volume, FIR EQ, IIR EQ, tone: Fix SOF_CTRL_CMD_SWITCH polarity
This patch inverts the use of switch value. A non-zero value unmutes the audio path.
Signed-off-by: Seppo Ingalsuo seppo.ingalsuo@linux.intel.com --- src/audio/eq_fir.c | 11 +++++++---- src/audio/eq_iir.c | 9 +++++---- src/audio/tone.c | 9 +++++---- src/audio/volume.c | 6 +++--- 4 files changed, 20 insertions(+), 15 deletions(-)
diff --git a/src/audio/eq_fir.c b/src/audio/eq_fir.c index 9056808..8babed3 100644 --- a/src/audio/eq_fir.c +++ b/src/audio/eq_fir.c @@ -33,6 +33,7 @@ #include <stdint.h> #include <stddef.h> #include <errno.h> +#include <stdbool.h> #include <reef/reef.h> #include <reef/lock.h> #include <reef/list.h> @@ -330,21 +331,23 @@ static int fir_cmd_set_value(struct comp_dev *dev, struct sof_ipc_ctrl_data *cda struct comp_data *cd = comp_get_drvdata(dev); int j; uint32_t ch; + bool val;
if (cdata->cmd == SOF_CTRL_CMD_SWITCH) { trace_eq("mst"); for (j = 0; j < cdata->num_elems; j++) { ch = cdata->chanv[j].channel; + val = cdata->chanv[j].value; tracev_value(ch); - tracev_value(cdata->chanv[j].value); + tracev_value(val); if (ch >= PLATFORM_MAX_CHANNELS) { trace_eq_error("che"); return -EINVAL; } - if (cdata->chanv[j].value > 0) - fir_mute(&cd->fir[ch]); - else + if (val) fir_unmute(&cd->fir[ch]); + else + fir_mute(&cd->fir[ch]); } } else { trace_eq_error("ste"); diff --git a/src/audio/eq_iir.c b/src/audio/eq_iir.c index d3a8fa3..88382fe 100644 --- a/src/audio/eq_iir.c +++ b/src/audio/eq_iir.c @@ -33,6 +33,7 @@ #include <stdint.h> #include <stddef.h> #include <errno.h> +#include <stdbool.h> #include <reef/reef.h> #include <reef/lock.h> #include <reef/list.h> @@ -331,7 +332,7 @@ static int iir_cmd_set_value(struct comp_dev *dev, struct sof_ipc_ctrl_data *cda struct comp_data *cd = comp_get_drvdata(dev); int j; uint32_t ch; - uint32_t val; + bool val;
if (cdata->cmd == SOF_CTRL_CMD_SWITCH) { trace_eq_iir("mst"); @@ -344,10 +345,10 @@ static int iir_cmd_set_value(struct comp_dev *dev, struct sof_ipc_ctrl_data *cda trace_eq_iir_error("che"); return -EINVAL; } - if (val > 0) - iir_mute_df2t(&cd->iir[ch]); - else + if (val) iir_unmute_df2t(&cd->iir[ch]); + else + iir_mute_df2t(&cd->iir[ch]); } } else { trace_eq_iir_error("ste"); diff --git a/src/audio/tone.c b/src/audio/tone.c index d565c17..3eb08e9 100644 --- a/src/audio/tone.c +++ b/src/audio/tone.c @@ -33,6 +33,7 @@ #include <stdint.h> #include <stddef.h> #include <errno.h> +#include <stdbool.h> #include <reef/reef.h> #include <reef/lock.h> #include <reef/list.h> @@ -466,7 +467,7 @@ static int tone_cmd_set_value(struct comp_dev *dev, struct sof_ipc_ctrl_data *cd struct comp_data *cd = comp_get_drvdata(dev); int j; uint32_t ch; - uint32_t val; + bool val;
if (cdata->cmd == SOF_CTRL_CMD_SWITCH) { trace_tone("mst"); @@ -479,10 +480,10 @@ static int tone_cmd_set_value(struct comp_dev *dev, struct sof_ipc_ctrl_data *cd trace_tone_error("che"); return -EINVAL; } - if (val > 0) - tonegen_mute(&cd->sg[ch]); - else + if (val) tonegen_unmute(&cd->sg[ch]); + else + tonegen_mute(&cd->sg[ch]);
} } else { diff --git a/src/audio/volume.c b/src/audio/volume.c index 28d3225..f52ab46 100644 --- a/src/audio/volume.c +++ b/src/audio/volume.c @@ -468,10 +468,10 @@ static int volume_ctrl_set_cmd(struct comp_dev *dev, struct sof_ipc_ctrl_data *c tracev_value(cdata->chanv[j].channel); tracev_value(cdata->chanv[j].value); if (cdata->chanv[j].channel == cd->chan[i]) { - if (cdata->chanv[j].value > 0) - volume_set_chan_mute(dev, i); - else + if (cdata->chanv[j].value) volume_set_chan_unmute(dev, i); + else + volume_set_chan_mute(dev, i); } } }
On Mon, 2017-10-23 at 16:55 +0300, Seppo Ingalsuo wrote:
This patch inverts the use of switch value. A non-zero value unmutes the audio path.
Signed-off-by: Seppo Ingalsuo seppo.ingalsuo@linux.intel.com
src/audio/eq_fir.c | 11 +++++++---- src/audio/eq_iir.c | 9 +++++---- src/audio/tone.c | 9 +++++---- src/audio/volume.c | 6 +++--- 4 files changed, 20 insertions(+), 15 deletions(-)
Applied.
Thanks
Liam
participants (2)
-
Liam Girdwood
-
Seppo Ingalsuo