Commit b30b60a2 authored by Pierre-Louis Bossart's avatar Pierre-Louis Bossart Committed by Mark Brown

ASoC: SOF: Intel: hda: add new flags for DAI_CONFIG

The DAI_CONFIG is used for both hw_params and hw_free. Use flags to
specify what stage the configuration applies to.

the DAI_CONFIG IPC may be sent also during the widget setup so each
flag is cleared after the IPC to restore the state.
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: default avatarBard Liao <bard.liao@intel.com>
Reviewed-by: default avatarGuennadi Liakhovetski <guennadi.liakhovetski@linux.intel.com>
Reviewed-by: default avatarBrent Lu <brent.lu@intel.com>
Link: https://lore.kernel.org/r/20211004171430.103674-4-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent 21c51692
...@@ -71,6 +71,9 @@ int hda_ctrl_dai_widget_setup(struct snd_soc_dapm_widget *w) ...@@ -71,6 +71,9 @@ int hda_ctrl_dai_widget_setup(struct snd_soc_dapm_widget *w)
return ret; return ret;
} }
/* set HW_PARAMS flag */
config->flags = FIELD_PREP(SOF_DAI_CONFIG_FLAGS_MASK, SOF_DAI_CONFIG_FLAGS_HW_PARAMS);
/* send DAI_CONFIG IPC */ /* send DAI_CONFIG IPC */
ret = sof_ipc_tx_message(sdev->ipc, config->hdr.cmd, config, config->hdr.size, ret = sof_ipc_tx_message(sdev->ipc, config->hdr.cmd, config, config->hdr.size,
&reply, sizeof(reply)); &reply, sizeof(reply));
...@@ -107,6 +110,9 @@ int hda_ctrl_dai_widget_free(struct snd_soc_dapm_widget *w) ...@@ -107,6 +110,9 @@ int hda_ctrl_dai_widget_free(struct snd_soc_dapm_widget *w)
config = &sof_dai->dai_config[sof_dai->current_config]; config = &sof_dai->dai_config[sof_dai->current_config];
/* set HW_FREE flag */
config->flags = FIELD_PREP(SOF_DAI_CONFIG_FLAGS_MASK, SOF_DAI_CONFIG_FLAGS_HW_FREE);
ret = sof_ipc_tx_message(sdev->ipc, config->hdr.cmd, config, config->hdr.size, ret = sof_ipc_tx_message(sdev->ipc, config->hdr.cmd, config, config->hdr.size,
&reply, sizeof(reply)); &reply, sizeof(reply));
if (ret < 0) if (ret < 0)
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
// Author: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> // Author: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
// //
#include <linux/bitfield.h>
#include "sof-audio.h" #include "sof-audio.h"
#include "ops.h" #include "ops.h"
...@@ -55,6 +56,9 @@ static int sof_dai_config_setup(struct snd_sof_dev *sdev, struct snd_sof_dai *da ...@@ -55,6 +56,9 @@ static int sof_dai_config_setup(struct snd_sof_dev *sdev, struct snd_sof_dai *da
return -EINVAL; return -EINVAL;
} }
/* set NONE flag to clear all previous settings */
config->flags = FIELD_PREP(SOF_DAI_CONFIG_FLAGS_MASK, SOF_DAI_CONFIG_FLAGS_NONE);
ret = sof_ipc_tx_message(sdev->ipc, config->hdr.cmd, config, config->hdr.size, ret = sof_ipc_tx_message(sdev->ipc, config->hdr.cmd, config, config->hdr.size,
&reply, sizeof(reply)); &reply, sizeof(reply));
......
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