[Jaunty] [Patch 2/3] SRU: Toshiba NB200 (Realtek ALC272) mute speakers when headphones are plugged in

Leann Ogasawara leann.ogasawara at canonical.com
Tue Nov 3 17:48:32 UTC 2009


>From 13986cae0d540ca8a98ec0a7ca081b44edb2c8e8 Mon Sep 17 00:00:00 2001
From: Leann Ogasawara <leann.ogasawara at canonical.com>
Date: Fri, 21 Aug 2009 13:56:28 -0700
Subject: [PATCH] UBUNTU: SAUCE: Toshiba NB200 (Realtek ALC272) mute speakers when headphones are plugged in

OriginalAuthor: Andres Salomon <dilinger at canonical.com>
OriginalLocation: Hardy LUM netbook-lpia branch
BugLink: http://bugs.launchpad.net/bugs/438318

Mute the speakers when headphones are plugged in for the Toshiba
NB200, Realtek ALC272 (Vendor ID: 0x10ec:0272, Subsystem ID:
0x1179:0xff6e, Revision ID: 0x100001).  Code was forward ported from
Hardy LUM (netbook-lpia branch).

Signed-off-by: Leann Ogasawara <leann.ogasawara at canonical.com>
---
 sound/pci/hda/patch_realtek.c |   38 ++++++++++++++++++++++++++++++++++++--
 1 files changed, 36 insertions(+), 2 deletions(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 79710c5..1b9f430 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -15646,6 +15646,40 @@ static void alc663_m51va_inithook(struct hda_codec *codec)
 	alc663_m51va_mic_automute(codec);
 }
 
+static void alc272_toshiba_speaker_automute(struct hda_codec *codec)
+{
+	unsigned int present;
+	unsigned char bits;
+
+	present = snd_hda_codec_read(codec, 0x21, 0,
+			AC_VERB_GET_PIN_SENSE, 0)
+			& AC_PINSENSE_PRESENCE;
+	bits = present ? HDA_AMP_MUTE : 0;
+	snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
+				AMP_OUT_MUTE, bits);
+	snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 1,
+				AMP_OUT_MUTE, bits);
+}
+
+static void alc272_toshiba_unsol_event(struct hda_codec *codec,
+		unsigned int res)
+{
+	switch (res >> 26) {
+	case ALC880_HP_EVENT:
+		alc272_toshiba_speaker_automute(codec);
+		break;
+	case ALC880_MIC_EVENT:
+		alc663_m51va_mic_automute(codec);
+		break;
+	}
+}
+
+static void alc272_toshiba_inithook(struct hda_codec *codec)
+{
+	alc272_toshiba_speaker_automute(codec);
+	alc663_m51va_mic_automute(codec);
+}
+
 /* ***************** Mode1 ******************************/
 static void alc663_mode1_unsol_event(struct hda_codec *codec,
 					   unsigned int res)
@@ -16086,8 +16120,8 @@ static struct alc_config_preset alc662_presets[] = {
 		.capsrc_nids = alc662_capsrc_nids,
 		.channel_mode = alc662_3ST_2ch_modes,
 		.input_mux = &alc663_m51va_capture_source,
-		.unsol_event = alc663_m51va_unsol_event,
-		.init_hook = alc663_m51va_inithook,
+		.unsol_event = alc272_toshiba_unsol_event,
+		.init_hook = alc272_toshiba_inithook,
 	},
 	[ALC663_ASUS_M51VA] = {
 		.mixers = { alc663_m51va_mixer, alc662_capture_mixer},
-- 
1.5.6.3







More information about the kernel-team mailing list