topology: Look up references for an object based on its index

We can distinguish different use cases by the object index value, the default
value is 0, meaning applicable for all use cases, defined by macro "SND_TOLG_INDEX_ALL".
An element can only refer to other elements for "all" use cases or the same use
cases, i.e. it can only refer to elements with index value "SND_TOLG_INDEX_ALL"
or the same index value as itself.
The object list has been sorted in ascending order of index, so when we look up
a reference for an object, we traverse the object list it depends on, if we have
not found the reference until index of the object list is greater than index of
the object, we give up and return an error.

Signed-off-by: Fuwei Tang <fuweix.tang@intel.com>
Reviewed-by: Mengdong Lin <mengdong.lin@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Fuwei Tang 2017-04-13 14:52:46 +08:00 committed by Takashi Iwai
parent af231ea1db
commit a3b4bd2c8c
7 changed files with 39 additions and 27 deletions

View file

@ -356,9 +356,10 @@ extern "C" {
* </pre>
*
* The section name is used to define the mixer name. The index number can be
* used to identify topology objects groups. This allows driver operations on
* objects with index number N and can be used to add/remove pipelines of
* objects whilst other objects are unaffected.
* used to identify topology objects groups(index "0" is common, fit for all
* user cases).This allows driver operations on objects with index number N and
* can be used to add/remove pipelines of objects whilst other objects are
* unaffected.
*
* <h5>Byte Controls</h5>
* A byte control is defined as a new section that can include channel mapping,
@ -752,6 +753,9 @@ enum snd_tplg_type {
SND_TPLG_TYPE_DAI, /*!< Physical DAI */
};
/** Fit for all user cases */
#define SND_TPLG_INDEX_ALL 0
/**
* \brief Create a new topology parser instance.
* \return New topology parser instance