Lines Matching defs:widget

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