[alsa-devel] [PATCH 13/31] HDA patch_via.c: Refresh front playback mute if hp plug-in mutes speaker.
Li Bo
liboat at gmail.com
Mon Oct 5 16:27:16 CEST 2009
[ALSA] HDA VIA: Refresh front playback mute if hp plug-in mutes speaker.
Signed-off-by: Lydia Wang <lydiawang at viatech.com.cn>
Index: sound-2.6/sound/pci/hda/patch_via.c
===================================================================
--- sound-2.6.orig/sound/pci/hda/patch_via.c 2009-10-05 15:10:13.000000000 +0800
+++ sound-2.6/sound/pci/hda/patch_via.c 2009-10-05 15:10:22.000000000 +0800
@@ -1346,14 +1346,26 @@
/* mute internal speaker if HP is plugged */
static void via_hp_automute(struct hda_codec *codec)
{
- unsigned int present;
+ unsigned int present = 0;
struct via_spec *spec = codec->spec;
+ char name[32] = "Front Playback Switch";
present = snd_hda_codec_read(codec, spec->autocfg.hp_pins[0], 0,
AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
- snd_hda_codec_amp_stereo(codec, spec->autocfg.line_out_pins[0],
- HDA_OUTPUT, 0, HDA_AMP_MUTE,
- present ? HDA_AMP_MUTE : 0);
+
+ if (!spec->hp_independent_mode) {
+ struct snd_card *card = codec->bus->card;
+ struct snd_kcontrol *kctl;
+ /* auto mute */
+ snd_hda_codec_amp_stereo(
+ codec, spec->autocfg.line_out_pins[0], HDA_OUTPUT, 0,
+ HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
+ /* notify change */
+ list_for_each_entry(kctl, &card->controls, list)
+ if (strcmp(kctl->id.name, name) == 0)
+ snd_ctl_notify(card, SNDRV_CTL_EVENT_MASK_VALUE,
+ &kctl->id);
+ }
}
static void via_gpio_control(struct hda_codec *codec)
More information about the Alsa-devel
mailing list