summaryrefslogtreecommitdiffstats
path: root/sound/soc/sof/intel/hda.c
diff options
context:
space:
mode:
authorMark Brown <broonie@kernel.org>2022-03-10 12:33:40 +0100
committerMark Brown <broonie@kernel.org>2022-03-10 12:33:40 +0100
commit233d2c4a103ac1ce83025029a83d5840b3d2b046 (patch)
tree4291d6fce1acc7d6f97efb9c1a67aaa3a00710a1 /sound/soc/sof/intel/hda.c
parentALSA/ASoC/SOF/Intel: improve support for ES8336-based platforms (diff)
parentASoC: SOF: move definition of snd_sof_ipc to header file (diff)
downloadlinux-233d2c4a103ac1ce83025029a83d5840b3d2b046.tar.xz
linux-233d2c4a103ac1ce83025029a83d5840b3d2b046.zip
Clean ups and preparation for IPC abstraction in the SOF driver
Merge series from Ranjani Sridharan <ranjani.sridharan@linux.intel.com>: In preparation for adding support for the new IPC version that has been introduced in the SOF firmware, this patch set includes some clean ups and necessary modifications to commonly used functions that will be re-used across different IPC-specific code.
Diffstat (limited to 'sound/soc/sof/intel/hda.c')
-rw-r--r--sound/soc/sof/intel/hda.c39
1 files changed, 30 insertions, 9 deletions
diff --git a/sound/soc/sof/intel/hda.c b/sound/soc/sof/intel/hda.c
index 07d8686632a5..7403b9848a56 100644
--- a/sound/soc/sof/intel/hda.c
+++ b/sound/soc/sof/intel/hda.c
@@ -47,14 +47,21 @@ int hda_ctrl_dai_widget_setup(struct snd_soc_dapm_widget *w, unsigned int quirk_
struct snd_soc_component *component = swidget->scomp;
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component);
struct sof_ipc_dai_config *config;
+ struct sof_dai_private_data *private;
struct snd_sof_dai *sof_dai;
struct sof_ipc_reply reply;
int ret;
sof_dai = swidget->private;
- if (!sof_dai || !sof_dai->dai_config) {
- dev_err(sdev->dev, "No config for DAI %s\n", w->name);
+ if (!sof_dai || !sof_dai->private) {
+ dev_err(sdev->dev, "%s: No private data for DAI %s\n", __func__, w->name);
+ return -EINVAL;
+ }
+
+ private = sof_dai->private;
+ if (!private->dai_config) {
+ dev_err(sdev->dev, "%s: No config for DAI %s\n", __func__, w->name);
return -EINVAL;
}
@@ -65,7 +72,7 @@ int hda_ctrl_dai_widget_setup(struct snd_soc_dapm_widget *w, unsigned int quirk_
return ret;
}
- config = &sof_dai->dai_config[sof_dai->current_config];
+ config = &private->dai_config[sof_dai->current_config];
/*
* For static pipelines, the DAI widget would already be set up and calling
@@ -101,6 +108,7 @@ int hda_ctrl_dai_widget_free(struct snd_soc_dapm_widget *w, unsigned int quirk_f
struct snd_sof_widget *swidget = w->dobj.private;
struct snd_soc_component *component = swidget->scomp;
struct snd_sof_dev *sdev = snd_soc_component_get_drvdata(component);
+ struct sof_dai_private_data *private;
struct sof_ipc_dai_config *config;
struct snd_sof_dai *sof_dai;
struct sof_ipc_reply reply;
@@ -108,8 +116,14 @@ int hda_ctrl_dai_widget_free(struct snd_soc_dapm_widget *w, unsigned int quirk_f
sof_dai = swidget->private;
- if (!sof_dai || !sof_dai->dai_config) {
- dev_err(sdev->dev, "error: No config to free DAI %s\n", w->name);
+ if (!sof_dai || !sof_dai->private) {
+ dev_err(sdev->dev, "%s: No private data for DAI %s\n", __func__, w->name);
+ return -EINVAL;
+ }
+
+ private = sof_dai->private;
+ if (!private->dai_config) {
+ dev_err(sdev->dev, "%s: No config for DAI %s\n", __func__, w->name);
return -EINVAL;
}
@@ -117,7 +131,7 @@ int hda_ctrl_dai_widget_free(struct snd_soc_dapm_widget *w, unsigned int quirk_f
if (!sof_dai->configured)
return 0;
- config = &sof_dai->dai_config[sof_dai->current_config];
+ config = &private->dai_config[sof_dai->current_config];
/* set HW_FREE flag along with any quirks */
config->flags = SOF_DAI_CONFIG_FLAGS_HW_FREE |
@@ -154,6 +168,7 @@ static int sdw_dai_config_ipc(struct snd_sof_dev *sdev,
int link_id, int alh_stream_id, int dai_id, bool setup)
{
struct snd_sof_widget *swidget = w->dobj.private;
+ struct sof_dai_private_data *private;
struct sof_ipc_dai_config *config;
struct snd_sof_dai *sof_dai;
@@ -164,12 +179,18 @@ static int sdw_dai_config_ipc(struct snd_sof_dev *sdev,
sof_dai = swidget->private;
- if (!sof_dai || !sof_dai->dai_config) {
- dev_err(sdev->dev, "error: No config for DAI %s\n", w->name);
+ if (!sof_dai || !sof_dai->private) {
+ dev_err(sdev->dev, "%s: No private data for DAI %s\n", __func__, w->name);
+ return -EINVAL;
+ }
+
+ private = sof_dai->private;
+ if (!private->dai_config) {
+ dev_err(sdev->dev, "%s: No config for DAI %s\n", __func__, w->name);
return -EINVAL;
}
- config = &sof_dai->dai_config[sof_dai->current_config];
+ config = &private->dai_config[sof_dai->current_config];
/* update config with link and stream ID */
config->dai_index = (link_id << 8) | dai_id;