MacBook Air 2009 no sound

Hello everyone.
First, please excuse my English - I mostly use google translator. And the second point - I really like to tell long stories...

I like FreeBSD and try to use it because it is fast, reliable and modern operating system. But I'm more of an advanced user than a system administrator, much less a programmer, and I can't solve some of the problems that arise.

Now to the point. A couple of days ago a friend brought me an old mid-2009 MacBook Air (A1304). Of course, I installed FreeBSD 13.2. It works faster than Apple's operating system, it doesn't have apps and features I don't need, and the packages always have up-to-date versions of apps. In addition to the well-known problem with Wi-Fi, I encountered a lack of sound, although in the old MacOS there was sound and the audio subsystem worked correctly.

I understand that I need to configure the sound subsystem using device.hints and sysctl, but I don't understand what exactly and how I should do it.

The hardware is based on the Realtek ALC889A chip, and in my experience is perfectly supported by the snd_hda driver. But I don't fully understand the audio output configuration method. Can anyone help me?


Code:
cat /dev/sndstat

Installed devices:
pcm0: <Realtek ALC889A (Internal Analog Speaker)> (play) default
pcm1: <Realtek ALC889A (Rear Analog Headphones)> (play)
No devices installed from userspace.

ls /dev/dsp*

/dev/dsp0.0    /dev/dsp1.0

Code:
sysctl -a | grep nid
hdaa0: <Realtek ALC889A Audio Function Group> at nid 1 on hdacc0
pcm0: <Realtek ALC889A (Internal Analog Speaker)> at nid 24 on hdaa0
pcm1: <Realtek ALC889A (Rear Analog Headphones)> at nid 20 on hdaa0
debug.minidump: 1
dev.pcm.1.%location: nid=20
dev.pcm.0.%location: nid=24
dev.hdaa.0.nid38: audio mixer [DISABLED]
          + [DISABLED] <- nid=37 [audio output] [DISABLED]
          + [DISABLED] <- nid=11 [audio mixer]
dev.hdaa.0.nid37: audio output [DISABLED]
dev.hdaa.0.nid36: audio mixer [DISABLED]
          + [DISABLED] <- nid=24 [pin: Speaker (Fixed)]
          + [DISABLED] <- nid=25 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=26 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=27 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=28 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=29 [beep widget]
          + [DISABLED] <- nid=20 [pin: Headphones (Green Jack)]
          + [DISABLED] <- nid=21 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=22 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=23 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=11 [audio mixer]
dev.hdaa.0.nid35: audio mixer [DISABLED]
          + [DISABLED] <- nid=24 [pin: Speaker (Fixed)]
          + [DISABLED] <- nid=25 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=26 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=27 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=28 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=29 [beep widget]
          + [DISABLED] <- nid=20 [pin: Headphones (Green Jack)]
          + [DISABLED] <- nid=21 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=22 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=23 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=11 [audio mixer]
dev.hdaa.0.nid34: audio mixer [DISABLED]
          + [DISABLED] <- nid=24 [pin: Speaker (Fixed)]
          + [DISABLED] <- nid=25 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=26 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=27 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=28 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=29 [beep widget]
          + [DISABLED] <- nid=20 [pin: Headphones (Green Jack)]
          + [DISABLED] <- nid=21 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=22 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=23 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=11 [audio mixer]
dev.hdaa.0.nid33: volume widget [DISABLED]
dev.hdaa.0.nid32: vendor widget [DISABLED]
dev.hdaa.0.nid31_original: 0x400000f0 as=15 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid31_config: 0x400000f0 as=15 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid31: pin: Line-out (None) [DISABLED]
dev.hdaa.0.nid30_original: 0x400000f0 as=15 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid30_config: 0x400000f0 as=15 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid30: pin: Line-out (None) [DISABLED]
          + <- nid=6 [audio output] [DISABLED]
dev.hdaa.0.nid29_original: 0x400000f0 as=15 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid29_config: 0x400000f0 as=15 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid29: beep widget
dev.hdaa.0.nid28_original: 0x400000f0 as=15 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid28_config: 0x400000f0 as=15 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid28: pin: Line-out (None) [DISABLED]
dev.hdaa.0.nid27_original: 0x400000f0 as=15 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid27_config: 0x400000f0 as=15 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid27: pin: Line-out (None) [DISABLED]
          + [DISABLED] <- nid=12 [audio mixer] (selected)
          + <- nid=13 [audio mixer]
          + <- nid=14 [audio mixer] [DISABLED]
          + <- nid=15 [audio mixer] [DISABLED]
          + <- nid=38 [audio mixer] [DISABLED]
