ASoC: SOF: Intel: hda: Remove hda_ctrl_dai_widget_setup/free()
authorRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Tue, 7 Mar 2023 14:04:34 +0000 (16:04 +0200)
committerMark Brown <broonie@kernel.org>
Tue, 7 Mar 2023 17:06:28 +0000 (17:06 +0000)
Remove these functions and reuse hda_dai_config().

Signed-off-by: Ranjani Sridharan <ranjani.sridharan@linux.intel.com>
Reviewed-by: Bard Liao <yung-chuan.liao@linux.intel.com>
Reviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Reviewed-by: Péter Ujfalusi <peter.ujfalusi@linux.intel.com>
Reviewed-by: Rander Wang <rander.wang@intel.com>
Signed-off-by: Peter Ujfalusi <peter.ujfalusi@linux.intel.com>
Link: https://lore.kernel.org/r/20230307140435.2808-14-peter.ujfalusi@linux.intel.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/sof/intel/hda.c
sound/soc/sof/intel/hda.h

index 81c697e..890993b 100644 (file)
 #define EXCEPT_MAX_HDR_SIZE    0x400
 #define HDA_EXT_ROM_STATUS_SIZE 8
 
-int hda_ctrl_dai_widget_setup(struct snd_soc_dapm_widget *w, unsigned int quirk_flags,
-                             struct snd_sof_dai_config_data *data)
-{
-       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);
-       const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg;
-       struct snd_sof_dai *sof_dai = swidget->private;
-       int ret;
-
-       if (!sof_dai) {
-               dev_err(sdev->dev, "%s: No DAI for DAI widget %s\n", __func__, w->name);
-               return -EINVAL;
-       }
-
-       if (tplg_ops->dai_config) {
-               unsigned int flags;
-
-               /* set HW_PARAMS flag along with quirks */
-               flags = SOF_DAI_CONFIG_FLAGS_HW_PARAMS |
-                       quirk_flags << SOF_DAI_CONFIG_FLAGS_QUIRK_SHIFT;
-
-               ret = tplg_ops->dai_config(sdev, swidget, flags, data);
-               if (ret < 0) {
-                       dev_err(sdev->dev, "%s: DAI config failed for widget %s\n", __func__,
-                               w->name);
-                       return ret;
-               }
-       }
-
-       return 0;
-}
-
-int hda_ctrl_dai_widget_free(struct snd_soc_dapm_widget *w, unsigned int quirk_flags,
-                            struct snd_sof_dai_config_data *data)
-{
-       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);
-       const struct sof_ipc_tplg_ops *tplg_ops = sdev->ipc->ops->tplg;
-       struct snd_sof_dai *sof_dai = swidget->private;
-
-       if (!sof_dai) {
-               dev_err(sdev->dev, "%s: No DAI for BE DAI widget %s\n", __func__, w->name);
-               return -EINVAL;
-       }
-
-       if (tplg_ops->dai_config) {
-               unsigned int flags;
-               int ret;
-
-               /* set HW_FREE flag along with any quirks */
-               flags = SOF_DAI_CONFIG_FLAGS_HW_FREE |
-                       quirk_flags << SOF_DAI_CONFIG_FLAGS_QUIRK_SHIFT;
-
-               ret = tplg_ops->dai_config(sdev, swidget, flags, data);
-               if (ret < 0)
-                       dev_err(sdev->dev, "%s: DAI config failed for widget '%s'\n", __func__,
-                               w->name);
-       }
-
-       return 0;
-}
-
 #if IS_ENABLED(CONFIG_SND_SOC_SOF_INTEL_SOUNDWIRE)
 
 /*
@@ -124,30 +60,28 @@ static int sdw_params_stream(struct device *dev,
                             struct sdw_intel_stream_params_data *params_data)
 {
        struct snd_soc_dai *d = params_data->dai;
-       struct snd_sof_dai_config_data data;
-       struct snd_soc_dapm_widget *w;
+       struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget(d, params_data->stream);
+       struct snd_sof_dai_config_data data = { 0 };
 
-       w = snd_soc_dai_get_widget(d, params_data->stream);
        data.dai_index = (params_data->link_id << 8) | d->id;
        data.dai_data = params_data->alh_stream_id;
 
-       return hda_ctrl_dai_widget_setup(w, SOF_DAI_CONFIG_FLAGS_NONE, &data);
+       return hda_dai_config(w, SOF_DAI_CONFIG_FLAGS_HW_PARAMS, &data);
 }
 
 static int sdw_free_stream(struct device *dev,
                           struct sdw_intel_stream_free_data *free_data)
 {
        struct snd_soc_dai *d = free_data->dai;
-       struct snd_sof_dai_config_data data;
-       struct snd_soc_dapm_widget *w;
+       struct snd_soc_dapm_widget *w = snd_soc_dai_get_widget(d, free_data->stream);
+       struct snd_sof_dai_config_data data = { 0 };
 
-       w = snd_soc_dai_get_widget(d, free_data->stream);
        data.dai_index = (free_data->link_id << 8) | d->id;
 
        /* send invalid stream_id */
        data.dai_data = 0xFFFF;
 
-       return hda_ctrl_dai_widget_free(w, SOF_DAI_CONFIG_FLAGS_NONE, &data);
+       return hda_dai_config(w, SOF_DAI_CONFIG_FLAGS_HW_FREE, &data);
 }
 
 struct sdw_intel_ops sdw_callback = {
index 815f73d..2a43bfc 100644 (file)
@@ -896,10 +896,6 @@ int hda_pci_intel_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
 
 struct snd_sof_dai;
 struct sof_ipc_dai_config;
-int hda_ctrl_dai_widget_setup(struct snd_soc_dapm_widget *w, unsigned int quirk_flags,
-                             struct snd_sof_dai_config_data *data);
-int hda_ctrl_dai_widget_free(struct snd_soc_dapm_widget *w, unsigned int quirk_flags,
-                            struct snd_sof_dai_config_data *data);
 
 #define SOF_HDA_POSITION_QUIRK_USE_SKYLAKE_LEGACY      (0) /* previous implementation */
 #define SOF_HDA_POSITION_QUIRK_USE_DPIB_REGISTERS      (1) /* recommended if VC0 only */