NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: kern/52912: hdafg: no sound from jack port on a laptop

Hi Jake,

I'm really glad I could help. And don't think you are alone who doesn't understand snd_hda logic easily.

The skeleton is like this:

- each associations should contain only one direction. Either in or just out pins. They are just group of pins to handle together. - sequences tell the pins their role within an association. And this is our case: Tell sequence 1 to speakers by default. Then tell sequence 15 to the one with electronic switch (aka. Jack). This tells the codec to mute other pins (speakers in our case), and route the output to this pin if connected.

Congratulations for your customized patch!
I suggest to test mixerctl. If you see odd things, you can improve the patch if necessary (for example mic jack, etc.).



On 2018. február 15. 22:29:19 Jake Slazenger <> wrote:

On Mon,  8 Jan 2018 19:25:00 +0000 (UTC)
Fekete Zoltán <> wrote:

The following reply was made to PR kern/52912; it has been noted by

From: =?UTF-8?Q?Fekete_Zolt=C3=A1n?= <>
Subject: Re: kern/52912: hdafg: no sound from jack port on a laptop
Date: Mon, 08 Jan 2018 20:22:05 +0100

 2018-01-08 07:50 időpontban ezt írta:
 >> Number:         52912
 >> Category:       kern
 >> Synopsis:       hdafg: no sound from jack port on a laptop
 >> Confidential:   no
 >> Severity:       non-critical
 >> Priority:       medium
 >> Responsible:    kern-bug-people
 >> State:          open
 >> Class:          sw-bug
 >> Submitter-Id:   net
 >> Arrival-Date:   Mon Jan 08 06:50:00 +0000 2018
 >> Originator:     Jake Slazenger
 >> Release:        CURRENT-8.0-171230
 >> Organization:
 >> Environment:
 > NetBSD localhost 8.0_BETA NetBSD 8.0_BETA (RUSTY) #0: Sun Jan  7
 > 16:30:08 MSK 2018
 > rusty@localhost:/usr/src/171230/src/sys/arch/amd64/compile/RUSTY
 > amd64
 >> Description:
 > When I connect headphones to jack port on my laptop with Realtek
 > ALC268 sound chip, sound is not switching to the headphones and
 > continues to come out from built-in speakers.
 > For example, on Linux-based systems sound is automatically switches
 > when headphones is connected.
 > Is it a bug, or I do something wrong and it can be switched
 > manually?
 >> How-To-Repeat:
 > Connect headphones to jack port on a laptop with Realtek ALC268
 > sound chip.
 >> Fix:

 Hi Jake,

 I had a similar problem, and finally I could figure out how to set
jack up. Probably your codec is not set up correctly, and it is not a
bug. There are several different codecs/setups, and kernel developers
do not have the capacity to program each one.

 So, you have to solve it yourself. It's not really obvious however.

 1. You have to read carefully the snd_hda man page. There you will
 understand how the hda driver groups the different in/out parts

 2. Try to find a technical manual for your sound chip. Similar to
mine here (Analog Devices 1984A):

 3. Use hdaudioctl get command to gain your current settings. You
have to read and decode hexadecimal numbers...

 4. Then modify the xml file you got in point 3, and use hdaudioctl
set command with the modified file apply changes. Then try jack.
Repeat 3-4 until success.

 Another aproach: if you can program, you could modify the kernel,
and recompile. Here is my patch, but this is device-dependent:

 Good luck!

 I'm working on a script that translates that output file into human
 readable form. Just time is always an issue.



Thank you very much, FeZ, for the such detailed answer!

But, anyway, I didn't understand how association and sequence numbers
works (yes, I'm a little bit stupid).

So I looked to FreeBSD sources to find required assoc and seq numbers:

And used it with Fekete's patches... And it worked!

So problem is partially solved, I think.

And again, thank you very much for the help, FeZ!

Oh, and yes. I'm sorry for my very bad English.

Patch for 7.1.1 kernel:
--- src/sys/dev/pci/hdaudio/hdafg.c.orig	2018-02-15 15:23:24.000000000 +0300
+++ src/sys/dev/pci/hdaudio/hdafg.c	2018-02-15 23:37:49.000000000 +0300
@@ -657,6 +657,21 @@

+        /* XXX ALC268 */
+        if (sc->sc_vendor == HDA_VENDOR_REALTEK && sc->sc_product == 0x0268) {
+	    if (COP_CFG_PORT_CONNECTIVITY(w->w_pin.config) == COP_PORT_JACK) {
+	        /* nid 20 */
+	        if (w->w_nid == 0x14) {
+		  /* set assoc=1 */
+		  w->w_pin.config &= ~0xf0;
+		  w->w_pin.config |= 0x10;
+		  /* set seq=15 */		
+		  w->w_pin.config &= ~0x0f;
+		  w->w_pin.config |= 0x0f;
+		}
+	    }
+	}
 	conn = COP_CFG_PORT_CONNECTIVITY(w->w_pin.config);
 	color = COP_CFG_COLOR(w->w_pin.config);
 	defdev = COP_CFG_DEFAULT_DEVICE(w->w_pin.config);

Home | Main Index | Thread Index | Old Index