ASoC: SOF: Pass PCI SSID to machine driver
[linux-2.6-microblaze.git] / sound / soc / sof / sof-audio.c
index 1cbda59..9c2359d 100644 (file)
 #include "sof-of-dev.h"
 #include "ops.h"
 
+static bool is_virtual_widget(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget *widget,
+                             const char *func)
+{
+       switch (widget->id) {
+       case snd_soc_dapm_out_drv:
+       case snd_soc_dapm_output:
+       case snd_soc_dapm_input:
+               dev_dbg(sdev->dev, "%s: %s is a virtual widget\n", func, widget->name);
+               return true;
+       default:
+               return false;
+       }
+}
+
 static void sof_reset_route_setup_status(struct snd_sof_dev *sdev, struct snd_sof_widget *widget)
 {
        const struct sof_ipc_tplg_ops *tplg_ops = sof_ipc_get_ops(sdev, tplg);
@@ -231,23 +245,9 @@ int sof_route_setup(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget *wsourc
        bool route_found = false;
 
        /* ignore routes involving virtual widgets in topology */
-       switch (src_widget->id) {
-       case snd_soc_dapm_out_drv:
-       case snd_soc_dapm_output:
-       case snd_soc_dapm_input:
-               return 0;
-       default:
-               break;
-       }
-
-       switch (sink_widget->id) {
-       case snd_soc_dapm_out_drv:
-       case snd_soc_dapm_output:
-       case snd_soc_dapm_input:
+       if (is_virtual_widget(sdev, src_widget->widget, __func__) ||
+           is_virtual_widget(sdev, sink_widget->widget, __func__))
                return 0;
-       default:
-               break;
-       }
 
        /* find route matching source and sink widgets */
        list_for_each_entry(sroute, &sdev->route_list, list)
@@ -396,6 +396,9 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg
        const struct sof_ipc_tplg_widget_ops *widget_ops;
        struct snd_soc_dapm_path *p;
 
+       if (is_virtual_widget(sdev, widget, __func__))
+               return;
+
        /* skip if the widget is in use or if it is already unprepared */
        if (!swidget || !swidget->prepared || swidget->use_count > 0)
                goto sink_unprepare;
@@ -433,6 +436,9 @@ sof_prepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget
        struct snd_soc_dapm_path *p;
        int ret;
 
+       if (is_virtual_widget(sdev, widget, __func__))
+               return 0;
+
        widget_ops = tplg_ops ? tplg_ops->widget : NULL;
        if (!widget_ops)
                return 0;
@@ -488,6 +494,9 @@ static int sof_free_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dap
        int err;
        int ret = 0;
 
+       if (is_virtual_widget(sdev, widget, __func__))
+               return 0;
+
        if (widget->dobj.private) {
                err = sof_widget_free(sdev, widget->dobj.private);
                if (err < 0)
@@ -527,6 +536,9 @@ static int sof_set_up_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_d
        struct snd_soc_dapm_path *p;
        int ret;
 
+       if (is_virtual_widget(sdev, widget, __func__))
+               return 0;
+
        if (swidget) {
                int i;
 
@@ -592,6 +604,9 @@ sof_walk_widgets_in_order(struct snd_sof_dev *sdev, struct snd_sof_pcm *spcm,
                return 0;
 
        for_each_dapm_widgets(list, i, widget) {
+               if (is_virtual_widget(sdev, widget, __func__))
+                       continue;
+
                /* starting widget for playback is AIF type */
                if (dir == SNDRV_PCM_STREAM_PLAYBACK && widget->id != snd_soc_dapm_aif_in)
                        continue;
@@ -1016,6 +1031,13 @@ int sof_machine_check(struct snd_sof_dev *sdev)
                mach = snd_sof_machine_select(sdev);
                if (mach) {
                        sof_pdata->machine = mach;
+
+                       if (sof_pdata->subsystem_id_set) {
+                               mach->mach_params.subsystem_vendor = sof_pdata->subsystem_vendor;
+                               mach->mach_params.subsystem_device = sof_pdata->subsystem_device;
+                               mach->mach_params.subsystem_id_set = true;
+                       }
+
                        snd_sof_set_mach_params(mach, sdev);
                        return 0;
                }