[alsa-devel] Found bug in latest sound/pci/hda/patch_realtek.c from git, the bug is about jack sensing

Kim Therkelsen kim_t26 at hotmail.com
Mon Nov 22 10:32:19 CET 2010


Hi, 

I think I have found a bug in patch_realtek.c. I have a 272X codec in my laptop and have discovered that it is only reported through the ALSA driver API when my headphone minijack is disconnected and not when it is connected.
This is happening because alc_report_jack(...) is only called when the minijack connector is disconnected and not when it is connected.
In order to make jack sensing work properly i modified patch_realtek.c and added alc_report_jack(codec, spec->autocfg.hp_pins[i]); at line 1132 (see code below).

The code shown below is from:
http://git.kernel.org/?p=linux/kernel/git/next/linux-next.git;a=blob;f=sound/pci/hda/patch_realtek.c;h=2363f1893e8873dbe3508039e1ec5a11d72e207a;hb=bf1b022588eba78c990fd58fd2471cd92c2c5683

1118 static void alc_automute_speaker(struct hda_codec *codec, int pinctl)
1119 {
1120         struct alc_spec *spec = codec->spec;
1121         unsigned int mute;
1122         hda_nid_t nid;
1123         int i;
1124 
1125         spec->jack_present = 0;
1126         for (i = 0; i < ARRAY_SIZE(spec->autocfg.hp_pins); i++) {
1127                 nid = spec->autocfg.hp_pins[i];
1128                 if (!nid)
1129                         break;
1130                 if (snd_hda_jack_detect(codec, nid)) {
1131                         spec->jack_present = 1;
//ADDED BY KT:     alc_report_jack(codec, spec->autocfg.hp_pins[i]);

1132                         break;
1133                 }
1134                 alc_report_jack(codec, spec->autocfg.hp_pins[i]);
1135         }
1136 
1137         mute = spec->jack_present ? HDA_AMP_MUTE : 0;
1138         /* Toggle internal speakers muting */
1139         for (i = 0; i < ARRAY_SIZE(spec->autocfg.speaker_pins); i++) {
1140                 nid = spec->autocfg.speaker_pins[i];
1141                 if (!nid)
1142                         break;
1143                 if (pinctl) {
1144                         snd_hda_codec_write(codec, nid, 0,
1145                                     AC_VERB_SET_PIN_WIDGET_CONTROL,
1146                                     spec->jack_present ? 0 : PIN_OUT);
1147                 } else {
1148                         snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1149                                          HDA_AMP_MUTE, mute);
1150                 }
1151         }
1152 }
Best regards,
Kim Therkelsen
 		 	   		  


More information about the Alsa-devel mailing list