summaryrefslogtreecommitdiff
path: root/sound/soc/sof
diff options
context:
space:
mode:
authorBard Liao <yung-chuan.liao@linux.intel.com>2023-06-16 13:00:32 +0300
committerMark Brown <broonie@kernel.org>2023-06-16 14:53:45 +0300
commit90ce7538659aad1c048653c23eadaba9d1648559 (patch)
tree4f7729bccf569073bf231a3f124cb519b3744c64 /sound/soc/sof
parentfadccca8f33959857948e279045a3757b5f21d55 (diff)
downloadlinux-90ce7538659aad1c048653c23eadaba9d1648559.tar.xz
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: Ranjani Sridharan <ranjani.sridharan@linux.intel.com> Signed-off-by: Bard Liao <yung-chuan.liao@linux.intel.com> Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com> Link: https://lore.kernel.org/r/20230616100039.378150-2-pierre-louis.bossart@linux.intel.com Signed-off-by: Mark Brown <broonie@kernel.org>
Diffstat (limited to 'sound/soc/sof')
-rw-r--r--sound/soc/sof/sof-audio.c32
1 files changed, 16 insertions, 16 deletions
diff --git a/sound/soc/sof/sof-audio.c b/sound/soc/sof/sof-audio.c
index 1cbda595c518..c77d07d62517 100644
--- a/sound/soc/sof/sof-audio.c
+++ b/sound/soc/sof/sof-audio.c
@@ -14,6 +14,20 @@
#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)