Commit 2f451d2a2a44b66586b803763068195088f9ccd4

Authored by Takashi Iwai
1 parent 9e226b4b7e

ALSA: hda - Re-enable the check NO_PRESENCE misc bit

We disabled the check of NO_PRESENCE bit of the default pin-config
in commit f4419172 temporarily.  One problem was that the first
implementation was wrong -- the bit after the shift must be checked.
However, this would still give many regressions on machines with broken
BIOS.  They set this bit wrongly even on active pins.

A workaround is to check whether all pins contain this bit.  As far as
I've checked, broken BIOSen set this bit on all pins, no matter whether
active or not.  In such a case, the driver should ignore this bit check.

Signed-off-by: Takashi Iwai <tiwai@suse.de>

Showing 3 changed files with 14 additions and 7 deletions Side-by-side Diff

sound/pci/hda/hda_codec.c
... ... @@ -4770,6 +4770,7 @@
4770 4770 memset(sequences_hp, 0, sizeof(sequences_hp));
4771 4771 assoc_line_out = 0;
4772 4772  
  4773 + codec->ignore_misc_bit = true;
4773 4774 end_nid = codec->start_nid + codec->num_nodes;
4774 4775 for (nid = codec->start_nid; nid < end_nid; nid++) {
4775 4776 unsigned int wid_caps = get_wcaps(codec, nid);
... ... @@ -4785,6 +4786,9 @@
4785 4786 continue;
4786 4787  
4787 4788 def_conf = snd_hda_codec_get_pincfg(codec, nid);
  4789 + if (!(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) &
  4790 + AC_DEFCFG_MISC_NO_PRESENCE))
  4791 + codec->ignore_misc_bit = false;
4788 4792 conn = get_defcfg_connect(def_conf);
4789 4793 if (conn == AC_JACK_PORT_NONE)
4790 4794 continue;
sound/pci/hda/hda_codec.h
... ... @@ -854,6 +854,7 @@
854 854 unsigned int no_sticky_stream:1; /* no sticky-PCM stream assignment */
855 855 unsigned int pins_shutup:1; /* pins are shut up */
856 856 unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */
  857 + unsigned int ignore_misc_bit:1; /* ignore MISC_NO_PRESENCE bit */
857 858 #ifdef CONFIG_SND_HDA_POWER_SAVE
858 859 unsigned int power_on :1; /* current (global) power-state */
859 860 unsigned int power_transition :1; /* power-state in transition */
sound/pci/hda/hda_local.h
... ... @@ -510,13 +510,15 @@
510 510  
511 511 static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid)
512 512 {
513   - return (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT) &&
514   - /* disable MISC_NO_PRESENCE check because it may break too
515   - * many devices
516   - */
517   - /*(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid) &
518   - AC_DEFCFG_MISC_NO_PRESENCE)) &&*/
519   - (get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP);
  513 + if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT))
  514 + return false;
  515 + if (!codec->ignore_misc_bit &&
  516 + (get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) &
  517 + AC_DEFCFG_MISC_NO_PRESENCE))
  518 + return false;
  519 + if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP))
  520 + return false;
  521 + return true;
520 522 }
521 523  
522 524 /* flags for hda_nid_item */