]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blob - src/patches/linux-3.2-bcm2835-alsamixer.patch
php: remove -march from CFLAGS on arm build.
[people/teissler/ipfire-2.x.git] / src / patches / linux-3.2-bcm2835-alsamixer.patch
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
4 @@ -33,6 +33,19 @@
5
6 #include "bcm2835.h"
7
8 +
9 +/* functions to convert alsa to chip volume and back. */
10 +int alsa2chip(int vol)
11 +{
12 + return -((vol << 8) / 100);
13 +}
14 +
15 +int chip2alsa(int vol)
16 +{
17 + return -((vol * 100) >> 8);
18 +}
19 +
20 +
21 static int snd_bcm2835_ctl_info(struct snd_kcontrol *kcontrol,
22 struct snd_ctl_elem_info *uinfo)
23 {
24 @@ -64,7 +77,7 @@
25 BUG_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK));
26
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)
33 @@ -85,13 +98,10 @@
34 changed = 1;
35 }
36 if (changed
37 - || (ucontrol->value.integer.value[0] != chip->volume)) {
38 - int atten;
39 + || (ucontrol->value.integer.value[0] != chip2alsa(chip->volume))) {
40
41 - chip->volume = ucontrol->value.integer.value[0];
42 + chip->volume = alsa2chip(ucontrol->value.integer.value[0]);
43 changed = 1;
44 - atten = -((chip->volume << 8) / 100);
45 - chip->volume = atten;
46 }
47
48 } else if (kcontrol->private_value == PCM_PLAYBACK_MUTE) {