Solved Snd_hda in laptops

Crivens

Administrator
Staff member
Administrator
Moderator
I am currently pulling my hair out.
It is my x230 that gives me grief.

In online meetings, I have no microphone. For that, the hw.snd_hda.default_unit needs to be 1. But then I have no sound on the speakers.
When the default_unit is 0, I have sound on speakers but plugging in a headhone does nothing. How can that be done? I can set it to 1 and use a headphone, but that still does not give me a mic on /dev/dsp. Or does it?
What do you guys do for this?
 
I ran into a similar issue not too long ago. My mic was on mixer 1, my audio was mixer 0 and some random ones didn't work between front and rear.

I just about got mine to work but I really don't quite understand it enough to make a guide. You need to rearrange some pins (nids) in the snd_hda driver so that your mic and the speaker you want (headphones) is on the same mixer, moving the ones you don't want to the other mixer. It seems that sometimes they get set to the wrong mixer. Check out this useful post by ollie@

https://forums.freebsd.org/threads/internal-microphone-setup-question.77091/#post-479069

My post at the end of the thread detailed my solution but that is probably quite specific to my hardware setup.

Perhaps also cross-check it with the solution recommended here:
https://forums.freebsd.org/threads/configure-pins-with-snd_hda.35965/#post-198985
 
I am no expert at all in this matter, but the subject seems technically fairly simple.
Imagine the sound chip like a matrix of switches that can be set off or on (mixer).
Every input/output has a node ID (NID).
What you mix together depends on which NIDs are enabled/disabled/wired.
How the particular driver/mixer implements this, I have no idea, though.

So you might need to sift through the source to find out how you can set the mixing configuration.

If you want to know more, just go to the Intel HDA specification and search for the keyword "NID".
 
I am no expert at all in this matter, but the subject seems technically fairly simple.
Yeah I thought so too so I thought I would give it a shot. I am also fairly tempted to say that it is quite easy as a process *but* I suspect in some cases there is still some potential driver related issues working against us.

I am also fairly certain that not all snd_hda hardware is equal. Some of it may be hard coded / hard wired in weird ways.

The main bit I didn't quite understand is the seq=? parts and how some special numbers (such as 15) seem to be needed.
 
Thank you all a lot guys. That gives me hope to get things sorted out. I will report back tomorrow.
 
Ok, I switched the microphones. According to audacity, /dev/dsp now has the built-in mic, the sound stayed.

Thank you all.
 
I remember that haiku has a tool that seems to be able to do all this on the fly. I'm checking if this can be done with the hda driver. If yes, this would be a nice freetime project.
 
I remember that haiku has a tool that seems to be able to do all this on the fly. I'm checking if this can be done with the hda driver. If yes, this would be a nice freetime project.
A thought did cross my mind to make a small X11 / Motif / ncurses app to allow a user to drag and drop the pins to different configs. Obviously it would be very tied to the snd_hda driver but these days, I think most people are using this.

I only have one machine where this is a problem (Z400). Since I also have an x230 I guess this will also exhibit the same issue, but I don't actually use that one for anything audio related.
 
Doing a jitsi call to the parents where they had to use a phone to also talk to the grandkids pushed me far enough.
I'm checking up on the hda sources and documentation.
 
Hehe. I look forward to seeing the end result. Also happy to test anything.
(Possibly on a spare computer because I'm a little screwed if I put the Z400 mic out of action ;))
 
The mappings are reset at boot. And as long as you do not associate that pin with this socket, you should be fine.
 
The mappings are reset at boot.
Not sure whether this is correct.
There are many reports that confirm my experience, that the wirings/mappings are *not* being reset at soft reset.

Many people report that their sound card works fine, if and only if they boot DOS/Windows, whose driver sets up the sound chip and its wirings, and then reboot (without cycling power or hitting the reset key) to FreeBSD.
The fact that the wiring is lost after S3 sleeping the machine, indicates that the FreeBSD sound drivers do not do the mapping themselves (or don't do it correctly).

Basically, the whole NID wiring can be defined with the hints snd_hda() allows to be set.
The bad thing now is that to my knowledge there is no documentation how to actually configure this for the typical hardware configurations found on PCs, particularly on laptops.
 
Ok, I started a 'lil programm to handle some things. For now, I can switch between the "public" and "private" interfaces. That would be speaker/mic and the chinch socket. Next will be the assignment matrix.

And because I felt like it, it is dome in lazarus/fpc. Works great.
 
Back
Top