Lines Matching refs:widget

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