Skip to content

Commit

Permalink
ALSA: hda - Re-enable the check NO_PRESENCE misc bit
Browse files Browse the repository at this point in the history
We disabled the check of NO_PRESENCE bit of the default pin-config
in commit f441917 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>
  • Loading branch information
Takashi Iwai committed Nov 10, 2011
1 parent 9e226b4 commit 2f451d2
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 7 deletions.
4 changes: 4 additions & 0 deletions sound/pci/hda/hda_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -4770,6 +4770,7 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
memset(sequences_hp, 0, sizeof(sequences_hp));
assoc_line_out = 0;

codec->ignore_misc_bit = true;
end_nid = codec->start_nid + codec->num_nodes;
for (nid = codec->start_nid; nid < end_nid; nid++) {
unsigned int wid_caps = get_wcaps(codec, nid);
Expand All @@ -4785,6 +4786,9 @@ int snd_hda_parse_pin_defcfg(struct hda_codec *codec,
continue;

def_conf = snd_hda_codec_get_pincfg(codec, nid);
if (!(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) &
AC_DEFCFG_MISC_NO_PRESENCE))
codec->ignore_misc_bit = false;
conn = get_defcfg_connect(def_conf);
if (conn == AC_JACK_PORT_NONE)
continue;
Expand Down
1 change: 1 addition & 0 deletions sound/pci/hda/hda_codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -854,6 +854,7 @@ struct hda_codec {
unsigned int no_sticky_stream:1; /* no sticky-PCM stream assignment */
unsigned int pins_shutup:1; /* pins are shut up */
unsigned int no_trigger_sense:1; /* don't trigger at pin-sensing */
unsigned int ignore_misc_bit:1; /* ignore MISC_NO_PRESENCE bit */
#ifdef CONFIG_SND_HDA_POWER_SAVE
unsigned int power_on :1; /* current (global) power-state */
unsigned int power_transition :1; /* power-state in transition */
Expand Down
16 changes: 9 additions & 7 deletions sound/pci/hda/hda_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -510,13 +510,15 @@ int snd_hda_jack_detect(struct hda_codec *codec, hda_nid_t nid);

static inline bool is_jack_detectable(struct hda_codec *codec, hda_nid_t nid)
{
return (snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT) &&
/* disable MISC_NO_PRESENCE check because it may break too
* many devices
*/
/*(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid) &
AC_DEFCFG_MISC_NO_PRESENCE)) &&*/
(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP);
if (!(snd_hda_query_pin_caps(codec, nid) & AC_PINCAP_PRES_DETECT))
return false;
if (!codec->ignore_misc_bit &&
(get_defcfg_misc(snd_hda_codec_get_pincfg(codec, nid)) &
AC_DEFCFG_MISC_NO_PRESENCE))
return false;
if (!(get_wcaps(codec, nid) & AC_WCAP_UNSOL_CAP))
return false;
return true;
}

/* flags for hda_nid_item */
Expand Down

0 comments on commit 2f451d2

Please sign in to comment.