From patchwork Wed Sep 16 09:07:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Lin, Mengdong" X-Patchwork-Id: 7192681 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id A4C9CBEEC1 for ; Wed, 16 Sep 2015 08:53:17 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id D19E42086A for ; Wed, 16 Sep 2015 08:53:16 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 9A31520868 for ; Wed, 16 Sep 2015 08:53:15 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 6575E2608B3; Wed, 16 Sep 2015 10:53:14 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Level: X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,NO_DNS_FOR_FROM, RCVD_IN_DNSWL_LOW, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 4BD7B26067A; Wed, 16 Sep 2015 10:53:12 +0200 (CEST) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id DFE0F2606A5; Wed, 16 Sep 2015 10:53:10 +0200 (CEST) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by alsa0.perex.cz (Postfix) with ESMTP id 9CAB5260603 for ; Wed, 16 Sep 2015 10:53:03 +0200 (CEST) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP; 16 Sep 2015 01:53:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.17,538,1437462000"; d="scan'208";a="805529804" Received: from amanda-hsw-pc.sh.intel.com ([10.239.159.75]) by orsmga002.jf.intel.com with ESMTP; 16 Sep 2015 01:53:00 -0700 From: mengdong.lin@intel.com To: alsa-devel@alsa-project.org Date: Wed, 16 Sep 2015 17:07:13 +0800 Message-Id: <1442394433-31417-1-git-send-email-mengdong.lin@intel.com> X-Mailer: git-send-email 1.9.1 Cc: mengdong.lin@linux.intel.com, tiwai@suse.de, Mengdong Lin , broonie@kernel.org, liam.r.girdwood@intel.com, subhransu.s.prusty@intel.com Subject: [alsa-devel] [PATCH] topology: Add API to set a vendor specific version number X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Mengdong Lin 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 Reviewed-by: Liam Girdwood --- include/topology.h | 8 ++++++++ src/topology/builder.c | 6 +++--- src/topology/parser.c | 7 +++++++ 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/include/topology.h b/include/topology.h index 6ff8c5f..9b84bd9 100644 --- a/include/topology.h +++ b/include/topology.h @@ -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 diff --git a/src/topology/builder.c b/src/topology/builder.c index 3bccd44..2f01137 100644 --- a/src/topology/builder.c +++ b/src/topology/builder.c @@ -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; @@ -125,7 +125,7 @@ static int write_elem_block(snd_tplg_t *tplg, } 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); @@ -243,7 +243,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); diff --git a/src/topology/parser.c b/src/topology/parser.c index 7ca244c..c0ab5e4 100644 --- a/src/topology/parser.c +++ b/src/topology/parser.c @@ -362,6 +362,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;