alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
To: Hans de Goede <hdegoede@redhat.com>,
	Cezary Rojewski <cezary.rojewski@intel.com>,
	Liam Girdwood <liam.r.girdwood@linux.intel.com>,
	Jie Yang <yang.jie@linux.intel.com>,
	Mark Brown <broonie@kernel.org>,
	Oder Chiou <oder_chiou@realtek.com>
Cc: alsa-devel@alsa-project.org
Subject: Re: [PATCH 4/6] ASoC: rt5670: Fix dac- and adc- vol-tlv values being off by a factor of 10
Date: Mon, 29 Jun 2020 10:10:01 -0500	[thread overview]
Message-ID: <fc377733-8db7-3422-65be-d79effaaad77@linux.intel.com> (raw)
In-Reply-To: <20200628155231.71089-5-hdegoede@redhat.com>



On 6/28/20 10:52 AM, Hans de Goede wrote:
> The adc_vol_tlv volume-control has a range from -17.625 dB to +30 dB,
> not -176.25 dB to + 300 dB. This wrong scale is esp. a problem in userspace

D'oh! nice catch.

> apps which translate the dB scale to a linear scale. With the logarithmic
> dB scale being of by a factor of 10 we loose all precision in the lower
> area of the range when apps translate things to a linear scale.
> 
> E.g. the 0 dB default, which corresponds with a value of 47 of the
> 0 - 127 range for the control, would be shown as 0/100 in alsa-mixer.
> 
> Since the centi-dB values used in the TLV struct cannot represent the
> 0.375 dB step size used by these controls, change the TLV definition
> for them to specify a min and max value instead of min + stepsize.
> 
> Signed-off-by: Hans de Goede <hdegoede@redhat.com>
> ---
>   sound/soc/codecs/rt5670.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/sound/soc/codecs/rt5670.c b/sound/soc/codecs/rt5670.c
> index f21181734170..dfbc0ca38ff7 100644
> --- a/sound/soc/codecs/rt5670.c
> +++ b/sound/soc/codecs/rt5670.c
> @@ -603,9 +603,9 @@ int rt5670_set_jack_detect(struct snd_soc_component *component,
>   EXPORT_SYMBOL_GPL(rt5670_set_jack_detect);
>   
>   static const DECLARE_TLV_DB_SCALE(out_vol_tlv, -4650, 150, 0);
> -static const DECLARE_TLV_DB_SCALE(dac_vol_tlv, -65625, 375, 0);
> +static const DECLARE_TLV_DB_MINMAX(dac_vol_tlv, -6562, 0);
>   static const DECLARE_TLV_DB_SCALE(in_vol_tlv, -3450, 150, 0);
> -static const DECLARE_TLV_DB_SCALE(adc_vol_tlv, -17625, 375, 0);
> +static const DECLARE_TLV_DB_MINMAX(adc_vol_tlv, -1762, 3000);
>   static const DECLARE_TLV_DB_SCALE(adc_bst_tlv, 0, 1200, 0);
>   
>   /* {0, +20, +24, +30, +35, +40, +44, +50, +52} dB */
> 

  reply	other threads:[~2020-06-29 17:35 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-28 15:52 ASoC: rt5670/cht_bsw_rt5672: Some bugfixes and cleanups Hans de Goede
2020-06-28 15:52 ` [PATCH 1/6] ASoC: Intel: cht_bsw_rt5672: Change bus format to I2S 2 channel Hans de Goede
2020-06-29 15:06   ` Pierre-Louis Bossart
2020-06-29 19:38   ` Mark Brown
2020-07-01 19:33   ` Sasha Levin
2020-07-01 19:46     ` Pierre-Louis Bossart
2020-07-03  8:28       ` Hans de Goede
2020-07-03 17:03   ` Mark Brown
2020-07-10 14:02   ` Sasha Levin
2020-06-28 15:52 ` [PATCH 2/6] ASoC: rt5670: Correct RT5670_LDO_SEL_MASK Hans de Goede
2020-06-28 15:52 ` [PATCH 3/6] ASoC: rt5670: Add new gpio1_is_ext_spk_en quirk and enable it on the Lenovo Miix 2 10 Hans de Goede
2020-06-28 15:52 ` [PATCH 4/6] ASoC: rt5670: Fix dac- and adc- vol-tlv values being off by a factor of 10 Hans de Goede
2020-06-29 15:10   ` Pierre-Louis Bossart [this message]
2020-06-28 15:52 ` [PATCH 5/6] ASoC: rt5670: Remove struct rt5670_platform_data Hans de Goede
2020-06-29 20:09   ` Mark Brown
2020-06-29 20:24     ` Hans de Goede
2020-06-29 21:01       ` Mark Brown
2020-06-28 15:52 ` [PATCH 6/6] ASoC: rt5670: Rename dev_gpio to gpio1_is_irq Hans de Goede
2020-06-29 15:14 ` ASoC: rt5670/cht_bsw_rt5672: Some bugfixes and cleanups Pierre-Louis Bossart
2020-06-29 20:02   ` Hans de Goede
2020-06-29 20:07     ` Mark Brown
2020-06-29 20:19       ` Hans de Goede

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=fc377733-8db7-3422-65be-d79effaaad77@linux.intel.com \
    --to=pierre-louis.bossart@linux.intel.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=broonie@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=hdegoede@redhat.com \
    --cc=liam.r.girdwood@linux.intel.com \
    --cc=oder_chiou@realtek.com \
    --cc=yang.jie@linux.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).