From patchwork Thu May 10 00:53:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 10391017 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id E1A7360540 for ; Thu, 10 May 2018 00:53:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2851283CB for ; Thu, 10 May 2018 00:53:18 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C6DD428470; Thu, 10 May 2018 00:53:18 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 11FD9283CB for ; Thu, 10 May 2018 00:53:17 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 1B0D62675C8; Thu, 10 May 2018 02:53:14 +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 9A6D62676A9; Thu, 10 May 2018 02:53:11 +0200 (CEST) Received: from mga06.intel.com (mga06.intel.com [134.134.136.31]) by alsa0.perex.cz (Postfix) with ESMTP id 9D35A267365 for ; Thu, 10 May 2018 02:53:06 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 May 2018 17:53:05 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.49,383,1520924400"; d="scan'208";a="223028582" Received: from jmmarti3-mobl1.amr.corp.intel.com (HELO ranjani-desktop.hsd1.ca.comcast.net) ([10.254.179.142]) by orsmga005.jf.intel.com with ESMTP; 09 May 2018 17:53:04 -0700 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Date: Wed, 9 May 2018 17:53:04 -0700 Message-Id: <20180510005304.27903-1-ranjani.sridharan@linux.intel.com> X-Mailer: git-send-email 2.14.1 Cc: liam.r.girdwood@linux.intel.com, pierre-louis.bossart@linux.intel.com Subject: [alsa-devel] [PATCH v4] ALSA: core api: define offsets for TLV items 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 Currently, there are no pre-defined accessors for the elements in topology TLV data. In the absence of such offsets, the tlv data will have to be decoded using hardwired offset numbers 0-N depending on the type of TLV. This patch defines accessor offsets for the type, length, min and mute/step items in TLV data for DB_SCALE type tlv's. These will be used by drivers to decode the TLV data while loading topology thereby improving code readability. The type and len offsets are common for all TLV types. The min and step/mute offsets are specific to DB_SCALE tlv type. Signed-off-by: Ranjani Sridharan Reviewed-by: Takashi Sakamoto --- Notes: v4: change placement of tlv accessor offsets include/uapi/sound/tlv.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/uapi/sound/tlv.h b/include/uapi/sound/tlv.h index be5371f09a62..e3437e96519a 100644 --- a/include/uapi/sound/tlv.h +++ b/include/uapi/sound/tlv.h @@ -42,6 +42,10 @@ #define SNDRV_CTL_TLVD_LENGTH(...) \ ((unsigned int)sizeof((const unsigned int[]) { __VA_ARGS__ })) +/* Accessor offsets for TLV data items */ +#define SNDRV_CTL_TLVO_TYPE 0 +#define SNDRV_CTL_TLVO_LEN 1 + #define SNDRV_CTL_TLVD_CONTAINER_ITEM(...) \ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_CONTAINER, __VA_ARGS__) #define SNDRV_CTL_TLVD_DECLARE_CONTAINER(name, ...) \ @@ -61,6 +65,10 @@ SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \ } +/* Accessor offsets for min, mute and step items in dB scale type TLV */ +#define SNDRV_CTL_TLVO_DB_SCALE_MIN 2 +#define SNDRV_CTL_TLVO_DB_SCALE_MUTE_AND_STEP 3 + /* dB scale specified with min/max values instead of step */ #define SNDRV_CTL_TLVD_DB_MINMAX_ITEM(min_dB, max_dB) \ SNDRV_CTL_TLVD_ITEM(SNDRV_CTL_TLVT_DB_MINMAX, (min_dB), (max_dB))