Commit 261c2407 authored by Takashi Iwai's avatar Takashi Iwai

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: default avatarTakashi Iwai <tiwai@suse.de>
parent 28d0325c
...@@ -945,12 +945,13 @@ static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid, ...@@ -945,12 +945,13 @@ static void alc_fix_pll_init(struct hda_codec *codec, hda_nid_t nid,
static void alc_automute_pin(struct hda_codec *codec) static void alc_automute_pin(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
unsigned int present; unsigned int present, pincap;
unsigned int nid = spec->autocfg.hp_pins[0]; unsigned int nid = spec->autocfg.hp_pins[0];
int i; int i;
/* need to execute and sync at first */ pincap = snd_hda_query_pin_caps(codec, nid);
snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0); if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
snd_hda_codec_read(codec, nid, 0, AC_VERB_SET_PIN_SENSE, 0);
present = snd_hda_codec_read(codec, nid, 0, present = snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_PIN_SENSE, 0); AC_VERB_GET_PIN_SENSE, 0);
spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0; spec->jack_present = (present & AC_PINSENSE_PRESENCE) != 0;
...@@ -1392,7 +1393,7 @@ static struct hda_verb alc888_fujitsu_xa3530_verbs[] = { ...@@ -1392,7 +1393,7 @@ static struct hda_verb alc888_fujitsu_xa3530_verbs[] = {
static void alc_automute_amp(struct hda_codec *codec) static void alc_automute_amp(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
unsigned int val, mute; unsigned int val, mute, pincap;
hda_nid_t nid; hda_nid_t nid;
int i; int i;
...@@ -1401,6 +1402,10 @@ static void alc_automute_amp(struct hda_codec *codec) ...@@ -1401,6 +1402,10 @@ static void alc_automute_amp(struct hda_codec *codec)
nid = spec->autocfg.hp_pins[i]; nid = spec->autocfg.hp_pins[i];
if (!nid) if (!nid)
break; break;
pincap = snd_hda_query_pin_caps(codec, nid);
if (pincap & AC_PINCAP_TRIG_REQ) /* need trigger? */
snd_hda_codec_read(codec, nid, 0,
AC_VERB_SET_PIN_SENSE, 0);
val = snd_hda_codec_read(codec, nid, 0, val = snd_hda_codec_read(codec, nid, 0,
AC_VERB_GET_PIN_SENSE, 0); AC_VERB_GET_PIN_SENSE, 0);
if (val & AC_PINSENSE_PRESENCE) { if (val & AC_PINSENSE_PRESENCE) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment