Bug 219350 - [snd_hda] ALC256: no sound out off headphones jack
Summary: [snd_hda] ALC256: no sound out off headphones jack
Status: In Progress
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: CURRENT
Hardware: amd64 Any
: --- Affects Only Me
Assignee: Marcelo Araujo
URL: https://reviews.freebsd.org/D19017
Keywords:
Depends on:
Blocks:
 
Reported: 2017-05-17 11:26 UTC by Nils Beyer
Modified: 2019-08-27 07:17 UTC (History)
12 users (show)

See Also:


Attachments
ALC256 patch (319 bytes, patch)
2017-12-11 05:29 UTC, Masachika ISHIZUKA
no flags Details | Diff
Patch for the ALC255 and ALC256 (549 bytes, patch)
2018-05-20 20:49 UTC, Neel Chauhan
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Nils Beyer 2017-05-17 11:26:32 UTC
Hi,

hardware: Dell Vostro 15-3568, Skylake
OS: FreeBSD 12.0-CURRENT #1 96a971c9a(drm-next)

there's no sound out off the headphones jack output. Onboard speaker works very well.

================================================================================
#sysctl dev.hdaa
--------------------------------------------------------------------------------
dev.hdaa.1.reconfig: 0
dev.hdaa.1.gpo_config: 
dev.hdaa.1.gpo_state: 
dev.hdaa.1.gpio_config: 
dev.hdaa.1.gpio_state: 
dev.hdaa.1.gpi_state: 
dev.hdaa.1.config: forcestereo,ivref50,ivref80,ivref100,ivref,vref
dev.hdaa.1.nid3_original: 0x18560010 as=1 seq=0 device=Digital-out conn=Jack ctype=Digital loc=0x18 color=Unknown misc=0
dev.hdaa.1.nid3_config: 0x18560010 as=1 seq=0 device=Digital-out conn=Jack ctype=Digital loc=0x18 color=Unknown misc=0
dev.hdaa.1.nid3: pin: Digital-out (Jack)
     Widget cap: 0x0040778d PWR DIGITAL UNSOL 8CH
    Association: 0 (0x0001)
        Pin cap: 0x09000094 PDC OUT HDMI DP HBR
     Pin config: 0x18560010 as=1 seq=0 device=Digital-out conn=Jack ctype=Digital loc=0x18 color=Unknown misc=0
    Pin control: 0x00000040 OUT
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 1
          + <- nid=2 [audio output]

dev.hdaa.1.nid2: audio output
     Widget cap: 0x00006611 PWR DIGITAL 8CH
    Association: 0 (0x0001)
            OSS: pcm (pcm)
     Stream cap: 0x00000005 AC3 PCM
        PCM cap: 0x001a07f0 16 24 32 bits, 32 44 48 88 96 176 192 KHz

dev.hdaa.1.%parent: hdacc1
dev.hdaa.1.%pnpinfo: type=0x01 subsystem=0x80860101
dev.hdaa.1.%location: nid=1
dev.hdaa.1.%driver: hdaa
dev.hdaa.1.%desc: Intel Skylake Audio Function Group
dev.hdaa.0.reconfig: 0
dev.hdaa.0.gpo_config: 
dev.hdaa.0.gpo_state: 
dev.hdaa.0.gpio_config: 0=keep 1=keep 2=keep
dev.hdaa.0.gpio_state: 0=disabled 1=disabled 2=disabled
dev.hdaa.0.gpi_state: 
dev.hdaa.0.config: forcestereo,ivref50,ivref80,ivref100,ivref,vref
dev.hdaa.0.nid36: audio selector
     Widget cap: 0x00300101 STEREO
    Association: 2 (0x0001)
            OSS: monitor
    Connections: 2
          + <- nid=18 [pin: Mic (Fixed)] (selected)
          + [DISABLED] <- nid=19 [pin: Line-out (None)] [DISABLED]

dev.hdaa.0.nid35: audio mixer [DISABLED]
     Widget cap: 0x0020010b STEREO
      Input amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 6
          + [DISABLED] <- nid=24 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=25 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=26 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=27 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=29 [beep widget]
          + [DISABLED] <- nid=18 [pin: Mic (Fixed)]

dev.hdaa.0.nid34: audio mixer [DISABLED]
     Widget cap: 0x0020010b STEREO
      Input amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 5
          + [DISABLED] <- nid=24 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=25 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=26 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=27 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=29 [beep widget]

dev.hdaa.0.nid33_original: 0x02211030 as=3 seq=0 device=Headphones conn=Jack ctype=1/8 loc=Front color=Black misc=0
dev.hdaa.0.nid33_config: 0x02211030 as=3 seq=0 device=Headphones conn=Jack ctype=1/8 loc=Front color=Black misc=0
dev.hdaa.0.nid33: pin: Headphones (Black Jack)
     Widget cap: 0x0040058d PWR UNSOL STEREO
    Association: 1 (0x0001)
        Pin cap: 0x0001001c PDC HP OUT EAPD
     Pin config: 0x02211030 as=3 seq=0 device=Headphones conn=Jack ctype=1/8 loc=Front color=Black misc=0
    Pin control: 0x000000c0 HP OUT
           EAPD: 0x00000002 EAPD
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 2
          + [DISABLED] <- nid=2 [audio output]
          + <- nid=3 [audio output] (selected)

dev.hdaa.0.nid32: vendor widget [DISABLED]
     Widget cap: 0x00f00040 PROC

dev.hdaa.0.nid31: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid30_original: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid30_config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid30: pin: Speaker (None) [DISABLED]
     Widget cap: 0x00400781 PWR DIGITAL UNSOL STEREO
        Pin cap: 0x00000014 PDC OUT
     Pin config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
    Pin control: 0x00000000
    Connections: 1
          + <- nid=6 [audio output] [DISABLED]

dev.hdaa.0.nid29_original: 0x40779a2d as=2 seq=13 device=Modem-handset conn=None ctype=Analog loc=0x00 color=Pink misc=10
dev.hdaa.0.nid29_config: 0x40779a2d as=2 seq=13 device=Modem-handset conn=None ctype=Analog loc=0x00 color=Pink misc=10
dev.hdaa.0.nid29: beep widget
     Widget cap: 0x00700400 PWR
    Association: -2 (0x0000)
            OSS: speaker (speaker)
        Pin cap: 0x00000020 IN
     Pin config: 0x40779a2d as=2 seq=13 device=Modem-handset conn=None ctype=Analog loc=0x00 color=Pink misc=10
    Pin control: 0x00000020 IN

dev.hdaa.0.nid28: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid27_original: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid27_config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid27: pin: Speaker (None) [DISABLED]
     Widget cap: 0x0040058f PWR UNSOL STEREO
        Pin cap: 0x00013734 PDC OUT IN VREF[ 50 80 100 GROUND HIZ ] EAPD
     Pin config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
    Pin control: 0x00000000
           EAPD: 0x00000002 EAPD
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
      Input amp: 0x00270300 mute=0 step=3 size=39 offset=0 (0/30dB)
    Connections: 2
          + [DISABLED] <- nid=2 [audio output] (selected)
          + <- nid=3 [audio output]

dev.hdaa.0.nid26_original: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid26_config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid26: pin: Speaker (None) [DISABLED]
     Widget cap: 0x0040048b PWR UNSOL STEREO
        Pin cap: 0x00003724 PDC IN VREF[ 50 80 100 GROUND HIZ ]
     Pin config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
    Pin control: 0x00000000
      Input amp: 0x00270300 mute=0 step=3 size=39 offset=0 (0/30dB)

dev.hdaa.0.nid25_original: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid25_config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid25: pin: Speaker (None) [DISABLED]
     Widget cap: 0x0040048b PWR UNSOL STEREO
        Pin cap: 0x00003724 PDC IN VREF[ 50 80 100 GROUND HIZ ]
     Pin config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
    Pin control: 0x00000000
      Input amp: 0x00270300 mute=0 step=3 size=39 offset=0 (0/30dB)

dev.hdaa.0.nid24_original: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid24_config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid24: pin: Speaker (None) [DISABLED]
     Widget cap: 0x0040048b PWR UNSOL STEREO
        Pin cap: 0x00003724 PDC IN VREF[ 50 80 100 GROUND HIZ ]
     Pin config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
    Pin control: 0x00000000
      Input amp: 0x00270300 mute=0 step=3 size=39 offset=0 (0/30dB)

dev.hdaa.0.nid23: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid22: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid21: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid20_original: 0x90170120 as=2 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.0.nid20_config: 0x90170120 as=2 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.0.nid20: pin: Speaker (Fixed)
     Widget cap: 0x0040058d PWR UNSOL STEREO
    Association: 0 (0x0001)
        Pin cap: 0x00010014 PDC OUT EAPD
     Pin config: 0x90170120 as=2 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
    Pin control: 0x00000040 OUT
           EAPD: 0x00000002 EAPD
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 1
          + <- nid=2 [audio output]

dev.hdaa.0.nid19_original: 0x40000000 as=0 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid19_config: 0x40000000 as=0 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid19: pin: Line-out (None) [DISABLED]
     Widget cap: 0x0040040b PWR STEREO
        Pin cap: 0x00000020 IN
     Pin config: 0x40000000 as=0 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
    Pin control: 0x00000000
      Input amp: 0x00270300 mute=0 step=3 size=39 offset=0 (0/30dB)

dev.hdaa.0.nid18_original: 0x90a60160 as=6 seq=0 device=Mic conn=Fixed ctype=Digital loc=Internal color=Unknown misc=1
dev.hdaa.0.nid18_config: 0x90a60160 as=6 seq=0 device=Mic conn=Fixed ctype=Digital loc=Internal color=Unknown misc=1
dev.hdaa.0.nid18: pin: Mic (Fixed)
     Widget cap: 0x0040040b PWR STEREO
    Association: 2 (0x0001)
            OSS: monitor (monitor)
        Pin cap: 0x00000020 IN
     Pin config: 0x90a60160 as=6 seq=0 device=Mic conn=Fixed ctype=Digital loc=Internal color=Unknown misc=1
    Pin control: 0x00000020 IN
      Input amp: 0x00270300 mute=0 step=3 size=39 offset=0 (0/30dB)

dev.hdaa.0.nid17: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid16: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid15: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid14: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid13: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid12: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid11: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid10: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid9: audio input [DISABLED]
     Widget cap: 0x0010051b PWR STEREO
     Stream cap: 0x00000001 PCM
        PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz
      Input amp: 0x80023f17 mute=1 step=63 size=2 offset=23 (-17/30dB)
    Connections: 1
          + [DISABLED] <- nid=34 [audio mixer] [DISABLED]

dev.hdaa.0.nid8: audio input [DISABLED]
     Widget cap: 0x0010051b PWR STEREO
     Stream cap: 0x00000001 PCM
        PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz
      Input amp: 0x80023f17 mute=1 step=63 size=2 offset=23 (-17/30dB)
    Connections: 1
          + [DISABLED] <- nid=35 [audio mixer] [DISABLED]

dev.hdaa.0.nid7: audio input
     Widget cap: 0x0010051b PWR STEREO
    Association: 2 (0x0001)
     Stream cap: 0x00000001 PCM
        PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz
      Input amp: 0x80023f17 mute=1 step=63 size=2 offset=23 (-17/30dB)
    Connections: 1
          + <- nid=36 [audio selector]

dev.hdaa.0.nid6: audio output [DISABLED]
     Widget cap: 0x00000611 PWR DIGITAL STEREO
     Stream cap: 0x00000001 PCM
        PCM cap: 0x000e05e0 16 20 24 bits, 44 48 88 96 192 KHz

dev.hdaa.0.nid5: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid4: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid3: audio output
     Widget cap: 0x0000041d PWR STEREO
    Association: 1 (0x0001)
            OSS: pcm (pcm)
     Stream cap: 0x00000001 PCM
        PCM cap: 0x000e0060 16 20 24 bits, 44 48 KHz
     Output amp: 0x00025757 mute=0 step=87 size=2 offset=87 (-65/0dB)

dev.hdaa.0.nid2: audio output
     Widget cap: 0x0000041d PWR STEREO
    Association: 0 (0x0001)
            OSS: pcm (pcm)
     Stream cap: 0x00000001 PCM
        PCM cap: 0x000e0060 16 20 24 bits, 44 48 KHz
     Output amp: 0x00025757 mute=0 step=87 size=2 offset=87 (-65/0dB)

dev.hdaa.0.%parent: hdacc0
dev.hdaa.0.%pnpinfo: type=0x01 subsystem=0x10280793
dev.hdaa.0.%location: nid=1
dev.hdaa.0.%driver: hdaa
dev.hdaa.0.%desc: Realtek (0x0256) Audio Function Group
dev.hdaa.%parent: 
================================================================================

================================================================================
#sysctl dev.pcm
--------------------------------------------------------------------------------
dev.pcm.2.eq_preamp: +0.0dB
dev.pcm.2.eq: 1
dev.pcm.2.bitperfect: 0
dev.pcm.2.buffersize: 65536
dev.pcm.2.play.vchanformat: s16le:2.0
dev.pcm.2.play.vchanrate: 48000
dev.pcm.2.play.vchanmode: passthrough
dev.pcm.2.play.vchans: 1
dev.pcm.2.play.32bit: 24
dev.pcm.2.%parent: hdaa1
dev.pcm.2.%pnpinfo: 
dev.pcm.2.%location: nid=3
dev.pcm.2.%driver: pcm
dev.pcm.2.%desc: Intel Skylake (HDMI/DP 8ch)
dev.pcm.1.eq_preamp: +0.0dB
dev.pcm.1.eq: 1
dev.pcm.1.bitperfect: 0
dev.pcm.1.buffersize: 65536
dev.pcm.1.play.vchanformat: s16le:2.0
dev.pcm.1.play.vchanrate: 48000
dev.pcm.1.play.vchanmode: fixed
dev.pcm.1.play.vchans: 1
dev.pcm.1.play.32bit: 24
dev.pcm.1.%parent: hdaa0
dev.pcm.1.%pnpinfo: 
dev.pcm.1.%location: nid=33
dev.pcm.1.%driver: pcm
dev.pcm.1.%desc: Realtek (0x0256) (Front Analog Headphones)
dev.pcm.0.eq_preamp: +0.0dB
dev.pcm.0.eq: 1
dev.pcm.0.bitperfect: 0
dev.pcm.0.buffersize: 65536
dev.pcm.0.rec.vchanformat: s16le:2.0
dev.pcm.0.rec.vchanrate: 48000
dev.pcm.0.rec.vchanmode: fixed
dev.pcm.0.rec.vchans: 1
dev.pcm.0.rec.autosrc: 2
dev.pcm.0.rec.32bit: 24
dev.pcm.0.play.vchanformat: s16le:2.0
dev.pcm.0.play.vchanrate: 48000
dev.pcm.0.play.vchanmode: fixed
dev.pcm.0.play.vchans: 1
dev.pcm.0.play.32bit: 24
dev.pcm.0.%parent: hdaa0
dev.pcm.0.%pnpinfo: 
dev.pcm.0.%location: nid=20,18
dev.pcm.0.%driver: pcm
dev.pcm.0.%desc: Realtek (0x0256) (Internal Analog)
dev.pcm.%parent: 
================================================================================

================================================================================
#cat /dev/sndstat ; mixer
--------------------------------------------------------------------------------
Installed devices:
pcm0: <Realtek (0x0256) (Internal Analog)> (play/rec)
pcm1: <Realtek (0x0256) (Front Analog Headphones)> (play) default
pcm2: <Intel Skylake (HDMI/DP 8ch)> (play)
No devices installed from userspace.
Mixer vol      is currently set to 100:100
Mixer bass     is currently set to  50:50
Mixer treble   is currently set to  50:50
Mixer pcm      is currently set to 100:100
Mixer ogain    is currently set to 100:100
================================================================================


Trying headphones jack using Ubuntu is successful.


Any ideas what to try next?



Thanks in advance and regards,
Nils
Comment 1 Andrey V. Elsukov freebsd_committer 2017-05-22 09:53:45 UTC
Did you try to change hw.snd.default_unit?
On my lenovo X1 carbon I have:

# cat /dev/sndstat 
Installed devices:
pcm0: <Conexant CX20753/4 (Analog)> (play/rec) default
pcm1: <Conexant CX20753/4 (Right Analog)> (play/rec)
pcm2: <Intel Skylake (HDMI/DP 8ch)> (play)

the onboard speaker works through pcm0, but headphone works only whith default_unit=1. In the same time, with default_unit=0 speaker doesn't plays sound when headphone is plugged in. You may need to stop playing the sound when you change default_unit.
Comment 2 Nils Beyer 2017-05-26 06:21:38 UTC
default sound output is already changed:
---------------------------------------------------------------------------------
#sysctl hw.snd.default_unit
hw.snd.default_unit: 1

# cat /dev/sndstat 
Installed devices:
pcm0: <Realtek (0x0256) (Internal Analog)> (play/rec)
pcm1: <Realtek (0x0256) (Front Analog Headphones)> (play) default
pcm2: <Intel Skylake (HDMI/DP 8ch)> (play)
No devices installed from userspace.
---------------------------------------------------------------------------------

Sound from the onboard speakers works without hassle...
Comment 3 Nils Beyer 2017-05-29 07:16:22 UTC
Ok, some more tests:

I started a music stream before I plugged in the headphones. Then I inserted the plug into the jack; somewhere before it reached the end I could hear sound (distorted and mono); as soon as I pushed further the sound disappeared again.

Looking at "/var/log/messages" the sound of the headphones disappears as soon as:

    hdaa0: Pin sense: nid=33 sense=0x80000000

says "(connected)"...
Comment 4 Nils Beyer 2017-06-13 14:02:10 UTC
The quirk "senseinv" by setting:

    hint.hdaa.1.config="forcestereo,ivref50,ivref80,ivref100,ivref,vref,senseinv"

in "/boot/loader.conf" doesn't help...
Comment 5 Nils Beyer 2017-07-20 12:22:28 UTC
I've switched OS to 11.1-RC3 - no change. Then I've patched
-----------------------------------------------------------------------
Index: sys/dev/sound/pci/hda/hdaa.c
===================================================================
--- sys/dev/sound/pci/hda/hdaa.c        (revision 321195)
+++ sys/dev/sound/pci/hda/hdaa.c        (working copy)
@@ -535,7 +535,7 @@
        struct hdaa_audio_as *as;
        uint32_t res;
        int connected, old;
-
+       return;
        if (w->enable == 0 || w->type !=
            HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX)
                return;
@@ -685,7 +685,7 @@
        struct hdaa_devinfo *devinfo = w->devinfo;
        uint32_t res;
        int i;
-
+       return;
        if (w->enable == 0 || w->type !=
            HDA_PARAM_AUDIO_WIDGET_CAP_TYPE_PIN_COMPLEX)
                return;
-----------------------------------------------------------------------

so that software jack sensing is disabled.

Still no change; I can hear sound out of the headphones short before the plug is completely inserted. Pushing it in completely makes the sound go away.

It seems to be a hardware bug/feature...
Comment 6 Fotis Zabaras 2017-07-27 08:59:16 UTC
I can verify this problem on Dell Inspiron 7566
Onboard speakers work fine
The headphone jack's sound is noisy,

==============================================================================



# sysctl dev.hdaa
dev.hdaa.1.reconfig: 0
dev.hdaa.1.gpo_config: 
dev.hdaa.1.gpo_state: 
dev.hdaa.1.gpio_config: 
dev.hdaa.1.gpio_state: 
dev.hdaa.1.gpi_state: 
dev.hdaa.1.config: forcestereo,ivref50,ivref80,ivref100,ivref,vref
dev.hdaa.1.nid3_original: 0x18560010 as=1 seq=0 device=Digital-out conn=Jack ctype=Digital loc=0x18 color=Unknown misc=0
dev.hdaa.1.nid3_config: 0x18560010 as=1 seq=0 device=Digital-out conn=Jack ctype=Digital loc=0x18 color=Unknown misc=0
dev.hdaa.1.nid3: pin: Digital-out (Jack)
     Widget cap: 0x0040778d PWR DIGITAL UNSOL 8CH
    Association: 0 (0x0001)
        Pin cap: 0x09000094 PDC OUT HDMI DP HBR
     Pin config: 0x18560010 as=1 seq=0 device=Digital-out conn=Jack ctype=Digital loc=0x18 color=Unknown misc=0
    Pin control: 0x00000040 OUT
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 1
          + <- nid=2 [audio output]

dev.hdaa.1.nid2: audio output
     Widget cap: 0x00006611 PWR DIGITAL 8CH
    Association: 0 (0x0001)
            OSS: pcm (pcm)
     Stream cap: 0x00000005 AC3 PCM
        PCM cap: 0x001a07f0 16 24 32 bits, 32 44 48 88 96 176 192 KHz

dev.hdaa.1.%parent: hdacc1
dev.hdaa.1.%pnpinfo: type=0x01 subsystem=0x80860101
dev.hdaa.1.%location: nid=1
dev.hdaa.1.%driver: hdaa
dev.hdaa.1.%desc: Intel Skylake Audio Function Group
dev.hdaa.0.reconfig: 0
dev.hdaa.0.gpo_config: 
dev.hdaa.0.gpo_state: 
dev.hdaa.0.gpio_config: 0=keep 1=keep 2=keep
dev.hdaa.0.gpio_state: 0=disabled 1=disabled 2=disabled
dev.hdaa.0.gpi_state: 
dev.hdaa.0.config: forcestereo,ivref50,ivref80,ivref100,ivref,vref
dev.hdaa.0.nid36: audio selector
     Widget cap: 0x00300101 STEREO
    Association: 2 (0x0001)
            OSS: monitor
    Connections: 2
          + <- nid=18 [pin: Mic (Fixed)] (selected)
          + [DISABLED] <- nid=19 [pin: Line-out (None)] [DISABLED]

dev.hdaa.0.nid35: audio mixer [DISABLED]
     Widget cap: 0x0020010b STEREO
      Input amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 6
          + [DISABLED] <- nid=24 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=25 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=26 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=27 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=29 [beep widget]
          + [DISABLED] <- nid=18 [pin: Mic (Fixed)]

dev.hdaa.0.nid34: audio mixer [DISABLED]
     Widget cap: 0x0020010b STEREO
      Input amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 5
          + [DISABLED] <- nid=24 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=25 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=26 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=27 [pin: Speaker (None)] [DISABLED]
          + [DISABLED] <- nid=29 [beep widget]

dev.hdaa.0.nid33_original: 0x02211030 as=3 seq=0 device=Headphones conn=Jack ctype=1/8 loc=Front color=Black misc=0
dev.hdaa.0.nid33_config: 0x02211030 as=3 seq=0 device=Headphones conn=Jack ctype=1/8 loc=Front color=Black misc=0
dev.hdaa.0.nid33: pin: Headphones (Black Jack)
     Widget cap: 0x0040058d PWR UNSOL STEREO
    Association: 1 (0x0001)
        Pin cap: 0x0001001c PDC HP OUT EAPD
     Pin config: 0x02211030 as=3 seq=0 device=Headphones conn=Jack ctype=1/8 loc=Front color=Black misc=0
    Pin control: 0x000000c0 HP OUT
           EAPD: 0x00000002 EAPD
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 2
          + [DISABLED] <- nid=2 [audio output]
          + <- nid=3 [audio output] (selected)

dev.hdaa.0.nid32: vendor widget [DISABLED]
     Widget cap: 0x00f00040 PROC

dev.hdaa.0.nid31: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid30_original: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid30_config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid30: pin: Speaker (None) [DISABLED]
     Widget cap: 0x00400781 PWR DIGITAL UNSOL STEREO
        Pin cap: 0x00000014 PDC OUT
     Pin config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
    Pin control: 0x00000000
    Connections: 1
          + <- nid=6 [audio output] [DISABLED]

dev.hdaa.0.nid29_original: 0x40700001 as=0 seq=1 device=Modem-handset conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid29_config: 0x40700001 as=0 seq=1 device=Modem-handset conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid29: beep widget
     Widget cap: 0x00700400 PWR
    Association: -2 (0x0000)
            OSS: speaker (speaker)
        Pin cap: 0x00000020 IN
     Pin config: 0x40700001 as=0 seq=1 device=Modem-handset conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
    Pin control: 0x00000020 IN

dev.hdaa.0.nid28: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid27_original: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid27_config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid27: pin: Speaker (None) [DISABLED]
     Widget cap: 0x0040058f PWR UNSOL STEREO
        Pin cap: 0x00013734 PDC OUT IN VREF[ 50 80 100 GROUND HIZ ] EAPD
     Pin config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
    Pin control: 0x00000000
           EAPD: 0x00000002 EAPD
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
      Input amp: 0x00270300 mute=0 step=3 size=39 offset=0 (0/30dB)
    Connections: 2
          + [DISABLED] <- nid=2 [audio output] (selected)
          + <- nid=3 [audio output]

dev.hdaa.0.nid26_original: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid26_config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid26: pin: Speaker (None) [DISABLED]
     Widget cap: 0x0040048b PWR UNSOL STEREO
        Pin cap: 0x00003724 PDC IN VREF[ 50 80 100 GROUND HIZ ]
     Pin config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
    Pin control: 0x00000000
      Input amp: 0x00270300 mute=0 step=3 size=39 offset=0 (0/30dB)

dev.hdaa.0.nid25_original: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid25_config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid25: pin: Speaker (None) [DISABLED]
     Widget cap: 0x0040048b PWR UNSOL STEREO
        Pin cap: 0x00003724 PDC IN VREF[ 50 80 100 GROUND HIZ ]
     Pin config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
    Pin control: 0x00000000
      Input amp: 0x00270300 mute=0 step=3 size=39 offset=0 (0/30dB)

dev.hdaa.0.nid24_original: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid24_config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid24: pin: Speaker (None) [DISABLED]
     Widget cap: 0x0040048b PWR UNSOL STEREO
        Pin cap: 0x00003724 PDC IN VREF[ 50 80 100 GROUND HIZ ]
     Pin config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
    Pin control: 0x00000000
      Input amp: 0x00270300 mute=0 step=3 size=39 offset=0 (0/30dB)

dev.hdaa.0.nid23: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid22: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid21: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid20_original: 0x90170120 as=2 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.0.nid20_config: 0x90170120 as=2 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.0.nid20: pin: Speaker (Fixed)
     Widget cap: 0x0040058d PWR UNSOL STEREO
    Association: 0 (0x0001)
        Pin cap: 0x00010014 PDC OUT EAPD
     Pin config: 0x90170120 as=2 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
    Pin control: 0x00000040 OUT
           EAPD: 0x00000002 EAPD
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 1
          + <- nid=2 [audio output]

dev.hdaa.0.nid19_original: 0x40000000 as=0 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid19_config: 0x40000000 as=0 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid19: pin: Line-out (None) [DISABLED]
     Widget cap: 0x0040040b PWR STEREO
        Pin cap: 0x00000020 IN
     Pin config: 0x40000000 as=0 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
    Pin control: 0x00000000
      Input amp: 0x00270300 mute=0 step=3 size=39 offset=0 (0/30dB)

