Repository navigation
unload physical dai link in remove #511
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
Merged
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -559,6 +559,24 @@ static void remove_link(struct snd_soc_component *comp, | |
| kfree(link); | ||
| } | ||
|
|
||
| /* unload dai link */ | ||
| static void remove_backend_link(struct snd_soc_component *comp, | ||
| struct snd_soc_dobj *dobj, int pass) | ||
| { | ||
| if (pass != SOC_TPLG_PASS_LINK) | ||
| return; | ||
|
plbossart marked this conversation as resolved.
Resolved
|
||
|
|
||
| if (dobj->ops && dobj->ops->link_unload) | ||
| dobj->ops->link_unload(comp, dobj); | ||
|
|
||
|
Member
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. add a comment here on why this is different from remove_link(). |
||
| /* | ||
| * We don't free the link here as what remove_link() do since BE | ||
| * links are not allocated by topology. | ||
| */ | ||
|
|
||
| list_del(&dobj->list); | ||
| } | ||
|
|
||
| /* bind a kcontrol to it's IO handlers */ | ||
| static int soc_tplg_kcontrol_bind_io(struct snd_soc_tplg_ctl_hdr *hdr, | ||
| struct snd_kcontrol_new *k, | ||
|
|
@@ -1651,6 +1669,9 @@ static int soc_tplg_dapm_widget_create(struct soc_tplg *tplg, | |
| if (ret < 0) | ||
| goto ready_err; | ||
|
|
||
| kfree(template.sname); | ||
| kfree(template.name); | ||
|
|
||
| return 0; | ||
|
|
||
| ready_err: | ||
|
|
@@ -2161,6 +2182,12 @@ static int soc_tplg_link_config(struct soc_tplg *tplg, | |
| return ret; | ||
| } | ||
|
|
||
| /* for unloading it in snd_soc_tplg_component_remove */ | ||
| link->dobj.index = tplg->index; | ||
| link->dobj.ops = tplg->ops; | ||
| link->dobj.type = SND_SOC_DOBJ_BACKEND_LINK; | ||
| list_add(&link->dobj.list, &tplg->comp->dobj_list); | ||
|
|
||
| return 0; | ||
| } | ||
|
|
||
|
|
@@ -2647,6 +2674,13 @@ int snd_soc_tplg_component_remove(struct snd_soc_component *comp, u32 index) | |
| case SND_SOC_DOBJ_DAI_LINK: | ||
| remove_link(comp, dobj, pass); | ||
| break; | ||
| case SND_SOC_DOBJ_BACKEND_LINK: | ||
| /* | ||
| * call link_unload ops if extra | ||
| * deinitialization is needed. | ||
| */ | ||
| remove_backend_link(comp, dobj, pass); | ||
| break; | ||
|
plbossart marked this conversation as resolved.
Resolved
|
||
| default: | ||
| dev_err(comp->dev, "ASoC: invalid component type %d for removal\n", | ||
| dobj->type); | ||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Fix commit message
"soc_tplg_link_config() will find the physical dai link and call soc_tplg_dai_link_load() to load the BE dai link. Currently remove_link() is only used to remove the FE dai link which is created by the topology. The BE dai link cannot however be unloaded in snd_soc_tplg_component_remove(), which is problematic if anything needs to be released or reinitialized.
This patch aligns the definitions of dynamic types with the existing UAPI and adds a new remove_backend_link() routine to unload the the BE dai link when snd_soc_tplg_component_remove() is invoked.
"