summaryrefslogtreecommitdiffstats
path: root/patches/linux-3.6.10/0053-bcm2835-ctl-fix-alsamixer-control.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/linux-3.6.10/0053-bcm2835-ctl-fix-alsamixer-control.patch')
-rw-r--r--patches/linux-3.6.10/0053-bcm2835-ctl-fix-alsamixer-control.patch59
1 files changed, 59 insertions, 0 deletions
diff --git a/patches/linux-3.6.10/0053-bcm2835-ctl-fix-alsamixer-control.patch b/patches/linux-3.6.10/0053-bcm2835-ctl-fix-alsamixer-control.patch
new file mode 100644
index 0000000..726a5da
--- /dev/null
+++ b/patches/linux-3.6.10/0053-bcm2835-ctl-fix-alsamixer-control.patch
@@ -0,0 +1,59 @@
+From: Arne Fitzenreiter <arne.fitzenreiter@ipfire.org>
+Date: Wed, 6 Jun 2012 08:02:10 +0200
+Subject: [PATCH] bcm2835-ctl: fix alsamixer control.
+
+alsamixer read the volume for the screen controller so we had to
+scale the chipvol back to db for reading.
+---
+ sound/arm/bcm2835-ctl.c | 22 ++++++++++++++++------
+ 1 file changed, 16 insertions(+), 6 deletions(-)
+
+diff --git a/sound/arm/bcm2835-ctl.c b/sound/arm/bcm2835-ctl.c
+index c0546e35..828a820 100755
+--- a/sound/arm/bcm2835-ctl.c
++++ b/sound/arm/bcm2835-ctl.c
+@@ -33,6 +33,19 @@
+
+ #include "bcm2835.h"
+
++
++/* functions to convert alsa to chip volume and back. */
++int alsa2chip(int vol)
++{
++ return -((vol << 8) / 100);
++}
++
++int chip2alsa(int vol)
++{
++ return -((vol * 100) >> 8);
++}
++
++
+ static int snd_bcm2835_ctl_info(struct snd_kcontrol *kcontrol,
+ struct snd_ctl_elem_info *uinfo)
+ {
+@@ -64,7 +77,7 @@ static int snd_bcm2835_ctl_get(struct snd_kcontrol *kcontrol,
+ BUG_ON(!chip && !(chip->avail_substreams & AVAIL_SUBSTREAMS_MASK));
+
+ if (kcontrol->private_value == PCM_PLAYBACK_VOLUME)
+- ucontrol->value.integer.value[0] = chip->volume;
++ ucontrol->value.integer.value[0] = chip2alsa(chip->volume);
+ else if (kcontrol->private_value == PCM_PLAYBACK_MUTE)
+ ucontrol->value.integer.value[0] = chip->mute;
+ else if (kcontrol->private_value == PCM_PLAYBACK_DEVICE)
+@@ -85,13 +98,10 @@ static int snd_bcm2835_ctl_put(struct snd_kcontrol *kcontrol,
+ changed = 1;
+ }
+ if (changed
+- || (ucontrol->value.integer.value[0] != chip->volume)) {
+- int atten;
++ || (ucontrol->value.integer.value[0] != chip2alsa(chip->volume))) {
+
+- chip->volume = ucontrol->value.integer.value[0];
++ chip->volume = alsa2chip(ucontrol->value.integer.value[0]);
+ changed = 1;
+- atten = -((chip->volume << 8) / 100);
+- chip->volume = atten;
+ }
+
+ } else if (kcontrol->private_value == PCM_PLAYBACK_MUTE) {