summaryrefslogtreecommitdiffstats
path: root/sound/soc/sof/ipc.c
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>2021-12-15 10:03:58 -0800
committerMark Brown <broonie@kernel.org>2021-12-15 22:16:41 +0000
commitd4a06c4334aed1fe76ae2b7aaae6ee8b72f30a8e (patch)
tree814d02686f3a34c37fef07de3420cc07a563c1e5 /sound/soc/sof/ipc.c
parent9d562fdcd52b1bb1a13cd5078ffc06dd3eff3aef (diff)
downloadlinux-stable-d4a06c4334aed1fe76ae2b7aaae6ee8b72f30a8e.tar.gz
linux-stable-d4a06c4334aed1fe76ae2b7aaae6ee8b72f30a8e.tar.bz2
linux-stable-d4a06c4334aed1fe76ae2b7aaae6ee8b72f30a8e.zip
ASoC: SOF: Drop ipc_cmd parameter for snd_sof_ipc_set_get_comp_data()
The correct ipc_cmd can be selected based on the `ctrl_cmd` and the `set` parameters: if the ctrl_cmd is SOF_CTRL_CMD_BINARY then SOF_IPC_COMP_*_DATA otherwise SOF_IPC_COMP_*_VALUE. The SET or GET direction can be selected with the use of `set` parameter. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Kai Vehmanen <kai.vehmanen@linux.intel.com> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20211215180404.53254-3-ranjani.sridharan@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/ipc.c')
-rw-r--r--sound/soc/sof/ipc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c
index 670d780241a3..bcfe7edee05e 100644
--- a/sound/soc/sof/ipc.c
+++ b/sound/soc/sof/ipc.c
@@ -817,7 +817,6 @@ static int sof_set_get_large_ctrl_data(struct snd_sof_dev *sdev,
* IPC get()/set() for kcontrols.
*/
int snd_sof_ipc_set_get_comp_data(struct snd_sof_control *scontrol,
- u32 ipc_cmd,
enum sof_ipc_ctrl_type ctrl_type,
enum sof_ipc_ctrl_cmd ctrl_cmd, bool set)
{
@@ -830,6 +829,7 @@ int snd_sof_ipc_set_get_comp_data(struct snd_sof_control *scontrol,
struct snd_sof_widget *swidget;
bool widget_found = false;
size_t send_bytes;
+ u32 ipc_cmd;
int err;
list_for_each_entry(swidget, &sdev->widget_list, list) {
@@ -873,6 +873,12 @@ int snd_sof_ipc_set_get_comp_data(struct snd_sof_control *scontrol,
return err;
}
+ /* Select the IPC cmd based on the ctrl_cmd and the direction */
+ if (ctrl_cmd == SOF_CTRL_CMD_BINARY)
+ ipc_cmd = set ? SOF_IPC_COMP_SET_DATA : SOF_IPC_COMP_GET_DATA;
+ else
+ ipc_cmd = set ? SOF_IPC_COMP_SET_VALUE : SOF_IPC_COMP_GET_VALUE;
+
cdata->rhdr.hdr.cmd = SOF_IPC_GLB_COMP_MSG | ipc_cmd;
cdata->cmd = ctrl_cmd;
cdata->type = ctrl_type;