]> git.alsa-project.org Git - alsa-lib.git/commit
snd_tlv_convert_from_dB: fix decreasing gain across entries
authorStephen Warren <swarren@nvidia.com>
Mon, 30 Sep 2013 21:25:49 +0000 (15:25 -0600)
committerTakashi Iwai <tiwai@suse.de>
Tue, 1 Oct 2013 10:24:45 +0000 (12:24 +0200)
commit529706fc323813cfad7c48d3738ea0bfa5b8305e
treee6bfb936e2a4624cbac0629806d7d6a52c06908c
parent383912ef83cb2d5835239a23f6afc6198697a587
snd_tlv_convert_from_dB: fix decreasing gain across entries

Currently, for a TLV consisting of TLV_DB_SCALE_ITEMs, if e.g. alsamixer
calls snd_mixer_selem_set_playback_dB() with a value that is in-between
two TLV_DB_SCALE_ITEMs, and xdir is negative, the selected raw hardware
value is the minimum in the first range above that value, rather than the
maximum in the last range below that value.

The user-visible symptom is that in alsamixer, pressing the down key to
reduce the value sticks at certain points, and cannot be incrementally
reduced any further, although directly selecting a much lower value (e.g.
by pressing 0..9) works as expected. This is triggered e.g. by
sound/soc/codec/max98090.c's max98090_hp_tlv[].

Fix this by checking whether xdir is positive or not, rather than
checking whether it has a non-zero value. The code to select the previous
range's max value is already present. This matches how xdir is used in
other parts of the code.

Signed-off-by: Stephen Warren <swarren@nvidia.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
src/control/tlv.c