Skip to content
  • Takashi Iwai's avatar
    ALSA: hda - Add snd_hda_jack_detect_state() helper function · 60ea8ca2
    Takashi Iwai authored
    
    
    snd_hda_jack_detect() function returns a boolean value for a jack
    plugged in or not, but it also returns always true when the
    corresponding pin is phantom (i.e. fixed).  This is OK in most cases,
    but it makes the generic parser misbehaving about the auto-mute or
    auto-mic switching, e.g. when one of headphone pins is a fixed.
    Namely, the driver decides whether to mute the speaker or not, just
    depending on the headphone plug state: if one of the headphone jacks
    is seen as active, then the speaker is muted.  Thus this will result
    always in the muted speaker output.
    
    So, the problem is the function returns a boolean, after all, although
    we need to think of "phantom" jack.  Now a new function,
    snd_hda_jack_detect_state() is introduced to return these tristates.
    The generic parser uses this function for checking the headphone or
    mic jack states.
    
    Meanwhile, the behavior of snd_hda_jack_detect() is kept as is, for
    keeping compatibility in other driver codes.
    
    Acked-by: default avatarDavid Henningsson <david.henningsson@canonical.com>
    Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
    60ea8ca2