All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Added Realtek ALC888 model entry for the Acer Aspire 4930G laptop
@ 2008-11-18 11:21 Petry Vincent
  2008-11-18 11:41 ` Takashi Iwai
  0 siblings, 1 reply; 12+ messages in thread
From: Petry Vincent @ 2008-11-18 11:21 UTC (permalink / raw)
  To: alsa-devel

[-- Attachment #1: Type: text/plain, Size: 755 bytes --]

Hello,

I would like to contribute a patch that adds a model entry for the Acer
Aspire 4930G laptop. Its chipset is a Realtek ALC888S-VC.
The new model is based on the "acer" model and fixes the following bugs
missing features:
- https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4223 Reversed
stereo (invalid report, please close it)
- https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4224 Headphone
jack sense
- https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4225 Internal mic
- channel mode (it was missing from the base acer model)

The model name is "acer-aspire-4930g" but could be renamed to something
more general, if necessary.

See attached patch file. It has been made against alsa-driver-1.0.18a.

Thanks,

Vincent Petry




[-- Attachment #2: alsa-driver-acer-aspire-4930g.patch --]
[-- Type: text/x-patch, Size: 14085 bytes --]

diff -Naur alsa-driver-1.0.18a/alsa-kernel/pci/hda/patch_realtek.c alsa-driver-1.0.18a-mod3//alsa-kernel/pci/hda/patch_realtek.c
--- alsa-driver-1.0.18a/alsa-kernel/pci/hda/patch_realtek.c	2008-11-12 18:02:25.000000000 +0800
+++ alsa-driver-1.0.18a-mod3//alsa-kernel/pci/hda/patch_realtek.c	2008-11-16 15:05:40.000000000 +0800
@@ -216,6 +216,7 @@
 	ALC883_TARGA_2ch_DIG,
 	ALC883_ACER,
 	ALC883_ACER_ASPIRE,
+	ALC888_ACER_ASPIRE_4930G,
 	ALC883_MEDION,
 	ALC883_MEDION_MD2,
 	ALC883_LAPTOP_EAPD,
@@ -1152,6 +1153,137 @@
 	}
 }
 
+static int alc888_mux_enum_put(struct snd_kcontrol *kcontrol,
+			       struct snd_ctl_elem_value *ucontrol)
+{
+	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+	struct alc_spec *spec = codec->spec;
+	unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
+	unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
+	struct hda_input_mux *imux = &spec->input_mux[mux_idx];
+	hda_nid_t nid = spec->capsrc_nids ?
+		spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
+	unsigned int *cur_val = &spec->cur_mux[adc_idx];
+	unsigned int i, idx;
+
+	idx = ucontrol->value.enumerated.item[0];
+	if (idx >= imux->num_items)
+		idx = imux->num_items - 1;
+	if (*cur_val == idx)
+		return 0;
+
+	for (i = 0; i < imux->num_items; i++) {
+		unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
+		snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
+					 imux->items[i].index,
+					 HDA_AMP_MUTE, v);
+	}
+	*cur_val = idx;
+	return 1;
+}
+
+/*
+ * ALC888 Acer Aspire 4930G model
+ */
+
+static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
+// Front Mic: set to PIN_IN (empty by default)
+	{ 0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
+// Unselect Front Mic by default in input mixer 3
+	{ 0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb) },
+	/* enable unsolicited event fpr HP jack */
+	{ 0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN },
+// Connect Internal HP to front
+	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
+// Connect HP out to front
+	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
+	{ }
+};
+
+#define alc888_mux_enum_info alc_mux_enum_info
+#define alc888_mux_enum_get alc_mux_enum_get
+
+static struct hda_input_mux alc888_acer_aspire_4930g_capture_source[2] = {
+	{
+		.num_items = 3,
+		.items = {
+			{ "Mic", 0x0 },
+			{ "Line", 0x2 },
+			{ "CD", 0x4 },
+		},
+	},
+	{
+		.num_items = 4,
+		.items = {
+			{ "Mic", 0x0 },
+			{ "Line", 0x2 },
+			{ "CD", 0x4 },
+			{ "Front Mic", 0xb }, // front mic only available on second ADC
+		},
+	},
+};
+
+static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
+	HDA_CODEC_VOLUME("Front Playback Volume", 		0x0c, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Front Playback Switch", 			0x0c, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME("Surround Playback Volume", 	0x0d, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Surround Playback Switch", 		0x0d, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
+	HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE_MONO("Center Playback Switch", 	0x0e, 1, 2, HDA_INPUT),
+	HDA_BIND_MUTE_MONO("LFE Playback Switch", 		0x0e, 2, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME("Side Playback Volume", 		0x0f, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Side Playback Switch", 			0x0f, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME("CD Playback Volume", 		0x0b, 0x04, HDA_INPUT),
+	HDA_CODEC_MUTE("CD Playback Switch", 			0x0b, 0x04, HDA_INPUT),
+	HDA_CODEC_VOLUME("Line Playback Volume", 		0x0b, 0x02, HDA_INPUT),
+	HDA_CODEC_MUTE("Line Playback Switch", 			0x0b, 0x02, HDA_INPUT),
+	HDA_CODEC_VOLUME("Mic Playback Volume", 		0x0b, 0x0, HDA_INPUT),
+	HDA_CODEC_VOLUME("Mic Boost", 				0x18, 0, HDA_INPUT),
+	HDA_CODEC_MUTE("Mic Playback Switch", 			0x0b, 0x0, HDA_INPUT),
+	HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
+	HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
+	{ } /* end */
+};
+
+static struct snd_kcontrol_new alc888_acer_aspire_4930g_capture_mixer[] = {
+	HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
+	HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
+	HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
+	HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
+	{
+		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.name = "Input Source",
+		.count = 2,
+		.info = alc888_mux_enum_info,
+		.get = alc888_mux_enum_get,
+		.put = alc888_mux_enum_put,
+	},
+	{ } /* end */
+};
+
+static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
+{	
+	unsigned int present;
+	present = snd_hda_codec_read(codec, 0x15, 0,
+				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
+	// enable or disable the internal HP PIN (regular muting doesn't work)
+	snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
+			    (present?0x0:PIN_OUT));
+}
+
+static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec, unsigned int res)
+{
+	if ( res >> 26 == ALC880_HP_EVENT )
+	{
+		alc888_acer_aspire_4930g_automute(codec);
+	}
+}
+
 /*
  * ALC880 3-stack model
  *
@@ -8176,6 +8308,7 @@
 	[ALC883_TARGA_2ch_DIG]	= "targa-2ch-dig",
 	[ALC883_ACER]		= "acer",
 	[ALC883_ACER_ASPIRE]	= "acer-aspire",
+	[ALC888_ACER_ASPIRE_4930G]		= "acer-aspire-4930g",
 	[ALC883_MEDION]		= "medion",
 	[ALC883_MEDION_MD2]	= "medion-md2",
 	[ALC883_LAPTOP_EAPD]	= "laptop-eapd",
@@ -8200,6 +8333,7 @@
 	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
 	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
 	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
+	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", ALC888_ACER_ASPIRE_4930G),
 	SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
 	SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
 	SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
@@ -8370,6 +8504,22 @@
 		.unsol_event = alc883_acer_aspire_unsol_event,
 		.init_hook = alc883_acer_aspire_automute,
 	},
+	[ALC888_ACER_ASPIRE_4930G] = {
+		.mixers = { alc888_acer_aspire_4930g_mixer, alc883_chmode_mixer },
+		.cap_mixer = alc888_acer_aspire_4930g_capture_mixer,
+		.init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, 
+				alc888_acer_aspire_4930g_verbs },
+		.num_dacs = ARRAY_SIZE(alc883_dac_nids),
+		.dac_nids = alc883_dac_nids,
+		.dig_out_nid = ALC883_DIGOUT_NID,
+		.num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
+		.channel_mode = alc883_3ST_6ch_modes,
+		.need_dac_fix = 1,
+		.num_mux_defs = ARRAY_SIZE(alc888_acer_aspire_4930g_capture_source),
+		.input_mux = alc888_acer_aspire_4930g_capture_source,
+		.unsol_event = alc888_acer_aspire_4930g_unsol_event,
+		.init_hook = alc888_acer_aspire_4930g_automute,
+	},
 	[ALC883_MEDION] = {
 		.mixers = { alc883_fivestack_mixer,
 			    alc883_chmode_mixer },
diff -Naur alsa-driver-1.0.18a/sound/pci/hda/patch_realtek.c alsa-driver-1.0.18a-mod3//sound/pci/hda/patch_realtek.c
--- alsa-driver-1.0.18a/sound/pci/hda/patch_realtek.c	2008-11-12 18:02:25.000000000 +0800
+++ alsa-driver-1.0.18a-mod3//sound/pci/hda/patch_realtek.c	2008-11-16 15:05:40.000000000 +0800
@@ -216,6 +216,7 @@
 	ALC883_TARGA_2ch_DIG,
 	ALC883_ACER,
 	ALC883_ACER_ASPIRE,
+	ALC888_ACER_ASPIRE_4930G,
 	ALC883_MEDION,
 	ALC883_MEDION_MD2,
 	ALC883_LAPTOP_EAPD,
@@ -1152,6 +1153,137 @@
 	}
 }
 
+static int alc888_mux_enum_put(struct snd_kcontrol *kcontrol,
+			       struct snd_ctl_elem_value *ucontrol)
+{
+	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+	struct alc_spec *spec = codec->spec;
+	unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
+	unsigned int mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
+	struct hda_input_mux *imux = &spec->input_mux[mux_idx];
+	hda_nid_t nid = spec->capsrc_nids ?
+		spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
+	unsigned int *cur_val = &spec->cur_mux[adc_idx];
+	unsigned int i, idx;
+
+	idx = ucontrol->value.enumerated.item[0];
+	if (idx >= imux->num_items)
+		idx = imux->num_items - 1;
+	if (*cur_val == idx)
+		return 0;
+
+	for (i = 0; i < imux->num_items; i++) {
+		unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
+		snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
+					 imux->items[i].index,
+					 HDA_AMP_MUTE, v);
+	}
+	*cur_val = idx;
+	return 1;
+}
+
+/*
+ * ALC888 Acer Aspire 4930G model
+ */
+
+static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
+// Front Mic: set to PIN_IN (empty by default)
+	{ 0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
+// Unselect Front Mic by default in input mixer 3
+	{ 0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb) },
+	/* enable unsolicited event fpr HP jack */
+	{ 0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN },
+// Connect Internal HP to front
+	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
+// Connect HP out to front
+	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
+	{ }
+};
+
+#define alc888_mux_enum_info alc_mux_enum_info
+#define alc888_mux_enum_get alc_mux_enum_get
+
+static struct hda_input_mux alc888_acer_aspire_4930g_capture_source[2] = {
+	{
+		.num_items = 3,
+		.items = {
+			{ "Mic", 0x0 },
+			{ "Line", 0x2 },
+			{ "CD", 0x4 },
+		},
+	},
+	{
+		.num_items = 4,
+		.items = {
+			{ "Mic", 0x0 },
+			{ "Line", 0x2 },
+			{ "CD", 0x4 },
+			{ "Front Mic", 0xb }, // front mic only available on second ADC
+		},
+	},
+};
+
+static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
+	HDA_CODEC_VOLUME("Front Playback Volume", 		0x0c, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Front Playback Switch", 			0x0c, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME("Surround Playback Volume", 	0x0d, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Surround Playback Switch", 		0x0d, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0, HDA_OUTPUT),
+	HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE_MONO("Center Playback Switch", 	0x0e, 1, 2, HDA_INPUT),
+	HDA_BIND_MUTE_MONO("LFE Playback Switch", 		0x0e, 2, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME("Side Playback Volume", 		0x0f, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Side Playback Switch", 			0x0f, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME("CD Playback Volume", 		0x0b, 0x04, HDA_INPUT),
+	HDA_CODEC_MUTE("CD Playback Switch", 			0x0b, 0x04, HDA_INPUT),
+	HDA_CODEC_VOLUME("Line Playback Volume", 		0x0b, 0x02, HDA_INPUT),
+	HDA_CODEC_MUTE("Line Playback Switch", 			0x0b, 0x02, HDA_INPUT),
+	HDA_CODEC_VOLUME("Mic Playback Volume", 		0x0b, 0x0, HDA_INPUT),
+	HDA_CODEC_VOLUME("Mic Boost", 				0x18, 0, HDA_INPUT),
+	HDA_CODEC_MUTE("Mic Playback Switch", 			0x0b, 0x0, HDA_INPUT),
+	HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
+	HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
+	{ } /* end */
+};
+
+static struct snd_kcontrol_new alc888_acer_aspire_4930g_capture_mixer[] = {
+	HDA_CODEC_VOLUME("Capture Volume", 0x08, 0x0, HDA_INPUT),
+	HDA_CODEC_MUTE("Capture Switch", 0x08, 0x0, HDA_INPUT),
+	HDA_CODEC_VOLUME_IDX("Capture Volume", 1, 0x09, 0x0, HDA_INPUT),
+	HDA_CODEC_MUTE_IDX("Capture Switch", 1, 0x09, 0x0, HDA_INPUT),
+	{
+		.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+		.name = "Input Source",
+		.count = 2,
+		.info = alc888_mux_enum_info,
+		.get = alc888_mux_enum_get,
+		.put = alc888_mux_enum_put,
+	},
+	{ } /* end */
+};
+
+static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
+{	
+	unsigned int present;
+	present = snd_hda_codec_read(codec, 0x15, 0,
+				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
+	// enable or disable the internal HP PIN (regular muting doesn't work)
+	snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
+			    (present?0x0:PIN_OUT));
+}
+
+static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec, unsigned int res)
+{
+	if ( res >> 26 == ALC880_HP_EVENT )
+	{
+		alc888_acer_aspire_4930g_automute(codec);
+	}
+}
+
 /*
  * ALC880 3-stack model
  *
@@ -8176,6 +8308,7 @@
 	[ALC883_TARGA_2ch_DIG]	= "targa-2ch-dig",
 	[ALC883_ACER]		= "acer",
 	[ALC883_ACER_ASPIRE]	= "acer-aspire",
+	[ALC888_ACER_ASPIRE_4930G]		= "acer-aspire-4930g",
 	[ALC883_MEDION]		= "medion",
 	[ALC883_MEDION_MD2]	= "medion-md2",
 	[ALC883_LAPTOP_EAPD]	= "laptop-eapd",
@@ -8200,6 +8333,7 @@
 	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
 	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
 	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
+	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G", ALC888_ACER_ASPIRE_4930G),
 	SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
 	SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
 	SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
@@ -8370,6 +8504,22 @@
 		.unsol_event = alc883_acer_aspire_unsol_event,
 		.init_hook = alc883_acer_aspire_automute,
 	},
+	[ALC888_ACER_ASPIRE_4930G] = {
+		.mixers = { alc888_acer_aspire_4930g_mixer, alc883_chmode_mixer },
+		.cap_mixer = alc888_acer_aspire_4930g_capture_mixer,
+		.init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs, 
+				alc888_acer_aspire_4930g_verbs },
+		.num_dacs = ARRAY_SIZE(alc883_dac_nids),
+		.dac_nids = alc883_dac_nids,
+		.dig_out_nid = ALC883_DIGOUT_NID,
+		.num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
+		.channel_mode = alc883_3ST_6ch_modes,
+		.need_dac_fix = 1,
+		.num_mux_defs = ARRAY_SIZE(alc888_acer_aspire_4930g_capture_source),
+		.input_mux = alc888_acer_aspire_4930g_capture_source,
+		.unsol_event = alc888_acer_aspire_4930g_unsol_event,
+		.init_hook = alc888_acer_aspire_4930g_automute,
+	},
 	[ALC883_MEDION] = {
 		.mixers = { alc883_fivestack_mixer,
 			    alc883_chmode_mixer },


[-- Attachment #3: Type: text/plain, Size: 160 bytes --]

_______________________________________________
Alsa-devel mailing list
Alsa-devel@alsa-project.org
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] Added Realtek ALC888 model entry for the Acer Aspire 4930G laptop
  2008-11-18 11:21 [PATCH] Added Realtek ALC888 model entry for the Acer Aspire 4930G laptop Petry Vincent
@ 2008-11-18 11:41 ` Takashi Iwai
  2008-11-18 13:13   ` [Bulk] " Vincent Petry
  0 siblings, 1 reply; 12+ messages in thread
From: Takashi Iwai @ 2008-11-18 11:41 UTC (permalink / raw)
  To: Petry Vincent; +Cc: alsa-devel

At Tue, 18 Nov 2008 19:21:45 +0800,
Petry Vincent wrote:
> 
> Hello,
> 
> I would like to contribute a patch that adds a model entry for the Acer
> Aspire 4930G laptop. Its chipset is a Realtek ALC888S-VC.
> The new model is based on the "acer" model and fixes the following bugs
> missing features:
> - https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4223 Reversed
> stereo (invalid report, please close it)
> - https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4224 Headphone
> jack sense
> - https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4225 Internal mic
> - channel mode (it was missing from the base acer model)
> 
> The model name is "acer-aspire-4930g" but could be renamed to something
> more general, if necessary.
> 
> See attached patch file. It has been made against alsa-driver-1.0.18a.

Thanks for the patch.

You need a patch only for the kernel tree, i.e. at best, create a diff
against my sound git tree:
    git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git

Or you can get a snapshot of alsa-driver in
    ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-snapshot.tar.gz
and create a patch against alsa-kernel directory only.

Regarding your changes: please run checkpatch.pl in $LINUX/scripts once.
You'll see some coding-style issues there.  Please fix them.

Also, you don't need to change the mux_enum_put function.  I applied
the patch below right now to my git tree.


thanks,

Takashi


>From cd896c331dd442c43cd9e23de3f1a4f3c111c292 Mon Sep 17 00:00:00 2001
From: Takashi Iwai <tiwai@suse.de>
Date: Tue, 18 Nov 2008 12:36:33 +0100
Subject: [PATCH] ALSA: hda - Allow multiple imux for matrix-type mixers of ALC codecs

Allow the multiple imux instances for matrix-type mixers like ALC882.
So far, only ALC260 used this feature, but other codecs may need a
similar stuff.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
 sound/pci/hda/patch_realtek.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 04e153a..b7d3439 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -382,11 +382,15 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
 {
 	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
 	struct alc_spec *spec = codec->spec;
-	const struct hda_input_mux *imux = spec->input_mux;
+	const struct hda_input_mux *imux;
 	unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
+	unsigned int mux_idx;
 	hda_nid_t nid = spec->capsrc_nids ?
 		spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
 
+	mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
+	imux = &spec->input_mux[mux_idx];
+
 	if (spec->is_mix_capture) {
 		/* Matrix-mixer style (e.g. ALC882) */
 		unsigned int *cur_val = &spec->cur_mux[adc_idx];
@@ -407,10 +411,7 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
 		return 1;
 	} else {
 		/* MUX style (e.g. ALC880) */
-		unsigned int mux_idx;
-		mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
-		return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx],
-					     ucontrol, nid,
+		return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
 					     &spec->cur_mux[adc_idx]);
 	}
 }
-- 
1.6.0.4

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [Bulk] Re: [PATCH] Added Realtek ALC888 model entry for the Acer Aspire 4930G laptop
  2008-11-18 11:41 ` Takashi Iwai