dev.hdaa.0.nid18_original: 0x90a60160 as=6 seq=0 device=Mic conn=Fixed ctype=Digital loc=Internal color=Unknown misc=1
dev.hdaa.0.nid18_config: 0x90a60160 as=6 seq=0 device=Mic conn=Fixed ctype=Digital loc=Internal color=Unknown misc=1
dev.hdaa.0.nid18: pin: Mic (Fixed)
     Widget cap: 0x0040040b PWR STEREO
    Association: 2 (0x0001)
            OSS: monitor (monitor)
        Pin cap: 0x00000020 IN
     Pin config: 0x90a60160 as=6 seq=0 device=Mic conn=Fixed ctype=Digital loc=Internal color=Unknown misc=1
    Pin control: 0x00000020 IN
      Input amp: 0x00270300 mute=0 step=3 size=39 offset=0 (0/30dB)

dev.hdaa.0.nid17: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid16: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid15: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid14: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid13: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid12: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid11: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid10: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid9: audio input [DISABLED]
     Widget cap: 0x0010051b PWR STEREO
     Stream cap: 0x00000001 PCM
        PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz
      Input amp: 0x80023f17 mute=1 step=63 size=2 offset=23 (-17/30dB)
    Connections: 1
          + [DISABLED] <- nid=34 [audio mixer] [DISABLED]

dev.hdaa.0.nid8: audio input [DISABLED]
     Widget cap: 0x0010051b PWR STEREO
     Stream cap: 0x00000001 PCM
        PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz
      Input amp: 0x80023f17 mute=1 step=63 size=2 offset=23 (-17/30dB)
    Connections: 1
          + [DISABLED] <- nid=35 [audio mixer] [DISABLED]

dev.hdaa.0.nid7: audio input
     Widget cap: 0x0010051b PWR STEREO
    Association: 2 (0x0001)
     Stream cap: 0x00000001 PCM
        PCM cap: 0x000e0560 16 20 24 bits, 44 48 96 192 KHz
      Input amp: 0x80023f17 mute=1 step=63 size=2 offset=23 (-17/30dB)
    Connections: 1
          + <- nid=36 [audio selector]

dev.hdaa.0.nid6: audio output [DISABLED]
     Widget cap: 0x00000611 PWR DIGITAL STEREO
     Stream cap: 0x00000001 PCM
        PCM cap: 0x000e05e0 16 20 24 bits, 44 48 88 96 192 KHz

dev.hdaa.0.nid5: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid4: vendor widget [DISABLED]
     Widget cap: 0x00f00000

dev.hdaa.0.nid3: audio output
     Widget cap: 0x0000041d PWR STEREO
    Association: 1 (0x0001)
            OSS: pcm (pcm)
     Stream cap: 0x00000001 PCM
        PCM cap: 0x000e0060 16 20 24 bits, 44 48 KHz
     Output amp: 0x00025757 mute=0 step=87 size=2 offset=87 (-65/0dB)

dev.hdaa.0.nid2: audio output
     Widget cap: 0x0000041d PWR STEREO
    Association: 0 (0x0001)
            OSS: pcm (pcm)
     Stream cap: 0x00000001 PCM
        PCM cap: 0x000e0060 16 20 24 bits, 44 48 KHz
     Output amp: 0x00025757 mute=0 step=87 size=2 offset=87 (-65/0dB)

dev.hdaa.0.%parent: hdacc0
dev.hdaa.0.%pnpinfo: type=0x01 subsystem=0x10280797
dev.hdaa.0.%location: nid=1
dev.hdaa.0.%driver: hdaa
dev.hdaa.0.%desc: Realtek ALC256 Audio Function Group
dev.hdaa.%parent: 

=============================================================================


=============================================================================
# sysctl dev.pcm
dev.pcm.2.bitperfect: 0
dev.pcm.2.buffersize: 65536
dev.pcm.2.play.vchanformat: s16le:2.0
dev.pcm.2.play.vchanrate: 48000
dev.pcm.2.play.vchanmode: passthrough
dev.pcm.2.play.vchans: 1
dev.pcm.2.play.32bit: 24
dev.pcm.2.%parent: hdaa1
dev.pcm.2.%pnpinfo: 
dev.pcm.2.%location: nid=3
dev.pcm.2.%driver: pcm
dev.pcm.2.%desc: Intel Skylake (HDMI/DP 8ch)
dev.pcm.1.bitperfect: 0
dev.pcm.1.buffersize: 65536
dev.pcm.1.play.vchanformat: s16le:2.0
dev.pcm.1.play.vchanrate: 48000
dev.pcm.1.play.vchanmode: fixed
dev.pcm.1.play.vchans: 2
dev.pcm.1.play.32bit: 24
dev.pcm.1.%parent: hdaa0
dev.pcm.1.%pnpinfo: 
dev.pcm.1.%location: nid=33
dev.pcm.1.%driver: pcm
dev.pcm.1.%desc: Realtek ALC256 (Front Analog Headphones)
dev.pcm.0.bitperfect: 0
dev.pcm.0.buffersize: 65536
dev.pcm.0.rec.vchanformat: s16le:2.0
dev.pcm.0.rec.vchanrate: 48000
dev.pcm.0.rec.vchanmode: fixed
dev.pcm.0.rec.vchans: 2
dev.pcm.0.rec.autosrc: 2
dev.pcm.0.rec.32bit: 24
dev.pcm.0.play.vchanformat: s16le:2.0
dev.pcm.0.play.vchanrate: 48000
dev.pcm.0.play.vchanmode: fixed
dev.pcm.0.play.vchans: 2
dev.pcm.0.play.32bit: 24
dev.pcm.0.%parent: hdaa0
dev.pcm.0.%pnpinfo: 
dev.pcm.0.%location: nid=20,18
dev.pcm.0.%driver: pcm
dev.pcm.0.%desc: Realtek ALC256 (Internal Analog)
dev.pcm.%parent: 

==============================================================================


==============================================================================


# cat /dev/sndstat ; mixer
Installed devices:
pcm0: <Realtek ALC256 (Internal Analog)> (play/rec)
pcm1: <Realtek ALC256 (Front Analog Headphones)> (play) default
pcm2: <Intel Skylake (HDMI/DP 8ch)> (play)
No devices installed from userspace.
Mixer vol      is currently set to  85:85
Mixer pcm      is currently set to 100:100
Mixer ogain    is currently set to 100:100


==============================================================================


