From patchwork Tue Mar 27 18:39:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ranjani Sridharan X-Patchwork-Id: 10311475 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 B7F6E60386 for ; Tue, 27 Mar 2018 18:39:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A813329DAF for ; Tue, 27 Mar 2018 18:39:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9B0A229DB3; Tue, 27 Mar 2018 18:39:54 +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=-1.9 required=2.0 tests=BAYES_00, 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 C809129DAF for ; Tue, 27 Mar 2018 18:39:53 +0000 (UTC) Received: from alsa0.perex.cz (localhost [127.0.0.1]) by alsa0.perex.cz (Postfix) with ESMTP id 59DA72671CC; Tue, 27 Mar 2018 20:39:52 +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 2A3B72671CC; Tue, 27 Mar 2018 20:39:50 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by alsa0.perex.cz (Postfix) with ESMTP id 062752671CC for ; Tue, 27 Mar 2018 20:39:46 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga003.fm.intel.com ([10.253.24.29]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 27 Mar 2018 11:39:45 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.48,367,1517904000"; d="scan'208";a="37338328" Received: from danisi-mobl.amr.corp.intel.com (HELO ranjani-desktop.hsd1.ca.comcast.net) ([10.254.191.102]) by FMSMGA003.fm.intel.com with ESMTP; 27 Mar 2018 11:39:44 -0700 From: Ranjani Sridharan To: alsa-devel@alsa-project.org Date: Tue, 27 Mar 2018 11:39:45 -0700 Message-Id: <20180327183945.6551-1-ranjani.sridharan@linux.intel.com> X-Mailer: git-send-email 2.14.1 Cc: liam.r.girdwood@linux.intel.com, broonie@kernel.org Subject: [alsa-devel] [PATCH] ASoC: Add accessor macros 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 This patch adds macros for accessing the type, length, min, mute and step items in TLV data. These will be used by drivers to extract the TLV data while loading topology. Signed-off-by: Ranjani Sridharan --- include/sound/tlv.h | 5 +++++ include/uapi/sound/tlv.h | 7 +++++++ 2 files changed, 12 insertions(+) diff --git a/include/sound/tlv.h b/include/sound/tlv.h index 3677ebb928d5..8fa379e8a568 100644 --- a/include/sound/tlv.h +++ b/include/sound/tlv.h @@ -49,6 +49,11 @@ #define TLV_DB_GAIN_MUTE SNDRV_CTL_TLVD_DB_GAIN_MUTE +#define TLV_ITEM_TYPE SNDRV_CTL_TLVD_ITEM_TYPE +#define TLV_ITEM_LEN SNDRV_CTL_TLVD_ITEM_LEN +#define TLV_DB_MIN SNDRV_CTL_TLVD_DB_SCALE_MIN +#define TLV_DB_MUTE_AND_STEP SNDRV_CTL_TLVD_DB_SCALE_MUTE_AND_STEP + /* * The below assumes that each item TLV is 4 words like DB_SCALE or LINEAR. * This is an old fasion and obsoleted by commit bf1d1c9b6179("ALSA: tlv: add diff --git a/include/uapi/sound/tlv.h b/include/uapi/sound/tlv.h index be5371f09a62..f3fba49ef6e8 100644 --- a/include/uapi/sound/tlv.h +++ b/include/uapi/sound/tlv.h @@ -60,6 +60,13 @@ unsigned int name[] = { \ SNDRV_CTL_TLVD_DB_SCALE_ITEM(min, step, mute) \ } +/* Accessor macros for TLV type and len */ +#define SNDRV_CTL_TLVD_ITEM_TYPE 0 +#define SNDRV_CTL_TLVD_ITEM_LEN 1 + +/* Accessor macros for min, mute and step values from dB scale type TLV */ +#define SNDRV_CTL_TLVD_DB_SCALE_MIN 2 +#define SNDRV_CTL_TLVD_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) \