@ 2008-11-18 13:13   ` Vincent Petry
  2008-11-18 13:19     ` Takashi Iwai
  0 siblings, 1 reply; 12+ messages in thread
From: Vincent Petry @ 2008-11-18 13:13 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

Hello Takashi,

I have updated the patch to make it work with your changes and tested
it. I also updated the code style.

diff -Nur alsa-kernel//pci/hda/patch_realtek.c
alsa-kernel-new//pci/hda/patch_realtek.c
--- alsa-kernel//pci/hda/patch_realtek.c	2008-11-18 19:39:33.000000000 +0800
+++ alsa-kernel-new//pci/hda/patch_realtek.c	2008-11-18
20:50:47.000000000 +0800
@@ -216,6 +216,7 @@
 	ALC883_TARGA_2ch_DIG,
 	ALC883_ACER,
 	ALC883_ACER_ASPIRE,
+	ALC888_ACER_ASPIRE_4930G,
 	ALC883_MEDION,
 	ALC883_MEDION_MD2,
 	ALC883_LAPTOP_EAPD,
@@ -1155,6 +1156,90 @@
 }

 /*
+ * ALC888 Acer Aspire 4930G model
+ */
+
+static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
+/* Front Mic: set to PIN_IN (empty by default) */
+	{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
+/* Unselect Front Mic by default in input mixer 3 */
+	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
+/* enable unsolicited event fpr HP jack */
+	{0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
+/* Connect Internal HP to front */
+	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
+/* Connect HP out to front */
+	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
+	{ }
+};
+
+static struct hda_input_mux alc888_acer_aspire_4930g_capture_source[2] = {
+	{
+		.num_items = 3,
+		.items = {
+			{ "Mic", 0x0 },
+			{ "Line", 0x2 },
+			{ "CD", 0x4 },
+		},
+	},
+	/* Front mic only available on second ADC */
+	{
+		.num_items = 4,
+		.items = {
+			{ "Mic", 0x0 },
+			{ "Line", 0x2 },
+			{ "CD", 0x4 },
+			{ "Front Mic", 0xb },
+		},
+	},
+};
+
+static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
+	HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
+		HDA_OUTPUT),
+	HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
+	HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
+	HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
+	HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
+	HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
+	HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
+	HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
+	HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
+	HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
+	HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
+	{ } /* end */
+};
+
+static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
+{
+	unsigned int present;
+	present = snd_hda_codec_read(codec, 0x15, 0,
+				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
+	/* Toggle the internal HP PIN (regular muting doesn't work) */
+	snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
+					(present ? 0x0 : PIN_OUT));
+}
+
+static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
+		unsigned int res)
+{
+	if (res >> 26 == ALC880_HP_EVENT)
+		alc888_acer_aspire_4930g_automute(codec);
+}
+
+/*
  * ALC880 3-stack model
  *
  * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
@@ -8180,6 +8265,7 @@
 	[ALC883_TARGA_2ch_DIG]	= "targa-2ch-dig",
 	[ALC883_ACER]		= "acer",
 	[ALC883_ACER_ASPIRE]	= "acer-aspire",
+	[ALC888_ACER_ASPIRE_4930G]	= "acer-aspire-4930g",
 	[ALC883_MEDION]		= "medion",
 	[ALC883_MEDION_MD2]	= "medion-md2",
 	[ALC883_LAPTOP_EAPD]	= "laptop-eapd",
@@ -8205,6 +8291,8 @@
 	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
 	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
 	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
+	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
+		ALC888_ACER_ASPIRE_4930G),
 	SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
 	SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
 	SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
@@ -8376,6 +8464,23 @@
 		.unsol_event = alc883_acer_aspire_unsol_event,
 		.init_hook = alc883_acer_aspire_automute,
 	},
+	[ALC888_ACER_ASPIRE_4930G] = {
+		.mixers = { alc888_acer_aspire_4930g_mixer,
+				alc883_chmode_mixer },
+		.init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
+				alc888_acer_aspire_4930g_verbs },
+		.num_dacs = ARRAY_SIZE(alc883_dac_nids),
+		.dac_nids = alc883_dac_nids,
+		.dig_out_nid = ALC883_DIGOUT_NID,
+		.num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
+		.channel_mode = alc883_3ST_6ch_modes,
+		.need_dac_fix = 1,
+		.num_mux_defs =
+			ARRAY_SIZE(alc888_acer_aspire_4930g_capture_source),
+		.input_mux = alc888_acer_aspire_4930g_capture_source,
+		.unsol_event = alc888_acer_aspire_4930g_unsol_event,
+		.init_hook = alc888_acer_aspire_4930g_automute,
+	},
 	[ALC883_MEDION] = {
 		.mixers = { alc883_fivestack_mixer,
 			    alc883_chmode_mixer },

Signed-off-by: Vincent Petry <PVince81@yahoo.fr>


Takashi Iwai a écrit :
> At Tue, 18 Nov 2008 19:21:45 +0800,
> Petry Vincent wrote:
>> Hello,
>>
>> I would like to contribute a patch that adds a model entry for the Acer
>> Aspire 4930G laptop. Its chipset is a Realtek ALC888S-VC.
>> The new model is based on the "acer" model and fixes the following bugs
>> missing features:
>> - https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4223 Reversed
>> stereo (invalid report, please close it)
>> - https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4224 Headphone
>> jack sense
>> - https://bugtrack.alsa-project.org/alsa-bug/view.php?id=4225 Internal mic
>> - channel mode (it was missing from the base acer model)
>>
>> The model name is "acer-aspire-4930g" but could be renamed to something
>> more general, if necessary.
>>
>> See attached patch file. It has been made against alsa-driver-1.0.18a.
> 
> Thanks for the patch.
> 
> You need a patch only for the kernel tree, i.e. at best, create a diff
> against my sound git tree:
>     git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6.git
> 
> Or you can get a snapshot of alsa-driver in
>     ftp://ftp.kernel.org/pub/linux/kernel/people/tiwai/snapshot/alsa-driver-snapshot.tar.gz
> and create a patch against alsa-kernel directory only.
> 
> Regarding your changes: please run checkpatch.pl in $LINUX/scripts once.
> You'll see some coding-style issues there.  Please fix them.
> 
> Also, you don't need to change the mux_enum_put function.  I applied
> the patch below right now to my git tree.
> 
> 
> thanks,
> 
> Takashi
> 
> 
>>From cd896c331dd442c43cd9e23de3f1a4f3c111c292 Mon Sep 17 00:00:00 2001
> From: Takashi Iwai <tiwai@suse.de>
> Date: Tue, 18 Nov 2008 12:36:33 +0100
> Subject: [PATCH] ALSA: hda - Allow multiple imux for matrix-type mixers of ALC codecs
> 
> Allow the multiple imux instances for matrix-type mixers like ALC882.
> So far, only ALC260 used this feature, but other codecs may need a
> similar stuff.
> 
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
> ---
>  sound/pci/hda/patch_realtek.c |   11 ++++++-----
>  1 files changed, 6 insertions(+), 5 deletions(-)
> 
> diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
> index 04e153a..b7d3439 100644
> --- a/sound/pci/hda/patch_realtek.c
> +++ b/sound/pci/hda/patch_realtek.c
> @@ -382,11 +382,15 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
>  {
>  	struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
>  	struct alc_spec *spec = codec->spec;
> -	const struct hda_input_mux *imux = spec->input_mux;
> +	const struct hda_input_mux *imux;
>  	unsigned int adc_idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
> +	unsigned int mux_idx;
>  	hda_nid_t nid = spec->capsrc_nids ?
>  		spec->capsrc_nids[adc_idx] : spec->adc_nids[adc_idx];
>  
> +	mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
> +	imux = &spec->input_mux[mux_idx];
> +
>  	if (spec->is_mix_capture) {
>  		/* Matrix-mixer style (e.g. ALC882) */
>  		unsigned int *cur_val = &spec->cur_mux[adc_idx];
> @@ -407,10 +411,7 @@ static int alc_mux_enum_put(struct snd_kcontrol *kcontrol,
>  		return 1;
>  	} else {
>  		/* MUX style (e.g. ALC880) */
> -		unsigned int mux_idx;
> -		mux_idx = adc_idx >= spec->num_mux_defs ? 0 : adc_idx;
> -		return snd_hda_input_mux_put(codec, &spec->input_mux[mux_idx],
> -					     ucontrol, nid,
> +		return snd_hda_input_mux_put(codec, imux, ucontrol, nid,
>  					     &spec->cur_mux[adc_idx]);
>  	}
>  }

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Bulk] Re: [PATCH] Added Realtek ALC888 model entry for the Acer Aspire 4930G laptop
  2008-11-18 13:13   ` [Bulk] " Vincent Petry
@ 2008-11-18 13:19     ` Takashi Iwai
  2008-11-18 13:55       ` Vincent Petry
  0 siblings, 1 reply; 12+ messages in thread
From: Takashi Iwai @ 2008-11-18 13:19 UTC (permalink / raw)
  To: Vincent Petry; +Cc: alsa-devel

At Tue, 18 Nov 2008 21:13:53 +0800,
Vincent Petry wrote:
> 
> Hello Takashi,
> 
> I have updated the patch to make it work with your changes and tested
> it. I also updated the code style.

Thanks for a quick fix!

> +static struct hda_input_mux alc888_acer_aspire_4930g_capture_source[2] = {
> +	{
> +		.num_items = 3,
> +		.items = {
> +			{ "Mic", 0x0 },
> +			{ "Line", 0x2 },
> +			{ "CD", 0x4 },
> +		},
> +	},
> +	/* Front mic only available on second ADC */

Well... I think we should stick with the single ADC (only using 2nd
ADC) if the front mic isn't available with the 1st ADC.
The first ADC is used as the primary stream, and people would wonder
when they can't record from the front/internal mic.

Or, you can exchange the first and second ADCs so that the second ADC
is used for the primary purpose and the less-functional ADC can be
still used parallel as an alternative stream (via hw:0,2).

Also, don't forget to add your new model to
Documentation/*/ALSA-Configuration.txt.

Otherwise the patch looks good.
Could you fix the above and repost?


thanks,

Takashi

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Bulk] Re: [PATCH] Added Realtek ALC888 model entry for the Acer Aspire 4930G laptop
  2008-11-18 13:19     ` Takashi Iwai
