From 41296831ad60b037f4c2ff078966b1ecdf329da6 Mon Sep 17 00:00:00 2001
From: Leann Ogasawara <leann.ogasawara@canonical.com>
Date: Tue, 18 Aug 2009 11:56:47 -0700
Subject: [PATCH] UBUNTU: SAUCE: Enable speakers for Toshiba NB200 (Realteak ALC272)

The following adds a new verb table to enable the speakers 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).  Carry this until it's merged upstream.

OriginalLocation: Hardy LUM netbook-lpia branch
BugLink: BugLink: http://bugs.launchpad.net/bugs/389040

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

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 6f683e4..80b630a 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -191,6 +191,7 @@ enum {
 	ALC272_DELL,
 	ALC272_DELL_ZM1,
 	ALC272_SAMSUNG_NC10,
+	ALC272_TOSHIBA_NB200,
 	ALC662_AUTO,
 	ALC662_MODEL_LAST,
 };
@@ -16327,6 +16328,28 @@ static struct hda_verb alc272_dell_init_verbs[] = {
 	{}
 };
 
+static struct hda_verb alc272_toshiba_init_verbs[] = {
+	/* Front Pin: output 0 (0x0c) */
+	{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT}, /* 0x14 */
+	{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE}, /* 0x14 */
+	/* Front Mic pin: input vref at 80% */
+	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80}, /* 0x19 */
+	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE},    /* 0x19 */
+	{0x17, AC_VERB_SET_EAPD_BTLENABLE, 2}, /* 0x14 */
+	{0x19, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN}, /* originally 0x12 */
+	{0x13, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
+	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
+	{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
+	{0x21, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
+	{0x21, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x21, AC_VERB_SET_CONNECT_SEL, 0x01},  /* Headphone */
+	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0)},
+	{0x23, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_UNMUTE(9)},
+	{0x18, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_MIC_EVENT},
+	{0x21, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC880_HP_EVENT},
+	{}
+};
+
 static struct snd_kcontrol_new alc662_auto_capture_mixer[] = {
 	HDA_CODEC_VOLUME("Capture Volume", 0x09, 0x0, HDA_INPUT),
 	HDA_CODEC_MUTE("Capture Switch", 0x09, 0x0, HDA_INPUT),
@@ -16813,6 +16836,7 @@ static const char *alc662_models[ALC662_MODEL_LAST] = {
 	[ALC272_DELL]		= "dell",
 	[ALC272_DELL_ZM1]	= "dell-zm1",
 	[ALC272_SAMSUNG_NC10]	= "samsung-nc10",
+	[ALC272_TOSHIBA_NB200]	= "toshiba-nb200",
 	[ALC662_AUTO]		= "auto",
 };
 
@@ -16870,6 +16894,7 @@ static struct snd_pci_quirk alc662_cfg_tbl[] = {
 	SND_PCI_QUIRK(0x105b, 0x0cd6, "Foxconn", ALC662_ECS),
 	SND_PCI_QUIRK(0x105b, 0x0d47, "Foxconn 45CMX/45GMX/45CMX-K",
 		      ALC662_3ST_6ch_DIG),
+	SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC272_TOSHIBA_NB200),
 	SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
 		      ALC662_3ST_6ch_DIG),
@@ -17154,6 +17179,20 @@ static struct alc_config_preset alc662_presets[] = {
 		.unsol_event = alc663_mode4_unsol_event,
 		.init_hook = alc663_mode4_inithook,
 	},
+	[ALC272_TOSHIBA_NB200] = {
+		.mixers = { alc663_m51va_mixer },
+		.init_verbs = { alc662_init_verbs, alc272_toshiba_init_verbs },
+		.num_dacs = ARRAY_SIZE(alc662_dac_nids),
+		.dac_nids = alc662_dac_nids,
+		.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
+		.adc_nids = alc662_adc_nids,
+		.num_adc_nids = ARRAY_SIZE(alc662_adc_nids),
+		.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,
+	},
 };
 
 
-- 
1.5.4.3