(In reply to Nils Beyer from comment #5)
Comment 7 cook.jason 2017-10-23 23:45:48 UTC
Sound can be heard for less than a second as the headphones are plugged-in. This laptop is a Dell Latitude 7370 and has a 4-pin headphone jack.

Installed devices:
pcm0: <Realtek ALC256 (Analog 2.0+HP/2.0)> (play/rec) default
pcm1: <Intel Skylake (HDMI/DP 8ch)> (play)
No devices installed from userspace.
Comment 8 Masachika ISHIZUKA 2017-12-11 05:29:03 UTC
Created attachment 188702 [details]
ALC256 patch

I bought DELL vostro 3568 last week.
I added 'hint.hdaa.0.nid33.config="as=2 seq=15  device=Headphones conn=Jack ctype=1/8 loc=Front color=Black misc=0"' to /boot/device.hints and patched hdaa_patches.c with reference to linux.
Now, I can use headphone.
Comment 9 Nils Beyer 2017-12-12 09:08:11 UTC
(In reply to Masachika ISHIZUKA from comment #8)

confirmed - with your patch applied sound is finally working out off the headphones jack. Thank you very much...
Comment 10 Nils Beyer 2018-02-20 11:42:00 UTC
Any chance to get that 4-line patch upstream?
Comment 11 psi 2018-03-03 07:43:01 UTC
Thank you everyone and to Masachika ISHIZUKA for his patch. I have two Dell Inspiron Laptop: 

1.) Inspiron 15-3552 and 
2.) Inspiron 15-3567. 

I have struggled for months to get headphones working. Both have weird sound behavior (headphone) on FreeBSD but on OpenBSD they're all crystal clear. 

