diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-06-25 02:13:40 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-06-25 02:15:03 -0400 |
commit | 261c2407401ca26fa17f05667ea68f51e12c5303 (patch) | |
tree | b388bf9ae09c0656f85f9f85e978b2845755f6c5 | |
parent | 28d0325ce6e0a52f53d8af687e6427fee59004d3 (diff) |
ALSA: hda - Add pin-sense trigger when needed for Realtek codecs
Realtek codecs require the pin-sense trigger call before actually
reading the pin-sense. Without this, the pin-detection might not be
done accurately.
This patch adds the pin-capability check and issues the trigger call
if required.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 334533197425..98ac24adf39c 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -945,12 +945,13 @@ static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, | |||
945 | static void alc_automute_pin(struct hda_codec *codec) | 945 | static void alc_automute_pin(struct hda_codec *codec) |
946 | { | 946 | { |
947 | struct alc_spec *spec = codec->spec; | 947 | struct alc_spec *spec = codec->spec; |
948 | unsigned int present; | 948 | unsigned int present, pincap; |
949 | unsigned int nid = spec->autocfg.hp_pins[0]; | 949 | unsigned int nid = spec->autocfg.hp_pins[0]; |
950 | int i; | 950 | int i; |
951 | 951 | ||
952 | /* need to execute and sync at first */ | 952 | pincap = snd_hda_query_pin_caps(codec, nid); |
953 | snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); | 953 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ |
954 | snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); | ||
954 | present = snd_hda_codec_read(codec, nid, 0, | 955 | present = snd_hda_codec_read(codec, nid, 0, |
955 | AC_VERB_GET_PIN_SENSE, 0); | 956 | AC_VERB_GET_PIN_SENSE, 0); |
956 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; | 957 | spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; |
@@ -1392,7 +1393,7 @@ static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { | |||
1392 | static void alc_automute_amp(struct hda_codec *codec) | 1393 | static void alc_automute_amp(struct hda_codec *codec) |
1393 | { | 1394 | { |
1394 | struct alc_spec *spec = codec->spec; | 1395 | struct alc_spec *spec = codec->spec; |
1395 | unsigned int val, mute; | 1396 | unsigned int val, mute, pincap; |
1396 | hda_nid_t nid; | 1397 | hda_nid_t nid; |
1397 | int i; | 1398 | int i; |
1398 | 1399 | ||
@@ -1401,6 +1402,10 @@ static void alc_automute_amp(struct hda_codec *codec) | |||
1401 | nid = spec->autocfg.hp_pins[i]; | 1402 | nid = spec->autocfg.hp_pins[i]; |
1402 | if (!nid) | 1403 | if (!nid) |
1403 | break; | 1404 | break; |
1405 | pincap = snd_hda_query_pin_caps(codec, nid); | ||
1406 | if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */ | ||
1407 | snd_hda_codec_read(codec, nid, 0, | ||
1408 | AC_VERB_SET_PIN_SENSE, 0); | ||
1404 | val = snd_hda_codec_read(codec, nid, 0, | 1409 | val = snd_hda_codec_read(codec, nid, 0, |
1405 | AC_VERB_GET_PIN_SENSE, 0); | 1410 | AC_VERB_GET_PIN_SENSE, 0); |
1406 | if (val & AC_PINSENSE_PRESENCE) { | 1411 | if (val & AC_PINSENSE_PRESENCE) { |