mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-31 22:25:35 -04:00
topology: Parse and build private data of physical links
Users can define private data for physical links by C API or text conf file. Private data pointer is added to C API template for physical links. Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
2894c31816
commit
c33b3a0ea2
2 changed files with 27 additions and 1 deletions
|
|
@ -996,6 +996,7 @@ struct snd_tplg_link_template {
|
||||||
|
|
||||||
unsigned int flag_mask; /* bitmask of flags to configure */
|
unsigned int flag_mask; /* bitmask of flags to configure */
|
||||||
unsigned int flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
|
unsigned int flags; /* SND_SOC_TPLG_LNK_FLGBIT_* flag value */
|
||||||
|
struct snd_soc_tplg_private *priv; /*!< private data */
|
||||||
};
|
};
|
||||||
|
|
||||||
/** \struct snd_tplg_obj_template
|
/** \struct snd_tplg_obj_template
|
||||||
|
|
|
||||||
|
|
@ -162,7 +162,7 @@ static int build_link(snd_tplg_t *tplg, struct tplg_elem *elem)
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
/* hw configs */
|
/* hw configs & private data */
|
||||||
base = &elem->ref_list;
|
base = &elem->ref_list;
|
||||||
list_for_each(pos, base) {
|
list_for_each(pos, base) {
|
||||||
|
|
||||||
|
|
@ -185,6 +185,12 @@ static int build_link(snd_tplg_t *tplg, struct tplg_elem *elem)
|
||||||
num_hw_configs++;
|
num_hw_configs++;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case SND_TPLG_TYPE_DATA: /* merge private data */
|
||||||
|
err = tplg_copy_data(tplg, elem, ref);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -1043,5 +1049,24 @@ int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t)
|
||||||
/* flags */
|
/* flags */
|
||||||
link->flag_mask = link_tpl->flag_mask;
|
link->flag_mask = link_tpl->flag_mask;
|
||||||
link->flags = link_tpl->flags;
|
link->flags = link_tpl->flags;
|
||||||
|
|
||||||
|
/* private data */
|
||||||
|
if (link_tpl->priv != NULL && link_tpl->priv->size) {
|
||||||
|
_link = realloc(link,
|
||||||
|
elem->size + link_tpl->priv->size);
|
||||||
|
if (!_link) {
|
||||||
|
tplg_elem_free(elem);
|
||||||
|
return -ENOMEM;
|
||||||
|
}
|
||||||
|
|
||||||
|
link = _link;
|
||||||
|
elem->link = link;
|
||||||
|
elem->size += link_tpl->priv->size;
|
||||||
|
|
||||||
|
memcpy(link->priv.data, link_tpl->priv->data,
|
||||||
|
link_tpl->priv->size);
|
||||||
|
link->priv.size = link_tpl->priv->size;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue