diff options
author | Sergey Vlasov <vsu@altlinux.ru> | 2005-04-25 05:22:20 -0400 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2005-05-29 04:05:17 -0400 |
commit | b16760bbb9e3c63b6beef7e2c8f8db64ab5efe70 (patch) | |
tree | eff28eebc3b50ee9b5d6dbe0959c104844e5d52a /sound | |
parent | ee7333970bee3e7565feeb3edfef4db81cbe72e5 (diff) |
[ALSA] fix behaviour of ac97_enum_mixer elements
AC97 Codec
ac97_enum mixer elements (e.g., 'Capture Source') did not work because
of wrong bitmask calculation in snd_ac97_get_enum_double() and
snd_ac97_put_enum_double().
https://bugtrack.alsa-project.org/alsa-bug/view.php?id=1072
Signed-off-by: Sergey Vlasov <vsu@altlinux.ru>
Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/ac97/ac97_codec.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c index 1ad7f83a65e1..36a33ae9ae03 100644 --- a/sound/pci/ac97/ac97_codec.c +++ b/sound/pci/ac97/ac97_codec.c | |||
@@ -465,7 +465,7 @@ int snd_ac97_get_enum_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * u | |||
465 | struct ac97_enum *e = (struct ac97_enum *)kcontrol->private_value; | 465 | struct ac97_enum *e = (struct ac97_enum *)kcontrol->private_value; |
466 | unsigned short val, bitmask; | 466 | unsigned short val, bitmask; |
467 | 467 | ||
468 | for (bitmask = 1; bitmask > e->mask; bitmask <<= 1) | 468 | for (bitmask = 1; bitmask < e->mask; bitmask <<= 1) |
469 | ; | 469 | ; |
470 | val = snd_ac97_read_cache(ac97, e->reg); | 470 | val = snd_ac97_read_cache(ac97, e->reg); |
471 | ucontrol->value.enumerated.item[0] = (val >> e->shift_l) & (bitmask - 1); | 471 | ucontrol->value.enumerated.item[0] = (val >> e->shift_l) & (bitmask - 1); |
@@ -482,7 +482,7 @@ int snd_ac97_put_enum_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * u | |||
482 | unsigned short val; | 482 | unsigned short val; |
483 | unsigned short mask, bitmask; | 483 | unsigned short mask, bitmask; |
484 | 484 | ||
485 | for (bitmask = 1; bitmask > e->mask; bitmask <<= 1) | 485 | for (bitmask = 1; bitmask < e->mask; bitmask <<= 1) |
486 | ; | 486 | ; |
487 | if (ucontrol->value.enumerated.item[0] > e->mask - 1) | 487 | if (ucontrol->value.enumerated.item[0] > e->mask - 1) |
488 | return -EINVAL; | 488 | return -EINVAL; |