aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Henningsson <david.henningsson@canonical.com>2012-08-10 07:29:32 -0400
committerTakashi Iwai <tiwai@suse.de>2012-08-10 08:10:20 -0400
commit14bc9c6dc694e2d7930802f7afd275de25ef8394 (patch)
treec7ba404da735043b93ef8207ed370cd733b7efca
parentde64c0ee7dbcbfbbe63bd9ea45783d87babc6452 (diff)
ALSA: hda - Fix panned "Beep Playback Switch"
When "Beep Playback Switch" had a different value on left and right channels (such as muting left but not right, or vice versa), this could result in the right channel being ignored. This patch enables beep to be sounding from right channel only, and also give correct result back to userspace (e g amixer). Signed-off-by: David Henningsson <david.henningsson@canonical.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r--sound/pci/hda/hda_beep.c20
1 files changed, 14 insertions, 6 deletions
diff --git a/sound/pci/hda/hda_beep.c b/sound/pci/hda/hda_beep.c
index 0bc2315b181d..d26ae65b43b7 100644
--- a/sound/pci/hda/hda_beep.c
+++ b/sound/pci/hda/hda_beep.c
@@ -237,10 +237,9 @@ int snd_hda_mixer_amp_switch_get_beep(struct snd_kcontrol *kcontrol,
237{ 237{
238 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 238 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
239 struct hda_beep *beep = codec->beep; 239 struct hda_beep *beep = codec->beep;
240 if (beep) { 240 if (beep && !beep->enabled) {
241 ucontrol->value.integer.value[0] = 241 ucontrol->value.integer.value[0] =
242 ucontrol->value.integer.value[1] = 242 ucontrol->value.integer.value[1] = 0;
243 beep->enabled;
244 return 0; 243 return 0;
245 } 244 }
246 return snd_hda_mixer_amp_switch_get(kcontrol, ucontrol); 245 return snd_hda_mixer_amp_switch_get(kcontrol, ucontrol);
@@ -252,9 +251,18 @@ int snd_hda_mixer_amp_switch_put_beep(struct snd_kcontrol *kcontrol,
252{ 251{
253 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 252 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
254 struct hda_beep *beep = codec->beep; 253 struct hda_beep *beep = codec->beep;
255 if (beep) 254 if (beep) {
256 snd_hda_enable_beep_device(codec, 255 u8 chs = get_amp_channels(kcontrol);
257 *ucontrol->value.integer.value); 256 int enable = 0;
257 long *valp = ucontrol->value.integer.value;
258 if (chs & 1) {
259 enable |= *valp;
260 valp++;
261 }
262 if (chs & 2)
263 enable |= *valp;
264 snd_hda_enable_beep_device(codec, enable);
265 }
258 return snd_hda_mixer_amp_switch_put(kcontrol, ucontrol); 266 return snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
259} 267}
260EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_put_beep); 268EXPORT_SYMBOL_HDA(snd_hda_mixer_amp_switch_put_beep);