/* refresh the component data from DSP */
scontrol->comp_data_dirty = false;
- ret = snd_sof_ipc_set_get_comp_data(scontrol,
- SOF_CTRL_TYPE_VALUE_CHAN_GET, false);
+ ret = snd_sof_ipc_set_get_comp_data(scontrol, false);
if (ret < 0) {
dev_err(scomp->dev, "error: failed to get control data: %d\n", ret);
/* Set the flag to re-try next time to get the data */
/* notify DSP of mixer updates */
if (pm_runtime_active(scomp->dev))
- snd_sof_ipc_set_get_comp_data(scontrol,
- SOF_CTRL_TYPE_VALUE_CHAN_SET, true);
+ snd_sof_ipc_set_get_comp_data(scontrol, true);
return change;
}
/* notify DSP of mixer updates */
if (pm_runtime_active(scomp->dev))
- snd_sof_ipc_set_get_comp_data(scontrol,
- SOF_CTRL_TYPE_VALUE_CHAN_SET, true);
+ snd_sof_ipc_set_get_comp_data(scontrol, true);
return change;
}
/* notify DSP of enum updates */
if (pm_runtime_active(scomp->dev))
- snd_sof_ipc_set_get_comp_data(scontrol,
- SOF_CTRL_TYPE_VALUE_CHAN_SET, true);
+ snd_sof_ipc_set_get_comp_data(scontrol, true);
return change;
}
/* notify DSP of byte control updates */
if (pm_runtime_active(scomp->dev))
- snd_sof_ipc_set_get_comp_data(scontrol,
- SOF_CTRL_TYPE_DATA_SET, true);
+ snd_sof_ipc_set_get_comp_data(scontrol, true);
return 0;
}
/* notify DSP of byte control updates */
if (pm_runtime_active(scomp->dev))
- snd_sof_ipc_set_get_comp_data(scontrol,
- SOF_CTRL_TYPE_DATA_SET, true);
+ snd_sof_ipc_set_get_comp_data(scontrol, true);
return 0;
}
cdata->data->magic = SOF_ABI_MAGIC;
cdata->data->abi = SOF_ABI_VERSION;
/* get all the component data from DSP */
- ret = snd_sof_ipc_set_get_comp_data(scontrol, SOF_CTRL_TYPE_DATA_GET, false);
+ ret = snd_sof_ipc_set_get_comp_data(scontrol, false);
if (ret < 0)
goto out;
sparams->src = (u8 *)src->chanv;
sparams->dst = (u8 *)dst->chanv;
break;
- case SOF_CTRL_TYPE_VALUE_COMP_GET:
- case SOF_CTRL_TYPE_VALUE_COMP_SET:
- sparams->src = (u8 *)src->compv;
- sparams->dst = (u8 *)dst->compv;
- break;
case SOF_CTRL_TYPE_DATA_GET:
case SOF_CTRL_TYPE_DATA_SET:
sparams->src = (u8 *)src->data->data;
/*
* IPC get()/set() for kcontrols.
*/
-int snd_sof_ipc_set_get_comp_data(struct snd_sof_control *scontrol,
- enum sof_ipc_ctrl_type ctrl_type, bool set)
+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->control_data;
struct sof_ipc_fw_ready *ready = &sdev->fw_ready;
struct sof_ipc_fw_version *v = &ready->version;
struct sof_ipc_ctrl_data_params sparams;
+ enum sof_ipc_ctrl_type ctrl_type;
struct snd_sof_widget *swidget;
bool widget_found = false;
size_t send_bytes;
return err;
}
- /* Select the IPC cmd based on the ctrl_cmd and the direction */
- if (cdata->cmd == SOF_CTRL_CMD_BINARY)
+ /*
+ * 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;
- else
+ 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;
sparams.hdr_bytes = sizeof(struct sof_ipc_ctrl_data);
sparams.elems = scontrol->num_channels;
break;
- case SOF_CTRL_TYPE_VALUE_COMP_GET:
- case SOF_CTRL_TYPE_VALUE_COMP_SET:
- sparams.msg_bytes = scontrol->num_channels *
- sizeof(struct sof_ipc_ctrl_value_comp);
- sparams.hdr_bytes = sizeof(struct sof_ipc_ctrl_data);
- sparams.elems = scontrol->num_channels;
- break;
case SOF_CTRL_TYPE_DATA_GET:
case SOF_CTRL_TYPE_DATA_SET:
sparams.msg_bytes = cdata->data->size;
static int sof_kcontrol_setup(struct snd_sof_dev *sdev, struct snd_sof_control *scontrol)
{
- enum sof_ipc_ctrl_type ctrl_type;
int ret;
/* reset readback offset for scontrol */
scontrol->readback_offset = 0;
- /* notify DSP of kcontrol values */
- switch (scontrol->control_data->cmd) {
- case SOF_CTRL_CMD_VOLUME:
- case SOF_CTRL_CMD_ENUM:
- case SOF_CTRL_CMD_SWITCH:
- ctrl_type = SOF_CTRL_TYPE_VALUE_CHAN_SET;
- break;
- case SOF_CTRL_CMD_BINARY:
- ctrl_type = SOF_CTRL_TYPE_DATA_SET;
- break;
- default:
- return 0;
- }
-
- ret = snd_sof_ipc_set_get_comp_data(scontrol, ctrl_type, true);
+ ret = snd_sof_ipc_set_get_comp_data(scontrol, true);
if (ret < 0)
dev_err(sdev->dev, "error: failed kcontrol value set for widget: %d\n",
scontrol->comp_id);
/*
* Mixer IPC
*/
-int snd_sof_ipc_set_get_comp_data(struct snd_sof_control *scontrol,
- enum sof_ipc_ctrl_type ctrl_type, bool set);
+int snd_sof_ipc_set_get_comp_data(struct snd_sof_control *scontrol, bool set);
/* DAI link fixup */
int sof_pcm_dai_link_fixup(struct snd_soc_pcm_runtime *rtd, struct snd_pcm_hw_params *params);