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>
This commit is contained in:
Seppo Ingalsuo 2017-10-23 16:55:13 +03:00 committed by Liam Girdwood
parent 2b3f0abd15
commit 41075ebdec
4 changed files with 20 additions and 15 deletions

View File

@ -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");

View File

@ -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");

View File

@ -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 {

View File

@ -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);
}
}
}