Commit 90ce7538 authored by Bard Liao's avatar Bard Liao Committed by Mark Brown

ASoC: SOF: sof-audio: add is_virtual_widget helper

Testing virtual widget is required in many functions. No function
changed in this commit.
Reviewed-by: default avatarRanjani Sridharan <ranjani.sridharan@linux.intel.com>
Signed-off-by: default avatarBard Liao <yung-chuan.liao@linux.intel.com>
Signed-off-by: default avatarPierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
Link: https://lore.kernel.org/r/20230616100039.378150-2-pierre-louis.bossart@linux.intel.comSigned-off-by: default avatarMark Brown <broonie@kernel.org>
parent fadccca8
...@@ -14,6 +14,20 @@ ...@@ -14,6 +14,20 @@
#include "sof-of-dev.h" #include "sof-of-dev.h"
#include "ops.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) 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); 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 ...@@ -231,23 +245,9 @@ int sof_route_setup(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget *wsourc
bool route_found = false; bool route_found = false;
/* ignore routes involving virtual widgets in topology */ /* ignore routes involving virtual widgets in topology */
switch (src_widget->id) { if (is_virtual_widget(sdev, src_widget->widget, __func__) ||
case snd_soc_dapm_out_drv: is_virtual_widget(sdev, sink_widget->widget, __func__))
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:
return 0; return 0;
default:
break;
}
/* find route matching source and sink widgets */ /* find route matching source and sink widgets */
list_for_each_entry(sroute, &sdev->route_list, list) list_for_each_entry(sroute, &sdev->route_list, list)
......
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