dev.hdaa.0.nid26_original: 0x400000f0 as=15 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid26_config: 0x400000f0 as=15 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid26: pin: Line-out (None) [DISABLED]
          + [DISABLED] <- nid=12 [audio mixer] (selected)
          + <- nid=13 [audio mixer]
          + <- nid=14 [audio mixer] [DISABLED]
          + <- nid=15 [audio mixer] [DISABLED]
          + <- nid=38 [audio mixer] [DISABLED]
dev.hdaa.0.nid25_original: 0x400000f0 as=15 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid25_config: 0x400000f0 as=15 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid25: pin: Line-out (None) [DISABLED]
          + [DISABLED] <- nid=12 [audio mixer] (selected)
          + <- nid=13 [audio mixer]
          + <- nid=14 [audio mixer] [DISABLED]
          + <- nid=15 [audio mixer] [DISABLED]
          + <- nid=38 [audio mixer] [DISABLED]
dev.hdaa.0.nid24_original: 0x90100120 as=2 seq=0 device=Speaker conn=Fixed ctype=Unknown loc=Internal color=Unknown misc=1
dev.hdaa.0.nid24_config: 0x90100120 as=2 seq=0 device=Speaker conn=Fixed ctype=Unknown loc=Internal color=Unknown misc=1
dev.hdaa.0.nid24: pin: Speaker (Fixed)
          + <- nid=12 [audio mixer] (selected)
          + [DISABLED] <- nid=13 [audio mixer]
          + [DISABLED] <- nid=14 [audio mixer] [DISABLED]
          + [DISABLED] <- nid=15 [audio mixer] [DISABLED]
          + [DISABLED] <- nid=38 [audio mixer] [DISABLED]
dev.hdaa.0.nid23_original: 0x400000f0 as=15 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid23_config: 0x400000f0 as=15 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid23: pin: Line-out (None) [DISABLED]
          + [DISABLED] <- nid=12 [audio mixer] (selected)
          + <- nid=13 [audio mixer]
          + <- nid=14 [audio mixer] [DISABLED]
          + <- nid=15 [audio mixer] [DISABLED]
          + <- nid=38 [audio mixer] [DISABLED]
dev.hdaa.0.nid22_original: 0x400000f0 as=15 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid22_config: 0x400000f0 as=15 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid22: pin: Line-out (None) [DISABLED]
          + [DISABLED] <- nid=12 [audio mixer] (selected)
          + <- nid=13 [audio mixer]
          + <- nid=14 [audio mixer] [DISABLED]
          + <- nid=15 [audio mixer] [DISABLED]
          + <- nid=38 [audio mixer] [DISABLED]
dev.hdaa.0.nid21_original: 0x400000f0 as=15 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid21_config: 0x400000f0 as=15 seq=0 device=Line-out conn=None ctype=Unknown loc=0x00 color=Unknown misc=0
dev.hdaa.0.nid21: pin: Line-out (None) [DISABLED]
          + [DISABLED] <- nid=12 [audio mixer] (selected)
          + <- nid=13 [audio mixer]
          + <- nid=14 [audio mixer] [DISABLED]
          + <- nid=15 [audio mixer] [DISABLED]
          + <- nid=38 [audio mixer] [DISABLED]
dev.hdaa.0.nid20_original: 0x01214030 as=3 seq=0 device=Headphones conn=Jack ctype=1/8 loc=Rear color=Green misc=0
dev.hdaa.0.nid20_config: 0x01214030 as=3 seq=0 device=Headphones conn=Jack ctype=1/8 loc=Rear color=Green misc=0
dev.hdaa.0.nid20: pin: Headphones (Green Jack)
          + [DISABLED] <- nid=12 [audio mixer]
          + <- nid=13 [audio mixer] (selected)
          + [DISABLED] <- nid=14 [audio mixer] [DISABLED]
          + [DISABLED] <- nid=15 [audio mixer] [DISABLED]
          + [DISABLED] <- nid=38 [audio mixer] [DISABLED]
