# FreeBSD 9 Realtek ALC898 Sound Driver



## markfisher (Jan 23, 2012)

I installed FreeBSD 9. I'm trying to make a sound to work but no luck.

My Sound Card: Realtek ALC898

Can someone help me how to make it to work (I'm creating custom kernel)?

Base on FreeBSD handbook, I ran [CMD=""]kldload snd_driver[/CMD] and I got:

```
ppc0: cannot reserve I/O port range
```

and [cmd=""]cat /dev/sndstat[/CMD]

```
pcm0: <HDA NVidia (Unknown) PCM #0 DisplayPort> (play)
pcm1: <HDA NVidia (Unknown) PCM #0 DisplayPort> (play)
pcm2: <HDA NVidia (Unknown) PCM #0 DisplayPort> (play)
pcm3: <HDA NVidia (Unknown) PCM #0 DisplayPort> (play)
pcm4: <HDA Realtek (Unknown) PCM #0 Analog> (play/rec) default
pcm5: <HDA Realtek (Unknown) PCM #1 Digital> (play)
```

Thanks
Mark


----------



## jb_fvwm2 (Jan 23, 2012)

You could use the howto I wrote if you have kernel sources installed (the howto for  audio/oss,) but AFAIK your kernel must not include any sound drivers or it may crash. (If no sound drivers are in your custom kernel, I believe one can either use FreeBSD's OR the OSS ones as the time permits to set them up).   (BTW other threads may cover hda and pcm issues, sorry not able to help in that case.)


----------



## mav@ (Jan 23, 2012)

So what is your problem and what have you tried? You have two sound cards (onboard and HDMI in video card). Both have good chance to work. "(Unknown)" in messages doesn't mean that are not supported by the driver, as driver is very universal.


----------



## markfisher (Jan 23, 2012)

Hi
@jb_fvwm2: Thanks for the reply. I found the HOWTO and I will give it try (Hopefully that works). But I really want to make snd_hda driver (I think that's driver for most Realtek sound card) to work rather than oss.

@mav@: Thanks for your reply. My problem is the sound doesn't work (I can't hear anything). I haven't tried anything because I'm not really good on how to make the driver to work (I used FreeBSD handbook to figure out the driver for my sound card but no luck)). If you have any idea on how to make sound to work, please let me know and I'll try it.

Thanks
Mark


----------



## mav@ (Jan 23, 2012)

OK. Lets start from fetching additional debugging information. Restore original kernel, boot into verbose messages mode (press respective button at loader menu or type *boot -v* at loader prompt) and upload /var/run/dmesg.boot file somewhere I can get it.


----------



## mav@ (Jan 23, 2012)

By the way, how did you tested sound? What the result of *cat /random >/dev/dsp*? Are you sure you've plugget speakers into the right connector? Is it desktop or laptop?


----------



## markfisher (Jan 24, 2012)

I sent you a link to my dmesg.boot. It's a desktop computer. I have plugged audio jack, I can hear music from my windows 7 partition.

From FreeBSD Handbook I used:
[CMD=""]mpg123 -a /dev/dsp4.0 MYMUSIC.mp3[/CMD]

I think you meant:
[CMD=""]cat /dev/random > /dev/dsp[/CMD]
instead of
[CMD=""]cat /random > /dev/dsp[/CMD]

I can hear static. Does that mean it's working with snd_hda driver?

Thanks
Mark


----------



## mav@ (Jan 24, 2012)

markfisher said:
			
		

> I sent you a link to my dmesg.boot
> 
> It's a desktop computer. I have plugged audio jack, I can hear music from my windows 7 partition.


I see a bug in your CODEC configuration, breaking your internal S/PDIF out and rear analog inputs. Add this line to /boot/loader.conf to fix it or try to update your BIOS:

```
hint.hdac.1.cad0.nid17.config="as=6"
```



			
				markfisher said:
			
		

> From FreeBSD Handbook I used:
> [CMD=""]mpg123 -a /dev/dsp4.0 MYMUSIC.mp3[/CMD]
> 
> I think you meant:
> ...


If you hear very loud static, then yes, it is working. You can remove -a with parameter from mpg123, as /dev/dsp4 is default in your case anyway.


----------



## markfisher (Jan 24, 2012)

@mav@
Can you please tell me which line from dmesg.boot shows that bug (I just want to learn how you found out)?

Thanks
Mark


----------



## mav@ (Jan 24, 2012)

Start from reading snd_hda manual page. Error can be seen here:

```
hdac1: hdac_audio_as_parse: Duplicate pin 0 (24) in association 4! Disabling association.
hdac1: hdac_audio_as_parse: Pin 24 has wrong direction for association 4! Disabling association.
hdac1: hdac_audio_as_parse: Pin 26 has wrong direction for association 4! Disabling association.
hdac1: 4 associations found:
hdac1: Association 0 (1) out:
hdac1:  Pin nid=20 seq=0
hdac1:  Pin nid=22 seq=1
hdac1:  Pin nid=21 seq=2
hdac1:  Pin nid=27 seq=15
hdac1: Association 1 (3) out:
hdac1:  Pin nid=30 seq=0
hdac1: Association 2 (4) out (disabled):
hdac1:  Pin nid=24 seq=0
hdac1:  Pin nid=26 seq=15
hdac1: Association 3 (5) in:
hdac1:  Pin nid=25 seq=0
```


----------



## markfisher (Jan 25, 2012)

@mav@
Thank you so much for your help


----------

