[alsa-devel] [PATCH 068/112] ALSA: hda - Clear unsol enable bits on unused pins in generic parser

Takashi Iwai tiwai at suse.de
Tue Jan 8 12:39:01 CET 2013


For preliminary works to migrate the generic parser for Conexant
codecs: the same function is ported to hda_generic.c.
But now it looks through the jack detect table so that it can cover
better.

Signed-off-by: Takashi Iwai <tiwai at suse.de>
---
 sound/pci/hda/hda_generic.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index a5c4bc0..b7b8d7e 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -3532,6 +3532,23 @@ static void init_digital(struct hda_codec *codec)
 		snd_hda_set_pin_ctl(codec, pin, PIN_IN);
 }
 
+/* clear unsol-event tags on unused pins; Conexant codecs seem to leave
+ * invalid unsol tags by some reason
+ */
+static void clear_unsol_on_unused_pins(struct hda_codec *codec)
+{
+	int i;
+
+	for (i = 0; i < codec->init_pins.used; i++) {
+		struct hda_pincfg *pin = snd_array_elem(&codec->init_pins, i);
+		hda_nid_t nid = pin->nid;
+		if (is_jack_detectable(codec, nid) &&
+		    !snd_hda_jack_tbl_get(codec, nid))
+			snd_hda_codec_update_cache(codec, nid, 0,
+					AC_VERB_SET_UNSOLICITED_ENABLE, 0);
+	}
+}
+
 int snd_hda_gen_init(struct hda_codec *codec)
 {
 	struct hda_gen_spec *spec = codec->spec;
@@ -3550,6 +3567,8 @@ int snd_hda_gen_init(struct hda_codec *codec)
 	init_input_src(codec);
 	init_digital(codec);
 
+	clear_unsol_on_unused_pins(codec);
+
 	/* call init functions of standard auto-mute helpers */
 	snd_hda_gen_hp_automute(codec, NULL);
 	snd_hda_gen_line_automute(codec, NULL);
-- 
1.8.0.1



More information about the Alsa-devel mailing list