Bug 105161

Summary: snd_hda_intel: Cirrus Logic CS4208 on mac mini late 2014 - jack detection inverted
Product: Drivers Reporter: Aleksandr Mezin (mezin.alexander)
Component: Sound(ALSA)Assignee: Jaroslav Kysela (perex)
Status: NEW ---    
Severity: normal CC: szg00000, tiwai
Priority: P1    
Hardware: All   
OS: Linux   
Kernel Version: 4.2.1 Subsystem:
Regression: No Bisected commit-id:
Attachments: alsa-info.sh output (with inv_jack_detect applied)
Test fix patch

Description Aleksandr Mezin 2015-09-28 18:01:11 UTC
Created attachment 188781 [details]
alsa-info.sh output (with inv_jack_detect applied)

When I plug in headphones, I hear sound from speaker.

Pulseaudio mutes headphones, unmutes speaker.
When I unplug headphones, speaker is muted and headphone unmuted.

Enabling inv_jack_detect using hdajackretask seems to solve the problem.
Comment 1 Takashi Iwai 2015-09-28 18:21:38 UTC
Is it really the inverted jack sense?  That is, "Headphone Jack" is reported "off" for plug and "on" for unplug states?
Comment 2 Aleksandr Mezin 2015-09-28 19:53:38 UTC
Disabled inv_jack_detect. No mic, no headphones, nothing plugged in.

$ amixer -c 1 contents

numid=17,iface=CARD,name='Headphone Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=on
numid=16,iface=CARD,name='Mic Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=off
numid=19,iface=CARD,name='SPDIF Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=off
numid=18,iface=CARD,name='Speaker Phantom Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=on
numid=15,iface=MIXER,name='Master Playback Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
...

Headphones plugged in:

$ amixer -c 1 contents
             
numid=17,iface=CARD,name='Headphone Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=off
numid=16,iface=CARD,name='Mic Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=off
numid=19,iface=CARD,name='SPDIF Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=off
numid=18,iface=CARD,name='Speaker Phantom Jack'
  ; type=BOOLEAN,access=r-------,values=1
  : values=on
numid=15,iface=MIXER,name='Master Playback Switch'
  ; type=BOOLEAN,access=rw------,values=1
  : values=on
...

As you can see, 'Headphone Jack' is inverted.
'Mic Jack' and 'SPDIF Jack' arent, but inv_jack_detect inverts them too, so it isn't a complete solution.
Comment 3 Takashi Iwai 2015-11-20 16:09:48 UTC
Well, the question is whether this is seen in all machines of this model, or it's specific only to your machine.  It's possible to apply a fixup generically for the corresponding model, but I hesitate to do so unless it's proven that it hits to all that model...
Comment 4 Takashi Iwai 2016-02-02 19:10:51 UTC
OK, I got another bug report showing the same problem, so the issue is present to this model generically, as it seems.

The machine has no built-in mic, but the input is only from the audio-in jack, right?  It seems that the audio-in jack doesn't give any sensing.

What about SPDIF jack?  Is there any jack that can be detected?  If not, this should be disabled as well.
Comment 5 Takashi Iwai 2016-02-02 19:14:40 UTC
FWIW, below is the test fix patch: it enables inv_jack_detect bit, and disables Mic and SPDIF jack detections.
Comment 6 Takashi Iwai 2016-02-02 19:15:53 UTC
Created attachment 202781 [details]
Test fix patch
Comment 7 Aleksandr Mezin 2016-02-02 19:40:21 UTC
I don't have that machine anymore, so I can't test the patch

If I remember correctly, there were only 2 jacks really - mic and headphone. And I am sure there weren't any built-in mic.

Better ask somebody who has the same machine near at hand, though.