On Mon, 8 Jan 2018 19:25:00 +0000 (UTC)
Fekete Zoltán <fekete.zoltan%minux.hu@localhost> wrote:
The following reply was made to PR kern/52912; it has been noted by
GNATS.
From: =?UTF-8?Q?Fekete_Zolt=C3=A1n?= <fekete.zoltan%minux.hu@localhost>
To: gnats-bugs%netbsd.org@localhost
Cc:
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 jake.slazenger%yandex.com@localhost 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):
http://www.analog.com/media/en/technical-documentation/obsolete-data-sheets/AD1984.pdf
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:
https://minux.hu/netbsd-hdaudio-jack-detection
Good luck!
I'm working on a script that translates that output file into human
readable form. Just time is always an issue.
Rgds,
FeZ
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:
https://github.com/freebsd/freebsd/blob/d8596f6f687a64b994b065f3058155405dfc39db/sys/dev/sound/pci/hda/hdaa_patches.c
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 @@
}
#endif
+ /* 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);