-
Notifications
You must be signed in to change notification settings - Fork 132
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor pipeline management #5262
base: topic/sof-dev
Are you sure you want to change the base?
Changes from 1 commit
6ff3766
8f21468
285fe36
5ccfeac
c6ece6d
a1d073c
32588f6
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -293,6 +293,17 @@ int sof_route_setup(struct snd_sof_dev *sdev, struct snd_soc_dapm_widget *wsourc | |
} | ||
EXPORT_SYMBOL(sof_route_setup); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You should have done this earlier, the previous patch uses the function. |
||
|
||
/* helper function to check if the widget belongs to a BE pipeline */ | ||
static bool sof_is_be_pipeline_widget(struct snd_soc_dapm_widget *w) | ||
{ | ||
struct snd_sof_widget *swidget = w->dobj.private; | ||
|
||
if (swidget->spipe->be_pipeline) | ||
return true; | ||
|
||
return false; | ||
} | ||
|
||
static int sof_setup_pipeline_connections(struct snd_sof_dev *sdev, | ||
struct snd_soc_dapm_widget_list *list, int dir) | ||
{ | ||
|
@@ -319,6 +330,12 @@ static int sof_setup_pipeline_connections(struct snd_sof_dev *sdev, | |
continue; | ||
|
||
if (p->sink->dobj.private) { | ||
/* | ||
* skip routes between widgets belonging to the BE pipeline | ||
*/ | ||
if (sof_is_be_pipeline_widget(widget) && | ||
sof_is_be_pipeline_widget(p->sink)) | ||
continue; | ||
ret = sof_route_setup(sdev, widget, p->sink); | ||
if (ret < 0) | ||
return ret; | ||
|
@@ -335,6 +352,12 @@ static int sof_setup_pipeline_connections(struct snd_sof_dev *sdev, | |
continue; | ||
|
||
if (p->source->dobj.private) { | ||
/* | ||
* skip routes between widgets belonging to the BE pipeline | ||
*/ | ||
if (sof_is_be_pipeline_widget(widget) && | ||
sof_is_be_pipeline_widget(p->source)) | ||
continue; | ||
ret = sof_route_setup(sdev, p->source, widget); | ||
if (ret < 0) | ||
return ret; | ||
|
@@ -415,8 +438,12 @@ sof_unprepare_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dapm_widg | |
if (is_virtual_widget(sdev, widget, __func__)) | ||
return; | ||
|
||
/* skip if the widget is in use or if it is already unprepared */ | ||
if (!swidget || !swidget->prepared || swidget->use_count > 0) | ||
/* | ||
* skip if the widget is in use or if it is already unprepared or | ||
* if it belongs to a BE pipeline. | ||
*/ | ||
if (!swidget || !swidget->prepared || swidget->use_count > 0 || | ||
swidget->spipe->be_pipeline) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. In some places use use sof_is_be_pipeline_widget() in some swidget->spipe->be_pipeline |
||
goto sink_unprepare; | ||
|
||
widget_ops = tplg_ops ? tplg_ops->widget : NULL; | ||
|
@@ -506,14 +533,16 @@ static int sof_free_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_dap | |
int dir, struct snd_sof_pcm *spcm) | ||
{ | ||
struct snd_soc_dapm_widget_list *list = spcm->stream[dir].list; | ||
struct snd_sof_widget *swidget = widget->dobj.private; | ||
struct snd_soc_dapm_path *p; | ||
int err; | ||
int ret = 0; | ||
|
||
if (is_virtual_widget(sdev, widget, __func__)) | ||
return 0; | ||
|
||
if (widget->dobj.private) { | ||
/* only free widgets that aren't part of the BE pipeline */ | ||
if (swidget && !sof_is_be_pipeline_widget(widget)) { | ||
err = sof_widget_free(sdev, widget->dobj.private); | ||
if (err < 0) | ||
ret = err; | ||
|
@@ -555,7 +584,7 @@ static int sof_set_up_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_d | |
if (is_virtual_widget(sdev, widget, __func__)) | ||
return 0; | ||
|
||
if (swidget) { | ||
if (swidget && !sof_is_be_pipeline_widget(widget)) { | ||
int i; | ||
|
||
ret = sof_widget_setup(sdev, widget->dobj.private); | ||
|
@@ -594,7 +623,7 @@ static int sof_set_up_widgets_in_path(struct snd_sof_dev *sdev, struct snd_soc_d | |
ret = sof_set_up_widgets_in_path(sdev, p->sink, dir, spcm); | ||
p->walking = false; | ||
if (ret < 0) { | ||
if (swidget) | ||
if (swidget && !sof_is_be_pipeline_widget(widget)) | ||
sof_widget_free(sdev, swidget); | ||
return ret; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is there any specific reason that we always call hw_params in .prepare?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
because sometimes we dont have a hw_free like in the case of xruns and we'll need to do everything again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
prepare() should be fast. We should call this out in comments - we need to do X,Y out of cycle because Z