alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Iwai <tiwai@suse.de>
To: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: vinod.koul@intel.com, alsa-devel@alsa-project.org,
	broonie@kernel.org, clemens@ladisch.de,
	ckeepax@opensource.wolfsonmicro.com
Subject: Re: [PATCH 2/4] test: use proper threshold level information for user-ctl-element-set test
Date: Mon, 19 Sep 2016 22:48:35 +0200	[thread overview]
Message-ID: <s5htwdblios.wl-tiwai@suse.de> (raw)
In-Reply-To: <1474123768-13160-3-git-send-email-o-takashi@sakamocchi.jp>

On Sat, 17 Sep 2016 16:49:26 +0200,
Takashi Sakamoto wrote:
> 
> Currently, this test program uses invalid array for threshold level
> information.

What do you mean exactly here as "threshold level"?
This term is fairly unclear to me and I don't remember of it being
defined properly although you seem to have started using in some
comments.


thanks,

Takashi

> 
> This commit replaces the array with valid information, which consists of
> newly exported TLV macros from kernel land.
> 
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
> ---
>  test/user-ctl-element-set.c | 41 +++++++++++++++++++++++++++--------------
>  1 file changed, 27 insertions(+), 14 deletions(-)
> 
> diff --git a/test/user-ctl-element-set.c b/test/user-ctl-element-set.c
> index 9b9dc59..7d22ca6 100644
> --- a/test/user-ctl-element-set.c
> +++ b/test/user-ctl-element-set.c
> @@ -8,6 +8,7 @@
>   */
>  
>  #include "../include/asoundlib.h"
> +#include <sound/tlv.h>
>  
>  struct elem_set_trial {
>  	snd_ctl_t *handle;
> @@ -414,22 +415,34 @@ static int check_elems(struct elem_set_trial *trial)
>  
>  static int check_tlv(struct elem_set_trial *trial)
>  {
> -	unsigned int orig[8], curr[8];
> -	int err;
> -
>  	/*
> -	 * See a layout of 'struct snd_ctl_tlv'. I don't know the reason to
> -	 * construct this buffer with the same layout. It should be abstracted
> -	 * inner userspace library...
> +	 * Use unlikely data for threshold level.
> +	 *
> +	 *  Linear: dB range (coeff)
> +	 *  0<-> 4: -5940<->-5636 (44)
> +	 *  4<->22: -5636<->-4556 (60)
> +	 * 22<->33: -4556<->-4072 (76)
> +	 * 33<->37: -4072<->-3832 (44)
> +	 * 37<->48: -3832<->-2996 (76)
> +	 * 48<->66: -2996<->-2204 (60)
> +	 * 66<->84: -2204<-> -836 (44)
> +	 * 84<->95:  -836<-> -176 (60)
> +	 * 95<->99:  -176<->    0 (76)
>  	 */
> -	orig[0] = snd_ctl_elem_id_get_numid(trial->id);
> -	orig[1] = 6 * sizeof(orig[0]);
> -	orig[2] = 'a';
> -	orig[3] = 'b';
> -	orig[4] = 'c';
> -	orig[5] = 'd';
> -	orig[6] = 'e';
> -	orig[7] = 'f';
> +	static const SNDRV_CTL_TLVD_DECLARE_DB_RANGE(orig,
> +		SNDRV_CTL_TLVD_DB_RANGE_HEAD(9),
> +		 0,   4, SNDRV_CTL_TLVD_DB_SCALE_ITEM(-5940, 44, 1),
> +		 4,  22, SNDRV_CTL_TLVD_DB_SCALE_ITEM(-5636, 60, 0),
> +		22,  33, SNDRV_CTL_TLVD_DB_SCALE_ITEM(-4556, 76, 0),
> +		33,  37, SNDRV_CTL_TLVD_DB_SCALE_ITEM(-4072, 44, 0),
> +		37,  48, SNDRV_CTL_TLVD_DB_SCALE_ITEM(-3832, 76, 0),
> +		48,  66, SNDRV_CTL_TLVD_DB_SCALE_ITEM(-2996, 60, 0),
> +		66,  84, SNDRV_CTL_TLVD_DB_SCALE_ITEM(-2204, 44, 0),
> +		84,  95, SNDRV_CTL_TLVD_DB_SCALE_ITEM( -836, 60, 0),
> +		95,  99, SNDRV_CTL_TLVD_DB_SCALE_ITEM( -176, 76, 0),
> +	);
> +	unsigned int curr[sizeof(orig)/sizeof(orig[0])];
> +	int err;
>  
>  	/*
>  	 * In in-kernel implementation, write and command operations are the
> -- 
> 2.7.4
> 

  reply	other threads:[~2016-09-19 20:48 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-09-17 14:49 [PATCH 0/4][alsa-lib] ctl: sync UAPI header for TLV-related macros and apply misc changes Takashi Sakamoto
2016-09-17 14:49 ` [PATCH 1/4] Update include/sound/tlv.h from 4.9-pre kernel uapi Takashi Sakamoto
2016-09-17 14:49 ` [PATCH 2/4] test: use proper threshold level information for user-ctl-element-set test Takashi Sakamoto
2016-09-19 20:48   ` Takashi Iwai [this message]
2016-09-20 10:13     ` Takashi Sakamoto
2016-09-17 14:49 ` [PATCH 3/4] ctl: fix API explanation for TLV operation Takashi Sakamoto
2016-09-17 14:49 ` [PATCH 4/4] ctl: improve documentation about TLV-related APIs Takashi Sakamoto

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=s5htwdblios.wl-tiwai@suse.de \
    --to=tiwai@suse.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.wolfsonmicro.com \
    --cc=clemens@ladisch.de \
    --cc=o-takashi@sakamocchi.jp \
    --cc=vinod.koul@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).