Skip to contentSkip to conversation

- fix speaker output for toshiba nb205 netbooks

PATCH In review Nickolas 2 participants 6 messages Jan 12, 2010 – Jan 16, 2010 Sound

lore
Share & tools
lore

Nickolas

author
#0 lore raw

PATCH 1/1 - fix speaker output for toshiba nb205 netbooks

this is a quick fix i wrote up a couple days ago to fix speaker output on the Realtek ALC272 codec present in toshiba nb205 netbooks. presently, speaker output doesn't work at all on this model, regardless of settings in the mixer. this is because the current driver thinks the speaker is at nid 0x0c instead of the correct 0x17. i'm not too familiar with this hardware, so i'm not sure that this patch won't have any negative effects for other hardware. it also seems like a messy way of fixing the problem. any comments or suggestions are welcome, as is testing for those who have this board. diffed against the latest git.

Thanks,
Nick

--

sound/pci/hda/patch_realtek.c +53 -1
@@ -192,6 +192,7 @@ enum {
 	ALC663_ASUS_MODE8,
 	ALC272_DELL,
 	ALC272_DELL_ZM1,
+	ALC272_TOSHIBA_N200,
 	ALC272_SAMSUNG_NC10,
 	ALC662_AUTO,
 	ALC662_MODEL_LAST,
@@ -16725,6 +16726,11 @@ static struct hda_verb alc272_dell_init_
 	{}
 };
 
+static struct hda_verb alc272_toshiba_init_verbs[] = {
+	{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{}
+};
+
 static struct hda_verb alc663_mode7_init_verbs[] = {
 	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
 	{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
@@ -17255,6 +17261,36 @@ static void alc663_g50v_inithook(struct 
 	alc_mic_automute(codec);
 }
 
+static void alc272_toshiba_speaker_automute(struct hda_codec *codec)
+{
+	unsigned int present;
+	unsigned char bits;
+
+	present = snd_hda_jack_detect(codec, 0x21);
+	bits = present ? HDA_AMP_MUTE : 0;
+	snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
+					HDA_AMP_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:
+		alc_mic_automute(codec);
+		break;
+	}
+}
+
+static void alc272_toshiba_init_hook(struct hda_codec *codec)
+{
+	alc272_toshiba_speaker_automute(codec);
+	alc_mic_automute(codec);
+}
+
 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
 	HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
 	ALC262_HIPPO_MASTER_SWITCH,
@@ -17391,7 +17427,7 @@ static struct snd_pci_quirk alc662_cfg_t
 	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", ALC663_ASUS_MODE4),
+	SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC272_TOSHIBA_N200),
 	SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
 		      ALC662_3ST_6ch_DIG),
@@ -17696,6 +17732,22 @@ static struct alc_config_preset alc662_p
 		.setup = alc663_m51va_setup,
 		.init_hook = alc663_m51va_inithook,
 	},