@ 2008-11-18 13:55       ` Vincent Petry
  2008-11-18 14:06         ` Takashi Iwai
                           ` (4 more replies)
  0 siblings, 5 replies; 12+ messages in thread
From: Vincent Petry @ 2008-11-18 13:55 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

Hello Takashi,

I have inverted both ADCs as you suggested, and it works fine. See patch
below.

Before doing this I had noise issues (distortion) with the front mic on
its right channel. Now after the inversion there is no more noise, but
my voice is only recorded on the right channel, the left channel volume
seems to be much lower. We can consider this as a separate bug, I will
investigate it later.

For the documentation, should I submit a separate patch?

Thanks.

Vincent

diff -Nur alsa-kernel//pci/hda/patch_realtek.c
alsa-kernel-new//pci/hda/patch_realtek.c
--- alsa-kernel//pci/hda/patch_realtek.c	2008-11-18 19:39:33.000000000 +0800
+++ alsa-kernel-new//pci/hda/patch_realtek.c	2008-11-18
21:38:42.000000000 +0800
@@ -216,6 +216,7 @@
 	ALC883_TARGA_2ch_DIG,
 	ALC883_ACER,
 	ALC883_ACER_ASPIRE,
+	ALC888_ACER_ASPIRE_4930G,
 	ALC883_MEDION,
 	ALC883_MEDION_MD2,
 	ALC883_LAPTOP_EAPD,
@@ -1155,6 +1156,90 @@
 }

 /*
+ * ALC888 Acer Aspire 4930G model
+ */
+
+static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
+/* Front Mic: set to PIN_IN (empty by default) */
+	{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
+/* Unselect Front Mic by default in input mixer 3 */
+	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
+/* enable unsolicited event fpr HP jack */
+	{0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
+/* Connect Internal HP to front */
+	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
+/* Connect HP out to front */
+	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
+	{ }
+};
+
+static struct hda_input_mux alc888_acer_aspire_4930g_capture_source[2] = {
+	/* Front mic only available on one ADC */
+	{
+		.num_items = 4,
+		.items = {
+			{ "Mic", 0x0 },
+			{ "Line", 0x2 },
+			{ "CD", 0x4 },
+			{ "Front Mic", 0xb },
+		},
+	},
+	{
+		.num_items = 3,
+		.items = {
+			{ "Mic", 0x0 },
+			{ "Line", 0x2 },
+			{ "CD", 0x4 },
+		},
+	}
+};
+
+static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
+	HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
+		HDA_OUTPUT),
+	HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
+	HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
+	HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
+	HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
+	HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
+	HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
+	HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
+	HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
+	HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
+	HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
+	{ } /* end */
+};
+
+static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
+{
+	unsigned int present;
+	present = snd_hda_codec_read(codec, 0x15, 0,
+				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
+	/* Toggle the internal HP PIN (regular muting doesn't work) */
+	snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
+					(present ? 0x0 : PIN_OUT));
+}
+
+static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
+		unsigned int res)
+{
+	if (res >> 26 == ALC880_HP_EVENT)
+		alc888_acer_aspire_4930g_automute(codec);
+}
+
+/*
  * ALC880 3-stack model
  *
  * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
@@ -6887,8 +6972,15 @@
 	0x08,
 };

+static hda_nid_t alc883_adc_nids_rev[2] = {
+	/* ADC2-1 */
+	0x09, 0x08
+};
+
 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };

+static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
+
 /* input MUX */
 /* FIXME: should be a matrix-type input source selection */

@@ -8180,6 +8272,7 @@
 	[ALC883_TARGA_2ch_DIG]	= "targa-2ch-dig",
 	[ALC883_ACER]		= "acer",
 	[ALC883_ACER_ASPIRE]	= "acer-aspire",
+	[ALC888_ACER_ASPIRE_4930G]	= "acer-aspire-4930g",
 	[ALC883_MEDION]		= "medion",
 	[ALC883_MEDION_MD2]	= "medion-md2",
 	[ALC883_LAPTOP_EAPD]	= "laptop-eapd",
@@ -8205,6 +8298,8 @@
 	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
 	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
 	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
+	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
+		ALC888_ACER_ASPIRE_4930G),
 	SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
 	SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
 	SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
@@ -8376,6 +8471,26 @@
 		.unsol_event = alc883_acer_aspire_unsol_event,
 		.init_hook = alc883_acer_aspire_automute,
 	},
+	[ALC888_ACER_ASPIRE_4930G] = {
+		.mixers = { alc888_acer_aspire_4930g_mixer,
+				alc883_chmode_mixer },
+		.init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
+				alc888_acer_aspire_4930g_verbs },
+		.num_dacs = ARRAY_SIZE(alc883_dac_nids),
+		.dac_nids = alc883_dac_nids,
+		.num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
+		.adc_nids = alc883_adc_nids_rev,
+		.capsrc_nids = alc883_capsrc_nids_rev,
+		.dig_out_nid = ALC883_DIGOUT_NID,
+		.num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
+		.channel_mode = alc883_3ST_6ch_modes,
+		.need_dac_fix = 1,
+		.num_mux_defs =
+			ARRAY_SIZE(alc888_acer_aspire_4930g_capture_source),
+		.input_mux = alc888_acer_aspire_4930g_capture_source,
+		.unsol_event = alc888_acer_aspire_4930g_unsol_event,
+		.init_hook = alc888_acer_aspire_4930g_automute,
+	},
 	[ALC883_MEDION] = {
 		.mixers = { alc883_fivestack_mixer,
 			    alc883_chmode_mixer },

Signed-off-by: Vincent Petry <PVince81@yahoo.fr>


Takashi Iwai a écrit :
> At Tue, 18 Nov 2008 21:13:53 +0800,
> Vincent Petry wrote:
>> Hello Takashi,
>>
>> I have updated the patch to make it work with your changes and tested
>> it. I also updated the code style.
> 
> Thanks for a quick fix!
> 
>> +static struct hda_input_mux alc888_acer_aspire_4930g_capture_source[2] = {
>> +	{
>> +		.num_items = 3,
>> +		.items = {
>> +			{ "Mic", 0x0 },
>> +			{ "Line", 0x2 },
>> +			{ "CD", 0x4 },
>> +		},
>> +	},
>> +	/* Front mic only available on second ADC */
> 
> Well... I think we should stick with the single ADC (only using 2nd
> ADC) if the front mic isn't available with the 1st ADC.
> The first ADC is used as the primary stream, and people would wonder
> when they can't record from the front/internal mic.
> 
> Or, you can exchange the first and second ADCs so that the second ADC
> is used for the primary purpose and the less-functional ADC can be
> still used parallel as an alternative stream (via hw:0,2).
> 
> Also, don't forget to add your new model to
> Documentation/*/ALSA-Configuration.txt.
> 
> Otherwise the patch looks good.
> Could you fix the above and repost?
> 
> 
> thanks,
> 
> Takashi
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Bulk] Re: [PATCH] Added Realtek ALC888 model entry for the Acer Aspire 4930G laptop
  2008-11-18 13:55       ` Vincent Petry
@ 2008-11-18 14:06         ` Takashi Iwai
  2008-11-18 14:06         ` Vincent Petry
                           ` (3 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Takashi Iwai @ 2008-11-18 14:06 UTC (permalink / raw)
  To: Vincent Petry; +Cc: alsa-devel

At Tue, 18 Nov 2008 21:55:41 +0800,
Vincent Petry wrote:
> 
> Hello Takashi,
> 
> I have inverted both ADCs as you suggested, and it works fine. See patch
> below.

Good to hear.

> Before doing this I had noise issues (distortion) with the front mic on
> its right channel. Now after the inversion there is no more noise, but
> my voice is only recorded on the right channel, the left channel volume
> seems to be much lower. We can consider this as a separate bug, I will
> investigate it later.

Yes, let's debug this later.

> For the documentation, should I submit a separate patch?

Better put together.  Please add and repost (again :) ?

Also, at each patch submission, add the patch subject and changelog
together with your sign-off again.  That is, a mail including patch
should be self-consistent, applicable alone.


thanks,

Takashi

> 
> Thanks.
> 
> Vincent
> 
> diff -Nur alsa-kernel//pci/hda/patch_realtek.c
> alsa-kernel-new//pci/hda/patch_realtek.c
> --- alsa-kernel//pci/hda/patch_realtek.c	2008-11-18 19:39:33.000000000 +0800
> +++ alsa-kernel-new//pci/hda/patch_realtek.c	2008-11-18
> 21:38:42.000000000 +0800
> @@ -216,6 +216,7 @@
>  	ALC883_TARGA_2ch_DIG,
>  	ALC883_ACER,
>  	ALC883_ACER_ASPIRE,
> +	ALC888_ACER_ASPIRE_4930G,
>  	ALC883_MEDION,
>  	ALC883_MEDION_MD2,
>  	ALC883_LAPTOP_EAPD,
> @@ -1155,6 +1156,90 @@
>  }
> 
>  /*
> + * ALC888 Acer Aspire 4930G model
> + */
> +
> +static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
> +/* Front Mic: set to PIN_IN (empty by default) */
> +	{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
> +/* Unselect Front Mic by default in input mixer 3 */
> +	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
> +/* enable unsolicited event fpr HP jack */
> +	{0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
> +/* Connect Internal HP to front */
> +	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
> +	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
> +	{0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
> +/* Connect HP out to front */
> +	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
> +	{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
> +	{0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
> +	{ }
> +};
> +
> +static struct hda_input_mux alc888_acer_aspire_4930g_capture_source[2] = {
> +	/* Front mic only available on one ADC */
> +	{
> +		.num_items = 4,
> +		.items = {
> +			{ "Mic", 0x0 },
> +			{ "Line", 0x2 },
> +			{ "CD", 0x4 },
> +			{ "Front Mic", 0xb },
> +		},
> +	},
> +	{
> +		.num_items = 3,
> +		.items = {
> +			{ "Mic", 0x0 },
> +			{ "Line", 0x2 },
> +			{ "CD", 0x4 },
> +		},
> +	}
> +};
> +
> +static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
> +	HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
> +	HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
> +	HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
> +	HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
> +	HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
> +		HDA_OUTPUT),
> +	HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
> +	HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
> +	HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
> +	HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
> +	HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
> +	HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
> +	HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
> +	HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
> +	HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
> +	HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
> +	HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
> +	HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
> +	HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
> +	HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
> +	{ } /* end */
> +};
> +
> +static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
> +{
> +	unsigned int present;
> +	present = snd_hda_codec_read(codec, 0x15, 0,
> +				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
> +	/* Toggle the internal HP PIN (regular muting doesn't work) */
> +	snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
> +					(present ? 0x0 : PIN_OUT));
> +}
> +
> +static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
> +		unsigned int res)
> +{
> +	if (res >> 26 == ALC880_HP_EVENT)
> +		alc888_acer_aspire_4930g_automute(codec);
> +}
> +
> +/*
>   * ALC880 3-stack model
>   *
>   * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
> @@ -6887,8 +6972,15 @@
>  	0x08,
>  };
> 
> +static hda_nid_t alc883_adc_nids_rev[2] = {
> +	/* ADC2-1 */
> +	0x09, 0x08
> +};
> +
>  static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
> 
> +static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
> +
>  /* input MUX */
>  /* FIXME: should be a matrix-type input source selection */
> 
> @@ -8180,6 +8272,7 @@
>  	[ALC883_TARGA_2ch_DIG]	= "targa-2ch-dig",
>  	[ALC883_ACER]		= "acer",
>  	[ALC883_ACER_ASPIRE]	= "acer-aspire",
> +	[ALC888_ACER_ASPIRE_4930G]	= "acer-aspire-4930g",
>  	[ALC883_MEDION]		= "medion",
>  	[ALC883_MEDION_MD2]	= "medion-md2",
>  	[ALC883_LAPTOP_EAPD]	= "laptop-eapd",
> @@ -8205,6 +8298,8 @@
>  	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
>  	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
>  	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
> +	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
> +		ALC888_ACER_ASPIRE_4930G),
>  	SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
>  	SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
>  	SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
> @@ -8376,6 +8471,26 @@
>  		.unsol_event = alc883_acer_aspire_unsol_event,
>  		.init_hook = alc883_acer_aspire_automute,
>  	},
> +	[ALC888_ACER_ASPIRE_4930G] = {
> +		.mixers = { alc888_acer_aspire_4930g_mixer,
> +				alc883_chmode_mixer },
> +		.init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
> +				alc888_acer_aspire_4930g_verbs },
> +		.num_dacs = ARRAY_SIZE(alc883_dac_nids),
> +		.dac_nids = alc883_dac_nids,
> +		.num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
> +		.adc_nids = alc883_adc_nids_rev,
> +		.capsrc_nids = alc883_capsrc_nids_rev,
> +		.dig_out_nid = ALC883_DIGOUT_NID,
> +		.num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
> +		.channel_mode = alc883_3ST_6ch_modes,
> +		.need_dac_fix = 1,
> +		.num_mux_defs =
> +			ARRAY_SIZE(alc888_acer_aspire_4930g_capture_source),
> +		.input_mux = alc888_acer_aspire_4930g_capture_source,
> +		.unsol_event = alc888_acer_aspire_4930g_unsol_event,
> +		.init_hook = alc888_acer_aspire_4930g_automute,
> +	},
>  	[ALC883_MEDION] = {
>  		.mixers = { alc883_fivestack_mixer,
>  			    alc883_chmode_mixer },
> 
> Signed-off-by: Vincent Petry <PVince81@yahoo.fr>
> 
> 
> Takashi Iwai a écrit :
> > At Tue, 18 Nov 2008 21:13:53 +0800,
> > Vincent Petry wrote:
> >> Hello Takashi,
> >>
> >> I have updated the patch to make it work with your changes and tested
> >> it. I also updated the code style.
> > 
> > Thanks for a quick fix!
> > 
> >> +static struct hda_input_mux alc888_acer_aspire_4930g_capture_source[2] = {
> >> +	{
> >> +		.num_items = 3,
> >> +		.items = {
> >> +			{ "Mic", 0x0 },
> >> +			{ "Line", 0x2 },
> >> +			{ "CD", 0x4 },
> >> +		},
> >> +	},
> >> +	/* Front mic only available on second ADC */
> > 
> > Well... I think we should stick with the single ADC (only using 2nd
> > ADC) if the front mic isn't available with the 1st ADC.
> > The first ADC is used as the primary stream, and people would wonder
> > when they can't record from the front/internal mic.
> > 
> > Or, you can exchange the first and second ADCs so that the second ADC
> > is used for the primary purpose and the less-functional ADC can be
> > still used parallel as an alternative stream (via hw:0,2).
> > 
> > Also, don't forget to add your new model to
> > Documentation/*/ALSA-Configuration.txt.
> > 
> > Otherwise the patch looks good.
> > Could you fix the above and repost?
> > 
> > 
> > thanks,
> > 
> > Takashi
> > _______________________________________________
> > Alsa-devel mailing list
> > Alsa-devel@alsa-project.org
> > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> > 
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Bulk] Re: [PATCH] Added Realtek ALC888 model entry for the Acer Aspire 4930G laptop
  2008-11-18 13:55       ` Vincent Petry
  2008-11-18 14:06         ` Takashi Iwai
@ 2008-11-18 14:06         ` Vincent Petry
  2008-11-18 14:21         ` [PATCH] hda: " Vincent Petry
                           ` (2 subsequent siblings)
  4 siblings, 0 replies; 12+ messages in thread
From: Vincent Petry @ 2008-11-18 14:06 UTC (permalink / raw)
  To: Takashi Iwai; +Cc: alsa-devel

Sorry, I thought the ALSA docs were only in the kernel. I just found out
the documentation is also in alsa-kernel. Here is the complete patch
again, including the doc change:

diff -Nur alsa-kernel//Documentation/ALSA-Configuration.txt
alsa-kernel-new//Documentation/ALSA-Configuration.txt
--- alsa-kernel//Documentation/ALSA-Configuration.txt	2008-11-18
19:39:33.000000000 +0800
+++ alsa-kernel-new//Documentation/ALSA-Configuration.txt	2008-11-18
22:02:51.000000000 +0800
@@ -903,6 +903,7 @@
 	  6stack-dig-demo  6-jack digital for Intel demo board
 	  acer		Acer laptops (Travelmate 3012WTMi, Aspire 5600, etc)
 	  acer-aspire	Acer Aspire 9810
+	  acer-aspire-4930g Acer Aspire 4930G
 	  medion	Medion Laptops
 	  medion-md2	Medion MD2
 	  targa-dig	Targa/MSI
diff -Nur alsa-kernel//pci/hda/patch_realtek.c
alsa-kernel-new//pci/hda/patch_realtek.c
--- alsa-kernel//pci/hda/patch_realtek.c	2008-11-18 19:39:33.000000000 +0800
+++ alsa-kernel-new//pci/hda/patch_realtek.c	2008-11-18
21:38:42.000000000 +0800
@@ -216,6 +216,7 @@
 	ALC883_TARGA_2ch_DIG,
 	ALC883_ACER,
 	ALC883_ACER_ASPIRE,
+	ALC888_ACER_ASPIRE_4930G,
 	ALC883_MEDION,
 	ALC883_MEDION_MD2,
 	ALC883_LAPTOP_EAPD,
@@ -1155,6 +1156,90 @@
 }

 /*
+ * ALC888 Acer Aspire 4930G model
+ */
+
+static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
+/* Front Mic: set to PIN_IN (empty by default) */
+	{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
+/* Unselect Front Mic by default in input mixer 3 */
+	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
+/* enable unsolicited event fpr HP jack */
+	{0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
+/* Connect Internal HP to front */
+	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
+/* Connect HP out to front */
+	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
+	{ }
+};
+
+static struct hda_input_mux alc888_acer_aspire_4930g_capture_source[2] = {
+	/* Front mic only available on one ADC */
+	{
+		.num_items = 4,
+		.items = {
+			{ "Mic", 0x0 },
+			{ "Line", 0x2 },
+			{ "CD", 0x4 },
+			{ "Front Mic", 0xb },
+		},
+	},
+	{
+		.num_items = 3,
+		.items = {
+			{ "Mic", 0x0 },
+			{ "Line", 0x2 },
+			{ "CD", 0x4 },
+		},
+	}
+};
+
+static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
+	HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
+		HDA_OUTPUT),
+	HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
+	HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
+	HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
+	HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
+	HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
+	HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
+	HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
+	HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
+	HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
+	HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
+	{ } /* end */
+};
+
+static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
+{
+	unsigned int present;
+	present = snd_hda_codec_read(codec, 0x15, 0,
+				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
+	/* Toggle the internal HP PIN (regular muting doesn't work) */
+	snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
+					(present ? 0x0 : PIN_OUT));
+}
+
+static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
+		unsigned int res)
+{
+	if (res >> 26 == ALC880_HP_EVENT)
+		alc888_acer_aspire_4930g_automute(codec);
+}
+
+/*
  * ALC880 3-stack model
  *
  * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
@@ -6887,8 +6972,15 @@
 	0x08,
 };

+static hda_nid_t alc883_adc_nids_rev[2] = {
+	/* ADC2-1 */
+	0x09, 0x08
+};
+
 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };

+static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
+
 /* input MUX */
 /* FIXME: should be a matrix-type input source selection */

@@ -8180,6 +8272,7 @@
 	[ALC883_TARGA_2ch_DIG]	= "targa-2ch-dig",
 	[ALC883_ACER]		= "acer",
 	[ALC883_ACER_ASPIRE]	= "acer-aspire",
+	[ALC888_ACER_ASPIRE_4930G]	= "acer-aspire-4930g",
 	[ALC883_MEDION]		= "medion",
 	[ALC883_MEDION_MD2]	= "medion-md2",
 	[ALC883_LAPTOP_EAPD]	= "laptop-eapd",
@@ -8205,6 +8298,8 @@
 	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
 	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
 	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
+	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
+		ALC888_ACER_ASPIRE_4930G),
 	SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
 	SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
 	SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
@@ -8376,6 +8471,26 @@
 		.unsol_event = alc883_acer_aspire_unsol_event,
 		.init_hook = alc883_acer_aspire_automute,
 	},
+	[ALC888_ACER_ASPIRE_4930G] = {
+		.mixers = { alc888_acer_aspire_4930g_mixer,
+				alc883_chmode_mixer },
+		.init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
+				alc888_acer_aspire_4930g_verbs },
+		.num_dacs = ARRAY_SIZE(alc883_dac_nids),
+		.dac_nids = alc883_dac_nids,
+		.num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
+		.adc_nids = alc883_adc_nids_rev,
+		.capsrc_nids = alc883_capsrc_nids_rev,
+		.dig_out_nid = ALC883_DIGOUT_NID,
+		.num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
+		.channel_mode = alc883_3ST_6ch_modes,
+		.need_dac_fix = 1,
+		.num_mux_defs =
+			ARRAY_SIZE(alc888_acer_aspire_4930g_capture_source),
+		.input_mux = alc888_acer_aspire_4930g_capture_source,
+		.unsol_event = alc888_acer_aspire_4930g_unsol_event,
+		.init_hook = alc888_acer_aspire_4930g_automute,
+	},
 	[ALC883_MEDION] = {
 		.mixers = { alc883_fivestack_mixer,
 			    alc883_chmode_mixer },

Signed-off-by: Vincent Petry <PVince81@yahoo.fr>

Vincent Petry a écrit :
> Hello Takashi,
> 
> I have inverted both ADCs as you suggested, and it works fine. See patch
> below.
> 
> Before doing this I had noise issues (distortion) with the front mic on
> its right channel. Now after the inversion there is no more noise, but
> my voice is only recorded on the right channel, the left channel volume
> seems to be much lower. We can consider this as a separate bug, I will
> investigate it later.
> 
> For the documentation, should I submit a separate patch?
> 
> Thanks.
> 
> Vincent
> 
> 
> 
> Takashi Iwai a écrit :
>> At Tue, 18 Nov 2008 21:13:53 +0800,
>> Vincent Petry wrote:
>>> Hello Takashi,
>>>
>>> I have updated the patch to make it work with your changes and tested
>>> it. I also updated the code style.
>> Thanks for a quick fix!
>>
>>> +static struct hda_input_mux alc888_acer_aspire_4930g_capture_source[2] = {
>>> +	{
>>> +		.num_items = 3,
>>> +		.items = {
>>> +			{ "Mic", 0x0 },
>>> +			{ "Line", 0x2 },
>>> +			{ "CD", 0x4 },
>>> +		},
>>> +	},
>>> +	/* Front mic only available on second ADC */
>> Well... I think we should stick with the single ADC (only using 2nd
>> ADC) if the front mic isn't available with the 1st ADC.
>> The first ADC is used as the primary stream, and people would wonder
>> when they can't record from the front/internal mic.
>>
>> Or, you can exchange the first and second ADCs so that the second ADC
>> is used for the primary purpose and the less-functional ADC can be
>> still used parallel as an alternative stream (via hw:0,2).
>>
>> Also, don't forget to add your new model to
>> Documentation/*/ALSA-Configuration.txt.
>>
>> Otherwise the patch looks good.
>> Could you fix the above and repost?
>>
>>
>> thanks,
>>
>> Takashi
>> _______________________________________________
>> Alsa-devel mailing list
>> Alsa-devel@alsa-project.org
>> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
>>
> 
> _______________________________________________
> Alsa-devel mailing list
> Alsa-devel@alsa-project.org
> http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] hda: Added Realtek ALC888 model entry for the Acer Aspire 4930G laptop
  2008-11-18 13:55       ` Vincent Petry
  2008-11-18 14:06         ` Takashi Iwai
  2008-11-18 14:06         ` Vincent Petry
@ 2008-11-18 14:21         ` Vincent Petry
  2008-11-18 15:09           ` Takashi Iwai
  2008-11-23  3:31         ` [PATCH] hda: Added an ALC888 model entry for Fujitsu-Siemens Amilo Xa3530 Vincent Petry
  2008-11-23  5:27         ` [PATCH] [resend] " Vincent Petry
  4 siblings, 1 reply; 12+ messages in thread
From: Vincent Petry @ 2008-11-18 14:21 UTC (permalink / raw)
  To: alsa-devel; +Cc: Takashi Iwai

Added Realtek ALC888 model entry for the Acer Aspire 4930G laptop that
fixes the following features:
- internal microphone
- heaphone jack sense
- channel mode

Signed-off-by: Vincent Petry <PVince81@yahoo.fr>
---
 Documentation/ALSA-Configuration.txt |    1
 pci/hda/patch_realtek.c              |  115
+++++++++++++++++++++++++++++++++++
 2 files changed, 116 insertions(+)

diff -Nur alsa-kernel//Documentation/ALSA-Configuration.txt
alsa-kernel-new//Documentation/ALSA-Configuration.txt
--- alsa-kernel//Documentation/ALSA-Configuration.txt	2008-11-18
19:39:33.000000000 +0800
+++ alsa-kernel-new//Documentation/ALSA-Configuration.txt	2008-11-18
22:02:51.000000000 +0800
@@ -903,6 +903,7 @@
 	  6stack-dig-demo  6-jack digital for Intel demo board
 	  acer		Acer laptops (Travelmate 3012WTMi, Aspire 5600, etc)
 	  acer-aspire	Acer Aspire 9810
+	  acer-aspire-4930g Acer Aspire 4930G
 	  medion	Medion Laptops
 	  medion-md2	Medion MD2
 	  targa-dig	Targa/MSI
diff -Nur alsa-kernel//pci/hda/patch_realtek.c
alsa-kernel-new//pci/hda/patch_realtek.c
--- alsa-kernel//pci/hda/patch_realtek.c	2008-11-18 19:39:33.000000000 +0800
+++ alsa-kernel-new//pci/hda/patch_realtek.c	2008-11-18
21:38:42.000000000 +0800
@@ -216,6 +216,7 @@
 	ALC883_TARGA_2ch_DIG,
 	ALC883_ACER,
 	ALC883_ACER_ASPIRE,
+	ALC888_ACER_ASPIRE_4930G,
 	ALC883_MEDION,
 	ALC883_MEDION_MD2,
 	ALC883_LAPTOP_EAPD,
@@ -1155,6 +1156,90 @@
 }

 /*
+ * ALC888 Acer Aspire 4930G model
+ */
+
+static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
+/* Front Mic: set to PIN_IN (empty by default) */
+	{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
+/* Unselect Front Mic by default in input mixer 3 */
+	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
+/* enable unsolicited event fpr HP jack */
+	{0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
+/* Connect Internal HP to front */
+	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
+/* Connect HP out to front */
+	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
+	{ }
+};
+
+static struct hda_input_mux alc888_acer_aspire_4930g_capture_source[2] = {
+	/* Front mic only available on one ADC */
+	{
+		.num_items = 4,
+		.items = {
+			{ "Mic", 0x0 },
+			{ "Line", 0x2 },
+			{ "CD", 0x4 },
+			{ "Front Mic", 0xb },
+		},
+	},
+	{
+		.num_items = 3,
+		.items = {
+			{ "Mic", 0x0 },
+			{ "Line", 0x2 },
+			{ "CD", 0x4 },
+		},
+	}
+};
+
+static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
+	HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
+		HDA_OUTPUT),
+	HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
+	HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
+	HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
+	HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
+	HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
+	HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
+	HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
+	HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
+	HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
+	HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
+	HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
+	HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
+	{ } /* end */
+};
+
+static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
+{
+	unsigned int present;
+	present = snd_hda_codec_read(codec, 0x15, 0,
+				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
+	/* Toggle the internal HP PIN (regular muting doesn't work) */
+	snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
+					(present ? 0x0 : PIN_OUT));
+}
+
+static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
+		unsigned int res)
+{
+	if (res >> 26 == ALC880_HP_EVENT)
+		alc888_acer_aspire_4930g_automute(codec);
+}
+
+/*
  * ALC880 3-stack model
  *
  * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
@@ -6887,8 +6972,15 @@
 	0x08,
 };

+static hda_nid_t alc883_adc_nids_rev[2] = {
+	/* ADC2-1 */
+	0x09, 0x08
+};
+
 static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };

+static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
+
 /* input MUX */
 /* FIXME: should be a matrix-type input source selection */

@@ -8180,6 +8272,7 @@
 	[ALC883_TARGA_2ch_DIG]	= "targa-2ch-dig",
 	[ALC883_ACER]		= "acer",
 	[ALC883_ACER_ASPIRE]	= "acer-aspire",
+	[ALC888_ACER_ASPIRE_4930G]	= "acer-aspire-4930g",
 	[ALC883_MEDION]		= "medion",
 	[ALC883_MEDION_MD2]	= "medion-md2",
 	[ALC883_LAPTOP_EAPD]	= "laptop-eapd",
@@ -8205,6 +8298,8 @@
 	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
 	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
 	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
+	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
+		ALC888_ACER_ASPIRE_4930G),
 	SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
 	SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
 	SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
@@ -8376,6 +8471,26 @@
 		.unsol_event = alc883_acer_aspire_unsol_event,
 		.init_hook = alc883_acer_aspire_automute,
 	},
+	[ALC888_ACER_ASPIRE_4930G] = {
+		.mixers = { alc888_acer_aspire_4930g_mixer,
+				alc883_chmode_mixer },
+		.init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
+				alc888_acer_aspire_4930g_verbs },
+		.num_dacs = ARRAY_SIZE(alc883_dac_nids),
+		.dac_nids = alc883_dac_nids,
+		.num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
+		.adc_nids = alc883_adc_nids_rev,
+		.capsrc_nids = alc883_capsrc_nids_rev,
+		.dig_out_nid = ALC883_DIGOUT_NID,
+		.num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
+		.channel_mode = alc883_3ST_6ch_modes,
+		.need_dac_fix = 1,
+		.num_mux_defs =
+			ARRAY_SIZE(alc888_acer_aspire_4930g_capture_source),
+		.input_mux = alc888_acer_aspire_4930g_capture_source,
+		.unsol_event = alc888_acer_aspire_4930g_unsol_event,
+		.init_hook = alc888_acer_aspire_4930g_automute,
+	},
 	[ALC883_MEDION] = {
 		.mixers = { alc883_fivestack_mixer,
 			    alc883_chmode_mixer },

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] hda: Added Realtek ALC888 model entry for the Acer Aspire 4930G laptop
  2008-11-18 14:21         ` [PATCH] hda: " Vincent Petry
@ 2008-11-18 15:09           ` Takashi Iwai
  0 siblings, 0 replies; 12+ messages in thread
From: Takashi Iwai @ 2008-11-18 15:09 UTC (permalink / raw)
  To: Vincent Petry; +Cc: alsa-devel

At Tue, 18 Nov 2008 22:21:57 +0800,
Vincent Petry wrote:
> 
> Added Realtek ALC888 model entry for the Acer Aspire 4930G laptop that
> fixes the following features:
> - internal microphone
> - heaphone jack sense
> - channel mode
> 
> Signed-off-by: Vincent Petry <PVince81@yahoo.fr>

Thanks, applied now to sound git tree.

However, your patch in this mail seems broken, likely due to your MUA.
I fixed it manually this time.  At the next time, please either fix
your MUA or use an attachment if it's difficult.


thanks,

Takashi


> ---
>  Documentation/ALSA-Configuration.txt |    1
>  pci/hda/patch_realtek.c              |  115
> +++++++++++++++++++++++++++++++++++
>  2 files changed, 116 insertions(+)
> 
> diff -Nur alsa-kernel//Documentation/ALSA-Configuration.txt
> alsa-kernel-new//Documentation/ALSA-Configuration.txt
> --- alsa-kernel//Documentation/ALSA-Configuration.txt	2008-11-18
> 19:39:33.000000000 +0800
> +++ alsa-kernel-new//Documentation/ALSA-Configuration.txt	2008-11-18
> 22:02:51.000000000 +0800
> @@ -903,6 +903,7 @@
>  	  6stack-dig-demo  6-jack digital for Intel demo board
>  	  acer		Acer laptops (Travelmate 3012WTMi, Aspire 5600, etc)
>  	  acer-aspire	Acer Aspire 9810
> +	  acer-aspire-4930g Acer Aspire 4930G
>  	  medion	Medion Laptops
>  	  medion-md2	Medion MD2
>  	  targa-dig	Targa/MSI
> diff -Nur alsa-kernel//pci/hda/patch_realtek.c
> alsa-kernel-new//pci/hda/patch_realtek.c
> --- alsa-kernel//pci/hda/patch_realtek.c	2008-11-18 19:39:33.000000000 +0800
> +++ alsa-kernel-new//pci/hda/patch_realtek.c	2008-11-18
> 21:38:42.000000000 +0800
> @@ -216,6 +216,7 @@
>  	ALC883_TARGA_2ch_DIG,
>  	ALC883_ACER,
>  	ALC883_ACER_ASPIRE,
> +	ALC888_ACER_ASPIRE_4930G,
>  	ALC883_MEDION,
>  	ALC883_MEDION_MD2,
>  	ALC883_LAPTOP_EAPD,
> @@ -1155,6 +1156,90 @@
>  }
> 
>  /*
> + * ALC888 Acer Aspire 4930G model
> + */
> +
> +static struct hda_verb alc888_acer_aspire_4930g_verbs[] = {
> +/* Front Mic: set to PIN_IN (empty by default) */
> +	{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
> +/* Unselect Front Mic by default in input mixer 3 */
> +	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
> +/* enable unsolicited event fpr HP jack */
> +	{0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
> +/* Connect Internal HP to front */
> +	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
> +	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
> +	{0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
> +/* Connect HP out to front */
> +	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
> +	{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
> +	{0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
> +	{ }
> +};
> +
> +static struct hda_input_mux alc888_acer_aspire_4930g_capture_source[2] = {
> +	/* Front mic only available on one ADC */
> +	{
> +		.num_items = 4,
> +		.items = {
> +			{ "Mic", 0x0 },
> +			{ "Line", 0x2 },
> +			{ "CD", 0x4 },
> +			{ "Front Mic", 0xb },
> +		},
> +	},
> +	{
> +		.num_items = 3,
> +		.items = {
> +			{ "Mic", 0x0 },
> +			{ "Line", 0x2 },
> +			{ "CD", 0x4 },
> +		},
> +	}
> +};
> +
> +static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
> +	HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
> +	HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
> +	HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
> +	HDA_BIND_MUTE("Surround Playback Switch", 0x0d, 2, HDA_INPUT),
> +	HDA_CODEC_VOLUME_MONO("Center Playback Volume", 0x0e, 1, 0x0,
> +		HDA_OUTPUT),
> +	HDA_CODEC_VOLUME_MONO("LFE Playback Volume", 0x0e, 2, 0x0, HDA_OUTPUT),
> +	HDA_BIND_MUTE_MONO("Center Playback Switch", 0x0e, 1, 2, HDA_INPUT),
> +	HDA_BIND_MUTE_MONO("LFE Playback Switch", 0x0e, 2, 2, HDA_INPUT),
> +	HDA_CODEC_VOLUME("Side Playback Volume", 0x0f, 0x0, HDA_OUTPUT),
> +	HDA_BIND_MUTE("Side Playback Switch", 0x0f, 2, HDA_INPUT),
> +	HDA_CODEC_VOLUME("CD Playback Volume", 0x0b, 0x04, HDA_INPUT),
> +	HDA_CODEC_MUTE("CD Playback Switch", 0x0b, 0x04, HDA_INPUT),
> +	HDA_CODEC_VOLUME("Line Playback Volume", 0x0b, 0x02, HDA_INPUT),
> +	HDA_CODEC_MUTE("Line Playback Switch", 0x0b, 0x02, HDA_INPUT),
> +	HDA_CODEC_VOLUME("Mic Playback Volume", 0x0b, 0x0, HDA_INPUT),
> +	HDA_CODEC_VOLUME("Mic Boost", 0x18, 0, HDA_INPUT),
> +	HDA_CODEC_MUTE("Mic Playback Switch", 0x0b, 0x0, HDA_INPUT),
> +	HDA_CODEC_VOLUME("PC Speaker Playback Volume", 0x0b, 0x05, HDA_INPUT),
> +	HDA_CODEC_MUTE("PC Speaker Playback Switch", 0x0b, 0x05, HDA_INPUT),
> +	{ } /* end */
> +};
> +
> +static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
> +{
> +	unsigned int present;
> +	present = snd_hda_codec_read(codec, 0x15, 0,
> +				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
> +	/* Toggle the internal HP PIN (regular muting doesn't work) */
> +	snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
> +					(present ? 0x0 : PIN_OUT));
> +}
> +
> +static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
> +		unsigned int res)
> +{
> +	if (res >> 26 == ALC880_HP_EVENT)
> +		alc888_acer_aspire_4930g_automute(codec);
> +}
> +
> +/*
>   * ALC880 3-stack model
>   *
>   * DAC: Front = 0x02 (0x0c), Surr = 0x05 (0x0f), CLFE = 0x04 (0x0e)
> @@ -6887,8 +6972,15 @@
>  	0x08,
>  };
> 
> +static hda_nid_t alc883_adc_nids_rev[2] = {
> +	/* ADC2-1 */
> +	0x09, 0x08
> +};
> +
>  static hda_nid_t alc883_capsrc_nids[2] = { 0x23, 0x22 };
> 
> +static hda_nid_t alc883_capsrc_nids_rev[2] = { 0x22, 0x23 };
> +
>  /* input MUX */
>  /* FIXME: should be a matrix-type input source selection */
> 
> @@ -8180,6 +8272,7 @@
>  	[ALC883_TARGA_2ch_DIG]	= "targa-2ch-dig",
>  	[ALC883_ACER]		= "acer",
>  	[ALC883_ACER_ASPIRE]	= "acer-aspire",
> +	[ALC888_ACER_ASPIRE_4930G]	= "acer-aspire-4930g",
>  	[ALC883_MEDION]		= "medion",
>  	[ALC883_MEDION_MD2]	= "medion-md2",
>  	[ALC883_LAPTOP_EAPD]	= "laptop-eapd",
> @@ -8205,6 +8298,8 @@
>  	SND_PCI_QUIRK(0x1025, 0x0110, "Acer Aspire", ALC883_ACER_ASPIRE),
>  	SND_PCI_QUIRK(0x1025, 0x0112, "Acer Aspire 9303", ALC883_ACER_ASPIRE),
>  	SND_PCI_QUIRK(0x1025, 0x0121, "Acer Aspire 5920G", ALC883_ACER_ASPIRE),
> +	SND_PCI_QUIRK(0x1025, 0x013e, "Acer Aspire 4930G",
> +		ALC888_ACER_ASPIRE_4930G),
>  	SND_PCI_QUIRK(0x1025, 0, "Acer laptop", ALC883_ACER), /* default Acer */
>  	SND_PCI_QUIRK(0x1028, 0x020d, "Dell Inspiron 530", ALC888_6ST_DELL),
>  	SND_PCI_QUIRK(0x103c, 0x2a3d, "HP Pavillion", ALC883_6ST_DIG),
> @@ -8376,6 +8471,26 @@
>  		.unsol_event = alc883_acer_aspire_unsol_event,
>  		.init_hook = alc883_acer_aspire_automute,
>  	},
> +	[ALC888_ACER_ASPIRE_4930G] = {
> +		.mixers = { alc888_acer_aspire_4930g_mixer,
> +				alc883_chmode_mixer },
> +		.init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
> +				alc888_acer_aspire_4930g_verbs },
> +		.num_dacs = ARRAY_SIZE(alc883_dac_nids),
> +		.dac_nids = alc883_dac_nids,
> +		.num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
> +		.adc_nids = alc883_adc_nids_rev,
> +		.capsrc_nids = alc883_capsrc_nids_rev,
> +		.dig_out_nid = ALC883_DIGOUT_NID,
> +		.num_channel_mode = ARRAY_SIZE(alc883_3ST_6ch_modes),
> +		.channel_mode = alc883_3ST_6ch_modes,
> +		.need_dac_fix = 1,
> +		.num_mux_defs =
> +			ARRAY_SIZE(alc888_acer_aspire_4930g_capture_source),
> +		.input_mux = alc888_acer_aspire_4930g_capture_source,
> +		.unsol_event = alc888_acer_aspire_4930g_unsol_event,
> +		.init_hook = alc888_acer_aspire_4930g_automute,
> +	},
>  	[ALC883_MEDION] = {
>  		.mixers = { alc883_fivestack_mixer,
>  			    alc883_chmode_mixer },
> 
> 

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] hda: Added an ALC888 model entry for Fujitsu-Siemens Amilo Xa3530
  2008-11-18 13:55       ` Vincent Petry
                           ` (2 preceding siblings ...)
  2008-11-18 14:21         ` [PATCH] hda: " Vincent Petry
@ 2008-11-23  3:31         ` Vincent Petry
  2008-11-24  7:13           ` Takashi Iwai
  2008-11-23  5:27         ` [PATCH] [resend] " Vincent Petry
  4 siblings, 1 reply; 12+ messages in thread
From: Vincent Petry @ 2008-11-23  3:31 UTC (permalink / raw)
  To: alsa-devel; +Cc: manu

This patch fixes the bug 0004240: ALC888 - Intel HDA - Headphone Controlling.
It is made against the 2008-11-23 snapshot.

Added Realtek ALC888 model entry for the Fujitsu-Siemens Amilo Xa3530
laptop. It has 4 jacks: HP out, Mic-in, Line-in and Line-out/Side/SPDIF
(this one is on the laptop side, the other ones are on the rear).

Model detection works.
Headphone jack sense works now.
Front mic works now, was same as Acer Aspire 4930G.
Added channel mode from 2 to 8 channels.

In 2ch and 4ch modes, the front is also sent to the Line-out/side jack
for convenience instead of just muting the Line-out/side jack like other
models do.

When using the Mic-in jack as CLFE, the sound is very low (bug?). To
work it around, in 6ch mode the CLFE channel is duplicated to the
Line-out/side jack because this one has a better amp.

Signed-off-by: Vincent Petry <PVince81@yahoo.fr>
---
 Documentation/ALSA-Configuration.txt |    1
 pci/hda/patch_realtek.c              |  176
+++++++++++++++++++++++++++++++++--
 2 files changed, 168 insertions(+), 9 deletions(-)

diff -Nur alsa-kernel//Documentation/ALSA-Configuration.txt
alsa-kernel-new//Documentation/ALSA-Configuration.txt
--- alsa-kernel//Documentation/ALSA-Configuration.txt	2008-11-23
07:05:01.000000000 +0800
+++ alsa-kernel-new//Documentation/ALSA-Configuration.txt	2008-11-23
10:58:28.000000000 +0800
@@ -919,6 +919,7 @@
 	  mitac		Mitac 8252D
 	  clevo-m720	Clevo M720 laptop series
 	  fujitsu-pi2515 Fujitsu AMILO Pi2515
+	  fujitsu-xa3530 Fujitsu AMILO XA3530
 	  3stack-6ch-intel Intel DG33* boards
 	  auto		auto-config reading BIOS (default)

diff -Nur alsa-kernel//pci/hda/patch_realtek.c
alsa-kernel-new//pci/hda/patch_realtek.c
--- alsa-kernel//pci/hda/patch_realtek.c	2008-11-23 07:05:02.000000000 +0800
+++ alsa-kernel-new//pci/hda/patch_realtek.c	2008-11-23
10:39:59.000000000 +0800
@@ -230,6 +230,7 @@
 	ALC883_MITAC,
 	ALC883_CLEVO_M720,
 	ALC883_FUJITSU_PI2515,
+	ALC888_FUJITSU_XA3530,
 	ALC883_3ST_6ch_INTEL,
 	ALC888_ASUS_M90V,
 	ALC888_ASUS_EEE1601,
@@ -1156,6 +1157,141 @@
 }

 /*
+ * ALC888
+ */
+
+/*
+ * 2ch mode
+ */
+static struct hda_verb alc888_4ST_ch2_intel_init[] = {
+/* Mic-in jack as mic in */
+	{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
+	{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
+/* Line-in jack as Line in */
+	{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
+	{ 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
+/* Line-Out as Front */
+	{ 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
+	{ } /* end */
+};
+
+/*
+ * 4ch mode
+ */
+static struct hda_verb alc888_4ST_ch4_intel_init[] = {
+/* Mic-in jack as mic in */
+	{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
+	{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
+/* Line-in jack as Surround */
+	{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
+/* Line-Out as Front */
+	{ 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
+	{ } /* end */
+};
+
+/*
+ * 6ch mode
+ */
+static struct hda_verb alc888_4ST_ch6_intel_init[] = {
+/* Mic-in jack as CLFE */
+	{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
+/* Line-in jack as Surround */
+	{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
+/* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
+	{ 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
+	{ } /* end */
+};
+
+/*
+ * 8ch mode
+ */
+static struct hda_verb alc888_4ST_ch8_intel_init[] = {
+/* Mic-in jack as CLFE */
+	{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
+/* Line-in jack as Surround */
+	{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
+/* Line-Out as Side */
+	{ 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
+	{ } /* end */
+};
+
+static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
+	{ 2, alc888_4ST_ch2_intel_init },
+	{ 4, alc888_4ST_ch4_intel_init },
+	{ 6, alc888_4ST_ch6_intel_init },
+	{ 8, alc888_4ST_ch8_intel_init },
+};
+
+/*
+ * ALC888 Fujitsu Siemens Amillo xa3530
+ */
+
+static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
+/* Front Mic: set to PIN_IN (empty by default) */
+	{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
+/* Connect Internal HP to Front */
+	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
+/* Connect Bass HP to Front */
+	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
+/* Connect Line-Out side jack (SPDIF) to Side */
+	{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
+/* Connect Mic jack to CLFE */
+	{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
+/* Connect Line-in jack to Surround */
+	{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
+/* Connect HP out jack to Front */
+	{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
+/* Enable unsolicited event for HP jack and Line-out jack */
+	{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
+	{0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
+	{}
+};
+
+static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec)
+{
+	unsigned int present;
+	unsigned int bits;
+	/* Line out presence */
+	present = snd_hda_codec_read(codec, 0x17, 0,
+				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
+	/* HP out presence */
+	present = present || snd_hda_codec_read(codec, 0x1b, 0,
+				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
+	bits = present ? HDA_AMP_MUTE : 0;
+	/* Toggle internal speakers muting */
+	snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
+				 HDA_AMP_MUTE, bits);
+	/* Toggle internal bass muting */
+	snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
+				 HDA_AMP_MUTE, bits);
+}
+
+static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec,
+		unsigned int res)
+{
+	if (res >> 26 == ALC880_HP_EVENT)
+		alc888_fujitsu_xa3530_automute(codec);
+}
+
+
+/*
  * ALC888 Acer Aspire 4930G model
  */

@@ -1164,7 +1300,7 @@
 	{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
 /* Unselect Front Mic by default in input mixer 3 */
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
-/* enable unsolicited event fpr HP jack */
+/* Enable unsolicited event for HP jack */
 	{0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
 /* Connect Internal HP to front */
 	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
@@ -1177,7 +1313,7 @@
 	{ }
 };

-static struct hda_input_mux alc888_acer_aspire_4930g_capture_source[2] = {
+static struct hda_input_mux alc888_2_capture_sources[2] = {
 	/* Front mic only available on one ADC */
 	{
 		.num_items = 4,
@@ -1198,7 +1334,7 @@
 	}
 };

-static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
+static struct snd_kcontrol_new alc888_base_mixer[] = {
 	HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
 	HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
 	HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -1225,11 +1361,12 @@
 static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
 {
 	unsigned int present;
+	unsigned int bits;
 	present = snd_hda_codec_read(codec, 0x15, 0,
 				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
-	/* Toggle the internal HP PIN (regular muting doesn't work) */
-	snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
-					(present ? 0x0 : PIN_OUT));
+	bits = present ? HDA_AMP_MUTE : 0;
+	snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
+				 HDA_AMP_MUTE, bits);
 }

 static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
@@ -8286,6 +8423,7 @@
 	[ALC883_MITAC]		= "mitac",
 	[ALC883_CLEVO_M720]	= "clevo-m720",
 	[ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
+	[ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
 	[ALC883_3ST_6ch_INTEL]	= "3stack-6ch-intel",
 	[ALC1200_ASUS_P5Q]	= "asus-p5q",
 	[ALC883_AUTO]		= "auto",
@@ -8346,6 +8484,8 @@
 	SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
 	SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
 	SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515",
ALC883_FUJITSU_PI2515),
+	SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",
+		ALC888_FUJITSU_XA3530),
 	SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
 	SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
 	SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
@@ -8472,7 +8612,7 @@
 		.init_hook = alc883_acer_aspire_automute,
 	},
 	[ALC888_ACER_ASPIRE_4930G] = {
-		.mixers = { alc888_acer_aspire_4930g_mixer,
+		.mixers = { alc888_base_mixer,
 				alc883_chmode_mixer },
 		.init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
 				alc888_acer_aspire_4930g_verbs },
@@ -8486,8 +8626,8 @@
 		.channel_mode = alc883_3ST_6ch_modes,
 		.need_dac_fix = 1,
 		.num_mux_defs =
-			ARRAY_SIZE(alc888_acer_aspire_4930g_capture_source),
-		.input_mux = alc888_acer_aspire_4930g_capture_source,
+			ARRAY_SIZE(alc888_2_capture_sources),
+		.input_mux = alc888_2_capture_sources,
 		.unsol_event = alc888_acer_aspire_4930g_unsol_event,
 		.init_hook = alc888_acer_aspire_4930g_automute,
 	},
@@ -8634,6 +8774,24 @@
 		.unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
 		.init_hook = alc883_2ch_fujitsu_pi2515_automute,
 	},
+	[ALC888_FUJITSU_XA3530] = {
+		.mixers = { alc888_base_mixer, alc883_chmode_mixer },
+		.init_verbs = { alc883_init_verbs,
+			alc888_fujitsu_xa3530_verbs },
+		.num_dacs = ARRAY_SIZE(alc883_dac_nids),
+		.dac_nids = alc883_dac_nids,
+		.num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
+		.adc_nids = alc883_adc_nids_rev,
+		.capsrc_nids = alc883_capsrc_nids_rev,
+		.dig_out_nid = ALC883_DIGOUT_NID,
+		.num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
+		.channel_mode = alc888_4ST_8ch_intel_modes,
+		.num_mux_defs =
+			ARRAY_SIZE(alc888_2_capture_sources),
+		.input_mux = alc888_2_capture_sources,
+		.unsol_event = alc888_fujitsu_xa3530_unsol_event,
+		.init_hook = alc888_fujitsu_xa3530_automute,
+	},
 	[ALC888_LENOVO_SKY] = {
 		.mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
 		.init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] [resend] hda: Added an ALC888 model entry for Fujitsu-Siemens Amilo Xa3530
  2008-11-18 13:55       ` Vincent Petry
                           ` (3 preceding siblings ...)
  2008-11-23  3:31         ` [PATCH] hda: Added an ALC888 model entry for Fujitsu-Siemens Amilo Xa3530 Vincent Petry
@ 2008-11-23  5:27         ` Vincent Petry
  4 siblings, 0 replies; 12+ messages in thread
From: Vincent Petry @ 2008-11-23  5:27 UTC (permalink / raw)
  To: alsa-devel

This patch fixes the bug 0004240: ALC888 - Intel HDA - Headphone Controlling.
It is made against the 2008-11-23 snapshot.

Added Realtek ALC888 model entry for the Fujitsu-Siemens Amilo Xa3530
laptop. It has 4 jacks: HP out, Mic-in, Line-in and Line-out/Side/SPDIF
(this one is on the laptop side, the other ones are on the rear).

Model detection works.
Headphone jack sense works now.
Front mic works now, was same as Acer Aspire 4930G.
Added channel mode from 2 to 8 channels.

In 2ch and 4ch modes, the front is also sent to the Line-out/side jack
for convenience instead of just muting the Line-out/side jack like other
models do.

When using the Mic-in jack as CLFE, the sound is very low (bug?). To
work it around, in 6ch mode the CLFE channel is duplicated to the
Line-out/side jack because this one has a better amp.

Signed-off-by: Vincent Petry <PVince81@yahoo.fr>
---
 Documentation/ALSA-Configuration.txt |    1
 pci/hda/patch_realtek.c              |  176
+++++++++++++++++++++++++++++++++--
 2 files changed, 168 insertions(+), 9 deletions(-)

diff -Nur alsa-kernel//Documentation/ALSA-Configuration.txt alsa-kernel-new//Documentation/ALSA-Configuration.txt
--- alsa-kernel//Documentation/ALSA-Configuration.txt	2008-11-23 07:05:01.000000000 +0800
+++ alsa-kernel-new//Documentation/ALSA-Configuration.txt	2008-11-23 10:58:28.000000000 +0800
@@ -919,6 +919,7 @@
 	  mitac		Mitac 8252D
 	  clevo-m720	Clevo M720 laptop series
 	  fujitsu-pi2515 Fujitsu AMILO Pi2515
+	  fujitsu-xa3530 Fujitsu AMILO XA3530
 	  3stack-6ch-intel Intel DG33* boards
 	  auto		auto-config reading BIOS (default)
 
diff -Nur alsa-kernel//pci/hda/patch_realtek.c alsa-kernel-new//pci/hda/patch_realtek.c
--- alsa-kernel//pci/hda/patch_realtek.c	2008-11-23 07:05:02.000000000 +0800
+++ alsa-kernel-new//pci/hda/patch_realtek.c	2008-11-23 10:39:59.000000000 +0800
@@ -230,6 +230,7 @@
 	ALC883_MITAC,
 	ALC883_CLEVO_M720,
 	ALC883_FUJITSU_PI2515,
+	ALC888_FUJITSU_XA3530,
 	ALC883_3ST_6ch_INTEL,
 	ALC888_ASUS_M90V,
 	ALC888_ASUS_EEE1601,
@@ -1156,6 +1157,141 @@
 }
 
 /*
+ * ALC888
+ */
+
+/*
+ * 2ch mode
+ */
+static struct hda_verb alc888_4ST_ch2_intel_init[] = {
+/* Mic-in jack as mic in */
+	{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
+	{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
+/* Line-in jack as Line in */
+	{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN },
+	{ 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
+/* Line-Out as Front */
+	{ 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
+	{ } /* end */
+};
+
+/*
+ * 4ch mode
+ */
+static struct hda_verb alc888_4ST_ch4_intel_init[] = {
+/* Mic-in jack as mic in */
+	{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_VREF80 },
+	{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_MUTE },
+/* Line-in jack as Surround */
+	{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
+/* Line-Out as Front */
+	{ 0x17, AC_VERB_SET_CONNECT_SEL, 0x00},
+	{ } /* end */
+};
+
+/*
+ * 6ch mode
+ */
+static struct hda_verb alc888_4ST_ch6_intel_init[] = {
+/* Mic-in jack as CLFE */
+	{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
+/* Line-in jack as Surround */
+	{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
+/* Line-Out as CLFE (workaround because Mic-in is not loud enough) */
+	{ 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
+	{ } /* end */
+};
+
+/*
+ * 8ch mode
+ */
+static struct hda_verb alc888_4ST_ch8_intel_init[] = {
+/* Mic-in jack as CLFE */
+	{ 0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
+/* Line-in jack as Surround */
+	{ 0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT },
+	{ 0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE },
+/* Line-Out as Side */
+	{ 0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
+	{ } /* end */
+};
+
+static struct hda_channel_mode alc888_4ST_8ch_intel_modes[4] = {
+	{ 2, alc888_4ST_ch2_intel_init },
+	{ 4, alc888_4ST_ch4_intel_init },
+	{ 6, alc888_4ST_ch6_intel_init },
+	{ 8, alc888_4ST_ch8_intel_init },
+};
+
+/*
+ * ALC888 Fujitsu Siemens Amillo xa3530
+ */
+
+static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
+/* Front Mic: set to PIN_IN (empty by default) */
+	{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
+/* Connect Internal HP to Front */
+	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x14, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x14, AC_VERB_SET_CONNECT_SEL, 0x00},
+/* Connect Bass HP to Front */
+	{0x15, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x15, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x15, AC_VERB_SET_CONNECT_SEL, 0x00},
+/* Connect Line-Out side jack (SPDIF) to Side */
+	{0x17, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x17, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x17, AC_VERB_SET_CONNECT_SEL, 0x03},
+/* Connect Mic jack to CLFE */
+	{0x18, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x18, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x18, AC_VERB_SET_CONNECT_SEL, 0x02},
+/* Connect Line-in jack to Surround */
+	{0x1a, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x1a, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x1a, AC_VERB_SET_CONNECT_SEL, 0x01},
+/* Connect HP out jack to Front */
+	{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
+	{0x1b, AC_VERB_SET_AMP_GAIN_MUTE, AMP_OUT_UNMUTE},
+	{0x1b, AC_VERB_SET_CONNECT_SEL, 0x00},
+/* Enable unsolicited event for HP jack and Line-out jack */
+	{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
+	{0x17, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
+	{}
+};
+
+static void alc888_fujitsu_xa3530_automute(struct hda_codec *codec)
+{
+	unsigned int present;
+	unsigned int bits;
+	/* Line out presence */
+	present = snd_hda_codec_read(codec, 0x17, 0,
+				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
+	/* HP out presence */
+	present = present || snd_hda_codec_read(codec, 0x1b, 0,
+				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
+	bits = present ? HDA_AMP_MUTE : 0;
+	/* Toggle internal speakers muting */
+	snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
+				 HDA_AMP_MUTE, bits);
+	/* Toggle internal bass muting */
+	snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
+				 HDA_AMP_MUTE, bits);
+}
+
+static void alc888_fujitsu_xa3530_unsol_event(struct hda_codec *codec,
+		unsigned int res)
+{
+	if (res >> 26 == ALC880_HP_EVENT)
+		alc888_fujitsu_xa3530_automute(codec);
+}
+
+
+/*
  * ALC888 Acer Aspire 4930G model
  */
 
@@ -1164,7 +1300,7 @@
 	{0x12, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_IN},
 /* Unselect Front Mic by default in input mixer 3 */
 	{0x22, AC_VERB_SET_AMP_GAIN_MUTE, AMP_IN_MUTE(0xb)},
-/* enable unsolicited event fpr HP jack */
+/* Enable unsolicited event for HP jack */
 	{0x15, AC_VERB_SET_UNSOLICITED_ENABLE, ALC880_HP_EVENT | AC_USRSP_EN},
 /* Connect Internal HP to front */
 	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_OUT},
@@ -1177,7 +1313,7 @@
 	{ }
 };
 
-static struct hda_input_mux alc888_acer_aspire_4930g_capture_source[2] = {
+static struct hda_input_mux alc888_2_capture_sources[2] = {
 	/* Front mic only available on one ADC */
 	{
 		.num_items = 4,
@@ -1198,7 +1334,7 @@
 	}
 };
 
-static struct snd_kcontrol_new alc888_acer_aspire_4930g_mixer[] = {
+static struct snd_kcontrol_new alc888_base_mixer[] = {
 	HDA_CODEC_VOLUME("Front Playback Volume", 0x0c, 0x0, HDA_OUTPUT),
 	HDA_BIND_MUTE("Front Playback Switch", 0x0c, 2, HDA_INPUT),
 	HDA_CODEC_VOLUME("Surround Playback Volume", 0x0d, 0x0, HDA_OUTPUT),
@@ -1225,11 +1361,12 @@
 static void alc888_acer_aspire_4930g_automute(struct hda_codec *codec)
 {
 	unsigned int present;
+	unsigned int bits;
 	present = snd_hda_codec_read(codec, 0x15, 0,
 				     AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
-	/* Toggle the internal HP PIN (regular muting doesn't work) */
-	snd_hda_codec_write(codec, 0x14, 0, AC_VERB_SET_PIN_WIDGET_CONTROL,
-					(present ? 0x0 : PIN_OUT));
+	bits = present ? HDA_AMP_MUTE : 0;
+	snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
+				 HDA_AMP_MUTE, bits);
 }
 
 static void alc888_acer_aspire_4930g_unsol_event(struct hda_codec *codec,
@@ -8286,6 +8423,7 @@
 	[ALC883_MITAC]		= "mitac",
 	[ALC883_CLEVO_M720]	= "clevo-m720",
 	[ALC883_FUJITSU_PI2515] = "fujitsu-pi2515",
+	[ALC888_FUJITSU_XA3530] = "fujitsu-xa3530",
 	[ALC883_3ST_6ch_INTEL]	= "3stack-6ch-intel",
 	[ALC1200_ASUS_P5Q]	= "asus-p5q",
 	[ALC883_AUTO]		= "auto",
@@ -8346,6 +8484,8 @@
 	SND_PCI_QUIRK(0x15d9, 0x8780, "Supermicro PDSBA", ALC883_3ST_6ch),
 	SND_PCI_QUIRK(0x161f, 0x2054, "Medion laptop", ALC883_MEDION),
 	SND_PCI_QUIRK(0x1734, 0x1108, "Fujitsu AMILO Pi2515", ALC883_FUJITSU_PI2515),
+	SND_PCI_QUIRK(0x1734, 0x113d, "Fujitsu AMILO Xa3530",
+		ALC888_FUJITSU_XA3530),
 	SND_PCI_QUIRK(0x17aa, 0x101e, "Lenovo 101e", ALC883_LENOVO_101E_2ch),
 	SND_PCI_QUIRK(0x17aa, 0x2085, "Lenovo NB0763", ALC883_LENOVO_NB0763),
 	SND_PCI_QUIRK(0x17aa, 0x3bfc, "Lenovo NB0763", ALC883_LENOVO_NB0763),
@@ -8472,7 +8612,7 @@
 		.init_hook = alc883_acer_aspire_automute,
 	},
 	[ALC888_ACER_ASPIRE_4930G] = {
-		.mixers = { alc888_acer_aspire_4930g_mixer,
+		.mixers = { alc888_base_mixer,
 				alc883_chmode_mixer },
 		.init_verbs = { alc883_init_verbs, alc880_gpio1_init_verbs,
 				alc888_acer_aspire_4930g_verbs },
@@ -8486,8 +8626,8 @@
 		.channel_mode = alc883_3ST_6ch_modes,
 		.need_dac_fix = 1,
 		.num_mux_defs =
-			ARRAY_SIZE(alc888_acer_aspire_4930g_capture_source),
-		.input_mux = alc888_acer_aspire_4930g_capture_source,
+			ARRAY_SIZE(alc888_2_capture_sources),
+		.input_mux = alc888_2_capture_sources,
 		.unsol_event = alc888_acer_aspire_4930g_unsol_event,
 		.init_hook = alc888_acer_aspire_4930g_automute,
 	},
@@ -8634,6 +8774,24 @@
 		.unsol_event = alc883_2ch_fujitsu_pi2515_unsol_event,
 		.init_hook = alc883_2ch_fujitsu_pi2515_automute,
 	},
+	[ALC888_FUJITSU_XA3530] = {
+		.mixers = { alc888_base_mixer, alc883_chmode_mixer },
+		.init_verbs = { alc883_init_verbs,
+			alc888_fujitsu_xa3530_verbs },
+		.num_dacs = ARRAY_SIZE(alc883_dac_nids),
+		.dac_nids = alc883_dac_nids,
+		.num_adc_nids = ARRAY_SIZE(alc883_adc_nids_rev),
+		.adc_nids = alc883_adc_nids_rev,
+		.capsrc_nids = alc883_capsrc_nids_rev,
+		.dig_out_nid = ALC883_DIGOUT_NID,
+		.num_channel_mode = ARRAY_SIZE(alc888_4ST_8ch_intel_modes),
+		.channel_mode = alc888_4ST_8ch_intel_modes,
+		.num_mux_defs =
+			ARRAY_SIZE(alc888_2_capture_sources),
+		.input_mux = alc888_2_capture_sources,
+		.unsol_event = alc888_fujitsu_xa3530_unsol_event,
+		.init_hook = alc888_fujitsu_xa3530_automute,
+	},
 	[ALC888_LENOVO_SKY] = {
 		.mixers = { alc888_lenovo_sky_mixer, alc883_chmode_mixer },
 		.init_verbs = { alc883_init_verbs, alc888_lenovo_sky_verbs},

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] hda: Added an ALC888 model entry for Fujitsu-Siemens Amilo Xa3530
  2008-11-23  3:31         ` [PATCH] hda: Added an ALC888 model entry for Fujitsu-Siemens Amilo Xa3530 Vincent Petry
@ 2008-11-24  7:13           ` Takashi Iwai
  0 siblings, 0 replies; 12+ messages in thread
From: Takashi Iwai @ 2008-11-24  7:13 UTC (permalink / raw)
  To: Vincent Petry; +Cc: alsa-devel, manu

At Sun, 23 Nov 2008 11:31:41 +0800,
Vincent Petry wrote:
> 
> This patch fixes the bug 0004240: ALC888 - Intel HDA - Headphone Controlling.
> It is made against the 2008-11-23 snapshot.
> 
> Added Realtek ALC888 model entry for the Fujitsu-Siemens Amilo Xa3530
> laptop. It has 4 jacks: HP out, Mic-in, Line-in and Line-out/Side/SPDIF
> (this one is on the laptop side, the other ones are on the rear).
> 
> Model detection works.
> Headphone jack sense works now.
> Front mic works now, was same as Acer Aspire 4930G.
> Added channel mode from 2 to 8 channels.
> 
> In 2ch and 4ch modes, the front is also sent to the Line-out/side jack
> for convenience instead of just muting the Line-out/side jack like other
> models do.
> 
> When using the Mic-in jack as CLFE, the sound is very low (bug?). To
> work it around, in 6ch mode the CLFE channel is duplicated to the
> Line-out/side jack because this one has a better amp.
> 
> Signed-off-by: Vincent Petry <PVince81@yahoo.fr>

Applied now.  Thanks.

BTW, your embedded patch is broken likely due to your MUA.
If it's difficult to fix, use an attachment as an alternative.


Takashi

^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2008-11-24  7:13 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-11-18 11:21 [PATCH] Added Realtek ALC888 model entry for the Acer Aspire 4930G laptop Petry Vincent
2008-11-18 11:41 ` Takashi Iwai
2008-11-18 13:13   ` [Bulk] " Vincent Petry
2008-11-18 13:19     ` Takashi Iwai
2008-11-18 13:55       ` Vincent Petry
2008-11-18 14:06         ` Takashi Iwai
2008-11-18 14:06         ` Vincent Petry
2008-11-18 14:21         ` [PATCH] hda: " Vincent Petry
2008-11-18 15:09           ` Takashi Iwai
2008-11-23  3:31         ` [PATCH] hda: Added an ALC888 model entry for Fujitsu-Siemens Amilo Xa3530 Vincent Petry
2008-11-24  7:13           ` Takashi Iwai
2008-11-23  5:27         ` [PATCH] [resend] " Vincent Petry

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.