summaryrefslogtreecommitdiff
path: root/sound/soc/sof/intel/hda-dai.c
diff options
context:
space:
mode:
authorRanjani Sridharan <ranjani.sridharan@linux.intel.com>2022-03-08 19:43:43 +0300
committerMark Brown <broonie@kernel.org>2022-03-09 16:30:09 +0300
commit839e484f9e173309d599e1281eb7221e07f41814 (patch)
tree75e4325fd2b63a147acafffd99465b21d84c75b8 /sound/soc/sof/intel/hda-dai.c
parent5f8333f62fcada65a85aac53c6a39eb6c4f0bb4e (diff)
downloadlinux-839e484f9e173309d599e1281eb7221e07f41814.tar.xz
ASoC: SOF: make struct snd_sof_dai IPC agnostic
Remove the comp_dai and dai_config members of struct snd_sof_dai and replace it with a void *private field. Introduce a new struct sof_dai_private_data that will contain the pointer to these two fields. The topology parser will populate this structure and save it as part of the "private" member in snd_sof_dai. Change all users of these fields to use the private member instead. Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com> Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com> Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20220308164344.577647-18-ranjani.sridharan@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof/intel/hda-dai.c')
-rw-r--r--sound/soc/sof/intel/hda-dai.c27
1 files changed, 21 insertions, 6 deletions
diff --git a/sound/soc/sof/intel/hda-dai.c b/sound/soc/sof/intel/hda-dai.c
index 75063140ed0c..9b78eea8d76b 100644
--- a/sound/soc/sof/intel/hda-dai.c
+++ b/sound/soc/sof/intel/hda-dai.c
@@ -167,6 +167,7 @@ static struct sof_ipc_dai_config *hda_dai_update_config(struct snd_soc_dapm_widg
int channel)
{
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;
@@ -175,12 +176,19 @@ static struct sof_ipc_dai_config *hda_dai_update_config(struct snd_soc_dapm_widg
sof_dai = swidget->private;
- if (!sof_dai || !sof_dai->dai_config) {
- dev_err(swidget->scomp->dev, "error: No config for DAI %s\n", w->name);
+ if (!sof_dai || !sof_dai->private) {
+ dev_err(swidget->scomp->dev, "%s: No private data for DAI %s\n", __func__,
+ w->name);
return NULL;
}
- config = &sof_dai->dai_config[sof_dai->current_config];
+ private = sof_dai->private;
+ if (!private->dai_config) {
+ dev_err(swidget->scomp->dev, "%s: No config for DAI %s\n", __func__, w->name);
+ return NULL;
+ }
+
+ config = &private->dai_config[sof_dai->current_config];
/* update config with stream tag */
config->hda.link_dma_ch = channel;
@@ -294,6 +302,7 @@ static int hda_link_dai_config_pause_push_ipc(struct snd_soc_dapm_widget *w)
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;
@@ -301,12 +310,18 @@ static int hda_link_dai_config_pause_push_ipc(struct snd_soc_dapm_widget *w)
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;
}
- config = &sof_dai->dai_config[sof_dai->current_config];
+ config = &private->dai_config[sof_dai->current_config];
/* set PAUSE command flag */
config->flags = FIELD_PREP(SOF_DAI_CONFIG_FLAGS_CMD_MASK, SOF_DAI_CONFIG_FLAGS_PAUSE);