1 diff -Naur linux-3.2.19.org/sound/arm/bcm2835-ctl.c linux-3.2.19/sound/arm/bcm2835-ctl.c
2 --- linux-3.2.19.org/sound/arm/bcm2835-ctl.c 2012-06-04 21:11:15.000000000 +0200
3 +++ linux-3.2.19/sound/arm/bcm2835-ctl.c 2012-06-04 21:32:37.969298501 +0200
9 +/* functions to convert alsa to chip volume and back. */
10 +int alsa2chip(int vol)
12 + return -((vol << 8) / 100);
15 +int chip2alsa(int vol)
17 + return -((vol * 100) >> 8);
21 static int snd_bcm2835_ctl_info(struct snd_kcontrol *kcontrol,
22 struct snd_ctl_elem_info *uinfo)
25 BUG_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK));
27 if (kcontrol->private_value == PCM_PLAYBACK_VOLUME)
28 - ucontrol->value.integer.value[0] = chip->volume;
29 + ucontrol->value.integer.value[0] = chip2alsa(chip->volume);
30 else if (kcontrol->private_value == PCM_PLAYBACK_MUTE)
31 ucontrol->value.integer.value[0] = chip->mute;
32 else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE)
37 - || (ucontrol->value.integer.value[0] != chip->volume)) {
39 + || (ucontrol->value.integer.value[0] != chip2alsa(chip->volume))) {
41 - chip->volume = ucontrol->value.integer.value[0];
42 + chip->volume = alsa2chip(ucontrol->value.integer.value[0]);
44 - atten = -((chip->volume << 8) / 100);
45 - chip->volume = atten;
48 } else if (kcontrol->private_value == PCM_PLAYBACK_MUTE) {