# Mac Pro - low volume problem



## CanOfBees (Feb 8, 2013)

Hi all, 

This is a cross-post [1] from the PC-BSD forums; I wanted to ask here, too, as there's more traffic. Here's the gist:

I'm having a problem with sound on a 1,1 Mac Pro. I have a pastebin (also appended below) with (some of?) the particulars:
	
	



```
dmesg | grep pcm 
sysctl -a | grep hw.snd 
mixer
```
Sound works, but with everything at 100%, the volume is incredibly low (it sounds like it's turned down to 5%). I've looked over the FreeBSD handbook, as well as the PC-BSD wiki, but I haven't found an answer in either of those docs.

I've tried modifying the hw.snd.default_unit values, but that hasn't worked.

I want to reiterate that I'm able to get sound, it's just being delivered at a not-quite-usable-level. Let me know if there's additional data I can provide. Suggestions are greatly appreciated!
Thanks! 

[1] http://forums.pcbsd.org/showthread.php?t=19289
From pastebin:

```
> dmesg | grep pcm
    pcm0: <Realtek ALC889A (Analog)> at nid 26 and 25 on hdaa0
    pcm1: <Realtek ALC889A (Rear Digital)> at nid 30 and 31 on hdaa0
    pcm2: <Realtek ALC889A (Front Analog Headphones)> at nid 24 on hdaa0
    pcm3: <Realtek ALC889A (Rear Analog Line-out)> at nid 21 on hdaa0
     
    > sysctl -a | grep hw.snd        
    hw.snd.vpc_reset: 0
    hw.snd.vpc_0db: 45
    hw.snd.vpc_autoreset: 1
    hw.snd.latency_profile: 1
    hw.snd.latency: 5
    hw.snd.report_soft_matrix: 1
    hw.snd.report_soft_formats: 1
    hw.snd.compat_linux_mmap: 0
    hw.snd.feeder_eq_exact_rate: 0
    hw.snd.feeder_eq_presets: PEQ:16000,0.2500,62,0.2500:-9,9,1.0:44100,48000,88200,96000,176400,192000
    hw.snd.feeder_rate_quality: 1
    hw.snd.feeder_rate_round: 25
    hw.snd.feeder_rate_max: 2016000
    hw.snd.feeder_rate_min: 1
    hw.snd.feeder_rate_polyphase_max: 183040
    hw.snd.feeder_rate_presets: 100:8:0.85 100:36:0.92 100:164:0.97
    hw.snd.vpc_mixer_bypass: 1
    hw.snd.verbose: 0
    hw.snd.maxautovchans: 16
    hw.snd.default_unit: 2
    hw.snd.version: 2009061500/amd64
     
    > mixer
    Mixer vol      is currently set to 100:100
    Mixer pcm      is currently set to 100:100
    Mixer igain    is currently set to 100:100
```


----------



## mav@ (Feb 15, 2013)

External power amplifier responsible for volume may be controlled by non-standardized CODEC GPIO pins. You may get their number and status with [cmd=]sysctl dev.hdaa.0.gpio_state[/cmd] You may try different combinations of "set" and "clear" for them in loader tunable hint.hdaa.0.gpio_config set in /boot/loader.conf like "0=set 1=clear ...".


----------



## CanOfBees (Feb 17, 2013)

@mav - Thanks for the reply! I'm away from the box until tomorrow morning, but I'll try your suggestions then. The current status of gpio_state is

```
> sysctl dev.hdaa.0.gpio_state
dev.hdaa.0.gpio_state: 0=disabled 1=disabled
```

I'll try modifying those values tomorrow via /boot/loader.conf as you suggest.
I appreciate the help.

Cheers!


----------



## CanOfBees (Feb 18, 2013)

I understand that some experimentation may be necessary, but are there any resources available that expand on the meanings of the various settings available for gpio_config states? E.g. "keep", "set", etc.

I'll keep tinkering with this as time allows. I added the following to /boot/loader.conf:

```
hint.hdaa.0.gpio_config="0=set"
hint.hdaa.0.gpio_config="1=set"
```
After rebooting, 

```
> sysctl -a | grep hdaa.0.gpio              
dev.hdaa.0.gpio_state: 0=disabled 1=output(1)
dev.hdaa.0.gpio_config: 0=keep 1=set
```
...so, something's different.  
But the sound is still low. 
Seriously, thanks again. I'll continue experimenting.
Cheers!


----------



## ColdfireMC (Feb 19, 2013)

activate debug messages

(hw.snd.verbose)


----------



## mav@ (Feb 20, 2013)

You can't set hint.hdaa.0.gpio_config twice in loader.conf. You should specify all values separated by spaces.


----------



## CanOfBees (Feb 21, 2013)

@ColdFireMC - thanks for the tip. 

```
# sysctl hw.snd.verbose=4
# cat /dev/sndstat ...results at bottom of post...
```

@mav - :r oops. Thanks for pointing that out. I changed /boot/loader.conf to 

```
hint.hdaa.0.gpio_config="0=set 1=set"
```
and rebooted. 

```
> sysctl -a | grep hdaa.0.gpio
dev.hdaa.0.gpio_state: 0=output(1) 1=output(1)
dev.hdaa.0.gpio_config: 0=set 1=set
```

Thank you both for the continued assistance. 

[1] results of `cat /dev/sndstat` *after* `sysctl hw.snd.verbose=4`:

```
# cat /dev/sndstat
FreeBSD Audio Driver (newpcm: 64bit 2009061500/amd64)
Installed devices:
pcm0: <Realtek ALC889A (Analog)> on hdaa0  (1p:1v/2r:1v)
	snddev flags=0x2e6<AUTOVCHAN,SOFTPCMVOL,BUSY,MPSAFE,REGISTERED,VPC>
	[pcm0:play:dsp0.p0]: spd 48000, fmt 0x00200010, flags 0x00002100, 0x00000004
	interrupts 658, underruns 0, feed 658, ready 0 [b:4096/2048/2|bs:4096/2048/2]
	channel flags=0x2100<BUSY,HAS_VCHAN>
	{userland} -> feeder_mixer(0x00200010) -> {hardware}
	pcm0:play:dsp0.p0[pcm0:virtual:dsp0.vp0]: spd 44100/48000, fmt 0x00200010, flags 0x10000000, 0x00000029
	interrupts 0, underruns 0, feed 0, ready 0 [b:0/0/0|bs:65536/2048/32]
	channel flags=0x10000000<VIRTUAL>
	{userland} -> feeder_root(0x00200010) -> feeder_volume(0x00200010) -> feeder_rate(0x00200010 q:1 44100 -> 48000) -> {hardware}
	[pcm0:record:dsp0.r0]: spd 48000, fmt 0x00200010, flags 0x00002100, 0x00000005
	interrupts 0, overruns 0, feed 0, hfree 4096, sfree 4096 [b:4096/2048/2|bs:4096/2048/2]
	channel flags=0x2100<BUSY,HAS_VCHAN>
	{hardware} -> feeder_root(0x00200010) -> feeder_mixer(0x00200010) -> {userland}
	[pcm0:record:dsp0.r1]: spd 44100, fmt 0x00200010, flags 0x00000000, 0x00000021
	interrupts 0, overruns 0, feed 0, hfree 4096, sfree 65536 [b:4096/2048/2|bs:65536/2048/32]
	channel flags=0x0
	{hardware} -> feeder_root(0x00200010) -> feeder_volume(0x00200010) -> {userland}
	pcm0:record:dsp0.r0[pcm0:virtual:dsp0.vr0]: spd 8000, fmt 0x00100008, flags 0x10000000, 0x00000000
	interrupts 0, overruns 0, feed 0, hfree 0, sfree 0 [b:0/0/0|bs:0/0/0]
	channel flags=0x10000000<VIRTUAL>
	{hardware} -> feeder_root(0x00000000) -> {userland}
pcm1: <Realtek ALC889A (Rear Digital)> on hdaa0  (1p:1v/1r:1v)
	snddev flags=0x2e6<AUTOVCHAN,SOFTPCMVOL,BUSY,MPSAFE,REGISTERED,VPC>
	[pcm1:play:dsp1.p0]: spd 48000, fmt 0x00200010, flags 0x00006100, 0x00000004
	interrupts 645, underruns 0, feed 645, ready 0 [b:4096/2048/2|bs:4096/2048/2]
	channel flags=0x6100<BUSY,HAS_VCHAN,VCHAN_PASSTHROUGH>
	{userland} -> feeder_mixer(0x00200010) -> {hardware}
	pcm1:play:dsp1.p0[pcm1:virtual:dsp1.vp0]: spd 44100/48000, fmt 0x00200010, flags 0x10000000, 0x00000029
	interrupts 0, underruns 0, feed 0, ready 0 [b:0/0/0|bs:65536/2048/32]
	channel flags=0x10000000<VIRTUAL>
	{userland} -> feeder_root(0x00200010) -> feeder_volume(0x00200010) -> feeder_rate(0x00200010 q:1 44100 -> 48000) -> {hardware}
	[pcm1:record:dsp1.r0]: spd 48000, fmt 0x00200010, flags 0x00006100, 0x00000005
	interrupts 610, overruns 0, feed 1220, hfree 4096, sfree 4096 [b:4096/2048/2|bs:4096/2048/2]
	channel flags=0x6100<BUSY,HAS_VCHAN,VCHAN_PASSTHROUGH>
	{hardware} -> feeder_root(0x00200010) -> feeder_mixer(0x00200010) -> {userland}
	pcm1:record:dsp1.r0[pcm1:virtual:dsp1.vr0]: spd 44100/48000, fmt 0x00200010, flags 0x10000000, 0x00000029
	interrupts 0, overruns 0, feed 0, hfree 0, sfree 65536 [b:0/0/0|bs:65536/2048/32]
	channel flags=0x10000000<VIRTUAL>
	{hardware} -> feeder_root(0x00200010) -> feeder_rate(0x00200010 q:1 48000 -> 44100) -> feeder_volume(0x00200010) -> {userland}
pcm2: <Realtek ALC889A (Front Analog Headphones)> on hdaa0  (1p:1v/0r:0v) default
	snddev flags=0x2e7<SIMPLEX,AUTOVCHAN,SOFTPCMVOL,BUSY,MPSAFE,REGISTERED,VPC>
	[pcm2:play:dsp2.p0]: spd 48000, fmt 0x00200010, flags 0x00002100, 0x00000004
	interrupts 441, underruns 0, feed 441, ready 0 [b:4096/2048/2|bs:4096/2048/2]
	channel flags=0x2100<BUSY,HAS_VCHAN>
	{userland} -> feeder_mixer(0x00200010) -> {hardware}
	pcm2:play:dsp2.p0[pcm2:virtual:dsp2.vp0]: spd 8000/48000, fmt 0x00100008/0x00200010, flags 0x10000000, 0x0000006b
	interrupts 0, underruns 0, feed 0, ready 0 [b:0/0/0|bs:4096/128/32]
	channel flags=0x10000000<VIRTUAL>
	{userland} -> feeder_root(0x00100008) -> feeder_format(0x00100008 -> 0x00100010) -> feeder_rate(0x00100010 q:1 8000 -> 48000) -> feeder_matrix(1.0 -> 2.0) -> feeder_volume(0x00200010) -> {hardware}
pcm3: <Realtek ALC889A (Rear Analog Line-out)> on hdaa0  (1p:1v/0r:0v)
	snddev flags=0x2e7<SIMPLEX,AUTOVCHAN,SOFTPCMVOL,BUSY,MPSAFE,REGISTERED,VPC>
	[pcm3:play:dsp3.p0]: spd 48000, fmt 0x00200010, flags 0x00002100, 0x00000004
	interrupts 616, underruns 0, feed 616, ready 0 [b:4096/2048/2|bs:4096/2048/2]
	channel flags=0x2100<BUSY,HAS_VCHAN>
	{userland} -> feeder_mixer(0x00200010) -> {hardware}
	pcm3:play:dsp3.p0[pcm3:virtual:dsp3.vp0]: spd 44100/48000, fmt 0x00200010, flags 0x10000000, 0x00000029
	interrupts 0, underruns 0, feed 0, ready 0 [b:0/0/0|bs:65536/2048/32]
	channel flags=0x10000000<VIRTUAL>
	{userland} -> feeder_root(0x00200010) -> feeder_volume(0x00200010) -> feeder_rate(0x00200010 q:1 44100 -> 48000) -> {hardware}

File Versions:
$FreeBSD: releng/9.1/sys/dev/sound/pcm/vchan.c 193640 2009-06-07 19:12:08Z ariff $
$FreeBSD: releng/9.1/sys/dev/sound/pcm/sound.c 231762 2012-02-15 14:30:04Z mav $
$FreeBSD: releng/9.1/sys/dev/sound/pcm/sndstat.c 235157 2012-05-09 08:18:22Z pho $
$FreeBSD: releng/9.1/sys/dev/sound/pcm/mixer.c 232405 2012-03-02 21:29:57Z ed $
$FreeBSD: releng/9.1/sys/dev/sound/pcm/feeder_volume.c 193640 2009-06-07 19:12:08Z ariff $
$FreeBSD: releng/9.1/sys/dev/sound/pcm/feeder_rate.c 209193 2010-06-15 07:06:54Z avg $
$FreeBSD: releng/9.1/sys/dev/sound/pcm/feeder_mixer.c 193640 2009-06-07 19:12:08Z ariff $
$FreeBSD: releng/9.1/sys/dev/sound/pcm/feeder_matrix.c 193640 2009-06-07 19:12:08Z ariff $
$FreeBSD: releng/9.1/sys/dev/sound/pcm/feeder_format.c 193640 2009-06-07 19:12:08Z ariff $
$FreeBSD: releng/9.1/sys/dev/sound/pcm/feeder_eq.c 209193 2010-06-15 07:06:54Z avg $
$FreeBSD: releng/9.1/sys/dev/sound/pcm/feeder_chain.c 193640 2009-06-07 19:12:08Z ariff $
$FreeBSD: releng/9.1/sys/dev/sound/pcm/feeder.c 193640 2009-06-07 19:12:08Z ariff $
$FreeBSD: releng/9.1/sys/dev/sound/pcm/dsp.c 225505 2011-09-12 08:38:21Z avg $
$FreeBSD: releng/9.1/sys/dev/sound/pcm/channel.c 233164 2012-03-19 07:24:26Z mav $
$FreeBSD: releng/9.1/sys/dev/sound/pcm/buffer.c 233164 2012-03-19 07:24:26Z mav $
$FreeBSD: releng/9.1/sys/dev/sound/pcm/ac97_patch.c 193640 2009-06-07 19:12:08Z ariff $
$FreeBSD: releng/9.1/sys/dev/sound/pcm/ac97.c 193640 2009-06-07 19:12:08Z ariff $
$FreeBSD: releng/9.1/sys/dev/sound/pci/hda/hdacc.c 232798 2012-03-10 21:58:08Z mav $
$FreeBSD: releng/9.1/sys/dev/sound/pci/hda/hdac.c 233878 2012-04-04 17:24:53Z mav $
$FreeBSD: releng/9.1/sys/dev/sound/pci/hda/hdaa_patches.c 238131 2012-07-05 15:32:31Z mav $
$FreeBSD: releng/9.1/sys/dev/sound/pci/hda/hdaa.c 240988 2012-09-27 08:24:34Z mav $
$FreeBSD: releng/9.1/sys/dev/sound/pci/via8233.c 193640 2009-06-07 19:12:08Z ariff $
$FreeBSD: releng/9.1/sys/dev/sound/pci/ich.c 216518 2010-12-18 14:21:28Z tijl $
$FreeBSD: releng/9.1/sys/dev/sound/pci/es137x.c 218909 2011-02-21 09:01:34Z brucec $
$FreeBSD: releng/9.1/sys/dev/sound/pci/csapcm.c 193640 2009-06-07 19:12:08Z ariff $
$FreeBSD: releng/9.1/sys/dev/sound/pci/csa.c 231047 2012-02-05 20:09:50Z pfg $
$FreeBSD: releng/9.1/sys/dev/sound/pci/cmi.c 193640 2009-06-07 19:12:08Z ariff $
$FreeBSD: releng/9.1/sys/dev/sound/isa/sndbuf_dma.c 193640 2009-06-07 19:12:08Z ariff $
```


----------



## CanOfBees (Mar 1, 2013)

While I've not had any more luck, I think I've gone as far as I can go with using hints unless there's some alternate way to express these [1]. I also found a bit of explanation re the meanings/utility of the values for [CMD=""]hint.hdaa.%d.gpio_config[/CMD] [2]. Hopefully, Mr. Motin won't mind being quoted (& I hope I'm getting the context right)
GPIO pins are bidirectional, but I have doubt that input or high impedance ("disable") state could be used to control something. "keep" is also useless, as by default these pins are disabled. So you have only "set" and "clear".​

[1] from /boot/loader.conf:

```
# adding verbose hw.snd debugging
hw.snd.verbose="4"

# adding hints for sound settings
#hint.pcm.2.eq=1
#hint.hdaa.0.gpio_config="0=set 1=set"
#hint.hdaa.0.gpio_config="0=clear 1=set"
#hint.hdaa.0.gpio_config="0=set 1=clear"
hint.hdaa.0.gpio_config="0=clear 1=clear"
```


[2] http://unix.derkeiler.com/Mailing-Lists/FreeBSD/questions/2012-10/msg00635.html


----------



## CanOfBees (Mar 15, 2013)

*Update & Fix*

I'm afraid I'm not sure why this works, but it does.

/boot/loader.conf

```
hint.hdaa.0.gpio_config="0=clear 1=clear"
hint.hdaa.0.config="ovref"
```

I added the 
	
	



```
hint.hdaa.0.config="ovref"
```
 after stumbling across a mention of low volume problems on Apple laptops. I thought, "why not?". Added it, rebooted, and forgot to test it. I just plugged in some ear buds, and Lo, there is Sound, and Much of It.

Thanks for the suggestions and help.


----------



## mav@ (Mar 16, 2013)

Have you tried to do it without touching GPIO settings at all? Can you show your [cmd=]devinfo -v[/cmd] output so I could create permanent patch to the driver?


----------



## CanOfBees (Mar 16, 2013)

@mav@, I would be delighted to do this. I'll get you the information as soon as I can get in front of the hardware again.


----------



## CanOfBees (Mar 16, 2013)

@mav@, I removed the GPIO settings, kept the ovref setting, and I still have correct sound after a reboot. I've put a Pastebin [1] up of the output of `devinfo -v`. Please let me know if I can provide any additional information to help.

Thanks again.

[1] http://pastebin.com/v5anBYqu


----------



## hartzell (Jan 26, 2014)

Just a quick success report.

I just updated my 2008 Mac Pro to 10-RELEASE (svn r261187).

I'm loading snd_hda in /boot/loader.conf with:

```
snd_hda_load="YES"
```

and with the following lines in /boot/device.hints:

```
hint.hdaa.0.config="ovref"
hint.hdaa.0.gpio_config="0=clear 1=set"
```

g.


When I set the default unit to 2 I get sound at a reasonable volume out of the front headset jack.
When I set the default unit to 3 I get sound at a reasonable volume out of the rear analog jack.

In a gnome2-lite desktop + rhythmbox built from ports I can play flac files nicely.

Oddly, the volume control in rhythmbox works, albeit with a bit of a delay but the volume control in the desktop menubar does not have any effect.

g.


----------

