All of lore.kernel.org
 help / color / mirror / Atom feed
From: Clemens Ladisch <clemens@ladisch.de>
To: alsa-devel@alsa-project.org, Julian Scheel <julian@jusst.de>
Subject: Re: Mixer volume/decibel mapping
Date: Fri, 28 May 2010 16:10:59 +0200	[thread overview]
Message-ID: <4BFFCEF3.9060309@ladisch.de> (raw)
In-Reply-To: <AANLkTinxF-OdPg_mZabDfupb_knV0uh2bslOQeBXyDgp@mail.gmail.com>

Raymond Yau wrote:
> 2010/5/25 Clemens Ladisch <clemens@ladisch.de>
> > Raymond Yau wrote:
> > > I have doubt about DECLARE_TLV_DB_LINEAR(ak4396_db_scale, TLV_DB_GAIN_MUTE, 0);
> > >
> > > since the datasheet mention that dB range is only -48dB to 0dB
> > >
> > > ATT = 20 log10 (ATT_DATA / 255) [dB]
> > >
> > > How can AK4396 has scale of -inf DB to 0dB in the driver code  ?
> >
> > When ATT_DATA = 0, there is no output, which is an attenuation of -inf.
> > The next value, ATT_DATA = 1, results in ATT = -48 dB.
> 
> refer to ice1712/prodigy_hifi.c , why the comment is -64dB to 0dB  ?
> 
> /*
>  * DAC volume attenuation mixer control (-64dB to 0dB)
> */

Apparently just copied from pontis.c.

> static int ak4396_dac_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
> {
>         uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
>         uinfo->count = 2;
>         uinfo->value.integer.min = 0;   /* mute */
>         uinfo->value.integer.max = 0xFF; /* linear */
>        return 0;
> }
> ...
> static const DECLARE_TLV_DB_SCALE(db_scale_wm_dac, -12700, 100, 1);

And this defines a dB scale from -127 dB to +128 dB, which will break
PulseAudio's volume calculations.

> > This is true regardless of the precision of the multiplier.  Even a one-
> > bit factor behaves like this; in fact, this would describe a mute switch.
> 
> This mean that the dB range should be calculated from the next step above
> the min_dB and max_dB when min_dB regarded as a mute switch

No; the AK4396 datasheet mentions -48 dB only because this is the minimum
attenuation that isn't completely mute.  The minimum of the ATT_DATA
registers _is_ zero, i.e. -inf dB, and therefore TLV_DB_GAIN_MUTE is the
correct minimum for the dB range.


Regards,
Clemens

  reply	other threads:[~2010-05-28 14:11 UTC|newest]

Thread overview: 47+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-05-19 16:34 Mixer volume/decibel mapping Sebastian H.
2010-05-20  7:34 ` Clemens Ladisch
2010-05-20  8:01 ` James Courtier-Dutton
2010-05-20  8:53   ` Raymond Yau
2010-05-20  9:41     ` Sebastian H.
2010-05-20 16:13       ` James Courtier-Dutton
2010-05-21  0:35         ` Raymond Yau
2010-05-21  1:30         ` Raymond Yau
2010-05-21  8:18           ` Sebastian H.
2010-06-07  3:37             ` Raymond Yau
2010-06-07  9:19               ` Sebastian H.
2010-06-08  1:03                 ` Raymond Yau
2010-06-08  6:02                   ` Sebastian Holtermann
2010-06-08 15:31                     ` Raymond Yau
2010-06-09 10:26                       ` Sebastian H.
2010-06-08  6:08                   ` Sebastian H.
2010-06-09  5:39                     ` Raymond Yau
2010-06-09  7:34                       ` Sebastian H.
2010-06-10  0:08                         ` Raymond Yau
2010-06-09  5:55                     ` Raymond Yau
2010-06-08  2:23                 ` Raymond Yau
2010-05-21  6:35         ` Clemens Ladisch
2010-05-21  6:51           ` Peter Ujfalusi
2010-05-21  9:56             ` Clemens Ladisch
2010-05-24  2:52               ` Raymond Yau
2010-05-25  8:38                 ` Clemens Ladisch
2010-05-25  8:43                   ` James Courtier-Dutton
2010-05-25  8:49                     ` Clemens Ladisch
2010-05-25 23:24                     ` Raymond Yau
2010-05-27 13:32                       ` Colin Guthrie
2010-05-29  3:54                         ` Raymond Yau
2010-05-29  1:57                     ` Raymond Yau
2010-05-29 18:46                       ` Colin Guthrie
2010-06-04 23:46                   ` Raymond Yau
     [not found]               ` <AANLkTik7mD1DAVWkOwM7sNu0EfgGApvzX9WRXWBOO4PI@mail.gmail.com>
2010-05-25  8:45                 ` Clemens Ladisch
2010-05-25 13:51                   ` Raymond Yau
2010-05-25 14:36                     ` Clemens Ladisch
2010-05-25 23:00                       ` Raymond Yau
2010-05-27  0:20                       ` Raymond Yau
2010-05-28 13:04                       ` Raymond Yau
2010-05-28 14:10                         ` Clemens Ladisch [this message]
2010-05-29  1:31                           ` Raymond Yau
2010-05-21 13:16           ` James Courtier-Dutton
2010-05-25  8:21             ` Clemens Ladisch
2010-06-09  6:19             ` Raymond Yau
2010-05-22  9:24           ` Raymond Yau
2010-05-20  9:20   ` Sebastian H.

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=4BFFCEF3.9060309@ladisch.de \
    --to=clemens@ladisch.de \
    --cc=alsa-devel@alsa-project.org \
    --cc=julian@jusst.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.