summaryrefslogtreecommitdiff
path: root/sound/soc/sof/ipc.c
diff options
context:
space:
mode:
authorPeter Ujfalusi <peter.ujfalusi@linux.intel.com>2022-04-05 10:27:08 -0700
committerMark Brown <broonie@kernel.org>2022-04-11 19:18:02 +0100
commite760f102c92c16307abebffd24a31bdb3ccd78ac (patch)
tree57ed16a9d13ed4a9aa47a85e0616c772545e4cc7 /sound/soc/sof/ipc.c
parent50d4d8cf544dfbb9668dce87a21580fedb6e827f (diff)
downloadlinux-next-e760f102c92c16307abebffd24a31bdb3ccd78ac.tar.gz
ASoC: SOF: ipc: Move the ipc_set_get_comp_data() local to ipc3-control
The snd_sof_ipc_set_get_comp_data() only used for kcontrol data update and it is an IPC3 message parsing function. Move it out from the generic ipc.c to ipc3-control.c and rename it to better describe it's function. Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Daniel Baluta <daniel.baluta@nxp.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Link: https://lore.kernel.org/r/20220405172708.122168-16-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.c83
1 files changed, 0 insertions, 83 deletions
diff --git a/sound/soc/sof/ipc.c b/sound/soc/sof/ipc.c
index 45c487ab8b54..6f8ac3fb195f 100644
--- a/sound/soc/sof/ipc.c
+++ b/sound/soc/sof/ipc.c
@@ -137,89 +137,6 @@ void snd_sof_ipc_reply(struct snd_sof_dev *sdev, u32 msg_id)
}
EXPORT_SYMBOL(snd_sof_ipc_reply);
-/*
- * IPC get()/set() for kcontrols.
- */
-int snd_sof_ipc_set_get_comp_data(struct snd_sof_control *scontrol, bool set)
-{
- struct snd_soc_component *scomp = scontrol->scomp;
- struct sof_ipc_ctrl_data *cdata = scontrol->ipc_control_data;
- struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(scomp);
- const struct sof_ipc_ops *iops = sdev->ipc->ops;
- enum sof_ipc_ctrl_type ctrl_type;
- struct snd_sof_widget *swidget;
- bool widget_found = false;
- u32 ipc_cmd, msg_bytes;
-
- list_for_each_entry(swidget, &sdev->widget_list, list) {
- if (swidget->comp_id == scontrol->comp_id) {
- widget_found = true;
- break;
- }
- }
-
- if (!widget_found) {
- dev_err(sdev->dev, "%s: can't find widget with id %d\n", __func__,
- scontrol->comp_id);
- return -EINVAL;
- }
-
- /*
- * Volatile controls should always be part of static pipelines and the widget use_count
- * would always be > 0 in this case. For the others, just return the cached value if the
- * widget is not set up.
- */
- if (!swidget->use_count)
- return 0;
-
- /*
- * Select the IPC cmd and the ctrl_type based on the ctrl_cmd and the
- * direction
- * Note: SOF_CTRL_TYPE_VALUE_COMP_* is not used and supported currently
- * for ctrl_type
- */
- if (cdata->cmd == SOF_CTRL_CMD_BINARY) {
- ipc_cmd = set ? SOF_IPC_COMP_SET_DATA : SOF_IPC_COMP_GET_DATA;
- ctrl_type = set ? SOF_CTRL_TYPE_DATA_SET : SOF_CTRL_TYPE_DATA_GET;
- } else {
- ipc_cmd = set ? SOF_IPC_COMP_SET_VALUE : SOF_IPC_COMP_GET_VALUE;
- ctrl_type = set ? SOF_CTRL_TYPE_VALUE_CHAN_SET : SOF_CTRL_TYPE_VALUE_CHAN_GET;
- }
-
- cdata->rhdr.hdr.cmd = SOF_IPC_GLB_COMP_MSG | ipc_cmd;
- cdata->type = ctrl_type;
- cdata->comp_id = scontrol->comp_id;
- cdata->msg_index = 0;
-
- /* calculate header and data size */
- switch (cdata->type) {
- case SOF_CTRL_TYPE_VALUE_CHAN_GET:
- case SOF_CTRL_TYPE_VALUE_CHAN_SET:
- cdata->num_elems = scontrol->num_channels;
-
- msg_bytes = scontrol->num_channels *
- sizeof(struct sof_ipc_ctrl_value_chan);
- msg_bytes += sizeof(struct sof_ipc_ctrl_data);
- break;
- case SOF_CTRL_TYPE_DATA_GET:
- case SOF_CTRL_TYPE_DATA_SET:
- cdata->num_elems = cdata->data->size;
-
- msg_bytes = cdata->data->size;
- msg_bytes += sizeof(struct sof_ipc_ctrl_data) +
- sizeof(struct sof_abi_hdr);
- break;
- default:
- return -EINVAL;
- }
-
- cdata->rhdr.hdr.size = msg_bytes;
- cdata->elems_remaining = 0;
-
- return iops->set_get_data(sdev, cdata, cdata->rhdr.hdr.size, set);
-}
-EXPORT_SYMBOL(snd_sof_ipc_set_get_comp_data);
-
int snd_sof_ipc_valid(struct snd_sof_dev *sdev)
{
struct sof_ipc_fw_ready *ready = &sdev->fw_ready;