mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-11-04 13:30:08 -05:00
topology: Define a function to build a single PCM element
Code refactoring. Rename tplg_build_pcm() to tplg_build_pcms() to build all PCM (FE DAI & DAI link) elements. It will call a new function build_pcm() to build a single PCM elemement. build_pcm() will be extended to handle more properties of a PCM. Signed-off-by: Mengdong Lin <mengdong.lin@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
b398ed4058
commit
e4237a250d
3 changed files with 17 additions and 5 deletions
|
|
@ -267,7 +267,7 @@ static int tplg_build_integ(snd_tplg_t *tplg)
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
err = tplg_build_pcm(tplg, SND_TPLG_TYPE_PCM);
|
err = tplg_build_pcms(tplg, SND_TPLG_TYPE_PCM);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -70,8 +70,20 @@ static int tplg_build_stream_caps(snd_tplg_t *tplg,
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* build FE DAI/PCM configurations */
|
/* build a PCM (FE DAI & DAI link) element */
|
||||||
int tplg_build_pcm(snd_tplg_t *tplg, unsigned int type)
|
static int build_pcm(snd_tplg_t *tplg, struct tplg_elem *elem)
|
||||||
|
{
|
||||||
|
int err;
|
||||||
|
|
||||||
|
err = tplg_build_stream_caps(tplg, elem->id, elem->pcm->caps);
|
||||||
|
if (err < 0)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* build all PCM (FE DAI & DAI link) elements */
|
||||||
|
int tplg_build_pcms(snd_tplg_t *tplg, unsigned int type)
|
||||||
{
|
{
|
||||||
struct list_head *base, *pos;
|
struct list_head *base, *pos;
|
||||||
struct tplg_elem *elem;
|
struct tplg_elem *elem;
|
||||||
|
|
@ -86,7 +98,7 @@ int tplg_build_pcm(snd_tplg_t *tplg, unsigned int type)
|
||||||
return -EINVAL;
|
return -EINVAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = tplg_build_stream_caps(tplg, elem->id, elem->pcm->caps);
|
err = build_pcm(tplg, elem);
|
||||||
if (err < 0)
|
if (err < 0)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -284,7 +284,7 @@ int tplg_add_enum(snd_tplg_t *tplg, struct snd_tplg_enum_template *enum_ctl,
|
||||||
int tplg_add_bytes(snd_tplg_t *tplg, struct snd_tplg_bytes_template *bytes_ctl,
|
int tplg_add_bytes(snd_tplg_t *tplg, struct snd_tplg_bytes_template *bytes_ctl,
|
||||||
struct tplg_elem **e);
|
struct tplg_elem **e);
|
||||||
|
|
||||||
int tplg_build_pcm(snd_tplg_t *tplg, unsigned int type);
|
int tplg_build_pcms(snd_tplg_t *tplg, unsigned int type);
|
||||||
int tplg_build_link_cfg(snd_tplg_t *tplg, unsigned int type);
|
int tplg_build_link_cfg(snd_tplg_t *tplg, unsigned int type);
|
||||||
int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t);
|
int tplg_add_link_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t);
|
||||||
int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t);
|
int tplg_add_pcm_object(snd_tplg_t *tplg, snd_tplg_obj_template_t *t);
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue