Skip to contentSkip to conversation

Fujitsu Lifebook port replicator/dock headphone jack sense

ALC262 patch_realtek.c Applied Tony Vroon 2 participants 4 messages Mar 14, 2008 Sound

lore
Share & tools
lore

Tony Vroon

author
#0 lore raw

Good afternoon,

Could you please consider the following patch for the 2.6.26 merge window. The docking station headphone output had no audio and jack sense was not considered.

Jack information from the laptop itself and the dock are combined, as the dock does not obscure the connector.

Regards,
Tony V.
LINX sysadmin

P.S. Codec graph included in case anyone wants to start using mic jack sense for automated capture source selection.

sound/pci/hda/patch_realtek.c +16 -4
index 33282f9..bbb8b2c 100644
@@ -8585,7 +8585,7 @@ static void alc262_hippo1_unsol_event(struct hda_codec *codec,
 
 /*
  * fujitsu model
- *  0x14 = headphone/spdif-out, 0x15 = internal speaker
+ *  0x14 = headphone/spdif-out, 0x15 = internal speaker, 0x1B = dock headphone out
  */
 
 #define ALC_HP_EVENT	0x37
@@ -8593,6 +8593,8 @@ static void alc262_hippo1_unsol_event(struct hda_codec *codec,
 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
 	{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
 	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
+	{0x1B, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
+	{0x1B, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
 	{}
 };
 
@@ -8633,12 +8635,16 @@ static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
 	unsigned int mute;
 
 	if (force || !spec->sense_updated) {
-		unsigned int present;
+		unsigned int present_int_hp, present_dock_hp;
 		/* need to execute and sync at first */
 		snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
-		present = snd_hda_codec_read(codec, 0x14, 0,
+		present_int_hp = snd_hda_codec_read(codec, 0x14, 0,
 				    	 AC_VERB_GET_PIN_SENSE, 0);
-		spec->jack_present = (present & 0x80000000) != 0;
+		snd_hda_codec_read(codec, 0x1B, 0, AC_VERB_SET_PIN_SENSE, 0);
+		present_dock_hp = snd_hda_codec_read(codec, 0x1B, 0,
+				    	 AC_VERB_GET_PIN_SENSE, 0);
+		spec->jack_present = (present_int_hp & 0x80000000) != 0;
+		spec->jack_present += (present_dock_hp & 0x80000000) != 0;
 		spec->sense_updated = 1;
 	}
 	if (spec->jack_present) {
@@ -8686,6 +8692,12 @@ static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
 	change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
 					   HDA_AMP_MUTE,
 					   valp[1] ? 0 : HDA_AMP_MUTE);
+	change |= snd_hda_codec_amp_update(codec, 0x1B, 0, HDA_OUTPUT, 0,
+					  HDA_AMP_MUTE,
+					  valp[0] ? 0 : HDA_AMP_MUTE);
+	change |= snd_hda_codec_amp_update(codec, 0x1B, 1, HDA_OUTPUT, 0,
+					   HDA_AMP_MUTE,
+					   valp[1] ? 0 : HDA_AMP_MUTE);
 	if (change)
 		alc262_fujitsu_automute(codec, 0);
 	return change;

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

#1 lore raw

At Fri, 14 Mar 2008 13:32:48 +0000,

sound/pci/hda/patch_realtek.c static void alc262_hippo1_unsol_event(struct hda_codec *codec, · line 8588

Quoted 11 lines · Tony Vroon
sound/pci/hda/patch_realtek.c +1 -1
index 33282f9..bbb8b2c 100644
@@ -8585,7 +8585,7 @@ static void alc262_hippo1_unsol_event(struct hda_codec *codec,
 
 /*
  * fujitsu model
- *  0x14 = headphone/spdif-out, 0x15 = internal speaker
+ *  0x14 = headphone/spdif-out, 0x15 = internal speaker, 0x1B = dock headphone out

Please fold the line to fit within 80 chars.

sound/pci/hda/patch_realtek.c static void alc262_hippo1_unsol_event(struct hda_codec *codec, · line 8597

Quoted 9 lines
sound/pci/hda/patch_realtek.c +2 -0
  */
 
 #define ALC_HP_EVENT	0x37
@@ -8593,6 +8593,8 @@ static void alc262_hippo1_unsol_event(struct hda_codec *codec,
 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
 	{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
 	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
+	{0x1B, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
+	{0x1B, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},

0x1b is preferred to 0x1B.

Quoted 10 lines
sound/pci/hda/patch_realtek.c +1 -1
 	{}
 };
 
@@ -8633,12 +8635,16 @@ static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
 	unsigned int mute;
 
 	if (force || !spec->sense_updated) {
-		unsigned int present;
+		unsigned int present_int_hp, present_dock_hp;
 		/* need to execute and sync at first */

sound/pci/hda/patch_realtek.c static void alc262_fujitsu_automute(struct hda_codec *codec, int force) · line 8647

Quoted 10 lines
sound/pci/hda/patch_realtek.c +6 -2
 		snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
-		present = snd_hda_codec_read(codec, 0x14, 0,
+		present_int_hp = snd_hda_codec_read(codec, 0x14, 0,
 				    	 AC_VERB_GET_PIN_SENSE, 0);
-		spec->jack_present = (present & 0x80000000) != 0;
+		snd_hda_codec_read(codec, 0x1B, 0, AC_VERB_SET_PIN_SENSE, 0);
+		present_dock_hp = snd_hda_codec_read(codec, 0x1B, 0,
+				    	 AC_VERB_GET_PIN_SENSE, 0);
+		spec->jack_present = (present_int_hp & 0x80000000) != 0;
+		spec->jack_present += (present_dock_hp & 0x80000000) != 0;

This must be "|=". jack_present is a one-bit value and thus overflow.

sound/pci/hda/patch_realtek.c static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, · line 8700

Quoted 13 lines
sound/pci/hda/patch_realtek.c +6 -0
 		spec->sense_updated = 1;
 	}
 	if (spec->jack_present) {
@@ -8686,6 +8692,12 @@ static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
 	change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
 					   HDA_AMP_MUTE,
 					   valp[1] ? 0 : HDA_AMP_MUTE);
+	change |= snd_hda_codec_amp_update(codec, 0x1B, 0, HDA_OUTPUT, 0,
+					  HDA_AMP_MUTE,
+					  valp[0] ? 0 : HDA_AMP_MUTE);
+	change |= snd_hda_codec_amp_update(codec, 0x1B, 1, HDA_OUTPUT, 0,
+					   HDA_AMP_MUTE,
+					   valp[1] ? 0 : HDA_AMP_MUTE);

You can use snd_hda_codec_amp_stereo(). Then it'll be a single call.

Could you fix and repost? Thanks.

Takashi

author
#2 lore raw

#2 [ALC262 patch_realtek.c] Fujitsu Lifebook port replicator/dock headphone jack sense

Good afternoon,

Could you please consider the following patch for the 2.6.26 merge window. The docking station headphone output had no audio and jack sense was not considered.

Jack information from the laptop itself and the dock are combined, as the dock does not obscure the connector. This is version 2 of this patch, incorporating feedback by Takashi Iwai.

Regards,
Tony V.
LINX sysadmin

sound/pci/hda/patch_realtek.c +18 -10
index 33282f9..d3f5654 100644
@@ -8585,7 +8585,8 @@ static void alc262_hippo1_unsol_event(struct hda_codec *codec,
 
 /*
  * fujitsu model
- *  0x14 = headphone/spdif-out, 0x15 = internal speaker
+ *  0x14 = headphone/spdif-out, 0x15 = internal speaker,
+ *  0x1b = port replicator headphone out
  */
 
 #define ALC_HP_EVENT	0x37
@@ -8593,6 +8594,8 @@ static void alc262_hippo1_unsol_event(struct hda_codec *codec,
 static struct hda_verb alc262_fujitsu_unsol_verbs[] = {
 	{0x14, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
 	{0x14, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
+	{0x1b, AC_VERB_SET_UNSOLICITED_ENABLE, AC_USRSP_EN | ALC_HP_EVENT},
+	{0x1b, AC_VERB_SET_PIN_WIDGET_CONTROL, PIN_HP},
 	{}
 };
 
@@ -8633,12 +8636,16 @@ static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
 	unsigned int mute;
 
 	if (force || !spec->sense_updated) {
-		unsigned int present;
+		unsigned int present_int_hp, present_dock_hp;
 		/* need to execute and sync at first */
 		snd_hda_codec_read(codec, 0x14, 0, AC_VERB_SET_PIN_SENSE, 0);
-		present = snd_hda_codec_read(codec, 0x14, 0,
+		present_int_hp = snd_hda_codec_read(codec, 0x14, 0,
 				    	 AC_VERB_GET_PIN_SENSE, 0);
-		spec->jack_present = (present & 0x80000000) != 0;
+		snd_hda_codec_read(codec, 0x1B, 0, AC_VERB_SET_PIN_SENSE, 0);
+		present_dock_hp = snd_hda_codec_read(codec, 0x1b, 0,
+				    	 AC_VERB_GET_PIN_SENSE, 0);
+		spec->jack_present = (present_int_hp & 0x80000000) != 0;
+		spec->jack_present |= (present_dock_hp & 0x80000000) != 0;
 		spec->sense_updated = 1;
 	}
 	if (spec->jack_present) {
@@ -8680,12 +8687,13 @@ static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
 	long *valp = ucontrol->value.integer.value;
 	int change;
 
-	change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
-					  HDA_AMP_MUTE,
-					  valp[0] ? 0 : HDA_AMP_MUTE);
-	change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
-					   HDA_AMP_MUTE,
-					   valp[1] ? 0 : HDA_AMP_MUTE);
+	change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
+						 HDA_AMP_MUTE,
+						 valp ? 0 : HDA_AMP_MUTE);
+	change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
+						 HDA_AMP_MUTE,
+						 valp ? 0 : HDA_AMP_MUTE);
+
 	if (change)
 		alc262_fujitsu_automute(codec, 0);
 	return change;

_______________________________________________
Alsa-devel mailing list
[email protected]
http://mailman.alsa-project.org/mailman/listinfo/alsa-devel

Applied
#3 lore raw

Re: #2 [ALC262 patch_realtek.c] Fujitsu Lifebook port replicator/dock headphone jack sense

At Fri, 14 Mar 2008 15:15:08 +0000,

Quoted 7 lines · Tony Vroon

Good afternoon,

Could you please consider the following patch for the 2.6.26 merge window. The docking station headphone output had no audio and jack sense was not considered.

Quoted 5 lines

Jack information from the laptop itself and the dock are combined, as the dock does not obscure the connector. This is version 2 of this patch, incorporating feedback by Takashi Iwai.

Applied to HG tree. Thanks.

Takashi