+	[ALC272_TOSHIBA_N200] = {
+		.mixers = { alc663_asus_21jd_clfe_mixer },
+		.cap_mixer = alc662_auto_capture_mixer,
+		.init_verbs = { alc662_init_verbs,
+				alc663_21jd_amic_init_verbs,
+				alc272_toshiba_init_verbs },
+		.num_dacs = ARRAY_SIZE(alc662_dac_nids),
+		.hp_nid = 0x03,
+		.dac_nids = alc662_dac_nids,
+		.dig_out_nid = ALC662_DIGOUT_NID,
+		.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
+		.channel_mode = alc662_3ST_2ch_modes,
+		.unsol_event = alc272_toshiba_unsol_event,
+		.setup = alc663_mode4_setup,
+		.init_hook = alc272_toshiba_init_hook,
+	},
 	[ALC272_SAMSUNG_NC10] = {
 		.mixers = { alc272_nc10_mixer },
 		.init_verbs = { alc662_init_verbs,
#1 lore raw

At Tue, 12 Jan 2010 16:58:32 -0500,

Quoted 11 lines · Nickolas

this is a quick fix i wrote up a couple days ago to fix speaker output on the Realtek ALC272 codec present in toshiba nb205 netbooks. presently, speaker output doesn't work at all on this model, regardless of settings in the mixer. this is because the current driver thinks the speaker is at nid 0x0c instead of the correct 0x17. i'm not too familiar with this hardware, so i'm not sure that this patch won't have any negative effects for other hardware. it also seems like a messy way of fixing the problem. any comments or suggestions are welcome, as is testing for those who have this board. diffed against the latest git.

Thanks for the patch. The change looks safe to me.

But I'm still wondering whether model=auto doesn't work for this device. Could you try it with the latest driver?

thanks,

Takashi

Quoted 100 lines

Thanks,
Nick

--

sound/pci/hda/patch_realtek.c +53 -1
@@ -192,6 +192,7 @@ enum {
 	ALC663_ASUS_MODE8,
 	ALC272_DELL,
 	ALC272_DELL_ZM1,
+	ALC272_TOSHIBA_N200,
 	ALC272_SAMSUNG_NC10,
 	ALC662_AUTO,
 	ALC662_MODEL_LAST,
@@ -16725,6 +16726,11 @@ static struct hda_verb alc272_dell_init_
 	{}
 };
 
+static struct hda_verb alc272_toshiba_init_verbs[] = {
+	{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{}
+};
+
 static struct hda_verb alc663_mode7_init_verbs[] = {
 	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
 	{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
@@ -17255,6 +17261,36 @@ static void alc663_g50v_inithook(struct 
 	alc_mic_automute(codec);
 }
 
+static void alc272_toshiba_speaker_automute(struct hda_codec *codec)
+{
+	unsigned int present;
+	unsigned char bits;
+
+	present = snd_hda_jack_detect(codec, 0x21);
+	bits = present ? HDA_AMP_MUTE : 0;
+	snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
+					HDA_AMP_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:
+		alc_mic_automute(codec);
+		break;
+	}
+}
+
+static void alc272_toshiba_init_hook(struct hda_codec *codec)
+{
+	alc272_toshiba_speaker_automute(codec);
+	alc_mic_automute(codec);
+}
+
 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
 	HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
 	ALC262_HIPPO_MASTER_SWITCH,
@@ -17391,7 +17427,7 @@ static struct snd_pci_quirk alc662_cfg_t
 	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", ALC663_ASUS_MODE4),
+	SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC272_TOSHIBA_N200),
 	SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
 		      ALC662_3ST_6ch_DIG),
@@ -17696,6 +17732,22 @@ static struct alc_config_preset alc662_p
 		.setup = alc663_m51va_setup,
 		.init_hook = alc663_m51va_inithook,
 	},
+	[ALC272_TOSHIBA_N200] = {
+		.mixers = { alc663_asus_21jd_clfe_mixer },
+		.cap_mixer = alc662_auto_capture_mixer,
+		.init_verbs = { alc662_init_verbs,
+				alc663_21jd_amic_init_verbs,
+				alc272_toshiba_init_verbs },
+		.num_dacs = ARRAY_SIZE(alc662_dac_nids),
+		.hp_nid = 0x03,
+		.dac_nids = alc662_dac_nids,
+		.dig_out_nid = ALC662_DIGOUT_NID,
+		.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
+		.channel_mode = alc662_3ST_2ch_modes,
+		.unsol_event = alc272_toshiba_unsol_event,
+		.setup = alc663_mode4_setup,
+		.init_hook = alc272_toshiba_init_hook,
+	},
 	[ALC272_SAMSUNG_NC10] = {
 		.mixers = { alc272_nc10_mixer },
 		.init_verbs = { alc662_init_verbs,
author
#2 lore raw
Quoted 16 lines · On Wed, 13 Jan 2010 09:14:32 +0100 Takashi Iwai <[email protected]> wrote:

At Tue, 12 Jan 2010 16:58:32 -0500,

Quoted 11 lines · Nickolas

this is a quick fix i wrote up a couple days ago to fix speaker output on the Realtek ALC272 codec present in toshiba nb205 netbooks. presently, speaker output doesn't work at all on this model, regardless of settings in the mixer. this is because the current driver thinks the speaker is at nid 0x0c instead of the correct 0x17. i'm not too familiar with this hardware, so i'm not sure that this patch won't have any negative effects for other hardware. it also seems like a messy way of fixing the problem. any comments or suggestions are welcome, as is testing for those who have this board. diffed against the latest git.

Thanks for the patch. The change looks safe to me.

Quoted 8 lines

But I'm still wondering whether model=auto doesn't work for this device. Could you try it with the latest driver?

thanks,

Takashi

hmm, i feel stupid. so, it works with model=auto, but why is that not implied when the model parameter isn't specified on the command line?

anyway, thanks for the help :)

Nick

Quoted 100 lines
Quoted 100 lines

Thanks,
Nick

--

sound/pci/hda/patch_realtek.c +53 -1
@@ -192,6 +192,7 @@ enum {
 	ALC663_ASUS_MODE8,
 	ALC272_DELL,
 	ALC272_DELL_ZM1,
+	ALC272_TOSHIBA_N200,
 	ALC272_SAMSUNG_NC10,
 	ALC662_AUTO,
 	ALC662_MODEL_LAST,
@@ -16725,6 +16726,11 @@ static struct hda_verb alc272_dell_init_
 	{}
 };
 
+static struct hda_verb alc272_toshiba_init_verbs[] = {
+	{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{}
+};
+
 static struct hda_verb alc663_mode7_init_verbs[] = {
 	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
 	{0x16, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
@@ -17255,6 +17261,36 @@ static void alc663_g50v_inithook(struct 
 	alc_mic_automute(codec);
 }
 
+static void alc272_toshiba_speaker_automute(struct hda_codec *codec)
+{
+	unsigned int present;
+	unsigned char bits;
+
+	present = snd_hda_jack_detect(codec, 0x21);
+	bits = present ? HDA_AMP_MUTE : 0;
+	snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
+					HDA_AMP_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:
+		alc_mic_automute(codec);
+		break;
+	}
+}
+
+static void alc272_toshiba_init_hook(struct hda_codec *codec)
+{
+	alc272_toshiba_speaker_automute(codec);
+	alc_mic_automute(codec);
+}
+
 static struct snd_kcontrol_new alc662_ecs_mixer[] = {
 	HDA_CODEC_VOLUME("Master Playback Volume", 0x02, 0x0, HDA_OUTPUT),
 	ALC262_HIPPO_MASTER_SWITCH,
@@ -17391,7 +17427,7 @@ static struct snd_pci_quirk alc662_cfg_t
 	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", ALC663_ASUS_MODE4),
+	SND_PCI_QUIRK(0x1179, 0xff6e, "Toshiba NB200", ALC272_TOSHIBA_N200),
 	SND_PCI_QUIRK(0x144d, 0xca00, "Samsung NC10", ALC272_SAMSUNG_NC10),
 	SND_PCI_QUIRK(0x1458, 0xa002, "Gigabyte 945GCM-S2L",
 		      ALC662_3ST_6ch_DIG),
@@ -17696,6 +17732,22 @@ static struct alc_config_preset alc662_p
 		.setup = alc663_m51va_setup,
 		.init_hook = alc663_m51va_inithook,
 	},
+	[ALC272_TOSHIBA_N200] = {
+		.mixers = { alc663_asus_21jd_clfe_mixer },
+		.cap_mixer = alc662_auto_capture_mixer,
+		.init_verbs = { alc662_init_verbs,
+				alc663_21jd_amic_init_verbs,
+				alc272_toshiba_init_verbs },
+		.num_dacs = ARRAY_SIZE(alc662_dac_nids),
+		.hp_nid = 0x03,
+		.dac_nids = alc662_dac_nids,
+		.dig_out_nid = ALC662_DIGOUT_NID,
+		.num_channel_mode = ARRAY_SIZE(alc662_3ST_2ch_modes),
+		.channel_mode = alc662_3ST_2ch_modes,
+		.unsol_event = alc272_toshiba_unsol_event,
+		.setup = alc663_mode4_setup,
+		.init_hook = alc272_toshiba_init_hook,
+	},
 	[ALC272_SAMSUNG_NC10] = {
 		.mixers = { alc272_nc10_mixer },
 		.init_verbs = { alc662_init_verbs,
#3 lore raw

At Wed, 13 Jan 2010 11:06:11 -0500,

Quoted 24 lines · Nickolas
Quoted 20 lines · On Wed, 13 Jan 2010 09:14:32 +0100 Takashi Iwai <[email protected]> wrote:

At Tue, 12 Jan 2010 16:58:32 -0500,

Quoted 11 lines · Nickolas

this is a quick fix i wrote up a couple days ago to fix speaker output on the Realtek ALC272 codec present in toshiba nb205 netbooks. presently, speaker output doesn't work at all on this model, regardless of settings in the mixer. this is because the current driver thinks the speaker is at nid 0x0c instead of the correct 0x17. i'm not too familiar with this hardware, so i'm not sure that this patch won't have any negative effects for other hardware. it also seems like a messy way of fixing the problem. any comments or suggestions are welcome, as is testing for those who have this board. diffed against the latest git.

Thanks for the patch. The change looks safe to me.

But I'm still wondering whether model=auto doesn't work for this device. Could you try it with the latest driver?

Quoted 6 lines
Quoted 4 lines

thanks,

Takashi

hmm, i feel stupid. so, it works with model=auto, but why is that not implied when the model parameter isn't specified on the command line?

OK, that's good to hear. IIRC, the quirk was there because it didn't work with model=auto, at least, at that time.

I guess it's time to back to auto option again. I'll fix now.

Thanks for quick testing!

Takashi

author
#4 lore raw
Quoted 36 lines · On Wed, 13 Jan 2010 17:17:20 +0100 Takashi Iwai <[email protected]> wrote:

At Wed, 13 Jan 2010 11:06:11 -0500,

Quoted 24 lines · Nickolas
Quoted 20 lines · On Wed, 13 Jan 2010 09:14:32 +0100 Takashi Iwai <[email protected]> wrote:

At Tue, 12 Jan 2010 16:58:32 -0500,

Quoted 11 lines · Nickolas

this is a quick fix i wrote up a couple days ago to fix speaker output on the Realtek ALC272 codec present in toshiba nb205 netbooks. presently, speaker output doesn't work at all on this model, regardless of settings in the mixer. this is because the current driver thinks the speaker is at nid 0x0c instead of the correct 0x17. i'm not too familiar with this hardware, so i'm not sure that this patch won't have any negative effects for other hardware. it also seems like a messy way of fixing the problem. any comments or suggestions are welcome, as is testing for those who have this board. diffed against the latest git.

Thanks for the patch. The change looks safe to me.

But I'm still wondering whether model=auto doesn't work for this device. Could you try it with the latest driver?

Quoted 6 lines
Quoted 4 lines

thanks,

Takashi

hmm, i feel stupid. so, it works with model=auto, but why is that not implied when the model parameter isn't specified on the command line?

OK, that's good to hear. IIRC, the quirk was there because it didn't work with model=auto, at least, at that time.

Quoted 6 lines

I guess it's time to back to auto option again. I'll fix now.

Thanks for quick testing!

Takashi

no problem. i'll test all the ports later today when i have time to make sure that they work properly with model=auto, just to be sure. thanks for the help!

Nick

author
#5 lore raw
Quoted 41 lines · On Wed, 13 Jan 2010 14:13:08 -0500 Nickolas <[email protected]> wrote:
Quoted 38 lines · On Wed, 13 Jan 2010 17:17:20 +0100 Takashi Iwai <[email protected]> wrote:

At Wed, 13 Jan 2010 11:06:11 -0500,

Quoted 24 lines · Nickolas
Quoted 20 lines · On Wed, 13 Jan 2010 09:14:32 +0100 Takashi Iwai <[email protected]> wrote:

At Tue, 12 Jan 2010 16:58:32 -0500,

Quoted 11 lines · Nickolas

this is a quick fix i wrote up a couple days ago to fix speaker output on the Realtek ALC272 codec present in toshiba nb205 netbooks. presently, speaker output doesn't work at all on this model, regardless of settings in the mixer. this is because the current driver thinks the speaker is at nid 0x0c instead of the correct 0x17. i'm not too familiar with this hardware, so i'm not sure that this patch won't have any negative effects for other hardware. it also seems like a messy way of fixing the problem. any comments or suggestions are welcome, as is testing for those who have this board. diffed against the latest git.

Thanks for the patch. The change looks safe to me.

But I'm still wondering whether model=auto doesn't work for this device. Could you try it with the latest driver?

Quoted 6 lines
Quoted 4 lines

thanks,

Takashi

hmm, i feel stupid. so, it works with model=auto, but why is that not implied when the model parameter isn't specified on the command line?

OK, that's good to hear. IIRC, the quirk was there because it didn't work with model=auto, at least, at that time.

I guess it's time to back to auto option again. I'll fix now.

Quoted 8 lines
Quoted 4 lines

Thanks for quick testing!

Takashi

no problem. i'll test all the ports later today when i have time to make sure that they work properly with model=auto, just to be sure. thanks for the help!

Nick

sorry for the delay. it looks like everything works for the most part. there are a few problems, ie with mic input, but those are hopefully just configuration issues, but it is no worse than it was before with the quirk. hope that helps.

Nick