dev.hdaa.0.nid19: vendor widget [DISABLED]
dev.hdaa.0.nid18: vendor widget [DISABLED]
dev.hdaa.0.nid17: vendor widget [DISABLED]
dev.hdaa.0.nid16: vendor widget [DISABLED]
dev.hdaa.0.nid15: audio mixer [DISABLED]
          + [DISABLED] <- nid=5 [audio output] [DISABLED]
          + [DISABLED] <- nid=11 [audio mixer]
dev.hdaa.0.nid14: audio mixer [DISABLED]
          + [DISABLED] <- nid=4 [audio output] [DISABLED]
          + [DISABLED] <- nid=11 [audio mixer]
dev.hdaa.0.nid13: audio mixer
          + <- nid=3 [audio output]
          + <- nid=11 [audio mixer]
dev.hdaa.0.nid12: audio mixer
          + <- nid=2 [audio output]
          + <- nid=11 [audio mixer]
dev.hdaa.0.nid11: audio mixer
          + [DISABLED] <- nid=24 [pin: Speaker (Fixed)]
          + [DISABLED] <- nid=25 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=26 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=27 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=28 [pin: Line-out (None)] [DISABLED]
          + <- nid=29 [beep widget]
          + [DISABLED] <- nid=20 [pin: Headphones (Green Jack)]
          + [DISABLED] <- nid=21 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=22 [pin: Line-out (None)] [DISABLED]
          + [DISABLED] <- nid=23 [pin: Line-out (None)] [DISABLED]
dev.hdaa.0.nid10: audio input [DISABLED]
          + [DISABLED] <- nid=31 [pin: Line-out (None)] [DISABLED]
dev.hdaa.0.nid9: audio input [DISABLED]
          + [DISABLED] <- nid=34 [audio mixer] [DISABLED]
dev.hdaa.0.nid8: audio input [DISABLED]
          + [DISABLED] <- nid=35 [audio mixer] [DISABLED]
dev.hdaa.0.nid7: audio input [DISABLED]
          + [DISABLED] <- nid=36 [audio mixer] [DISABLED]
dev.hdaa.0.nid6: audio output [DISABLED]
dev.hdaa.0.nid5: audio output [DISABLED]
dev.hdaa.0.nid4: audio output [DISABLED]
dev.hdaa.0.nid3: audio output
dev.hdaa.0.nid2: audio output
dev.hdaa.0.%location: nid=1

Thanks!
 
Yes, that's the first thing I tried, but I only saw changing the default output device in DSBmixer, and nothing else. There is still no sound.

Added:

I just plugged in a usb sound card and the sysсtl immediately switched to default unit 2 and I am getting sound through that device.

Code:
cat /dev/sndstat
Installed devices:
pcm0: <Realtek ALC889A (Internal Analog Speaker)> (play)
pcm1: <Realtek ALC889A (Rear Analog Headphones)> (play)
pcm2: <USB audio> (play/rec) default
No devices installed from userspace.
 
Little update. I added hint.hdaa.0.config="ovref" to /boot/device.hints and the built-in speaker worked! I'm confused. Obviously, this option controls power through the chip's GPIO pins, and started the output power amplifier, but the headphone output still did not work.
 
I guess same trick doesn't work for headphones.
Not sure how you check sound output. In my case switching output between speakers and headphones isn't immediate for apps. Firefox use proper device after some time and after restarting it. Musikcube is much faster.
 
Well, I solved the problem by hardware, after a little reverse engineering of the sound card. On the sound card, near the ALC885 was a chip, marked as ADW. This is a click-pop suppressor, etc., very similar to the MAX9890. It's controlled by the logic level from the audio chip. I used an oscilloscope to be sure that the audio signal from the sound chip comes to the input of this chip, and its output through capacitors is connected to the headphone jack

Unfortunately, I could not cut the wire coming from the audio chip, because it goes somewhere in the deep layers. Then I simply removed this chip, connecting its inputs and outputs. Now the ALC885 chip is connected like in 99% of any other sound devices.

I tested outputs switching by switching the main device in the DSBmixer. After switching, the mixer suggested restarting the Pulseaudio service. After that, and after the audio program (Audacious) was restarted, the default audio device was switched.
 

Attachments

  • photo_2023-06-18_20-23-51.jpg
    photo_2023-06-18_20-23-51.jpg
    104.3 KB · Views: 48
  • photo_2023-06-18_20-23-53.jpg
    photo_2023-06-18_20-23-53.jpg
    91.8 KB · Views: 53
Back
Top