Commit 0c888bab authored by Bard Liao's avatar Bard Liao Committed by Mark Brown

ASoC: SOF: dont wake dsp up in kcontrol IO

Always get kcontrol value from cache, set kcontrol value to DSP
when DSP is active. Kcontrol values will be restored when DSP boot up.
We will set the default value of kcontrol in sof_complete to make sure
the value is align with firmware.
Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 7df43911
This diff is collapsed.
......@@ -3016,6 +3016,49 @@ static int sof_route_load(struct snd_soc_component *scomp, int index,
return ret;
}
/* Function to set the initial value of SOF kcontrols.
* The value will be stored in scontrol->control_data
*/
static int snd_sof_cache_kcontrol_val(struct snd_sof_dev *sdev)
{
struct snd_sof_control *scontrol = NULL;
int ipc_cmd, ctrl_type;
int ret = 0;
list_for_each_entry(scontrol, &sdev->kcontrol_list, list) {
/* notify DSP of kcontrol values */
switch (scontrol->cmd) {
case SOF_CTRL_CMD_VOLUME:
case SOF_CTRL_CMD_ENUM:
case SOF_CTRL_CMD_SWITCH:
ipc_cmd = SOF_IPC_COMP_GET_VALUE;
ctrl_type = SOF_CTRL_TYPE_VALUE_CHAN_GET;
break;
case SOF_CTRL_CMD_BINARY:
ipc_cmd = SOF_IPC_COMP_GET_DATA;
ctrl_type = SOF_CTRL_TYPE_DATA_GET;
break;
default:
dev_err(sdev->dev,
"error: Invalid scontrol->cmd: %d\n",
scontrol->cmd);
return -EINVAL;
}
ret = snd_sof_ipc_set_get_comp_data(sdev->ipc, scontrol,
ipc_cmd, ctrl_type,
scontrol->cmd,
false);
if (ret < 0) {
dev_warn(sdev->dev,
"error: kcontrol value get for widget: %d\n",
scontrol->comp_id);
}
}
return ret;
}
int snd_sof_complete_pipeline(struct snd_sof_dev *sdev,
struct snd_sof_widget *swidget)
{
......@@ -3059,6 +3102,11 @@ static void sof_complete(struct snd_soc_component *scomp)
break;
}
}
/*
* cache initial values of SOF kcontrols by reading DSP value over
* IPC. It may be overwritten by alsa-mixer after booting up
*/
snd_sof_cache_kcontrol_val(sdev);
}
/* manifest - optional to inform component of manifest */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment