Skip to content

Commit ae5f868

Browse files
ranj063lgirdwood
authored andcommitted
ASoC: SOF: restore byte control data after resume
This patch adds support for retreiving byte control data after the DSP comes out of D3. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Seppo Ingalsuo <seppo.ingalsuo@linux.intel.com>
1 parent 64cf3e3 commit ae5f868

1 file changed

Lines changed: 28 additions & 4 deletions

File tree

sound/soc/sof/pm.c

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ static int sof_restore_pipelines(struct snd_sof_dev *sdev)
2929
struct sof_ipc_comp_dai *comp_dai;
3030
struct sof_ipc_hdr *hdr;
3131
struct snd_sof_control *scontrol = NULL;
32+
int ipc_cmd, ctrl_type, sof_abi;
3233
int ret = 0;
3334

3435
/* restore pipeline components */
@@ -129,10 +130,33 @@ static int sof_restore_pipelines(struct snd_sof_dev *sdev)
129130
list_for_each_entry(scontrol, &sdev->kcontrol_list, list) {
130131

131132
/* notify DSP of kcontrol values */
132-
ret = snd_sof_ipc_set_comp_data(sdev->ipc, scontrol,
133-
SOF_IPC_COMP_SET_VALUE,
134-
SOF_CTRL_TYPE_VALUE_CHAN_SET,
135-
scontrol->cmd);
133+
switch (scontrol->cmd) {
134+
case SOF_CTRL_CMD_VOLUME:
135+
ipc_cmd = SOF_IPC_COMP_SET_VALUE;
136+
ctrl_type = SOF_CTRL_TYPE_VALUE_CHAN_SET;
137+
ret = snd_sof_ipc_set_comp_data(sdev->ipc, scontrol,
138+
ipc_cmd, ctrl_type,
139+
scontrol->cmd);
140+
break;
141+
case SOF_CTRL_CMD_BINARY:
142+
143+
/* Check if control data contains valid data.
144+
* SOF_ABI_MAGIC will not match if there is no data.
145+
*/
146+
ipc_cmd = SOF_IPC_COMP_SET_DATA;
147+
ctrl_type = SOF_CTRL_TYPE_DATA_SET;
148+
sof_abi = scontrol->control_data->data->magic;
149+
if (sof_abi == SOF_ABI_MAGIC)
150+
ret = snd_sof_ipc_set_comp_data(sdev->ipc,
151+
scontrol,
152+
ipc_cmd,
153+
ctrl_type,
154+
scontrol->cmd);
155+
break;
156+
157+
default:
158+
break;
159+
}
136160
if (ret < 0) {
137161
dev_err(sdev->dev,
138162
"error: failed kcontrol value set for widget: %d\n",

0 commit comments

Comments
 (0)