topology: A API calls to directly build topology data from templates

Add some new API calls so that applications can directly build topology data
using template structures.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Signed-off-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Mengdong Lin 2015-08-11 18:23:17 +01:00 committed by Takashi Iwai
parent 1b148ef590
commit 5b518c9159
6 changed files with 573 additions and 18 deletions

View file

@ -35,6 +35,23 @@ int tplg_ref_add(struct tplg_elem *elem, int type, const char* id)
return 0;
}
/* directly add a reference elem */
int tplg_ref_add_elem(struct tplg_elem *elem, struct tplg_elem *elem_ref)
{
struct tplg_ref *ref;
ref = calloc(1, sizeof(*ref));
if (!ref)
return -ENOMEM;
ref->type = elem_ref->type;
ref->elem = elem_ref;
elem_copy_text(ref->id, elem_ref->id, SNDRV_CTL_ELEM_ID_NAME_MAXLEN);
list_add_tail(&ref->list, &elem->ref_list);
return 0;
}
void tplg_ref_free_list(struct list_head *base)
{
struct list_head *pos, *npos;