Lines Matching full:widget
17 static bool is_virtual_widget(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget *widget, in is_virtual_widget() argument
20 switch (widget->id) { in is_virtual_widget()
24 dev_dbg(sdev->dev, "%s: %s is a virtual widget\n", func, widget->name); in is_virtual_widget()
31 static void sof_reset_route_setup_status(struct snd_sof_dev *sdev, struct snd_sof_widget *widget) in sof_reset_route_setup_status() argument
37 if (sroute->src_widget == widget || sroute->sink_widget == widget) { in sof_reset_route_setup_status()
65 /* reset route setup status for all routes that contain this widget */ in sof_widget_free_unlocked()
68 /* free DAI config and continue to free widget even if it fails */ in sof_widget_free_unlocked()
78 dev_err(sdev->dev, "failed to free config for widget %s\n", in sof_widget_free_unlocked()
79 swidget->widget->name); in sof_widget_free_unlocked()
101 i, swidget->widget->name); in sof_widget_free_unlocked()
110 * free the scheduler widget (same as pipe_widget) associated with the current swidget. in sof_widget_free_unlocked()
120 dev_dbg(sdev->dev, "widget %s freed\n", swidget->widget->name); in sof_widget_free_unlocked()
152 /* widget already set up */ in sof_widget_setup_unlocked()
157 * The scheduler widget for a pipeline is not part of the connected DAPM in sof_widget_setup_unlocked()
158 * widget list and it needs to be set up before the widgets in the pipeline in sof_widget_setup_unlocked()
159 * are set up. The use_count for the scheduler widget is incremented for every in sof_widget_setup_unlocked()
160 * widget in a given pipeline to ensure that it is freed only after the last in sof_widget_setup_unlocked()
161 * widget in the pipeline is freed. Skip setting up scheduler widget for static pipelines. in sof_widget_setup_unlocked()
165 dev_err(sdev->dev, "No pipeline set for %s\n", swidget->widget->name); in sof_widget_setup_unlocked()
181 i, swidget->widget->name); in sof_widget_setup_unlocked()
187 /* setup widget in the DSP */ in sof_widget_setup_unlocked()
209 /* restore kcontrols for widget */ in sof_widget_setup_unlocked()
216 dev_dbg(sdev->dev, "widget %s setup complete\n", swidget->widget->name); in sof_widget_setup_unlocked()
221 /* widget use_count will be decremented by sof_widget_free() */ in sof_widget_setup_unlocked()
266 if (is_virtual_widget(sdev, src_widget->widget, __func__) || in sof_route_setup()
267 is_virtual_widget(sdev, sink_widget->widget, __func__)) in sof_route_setup()
302 struct snd_soc_dapm_widget *widget; in sof_setup_pipeline_connections() local
315 for_each_dapm_widgets(list, i, widget) { in sof_setup_pipeline_connections()
316 if (!widget->dobj.private) in sof_setup_pipeline_connections()
319 snd_soc_dapm_widget_for_each_sink_path(widget, p) { in sof_setup_pipeline_connections()
324 ret = sof_route_setup(sdev, widget, p->sink); in sof_setup_pipeline_connections()
331 for_each_dapm_widgets(list, i, widget) { in sof_setup_pipeline_connections()
332 if (!widget->dobj.private) in sof_setup_pipeline_connections()
335 snd_soc_dapm_widget_for_each_source_path(widget, p) { in sof_setup_pipeline_connections()
340 ret = sof_route_setup(sdev, p->source, widget); in sof_setup_pipeline_connections()
349 * The above loop handles connections between widgets that belong to the DAPM widget list. in sof_setup_pipeline_connections()
361 src_widget_in_dapm_list = widget_in_list(list, sroute->src_widget->widget); in sof_setup_pipeline_connections()
362 sink_widget_in_dapm_list = widget_in_list(list, sroute->sink_widget->widget); in sof_setup_pipeline_connections()
373 * At this point either the source widget or the sink widget is in the DAPM list in sof_setup_pipeline_connections()
374 * with a route that might need to be set up. Check the use_count of the widget in sof_setup_pipeline_connections()
391 * this route will get freed when either the source widget or the sink in sof_setup_pipeline_connections()
392 * widget is freed during hw_free in sof_setup_pipeline_connections()
409 sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget *widget, in sof_unprepare_widgets_in_path() argument
413 struct snd_sof_widget *swidget = widget->dobj.private; in sof_unprepare_widgets_in_path()
417 if (is_virtual_widget(sdev, widget, __func__)) in sof_unprepare_widgets_in_path()
420 /* skip if the widget is in use or if it is already unprepared */ in sof_unprepare_widgets_in_path()
424 widget_ops = tplg_ops ? tplg_ops->widget : NULL; in sof_unprepare_widgets_in_path()
425 if (widget_ops && widget_ops[widget->id].ipc_unprepare) in sof_unprepare_widgets_in_path()
426 /* unprepare the source widget */ in sof_unprepare_widgets_in_path()
427 widget_ops[widget->id].ipc_unprepare(swidget); in sof_unprepare_widgets_in_path()
433 snd_soc_dapm_widget_for_each_sink_path(widget, p) { in sof_unprepare_widgets_in_path()
445 sof_prepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget *widget, in sof_prepare_widgets_in_path() argument
452 struct snd_sof_widget *swidget = widget->dobj.private; in sof_prepare_widgets_in_path()
457 if (is_virtual_widget(sdev, widget, __func__)) in sof_prepare_widgets_in_path()
460 widget_ops = tplg_ops ? tplg_ops->widget : NULL; in sof_prepare_widgets_in_path()
464 if (!swidget || !widget_ops[widget->id].ipc_prepare || swidget->prepared) in sof_prepare_widgets_in_path()
467 /* prepare the source widget */ in sof_prepare_widgets_in_path()
468 ret = widget_ops[widget->id].ipc_prepare(swidget, fe_params, platform_params, in sof_prepare_widgets_in_path()
471 dev_err(sdev->dev, "failed to prepare widget %s\n", widget->name); in sof_prepare_widgets_in_path()
479 snd_soc_dapm_widget_for_each_sink_path(widget, p) { in sof_prepare_widgets_in_path()
489 /* unprepare the source widget */ in sof_prepare_widgets_in_path()
490 if (widget_ops[widget->id].ipc_unprepare && in sof_prepare_widgets_in_path()
492 widget_ops[widget->id].ipc_unprepare(swidget); in sof_prepare_widgets_in_path()
504 * free all widgets in the sink path starting from the source widget
507 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
515 if (is_virtual_widget(sdev, widget, __func__)) in sof_free_widgets_in_path()
518 if (widget->dobj.private) { in sof_free_widgets_in_path()
519 err = sof_widget_free(sdev, widget->dobj.private); in sof_free_widgets_in_path()
525 snd_soc_dapm_widget_for_each_sink_path(widget, p) { in sof_free_widgets_in_path()
543 * set up all widgets in the sink path starting from the source widget
547 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
552 struct snd_sof_widget *swidget = widget->dobj.private; in sof_set_up_widgets_in_path()
557 if (is_virtual_widget(sdev, widget, __func__)) in sof_set_up_widgets_in_path()
563 ret = sof_widget_setup(sdev, widget->dobj.private); in sof_set_up_widgets_in_path()
572 * Add the widget's pipe_widget to the list of pipelines to be triggered if not in sof_set_up_widgets_in_path()
589 snd_soc_dapm_widget_for_each_sink_path(widget, p) { in sof_set_up_widgets_in_path()
616 struct snd_soc_dapm_widget *widget; in sof_walk_widgets_in_order() local
624 for_each_dapm_widgets(list, i, widget) { in sof_walk_widgets_in_order()
625 if (is_virtual_widget(sdev, widget, __func__)) in sof_walk_widgets_in_order()
628 /* starting widget for playback is AIF type */ in sof_walk_widgets_in_order()
629 if (dir == SNDRV_PCM_STREAM_PLAYBACK && widget->id != snd_soc_dapm_aif_in) in sof_walk_widgets_in_order()
632 /* starting widget for capture is DAI type */ in sof_walk_widgets_in_order()
633 if (dir == SNDRV_PCM_STREAM_CAPTURE && widget->id != snd_soc_dapm_dai_out) in sof_walk_widgets_in_order()
638 ret = sof_set_up_widgets_in_path(sdev, widget, dir, spcm); in sof_walk_widgets_in_order()
642 ret = sof_free_widgets_in_path(sdev, widget, dir, spcm); in sof_walk_widgets_in_order()
652 * widget is modified by the source widget in the path. Use a local in sof_walk_widgets_in_order()
658 ret = sof_prepare_widgets_in_path(sdev, widget, fe_params, platform_params, in sof_walk_widgets_in_order()
663 sof_unprepare_widgets_in_path(sdev, widget, list); in sof_walk_widgets_in_order()
666 dev_err(sdev->dev, "Invalid widget op %d\n", op); in sof_walk_widgets_in_order()
685 struct snd_soc_dapm_widget *widget; in sof_widget_list_setup() local
694 * instance ID and pick the widget configuration based on the runtime PCM params. in sof_widget_list_setup()
701 /* Set up is used to send the IPC to the DSP to create the widget */ in sof_widget_list_setup()
719 for_each_dapm_widgets(list, i, widget) { in sof_widget_list_setup()
720 struct snd_sof_widget *swidget = widget->dobj.private; in sof_widget_list_setup()
730 swidget->widget->name); in sof_widget_list_setup()
737 dev_err(sdev->dev, "error: no pipeline widget found for %s\n", in sof_widget_list_setup()
738 swidget->widget->name); in sof_widget_list_setup()
775 /* send IPC to free widget in the DSP */ in sof_widget_list_free()
778 /* unprepare the widget */ in sof_widget_list_free()
861 /* free widget list */ in sof_pcm_stream_free()
927 if (strcmp(name, swidget->widget->name) == 0) in snd_sof_find_swidget()
934 /* find widget by stream name and direction */
949 if (!strcmp(pcm_name, swidget->widget->sname) && in snd_sof_find_swidget_sname()