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: Bard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Bard Liao
2019-06-12 12:01:48 -05:00
committed by Mark Brown
parent 7df43911e9
commit 0c888baba8
2 changed files with 82 additions and 228 deletions

View File

@@ -3016,6 +3016,49 @@ err:
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 */