diff --git a/sound/soc/sof/pm.c b/sound/soc/sof/pm.c index 0ebc3fc8cd9d6a..8bef8d67ca991c 100644 --- a/sound/soc/sof/pm.c +++ b/sound/soc/sof/pm.c @@ -29,6 +29,7 @@ static int sof_restore_pipelines(struct snd_sof_dev *sdev) struct sof_ipc_comp_dai *comp_dai; struct sof_ipc_hdr *hdr; struct snd_sof_control *scontrol = NULL; + int ipc_cmd, ctrl_type, sof_abi; int ret = 0; /* restore pipeline components */ @@ -129,10 +130,33 @@ static int sof_restore_pipelines(struct snd_sof_dev *sdev) list_for_each_entry(scontrol, &sdev->kcontrol_list, list) { /* notify DSP of kcontrol values */ - ret = snd_sof_ipc_set_comp_data(sdev->ipc, scontrol, - SOF_IPC_COMP_SET_VALUE, - SOF_CTRL_TYPE_VALUE_CHAN_SET, - scontrol->cmd); + switch (scontrol->cmd) { + case SOF_CTRL_CMD_VOLUME: + ipc_cmd = SOF_IPC_COMP_SET_VALUE; + ctrl_type = SOF_CTRL_TYPE_VALUE_CHAN_SET; + ret = snd_sof_ipc_set_comp_data(sdev->ipc, scontrol, + ipc_cmd, ctrl_type, + scontrol->cmd); + break; + case SOF_CTRL_CMD_BINARY: + + /* Check if control data contains valid data. + * SOF_ABI_MAGIC will not match if there is no data. + */ + ipc_cmd = SOF_IPC_COMP_SET_DATA; + ctrl_type = SOF_CTRL_TYPE_DATA_SET; + sof_abi = scontrol->control_data->data->magic; + if (sof_abi == SOF_ABI_MAGIC) + ret = snd_sof_ipc_set_comp_data(sdev->ipc, + scontrol, + ipc_cmd, + ctrl_type, + scontrol->cmd); + break; + + default: + break; + } if (ret < 0) { dev_err(sdev->dev, "error: failed kcontrol value set for widget: %d\n",