Lines Matching full:widget
16 static bool is_virtual_widget(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget *widget, in is_virtual_widget() argument
19 switch (widget->id) { in is_virtual_widget()
23 dev_dbg(sdev->dev, "%s: %s is a virtual widget\n", func, widget->name); in is_virtual_widget()
30 static void sof_reset_route_setup_status(struct snd_sof_dev *sdev, struct snd_sof_widget *widget) in sof_reset_route_setup_status() argument
36 if (sroute->src_widget == widget || sroute->sink_widget == widget) { in sof_reset_route_setup_status()
64 /* reset route setup status for all routes that contain this widget */ in sof_widget_free_unlocked()
67 /* free DAI config and continue to free widget even if it fails */ in sof_widget_free_unlocked()
77 dev_err(sdev->dev, "failed to free config for widget %s\n", in sof_widget_free_unlocked()
78 swidget->widget->name); in sof_widget_free_unlocked()
100 i, swidget->widget->name); in sof_widget_free_unlocked()
109 * free the scheduler widget (same as pipe_widget) associated with the current swidget. in sof_widget_free_unlocked()
119 dev_dbg(sdev->dev, "widget %s freed\n", swidget->widget->name); in sof_widget_free_unlocked()
151 /* widget already set up */ in sof_widget_setup_unlocked()
156 * The scheduler widget for a pipeline is not part of the connected DAPM in sof_widget_setup_unlocked()
157 * widget list and it needs to be set up before the widgets in the pipeline in sof_widget_setup_unlocked()
158 * are set up. The use_count for the scheduler widget is incremented for every in sof_widget_setup_unlocked()
159 * widget in a given pipeline to ensure that it is freed only after the last in sof_widget_setup_unlocked()
160 * widget in the pipeline is freed. Skip setting up scheduler widget for static pipelines. in sof_widget_setup_unlocked()
164 dev_err(sdev->dev, "No pipeline set for %s\n", swidget->widget->name); in sof_widget_setup_unlocked()
180 i, swidget->widget->name); in sof_widget_setup_unlocked()
186 /* setup widget in the DSP */ in sof_widget_setup_unlocked()
208 /* restore kcontrols for widget */ in sof_widget_setup_unlocked()
215 dev_dbg(sdev->dev, "widget %s setup complete\n", swidget->widget->name); in sof_widget_setup_unlocked()
220 /* widget use_count will be decremented by sof_widget_free() */ in sof_widget_setup_unlocked()
265 if (is_virtual_widget(sdev, src_widget->widget, __func__) || in sof_route_setup()
266 is_virtual_widget(sdev, sink_widget->widget, __func__)) in sof_route_setup()
301 struct snd_soc_dapm_widget *widget; in sof_setup_pipeline_connections() local
314 for_each_dapm_widgets(list, i, widget) { in sof_setup_pipeline_connections()
315 if (!widget->dobj.private) in sof_setup_pipeline_connections()
318 snd_soc_dapm_widget_for_each_sink_path(widget, p) { in sof_setup_pipeline_connections()
323 ret = sof_route_setup(sdev, widget, p->sink); in sof_setup_pipeline_connections()
330 for_each_dapm_widgets(list, i, widget) { in sof_setup_pipeline_connections()
331 if (!widget->dobj.private) in sof_setup_pipeline_connections()
334 snd_soc_dapm_widget_for_each_source_path(widget, p) { in sof_setup_pipeline_connections()
339 ret = sof_route_setup(sdev, p->source, widget); in sof_setup_pipeline_connections()
348 * The above loop handles connections between widgets that belong to the DAPM widget list. in sof_setup_pipeline_connections()
360 src_widget_in_dapm_list = widget_in_list(list, sroute->src_widget->widget); in sof_setup_pipeline_connections()
361 sink_widget_in_dapm_list = widget_in_list(list, sroute->sink_widget->widget); in sof_setup_pipeline_connections()
372 * At this point either the source widget or the sink widget is in the DAPM list in sof_setup_pipeline_connections()
373 * with a route that might need to be set up. Check the use_count of the widget in sof_setup_pipeline_connections()
390 * this route will get freed when either the source widget or the sink in sof_setup_pipeline_connections()
391 * widget is freed during hw_free in sof_setup_pipeline_connections()
408 sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget *widget, in sof_unprepare_widgets_in_path() argument
412 struct snd_sof_widget *swidget = widget->dobj.private; in sof_unprepare_widgets_in_path()
416 if (is_virtual_widget(sdev, widget, __func__)) in sof_unprepare_widgets_in_path()
419 /* skip if the widget is in use or if it is already unprepared */ in sof_unprepare_widgets_in_path()
423 widget_ops = tplg_ops ? tplg_ops->widget : NULL; in sof_unprepare_widgets_in_path()
424 if (widget_ops && widget_ops[widget->id].ipc_unprepare) in sof_unprepare_widgets_in_path()
425 /* unprepare the source widget */ in sof_unprepare_widgets_in_path()
426 widget_ops[widget->id].ipc_unprepare(swidget); in sof_unprepare_widgets_in_path()
432 snd_soc_dapm_widget_for_each_sink_path(widget, p) { in sof_unprepare_widgets_in_path()
444 sof_prepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget *widget, in sof_prepare_widgets_in_path() argument
451 struct snd_sof_widget *swidget = widget->dobj.private; in sof_prepare_widgets_in_path()
456 if (is_virtual_widget(sdev, widget, __func__)) in sof_prepare_widgets_in_path()
459 widget_ops = tplg_ops ? tplg_ops->widget : NULL; in sof_prepare_widgets_in_path()
463 if (!swidget || !widget_ops[widget->id].ipc_prepare || swidget->prepared) in sof_prepare_widgets_in_path()
466 /* prepare the source widget */ in sof_prepare_widgets_in_path()
467 ret = widget_ops[widget->id].ipc_prepare(swidget, fe_params, platform_params, in sof_prepare_widgets_in_path()
470 dev_err(sdev->dev, "failed to prepare widget %s\n", widget->name); in sof_prepare_widgets_in_path()
478 snd_soc_dapm_widget_for_each_sink_path(widget, p) { in sof_prepare_widgets_in_path()
488 /* unprepare the source widget */ in sof_prepare_widgets_in_path()
489 if (widget_ops[widget->id].ipc_unprepare && in sof_prepare_widgets_in_path()
491 widget_ops[widget->id].ipc_unprepare(swidget); in sof_prepare_widgets_in_path()
503 * free all widgets in the sink path starting from the source widget
506 static int sof_free_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget *widget, in sof_free_widgets_in_path() argument
514 if (is_virtual_widget(sdev, widget, __func__)) in sof_free_widgets_in_path()
517 if (widget->dobj.private) { in sof_free_widgets_in_path()
518 err = sof_widget_free(sdev, widget->dobj.private); in sof_free_widgets_in_path()
524 snd_soc_dapm_widget_for_each_sink_path(widget, p) { in sof_free_widgets_in_path()
542 * set up all widgets in the sink path starting from the source widget
546 static int sof_set_up_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget *widget, in sof_set_up_widgets_in_path() argument
551 struct snd_sof_widget *swidget = widget->dobj.private; in sof_set_up_widgets_in_path()
556 if (is_virtual_widget(sdev, widget, __func__)) in sof_set_up_widgets_in_path()
562 ret = sof_widget_setup(sdev, widget->dobj.private); in sof_set_up_widgets_in_path()
571 * Add the widget's pipe_widget to the list of pipelines to be triggered if not in sof_set_up_widgets_in_path()
588 snd_soc_dapm_widget_for_each_sink_path(widget, p) { in sof_set_up_widgets_in_path()
615 struct snd_soc_dapm_widget *widget; in sof_walk_widgets_in_order() local
623 for_each_dapm_widgets(list, i, widget) { in sof_walk_widgets_in_order()
624 if (is_virtual_widget(sdev, widget, __func__)) in sof_walk_widgets_in_order()
627 /* starting widget for playback is AIF type */ in sof_walk_widgets_in_order()
628 if (dir == SNDRV_PCM_STREAM_PLAYBACK && widget->id != snd_soc_dapm_aif_in) in sof_walk_widgets_in_order()
631 /* starting widget for capture is DAI type */ in sof_walk_widgets_in_order()
632 if (dir == SNDRV_PCM_STREAM_CAPTURE && widget->id != snd_soc_dapm_dai_out) in sof_walk_widgets_in_order()
637 ret = sof_set_up_widgets_in_path(sdev, widget, dir, spcm); in sof_walk_widgets_in_order()
641 ret = sof_free_widgets_in_path(sdev, widget, dir, spcm); in sof_walk_widgets_in_order()
651 * widget is modified by the source widget in the path. Use a local in sof_walk_widgets_in_order()
657 ret = sof_prepare_widgets_in_path(sdev, widget, fe_params, platform_params, in sof_walk_widgets_in_order()
662 sof_unprepare_widgets_in_path(sdev, widget, list); in sof_walk_widgets_in_order()
665 dev_err(sdev->dev, "Invalid widget op %d\n", op); in sof_walk_widgets_in_order()
684 struct snd_soc_dapm_widget *widget; in sof_widget_list_setup() local
693 * instance ID and pick the widget configuration based on the runtime PCM params. in sof_widget_list_setup()
700 /* Set up is used to send the IPC to the DSP to create the widget */ in sof_widget_list_setup()
718 for_each_dapm_widgets(list, i, widget) { in sof_widget_list_setup()
719 struct snd_sof_widget *swidget = widget->dobj.private; in sof_widget_list_setup()
729 swidget->widget->name); in sof_widget_list_setup()
736 dev_err(sdev->dev, "error: no pipeline widget found for %s\n", in sof_widget_list_setup()
737 swidget->widget->name); in sof_widget_list_setup()
774 /* send IPC to free widget in the DSP */ in sof_widget_list_free()
777 /* unprepare the widget */ in sof_widget_list_free()
860 /* free widget list */ in sof_pcm_stream_free()
926 if (strcmp(name, swidget->widget->name) == 0) in snd_sof_find_swidget()
933 /* find widget by stream name and direction */
948 if (!strcmp(pcm_name, swidget->widget->sname) && in snd_sof_find_swidget_sname()