We have the same issue with Nils Beyer on the second laptop (see this thread comment #3). 

I applied the patch, recompiled the kernel (FreeBSD 11 stable) and boom!!...crystal clear sound same with OpenBSD. 

I can settle with OpenBSD but my usb speaker (kind of expensive) doesn't work. However it works fine on FreeBSD. 

I am very thankful I found this thread. Hope this helps with anyone having same machine as mine.
Comment 12 marc.priggemeyer 2018-03-23 23:56:34 UTC
Hi,

unfortunately, I cannot confirm that the patch works on Dell Latitude 5480 with ALC256.
With or without the patch I hear sound for a fraction of a second while plugging the headphones into the jack.

I needed to put nid20 (internal speaker) and nid33 (headphones) on the same association to get to that state (again, the patch doesn't change anything).
Setting misc=1 for nid33 disables sensing and leaves the output of sound on the headphones enabled, but that also means that the internal speaker stays active.
hint.hdac.0.cad0.nid20.config="as=1 seq=0"
hint.hdac.0.cad0.nid33.config="as=1 seq=15 misc=1"


To me it appears to be a problem with the sensing and retasking of the audio jack... Using unpatched 12-CURRENT above device.hints works with the mentioned drawback of both outputs being always active. Since the internal speaker is deactivated when headphones are attached means sensing works. The question is why there is the short burst of sound on the headphones jack while plugging in?

Verbose data below.

Best,
Marc


dev.hdaa.0.nid2: audio output
     Widget cap: 0x0000041d PWR STEREO
    Association: 0 (0x8001)
            OSS: pcm (pcm)
     Stream cap: 0x00000001 PCM
        PCM cap: 0x000e0060 16 20 24 bits, 44 48 KHz
     Output amp: 0x00025757 mute=0 step=87 size=2 offset=87 (-65/0dB)
dev.hdaa.0.nid20: pin: Speaker (Fixed)
     Widget cap: 0x0040058d PWR UNSOL STEREO
    Association: 0 (0x0001)
        Pin cap: 0x00010014 PDC OUT EAPD
     Pin config: 0x90170110 as=1 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
    Pin control: 0x00000040 OUT
           EAPD: 0x00000002 EAPD
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 1
          + <- nid=2 [audio output]
dev.hdaa.0.nid33: pin: Headphones (Black Jack)
     Widget cap: 0x0040058d PWR UNSOL STEREO
    Association: 0 (0x8000)
        Pin cap: 0x0001001c PDC HP OUT EAPD
     Pin config: 0x0221101f as=1 seq=15 device=Headphones conn=Jack ctype=1/8 loc=Front color=Black misc=0
    Pin control: 0x000000c0 HP OUT
           EAPD: 0x00000002 EAPD
     Output amp: 0x80000000 mute=1 step=0 size=0 offset=0 (0/0dB)
    Connections: 2
          + <- nid=2 [audio output] (selected)
          + [DISABLED] <- nid=3 [audio output] [DISABLED]


##################

FreeBSD Audio Driver (64bit 2009061500/amd64)
Installed devices:
pcm0: <Realtek ALC256 (Analog 2.0+HP/2.0)> on hdaa0  (1p:1v/1r:1v) default
	snddev flags=0x2e2<AUTOVCHAN,BUSY,MPSAFE,REGISTERED,VPC>
	[pcm0:play:dsp0.p0]: spd 48000, fmt 0x00200010, flags 0x00002100, 0x00000004
	interrupts 6277, underruns 0, feed 6277, ready 0 [b:4096/2048/2|bs:4096/2048/2]
	channel flags=0x2100<BUSY,HAS_VCHAN>
	{userland} -> feeder_mixer(0x00200010) -> {hardware}
	pcm0:play:dsp0.p0[pcm0:virtual:dsp0.vp0]: spd 48000, fmt 0x00200010, flags 0x10001154, 0x00000021, pid 1409 (firefox)
	interrupts 0, underruns 0, feed 6277, ready 0 [b:0/0/0|bs:16384/8192/2]
	channel flags=0x10001154<RUNNING,NOTRIGGER,NBIO,BUSY,HAS_SIZE,VIRTUAL>
	{userland} -> feeder_root(0x00200010) -> feeder_volume(0x00200010) -> {hardware}
	[pcm0:record:dsp0.r0]: spd 48000, fmt 0x00200010, flags 0x00002100, 0x00000005
	interrupts 0, overruns 0, feed 0, hfree 4096, sfree 4096 [b:4096/2048/2|bs:4096/2048/2]
	channel flags=0x2100<BUSY,HAS_VCHAN>
	{hardware} -> feeder_root(0x00200010) -> feeder_mixer(0x00200010) -> {userland}
	pcm0:record:dsp0.r0[pcm0:virtual:dsp0.vr0]: spd 8000, fmt 0x00100008, flags 0x10000000, 0x00000000
	interrupts 0, overruns 0, feed 0, hfree 0, sfree 0 [b:0/0/0|bs:0/0/0]
	channel flags=0x10000000<VIRTUAL>
	{hardware} -> feeder_root(0x00000000) -> {userland}
pcm1: <Intel Kabylake (HDMI/DP 8ch)> on hdaa1  (1p:1v/0r:0v)
	snddev flags=0x2e7<SIMPLEX,AUTOVCHAN,SOFTPCMVOL,BUSY,MPSAFE,REGISTERED,VPC>
	[pcm1:play:dsp1.p0]: spd 48000, fmt 0x00200010, flags 0x00006100, 0x00000004
	interrupts 0, underruns 0, feed 0, ready 0 [b:4096/2048/2|bs:4096/2048/2]
	channel flags=0x6100<BUSY,HAS_VCHAN,VCHAN_PASSTHROUGH>
	{userland} -> feeder_mixer(0x00200010) -> {hardware}
	pcm1:play:dsp1.p0[pcm1:virtual:dsp1.vp0]: spd 8000, fmt 0x00100008, flags 0x10000000, 0x00000000
	interrupts 0, underruns 0, feed 0, ready 0 [b:0/0/0|bs:0/0/0]
	channel flags=0x10000000<VIRTUAL>
	{userland} -> feeder_root(0x00000000) -> {hardware}
No devices installed from userspace.

############################

Plugging and Unplugging of the headphones:
Mar 24 00:55:41 freebsd kernel: hdaa0: Unsolicited response 84000008
Mar 24 00:55:41 freebsd kernel: hdaa0: Pin sense: nid=33 sense=0x80000000 (connected)
Mar 24 00:55:41 freebsd kernel: pcm0: Redirect output to: headphones
Mar 24 00:55:41 freebsd kernel: hdaa0: Setting amplifier nid=33 index=0 out mute=0/0 vol=0/0
Mar 24 00:55:41 freebsd kernel: hdaa0: Setting amplifier nid=20 index=0 out mute=1/1 vol=0/0
Mar 24 00:55:41 freebsd kernel: pcm0: Playback channel set is: Front Left, Front Right, 
Mar 24 00:55:41 freebsd kernel: pcm0: Playback channel matrix is: 2.0 (connected)



Mar 24 00:55:45 freebsd kernel: hdaa0: Unsolicited response 84000000
Mar 24 00:55:45 freebsd kernel: hdaa0: Pin sense: nid=33 sense=0x00000000 (disconnected)
Mar 24 00:55:45 freebsd kernel: pcm0: Redirect output to: main
Mar 24 00:55:45 freebsd kernel: hdaa0: Setting amplifier nid=33 index=0 out mute=1/1 vol=0/0
Mar 24 00:55:45 freebsd kernel: hdaa0: Setting amplifier nid=20 index=0 out mute=0/0 vol=0/0
Mar 24 00:55:45 freebsd kernel: pcm0: Playback channel set is: Front Left, Front Right, 
Mar 24 00:55:45 freebsd kernel: pcm0: Playback channel matrix is: 2.0 (unknown)
Comment 13 Masachika ISHIZUKA 2018-03-24 14:34:20 UTC
(In reply to marc.priggemeyer from comment #12)

Please show the output of 'sysctl -a | grep hdaa'.
Comment 14 marc.priggemeyer 2018-03-24 17:54:27 UTC
(In reply to Masachika ISHIZUKA from comment #13)
Here you go:
dev.pcm.1.%parent: hdaa1
dev.pcm.0.%parent: hdaa0
dev.hdaa.1.reconfig: 0
dev.hdaa.1.gpo_config: 
dev.hdaa.1.gpo_state: 
dev.hdaa.1.gpio_config: 
dev.hdaa.1.gpio_state: 
dev.hdaa.1.gpi_state: 
dev.hdaa.1.config: forcestereo,ivref50,ivref80,ivref100,ivref,vref
dev.hdaa.1.nid3_original: 0x18560010 as=1 seq=0 device=Digital-out conn=Jack ctype=Digital loc=0x18 color=Unknown misc=0
dev.hdaa.1.nid3_config: 0x18560010 as=1 seq=0 device=Digital-out conn=Jack ctype=Digital loc=0x18 color=Unknown misc=0
dev.hdaa.1.nid3: pin: Digital-out (Jack)
dev.hdaa.1.nid2: audio output
dev.hdaa.1.%parent: hdacc1
dev.hdaa.1.%pnpinfo: type=0x01 subsystem=0x80860101
dev.hdaa.1.%location: nid=1
dev.hdaa.1.%driver: hdaa
dev.hdaa.1.%desc: Intel Kabylake Audio Function Group
dev.hdaa.0.reconfig: 0
dev.hdaa.0.gpo_config: 
dev.hdaa.0.gpo_state: 
dev.hdaa.0.gpio_config: 0=keep 1=keep 2=keep
dev.hdaa.0.gpio_state: 0=disabled 1=disabled 2=disabled
dev.hdaa.0.gpi_state: 
dev.hdaa.0.config: forcestereo,ivref50,ivref80,ivref100,ivref,vref
dev.hdaa.0.nid36: audio selector
dev.hdaa.0.nid35: audio mixer [DISABLED]
dev.hdaa.0.nid34: audio mixer [DISABLED]
dev.hdaa.0.nid33_original: 0x02211020 as=2 seq=0 device=Headphones conn=Jack ctype=1/8 loc=Front color=Black misc=0
dev.hdaa.0.nid33_config: 0x0221111f as=1 seq=15 device=Headphones conn=Jack ctype=1/8 loc=Front color=Black misc=1
dev.hdaa.0.nid33: pin: Headphones (Black Jack)
dev.hdaa.0.nid32: vendor widget [DISABLED]
dev.hdaa.0.nid31: vendor widget [DISABLED]
dev.hdaa.0.nid30_original: 0x421211f2 as=15 seq=2 device=Speaker conn=None ctype=1/4 loc=Front color=Black misc=1
dev.hdaa.0.nid30_config: 0x421211f2 as=15 seq=2 device=Speaker conn=None ctype=1/4 loc=Front color=Black misc=1
dev.hdaa.0.nid30: pin: Speaker (None) [DISABLED]
dev.hdaa.0.nid29_original: 0x40700001 as=0 seq=1 device=Modem-handset conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid29_config: 0x40700001 as=0 seq=1 device=Modem-handset conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid29: beep widget
dev.hdaa.0.nid28: vendor widget [DISABLED]
dev.hdaa.0.nid27_original: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid27_config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid27: pin: Speaker (None) [DISABLED]
dev.hdaa.0.nid26_original: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid26_config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid26: pin: Speaker (None) [DISABLED]
dev.hdaa.0.nid25_original: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid25_config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid25: pin: Speaker (None) [DISABLED]
dev.hdaa.0.nid24_original: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid24_config: 0x411111f0 as=15 seq=0 device=Speaker conn=None ctype=1/8 loc=Rear color=Black misc=1
dev.hdaa.0.nid24: pin: Speaker (None) [DISABLED]
dev.hdaa.0.nid23: vendor widget [DISABLED]
dev.hdaa.0.nid22: vendor widget [DISABLED]
dev.hdaa.0.nid21: vendor widget [DISABLED]
dev.hdaa.0.nid20_original: 0x90170110 as=1 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.0.nid20_config: 0x90170110 as=1 seq=0 device=Speaker conn=Fixed ctype=Analog loc=Internal color=Unknown misc=1
dev.hdaa.0.nid20: pin: Speaker (Fixed)
dev.hdaa.0.nid19_original: 0x40000000 as=0 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid19_config: 0x40000000 as=0 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid19: pin: Line-out (None) [DISABLED]
dev.hdaa.0.nid18_original: 0x90a60140 as=4 seq=0 device=Mic conn=Fixed ctype=Digital loc=Internal color=Unknown misc=1
dev.hdaa.0.nid18_config: 0x90a60140 as=4 seq=0 device=Mic conn=Fixed ctype=Digital loc=Internal color=Unknown misc=1
dev.hdaa.0.nid18: pin: Mic (Fixed)
dev.hdaa.0.nid17: vendor widget [DISABLED]
dev.hdaa.0.nid16: vendor widget [DISABLED]
dev.hdaa.0.nid15: vendor widget [DISABLED]
dev.hdaa.0.nid14: vendor widget [DISABLED]
dev.hdaa.0.nid13: vendor widget [DISABLED]
dev.hdaa.0.nid12: vendor widget [DISABLED]
dev.hdaa.0.nid11: vendor widget [DISABLED]
dev.hdaa.0.nid10: vendor widget [DISABLED]
dev.hdaa.0.nid9: audio input [DISABLED]
dev.hdaa.0.nid8: audio input [DISABLED]
dev.hdaa.0.nid7: audio input
dev.hdaa.0.nid6: audio output [DISABLED]
dev.hdaa.0.nid5: vendor widget [DISABLED]
dev.hdaa.0.nid4: vendor widget [DISABLED]
dev.hdaa.0.nid3: audio output [DISABLED]
dev.hdaa.0.nid2: audio output
dev.hdaa.0.%parent: hdacc0
dev.hdaa.0.%pnpinfo: type=0x01 subsystem=0x102807d0
dev.hdaa.0.%location: nid=1
dev.hdaa.0.%driver: hdaa
dev.hdaa.0.%desc: Realtek ALC256 Audio Function Group
dev.hdaa.%parent:
Comment 15 Masachika ISHIZUKA 2018-03-25 12:41:50 UTC
(In reply to marc.priggemeyer from comment #14)

Thank you for showing the output of sysctl.
It looks good.
My vostro 3568 and you latitude 4580 are the same codec(realtek ALC3246).
ALC3246 is compatible with ALC256.
My vostro was good working after I was patched to /usr/src/sys/dev/sound/pci/hda/hdaa_patches.c and make buildkernel && make installkernel && reboot.
I don't know why your latitude is not good working.
Comment 16 Ivan 2018-05-05 14:00:14 UTC
I have Dell XPS13 (Skylake) with ALC256

After I applied this patch, sound is greatly improved (before it was distorted  beyond recognition).

However, some static noises left, actually they reflect my actions, changing tone and loudness when I switch windows, scrolling and so on. Noise look the same for 100 vol or 1 (vol = 0 or pcm=0 shut it completely). Onboard speakers are OK.

I looked into linux quirks and found several fixes for this troublesome codec. I can't figure out which you applied, was it ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE ?

Maybe, something can be improved ?
Comment 17 Masachika ISHIZUKA 2018-05-07 04:29:22 UTC
(In reply to Ivan from comment #16)
I don't apply any of ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE.
The patch above is common ALC256 patch, not for specific machines.
This patch is from alc256_init() in linux/sound/pci/hda/patch_realtek.c.
Comment 18 Ivan 2018-05-07 09:35:28 UTC
(In reply to Masachika ISHIZUKA from comment #17)
Do you know what they are doing here?
[ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE] = {
		.type = HDA_FIXUP_VERBS,
		.v.verbs = (const struct hda_verb[]) {
			/* Disable pass-through path for FRONT 14h */
			{0x20, AC_VERB_SET_COEF_INDEX, 0x36},
			{0x20, AC_VERB_SET_PROC_COEF, 0x1737},
			{}
},

0x20 looks like nid
So, it's a write hdaa_write_coef(dev, 0x20, AC_VERB_SET_COEF_INDEX, 0x36) ?

Defines:
#define AC_VERB_SET_PROC_COEF			0x400
#define AC_VERB_SET_COEF_INDEX	0x500
Comment 19 Masachika ISHIZUKA 2018-05-07 12:21:03 UTC
(In reply to Ivan from comment #18)
I don't know what is doing with ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE.
I found the below when searching with 'ALC256_FIXUP_DELL_XPS_13_HEADPHONE_NOISE'.

| On Tue, 24 Nov 2015 04:08:18 +0100,
| Hui Wang wrote:
| > 
| > We have a machine Dell XPS 13 with the codec alc256, after resume back
| > from S3, the headphone has noise when play sound.
| > 
| > Through comparing with the coeff vaule before and after S3, we found
| > restoring a coeff register will help remove noise.

So, I think that patch is for resume.
Comment 20 Neel Chauhan 2018-05-20 20:49:37 UTC
Created attachment 193575 [details]
Patch for the ALC255 and ALC256

This also affects the Dell Inspiron 7352 which uses the ALC255 codec.
Comment 21 Martin Wilke freebsd_committer 2019-01-29 14:49:57 UTC
Take. added review url.
Comment 22 Marcel Bonnet 2019-03-08 12:31:50 UTC
The proposed patch worked for me.

RealTek ALC256 (laptop is Dell Latitude 3490).

Headphones now work propperlly. Thanks.

More hardware info, output from sysctl and whatever, may be found in a thread I opened yesterday in freebsd-multimedia mail list: https://lists.freebsd.org/pipermail/freebsd-multimedia/2019-March/019554.html
Comment 23 commit-hook freebsd_committer 2019-07-30 02:02:42 UTC
A commit references this bug:

Author: araujo
Date: Tue Jul 30 02:01:50 UTC 2019
New revision: 350433
URL: https://svnweb.freebsd.org/changeset/base/350433

Log:
  Fix sound on headset jack for ALC255 and ALC256 codec.

  PR:		219350 [1], [2]
  Submitted by:	Masachika ISHIZUKA (ish_at_amail.plala.or.jp) [1]
  		Neel Chauhan (neel_at_neelc.org) [2]
  		uri Momotyuk (yurkis_at_gmail.com) [3]
  Reported by:	miwi
  Reviewed by:	mav
  Obtained from:	https://github.com/trueos/trueos/pull/279 [3]
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D19017

Changes:
  head/sys/dev/sound/pci/hda/hdaa_patches.c
  head/sys/dev/sound/pci/hda/hdac.h
Comment 24 Marcelo Araujo freebsd_committer 2019-07-30 03:05:54 UTC
Taking it.
Comment 25 commit-hook freebsd_committer 2019-08-27 07:17:38 UTC
A commit references this bug:

Author: araujo
Date: Tue Aug 27 07:17:32 UTC 2019
New revision: 351541
URL: https://svnweb.freebsd.org/changeset/base/351541

Log:
  MFC r350433: Fix sound on headset jack for ALC255 and ALC256 codec.

  PR:		219350 [1], [2]
  Submitted by:	Masachika ISHIZUKA (ish_at_amail.plala.or.jp) [1]
  		Neel Chauhan (neel_at_neelc.org) [2]
  		Yuri Momotyuk (yurkis_at_gmail.com) [3]
  Reported by:	miwi
  Reviewed by:	mav
  Obtained from:	https://github.com/trueos/trueos/pull/279 [3]
  MFC after:	2 weeks
  Differential Revision:	https://reviews.freebsd.org/D19017

Changes:
_U  stable/12/
  stable/12/sys/dev/sound/pci/hda/hdaa_patches.c
  stable/12/sys/dev/sound/pci/hda/hdac.h