# pass parameter to kernel module



## estellnb (Feb 15, 2009)

I need to pass the following parameter to the snd_hda module in order to allow correct headphone support: model=fujitsu-pi2515

(Linux: /etc/modprobe.d/sound:
 options snd-hda-intel model=fujitsu-pi2515) works

(FreeBSD: /boot/loader.conf
snd_hda_flags="model=fujitsu-pi2515") does not work

anything wrong in here?


----------



## SirDice (Feb 16, 2009)

model= is a linux kernel module option, this obviously doesn't work with a freebsd kernel module as they are quite different.

You will need to set device.hints. Not sure which one as I don't have a hda soundcard.

http://www.freebsd.org/cgi/man.cgi?...ktion=0&manpath=FreeBSD+8-current&format=html (the man page for 7.1 isn't updated, it should on your system)
http://www.freebsd.org/cgi/man.cgi?...ion=0&manpath=FreeBSD+7.1-RELEASE&format=html


----------



## estellnb (Feb 16, 2009)

How can I force a module reloading that takes device.hints into account without having to reboot?


----------



## estellnb (Feb 16, 2009)

How can I get the 'verbose driver output'?


----------



## SirDice (Feb 16, 2009)

kldload, kldunload and kldstat are the tools similar to linux' insmod, lsmod etc.


----------



## plamaiziere (Feb 16, 2009)

estellnb said:
			
		

> How can I force a module reloading that takes device.hints into account without having to reboot?



You can't (i think), device.hints is read by the loader at boot time. For the verbose mode, put boot_verbose="YES" in /boot/loader.conf

What is the problem with snd_hda? You can start with the current version of snd_hda (just copy the /sys/dev/sound/pci/hda directory from FreeBSD-Current and rebuild the module).


----------



## SirDice (Feb 16, 2009)

You may need to update your src tree..

From /usr/src/UPDATING:


> 20090107:
> snd_hda(4) driver was updated to version 20081226_0122.
> 
> Due to added HDMI audio and logical audio devices support, updated
> ...


----------



## estellnb (Feb 16, 2009)

The thing here is simply that the main speaker should be turned off if the headphones are plugged in. Under Linux there are two different volume control panels for the headphones and the main speaker. To achieve both (mainspeaker turned off, headphone volume control used) it is necessary to reconfigure the pins by specifying the given model id.


----------



## estellnb (Feb 16, 2009)

kldload takes device.hints into account?


----------



## blah (Feb 16, 2009)

estellnb said:
			
		

> How can I force a module reloading that takes device.hints into account without having to reboot?


set kernel environment beforehand using kenv(1)()


----------



## plamaiziere (Feb 17, 2009)

*snd_hda pin configuration*



			
				estellnb said:
			
		

> The thing here is simply that the main speaker should be turned off if the headphones are plugged in. Under Linux there are two different volume control panels for the headphones and the main speaker. To achieve both (mainspeaker turned off, headphone volume control used) it is necessary to reconfigure the pins by specifying the given model id.



Ok. You may need to associate the headphone pin to the speaker. So the driver will mute the speaker.

The man page of snd_hda explains this:
The sequence number 15 has a special meaning for output associations. Output pins with this number and device type ``Headphones'' will duplicate (with automatic mute if jack detection is supported) the first pin in that association.

By instance I've got on my laptop:

```
hdac0:  nid 20 0x90100140 as  4 seq  0       Speaker Fixed jack  0 loc 16 color Unknown misc 1
hdac0:  nid 21 0x012b4050 as  5 seq  0    Headphones  Jack jack 11 loc  1 color   Green misc 0
```

To make the auto mute works, The headphone pin must be associate with the as '4' (the as of the speaker pin) with the sequence '15'). So I must add a quirk like:

```
hint.hdac.0.cad0.nid21.config="as=4 seq=15"
```

But be sure to have the latest version of the snd_hda driver.

Put somewhere the output of snd_hda and pcm in verbose mode if you need more help.


----------



## estellnb (Mar 16, 2009)

Unfortunately simply adding 

```
hint.hdac.0.cad0.nid21.config="as=4 seq=15"
```
seems to have no effect.
Unfortunately I do not understand what the 'nid', 'as' and 'seq' parameters are ment to be for.


----------



## estellnb (Mar 16, 2009)

As I have not found out on how to post attachements I have simply uploaded /var/log/messages at http://wwwu.edu.uni-klu.ac.at/estellnb/freebsd-bugs/messages .


----------



## estellnb (Mar 18, 2010)

*freshen snd_hda kernel module*

How should I freshen the snd_hda kernel module?
/usr/src/sys/modules/sound/driver/hda solely contains a single Makefile which has not been updated in the HEAD release.


----------



## estellnb (Mar 18, 2010)

OK; that is done:

```
cd /sys/modules
mv sound sound-old
svn co [url]http://svn.freebsd.org/base/head/sys/modules/sound[/url]
cd /sys/dev
mv sound sound-old
svn co [url]http://svn.freebsd.org/base/head/sys/dev/sound[/url]
cd /sys/modules/sound/driver/hda
make depend all install  (make depend; make all; make install;)
```


----------

