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>
This commit is contained in:
parent
28d0325ce6
commit
261c240740
1 changed files with 9 additions and 4 deletions
|
@ -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[] = {
|
||||||
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)
|
||||||
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) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue