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()
61 /* reset route setup status for all routes that contain this widget */ in sof_widget_free_unlocked()
64 /* free DAI config and continue to free widget even if it fails */ in sof_widget_free_unlocked()
74 dev_err(sdev->dev, "failed to free config for widget %s\n", in sof_widget_free_unlocked()
75 swidget->widget->name); in sof_widget_free_unlocked()
97 i, swidget->widget->name); in sof_widget_free_unlocked()
106 * free the scheduler widget (same as pipe_widget) associated with the current swidget. in sof_widget_free_unlocked()
117 dev_dbg(sdev->dev, "widget %s freed\n", swidget->widget->name); in sof_widget_free_unlocked()
149 /* widget already set up */ in sof_widget_setup_unlocked()
154 * The scheduler widget for a pipeline is not part of the connected DAPM in sof_widget_setup_unlocked()
155 * widget list and it needs to be set up before the widgets in the pipeline in sof_widget_setup_unlocked()
156 * are set up. The use_count for the scheduler widget is incremented for every in sof_widget_setup_unlocked()
157 * widget in a given pipeline to ensure that it is freed only after the last in sof_widget_setup_unlocked()
158 * widget in the pipeline is freed. Skip setting up scheduler widget for static pipelines. in sof_widget_setup_unlocked()
162 dev_err(sdev->dev, "No pipeline set for %s\n", swidget->widget->name); in sof_widget_setup_unlocked()
178 i, swidget->widget->name); in sof_widget_setup_unlocked()
184 /* setup widget in the DSP */ in sof_widget_setup_unlocked()
206 /* restore kcontrols for widget */ in sof_widget_setup_unlocked()
213 dev_dbg(sdev->dev, "widget %s setup complete\n", swidget->widget->name); in sof_widget_setup_unlocked()
218 /* widget use_count will be decremented by sof_widget_free() */ in sof_widget_setup_unlocked()
263 if (is_virtual_widget(sdev, src_widget->widget, __func__) || in sof_route_setup()
264 is_virtual_widget(sdev, sink_widget->widget, __func__)) in sof_route_setup()
299 struct snd_soc_dapm_widget *widget; in sof_setup_pipeline_connections() local
312 for_each_dapm_widgets(list, i, widget) { in sof_setup_pipeline_connections()
313 if (!widget->dobj.private) in sof_setup_pipeline_connections()
316 snd_soc_dapm_widget_for_each_sink_path(widget, p) { in sof_setup_pipeline_connections()
321 ret = sof_route_setup(sdev, widget, p->sink); in sof_setup_pipeline_connections()
328 for_each_dapm_widgets(list, i, widget) { in sof_setup_pipeline_connections()
329 if (!widget->dobj.private) in sof_setup_pipeline_connections()
332 snd_soc_dapm_widget_for_each_source_path(widget, p) { in sof_setup_pipeline_connections()
337 ret = sof_route_setup(sdev, p->source, widget); in sof_setup_pipeline_connections()
346 * The above loop handles connections between widgets that belong to the DAPM widget list. in sof_setup_pipeline_connections()
358 src_widget_in_dapm_list = widget_in_list(list, sroute->src_widget->widget); in sof_setup_pipeline_connections()
359 sink_widget_in_dapm_list = widget_in_list(list, sroute->sink_widget->widget); in sof_setup_pipeline_connections()
370 * At this point either the source widget or the sink widget is in the DAPM list in sof_setup_pipeline_connections()
371 * with a route that might need to be set up. Check the use_count of the widget in sof_setup_pipeline_connections()
388 * this route will get freed when either the source widget or the sink in sof_setup_pipeline_connections()
389 * widget is freed during hw_free in sof_setup_pipeline_connections()
406 sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget *widget, in sof_unprepare_widgets_in_path() argument
410 struct snd_sof_widget *swidget = widget->dobj.private; in sof_unprepare_widgets_in_path()
414 if (is_virtual_widget(sdev, widget, __func__)) in sof_unprepare_widgets_in_path()
417 /* skip if the widget is in use or if it is already unprepared */ in sof_unprepare_widgets_in_path()
421 widget_ops = tplg_ops ? tplg_ops->widget : NULL; in sof_unprepare_widgets_in_path()
422 if (widget_ops && widget_ops[widget->id].ipc_unprepare) in sof_unprepare_widgets_in_path()
423 /* unprepare the source widget */ in sof_unprepare_widgets_in_path()
424 widget_ops[widget->id].ipc_unprepare(swidget); in sof_unprepare_widgets_in_path()
430 snd_soc_dapm_widget_for_each_sink_path(widget, p) { in sof_unprepare_widgets_in_path()
442 sof_prepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget *widget, in sof_prepare_widgets_in_path() argument
449 struct snd_sof_widget *swidget = widget->dobj.private; in sof_prepare_widgets_in_path()
454 if (is_virtual_widget(sdev, widget, __func__)) in sof_prepare_widgets_in_path()
457 widget_ops = tplg_ops ? tplg_ops->widget : NULL; in sof_prepare_widgets_in_path()
461 if (!swidget || !widget_ops[widget->id].ipc_prepare || swidget->prepared) in sof_prepare_widgets_in_path()
464 /* prepare the source widget */ in sof_prepare_widgets_in_path()
465 ret = widget_ops[widget->id].ipc_prepare(swidget, fe_params, platform_params, in sof_prepare_widgets_in_path()
468 dev_err(sdev->dev, "failed to prepare widget %s\n", widget->name); in sof_prepare_widgets_in_path()
476 snd_soc_dapm_widget_for_each_sink_path(widget, p) { in sof_prepare_widgets_in_path()
486 /* unprepare the source widget */ in sof_prepare_widgets_in_path()
487 if (widget_ops[widget->id].ipc_unprepare && in sof_prepare_widgets_in_path()
489 widget_ops[widget->id].ipc_unprepare(swidget); in sof_prepare_widgets_in_path()
501 * free all widgets in the sink path starting from the source widget
504 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
512 if (is_virtual_widget(sdev, widget, __func__)) in sof_free_widgets_in_path()
515 if (widget->dobj.private) { in sof_free_widgets_in_path()
516 err = sof_widget_free(sdev, widget->dobj.private); in sof_free_widgets_in_path()
522 snd_soc_dapm_widget_for_each_sink_path(widget, p) { in sof_free_widgets_in_path()
540 * set up all widgets in the sink path starting from the source widget
544 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
549 struct snd_sof_widget *swidget = widget->dobj.private; in sof_set_up_widgets_in_path()
554 if (is_virtual_widget(sdev, widget, __func__)) in sof_set_up_widgets_in_path()
560 ret = sof_widget_setup(sdev, widget->dobj.private); in sof_set_up_widgets_in_path()
569 * Add the widget's pipe_widget to the list of pipelines to be triggered if not in sof_set_up_widgets_in_path()
586 snd_soc_dapm_widget_for_each_sink_path(widget, p) { in sof_set_up_widgets_in_path()
613 struct snd_soc_dapm_widget *widget; in sof_walk_widgets_in_order() local
621 for_each_dapm_widgets(list, i, widget) { in sof_walk_widgets_in_order()
622 if (is_virtual_widget(sdev, widget, __func__)) in sof_walk_widgets_in_order()
625 /* starting widget for playback is AIF type */ in sof_walk_widgets_in_order()
626 if (dir == SNDRV_PCM_STREAM_PLAYBACK && widget->id != snd_soc_dapm_aif_in) in sof_walk_widgets_in_order()
629 /* starting widget for capture is DAI type */ in sof_walk_widgets_in_order()
630 if (dir == SNDRV_PCM_STREAM_CAPTURE && widget->id != snd_soc_dapm_dai_out) in sof_walk_widgets_in_order()
635 ret = sof_set_up_widgets_in_path(sdev, widget, dir, spcm); in sof_walk_widgets_in_order()
639 ret = sof_free_widgets_in_path(sdev, widget, dir, spcm); in sof_walk_widgets_in_order()
649 * widget is modified by the source widget in the path. Use a local in sof_walk_widgets_in_order()
655 ret = sof_prepare_widgets_in_path(sdev, widget, fe_params, platform_params, in sof_walk_widgets_in_order()
660 sof_unprepare_widgets_in_path(sdev, widget, list); in sof_walk_widgets_in_order()
663 dev_err(sdev->dev, "Invalid widget op %d\n", op); in sof_walk_widgets_in_order()
682 struct snd_soc_dapm_widget *widget; in sof_widget_list_setup() local
691 * instance ID and pick the widget configuration based on the runtime PCM params. in sof_widget_list_setup()
698 /* Set up is used to send the IPC to the DSP to create the widget */ in sof_widget_list_setup()
716 for_each_dapm_widgets(list, i, widget) { in sof_widget_list_setup()
717 struct snd_sof_widget *swidget = widget->dobj.private; in sof_widget_list_setup()
727 swidget->widget->name); in sof_widget_list_setup()
734 dev_err(sdev->dev, "error: no pipeline widget found for %s\n", in sof_widget_list_setup()
735 swidget->widget->name); in sof_widget_list_setup()
772 /* send IPC to free widget in the DSP */ in sof_widget_list_free()
775 /* unprepare the widget */ in sof_widget_list_free()
867 /* free widget list */ in sof_pcm_stream_free()
937 if (strcmp(name, swidget->widget->name) == 0) in snd_sof_find_swidget()
944 /* find widget by stream name and direction */
959 if (!strcmp(pcm_name, swidget->widget->sname) && in snd_sof_find_swidget_sname()