]> git.alsa-project.org Git - alsa-lib.git/commitdiff
topology: Add API to set a vendor specific version number
authorMengdong Lin <mengdong.lin@intel.com>
Wed, 16 Sep 2015 09:07:13 +0000 (17:07 +0800)
committerTakashi Iwai <tiwai@suse.de>
Wed, 23 Sep 2015 08:45:52 +0000 (10:45 +0200)
This vendor-specific version number is optional. It will be written to
the 'version' field of each block header of the binary toplogy data file.
The vendor driver can check this number for further processing in kernel.

The topology ABI version number is still stored in the 'abi' field of
block headers.

Signed-off-by: Mengdong Lin <mengdong.lin@intel.com>
Reviewed-by: Liam Girdwood <liam.r.girdwood@linux.intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/topology.h
src/topology/builder.c
src/topology/parser.c

index 6ff8c5fb4609d87b538ed7b89abe96b10f4e502d..9b84bd9331dc4663dc7d209763536dc9f5c390fc 100644 (file)
@@ -690,6 +690,14 @@ int snd_tplg_build(snd_tplg_t *tplg, const char *outfile);
  */
 int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len);
 
+/**
+ * \brief Set an optional vendor specific version number.
+ * \param tplg Topology instance.
+ * \param version Vendor specific version number.
+ * \return Zero on success, otherwise a negative error code
+ */
+int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version);
+
 /* \} */
 
 #ifdef __cplusplus
index 91412aadd098f6e5523a3e0b98b5f7d3cda1af11..8d57a8b719f7a37d803c0fb26869997869ef716e 100644 (file)
@@ -89,7 +89,7 @@ static int write_data_block(snd_tplg_t *tplg, int size, int tplg_type,
 
        /* write the header for this block */
        ret = write_block_header(tplg, tplg_type, 0,
-               SND_SOC_TPLG_ABI_VERSION, 0, size, 1);
+               tplg->version, 0, size, 1);
        if (ret < 0) {
                SNDERR("error: failed to write %s block %d\n", obj_name, ret);
                return ret;
@@ -124,7 +124,7 @@ static int write_elem_block(snd_tplg_t *tplg,
        vendor_type = elem->vendor_type;
 
        ret = write_block_header(tplg, tplg_type, vendor_type,
-               SND_SOC_TPLG_ABI_VERSION, 0, size, count);
+               tplg->version, 0, size, count);
        if (ret < 0) {
                SNDERR("error: failed to write %s block %d\n",
                        obj_name, ret);
@@ -242,7 +242,7 @@ static int write_manifest_data(snd_tplg_t *tplg)
 
        /* write the header for this block */
        ret = write_block_header(tplg, SND_SOC_TPLG_TYPE_MANIFEST, 0,
-               SND_SOC_TPLG_ABI_VERSION, 0,
+               tplg->version, 0,
                sizeof(tplg->manifest) + tplg->manifest.priv.size, 1);
        if (ret < 0) {
                SNDERR("error: failed to write manifest block %d\n", ret);
index 44c6146b22f28e7e98cb30be08f1e6f691dd550d..6671055ae2262e39725d5958815064d2e987e5d4 100644 (file)
@@ -361,6 +361,13 @@ int snd_tplg_set_manifest_data(snd_tplg_t *tplg, const void *data, int len)
        return 0;
 }
 
+int snd_tplg_set_version(snd_tplg_t *tplg, unsigned int version)
+{
+       tplg->version = version;
+
+       return 0;
+}
+
 void snd_tplg_verbose(snd_tplg_t *tplg, int verbose)
 {
        tplg->verbose = verbose;