From mboxrd@z Thu Jan 1 00:00:00 1970 From: David Henningsson Subject: Re: TLV question - ranges not in volume order Date: Wed, 08 May 2013 15:33:11 +0200 Message-ID: <518A5417.90609@canonical.com> References: <518A3545.8000809@canonical.com> <518A407B.3070802@ladisch.de> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------050904030806060600020504" Return-path: Received: from youngberry.canonical.com (youngberry.canonical.com [91.189.89.112]) by alsa0.perex.cz (Postfix) with ESMTP id BC2082608C9 for ; Wed, 8 May 2013 15:33:12 +0200 (CEST) In-Reply-To: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Takashi Iwai Cc: rex.tsai@canonical.com, "alsa-devel@alsa-project.org" , Clemens Ladisch List-Id: alsa-devel@alsa-project.org This is a multi-part message in MIME format. --------------050904030806060600020504 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit On 05/08/2013 02:14 PM, Takashi Iwai wrote: > At Wed, 08 May 2013 14:09:31 +0200, > Clemens Ladisch wrote: >> >> David Henningsson wrote: >>> I recently came across a strange ASoC volume control. In this case, >>> the values are not in volume order, i e, the control is declared >>> something like below. >>> >>> However alsamixer seems not to handle this "reordering" correctly. My >>> question is if this is something that should be fixed in alsamixer (or >>> possibly alsa-lib?), or does one need to write some kind of mapping >>> table in the kernel, just to make something come in volume order to >>> userspace? >> >> Items in a DB_RANGE container must be ordered by their values *and* by >> their dB values. This implies that larger values must correspond with >> larger dB values, whis is also required for all other mixer controls. >> >> If the register values are unordered, the driver must reorder them. > > Yep. Although there is no explicit definition, it's an implicit rule, > as we have never implemented the parser code to allow the disorder. > > We should add a text mentioning that somewhere. A patch is welcome ;) Like this? (Feel free to apply if you think it's good) -- David Henningsson, Canonical Ltd. https://launchpad.net/~diwic --------------050904030806060600020504 Content-Type: text/x-patch; name="0001-ALSA-Add-comment-for-control-TLV-API.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename="0001-ALSA-Add-comment-for-control-TLV-API.patch" >>From 19778a06ef5bd995ba1e800dc14bbe7ff27dcb97 Mon Sep 17 00:00:00 2001 From: David Henningsson Date: Wed, 8 May 2013 15:28:49 +0200 Subject: [PATCH] ALSA: Add comment for control TLV API Userspace is not meant to have to handle all strange dB ranges, so add a specification comment. Signed-off-by: David Henningsson --- include/sound/tlv.h | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/include/sound/tlv.h b/include/sound/tlv.h index 28c65e1..84fc31a 100644 --- a/include/sound/tlv.h +++ b/include/sound/tlv.h @@ -74,7 +74,10 @@ #define DECLARE_TLV_DB_LINEAR(name, min_dB, max_dB) \ unsigned int name[] = { TLV_DB_LINEAR_ITEM(min_dB, max_dB) } -/* dB range container */ +/* dB range container. Items in dB range container must be ordered +by their values and by their dB values. This implies that larger values +must correspond with larger dB values (which is also required for all +other mixer controls). */ /* Each item is: */ #define TLV_DB_RANGE_ITEM(...) \ TLV_ITEM(SNDRV_CTL_TLVT_DB_RANGE, __VA_ARGS__) -- 1.7.9.5 --------------050904030806060600020504 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline --------------050904030806060600020504--