# Problem with mic on Realtek ALC256



## drr (Dec 11, 2021)

I have installed FreeBSD 13 on my Optiplex 7080 mini tower, with KDE/Plasma desktop. Sound output works fine through the internal speaker, headphone and HDMI. I am able to switch these outputs with the plasma pulse audio volume controller. Connecting a headphone to the front audio port switches output from internal speaker to headphones automatically, as expected.

However, I am yet to get a mic working on this machine, in FreeBSD. Headphone mic used to work fine with ubuntu that came preinstalled with this machine, hence, I believe that the hardware is alright.

I have listed the outputs of some commands that I have come across from the Handbook and the forums, while I was researching for a solution.


```
% cat /dev/sndstat

Installed devices:
pcm0: <Realtek ALC256 (Analog 2.0+HP)> (play) default
pcm1: <Realtek ALC256 (Rear Analog Line-out)> (play)
pcm2: <Intel Kaby Lake (HDMI/DP 8ch)> (play)
No devices installed from userspace.
```


```
% dmesg | grep hda*

hdac0: <Intel Comet Lake-H HDA Controller> mem 0x91330000-0x91333fff,0x91000000-0x910fffff at device 31.3 on pci0
hdacc0: <Realtek ALC256 HDA CODEC> at cad 0 on hdac0
hdaa0: <Realtek ALC256 Audio Function Group> at nid 1 on hdacc0
pcm0: <Realtek ALC256 (Analog 2.0+HP)> at nid 20,33 on hdaa0
pcm1: <Realtek ALC256 (Rear Analog Line-out)> at nid 27 on hdaa0
hdacc1: <Intel Kaby Lake HDA CODEC> at cad 2 on hdac0
hdaa1: <Intel Kaby Lake Audio Function Group> at nid 1 on hdacc1
pcm2: <Intel Kaby Lake (HDMI/DP 8ch)> at nid 3 on hdaa1
```

The internal speaker and headphone work through pcm0. The front audio port uses a 4-pin jack, for headphone and mic.

Could anyone please help me to get the mic working? Please advise me on what additional information is required to investigate the issue. Thanks in advance.


----------



## drr (Dec 24, 2021)

I have got some help on this issue on the freebsd IRC channel and it looks like my audio chip may not be supported yet.

I have also found out that while mic works on ubuntu, it does not work on pop-os, which is based on ubuntu. I think ubuntu must be using a patch as this machine came preinstalled with ubuntu.

Is there a way to fund out if ubuntu has a specific patch for this audio chip and use that information in device hints or similar configuration to get mic working in FreeBSD?


----------



## drr (Dec 24, 2021)

I have pasted the output of `sysctl dev.hdaa` at the link below, in case anyone finds any clues in it.






						Paste.ee
					

A free, easy to use Pastebin.



					paste.ee


----------



## DenisVS (Dec 25, 2021)

Maybe here you can find the right way to solve?


----------



## drr (Dec 26, 2021)

DenisVS said:


> Maybe here you can find the right way to solve?


Thanks. I will try this.

In the meantime, as an interim solution, I bought a cheap USB audio adapter that gets detected as 'KTMicro KT USB Audio'. The headphone and mic are working OK on this adapter, if it is plugged in at the time of booting the machine. In order to get mic working in Firefox, I have to run `mixer mic 100`, as the pulse audio control in my KDE/Plasma desktop does not seem to adjust mic volume at the moment.


----------



## raubkatzenbaby (May 6, 2022)

Hi drr and everyone, I'm not sure if you guys are still looking for a solution for this issue, but if anyone frequents this question again, I have been researching this issue this week because my LG Gram 17 had neither output nor input devices detected or working on Linux Mint and thank God and all the amazing people who worked on it, I managed to find a solution for my LG Gram with ALC256 as well. I made a video here with the steps in the video's description: 



_View: https://www.youtube.com/watch?v=Vz6jDUyn7S0_


I'm not sure if this solution is cross-distro and will work with you as it did on my Mint setup. I'm just sharing and feel free to remove my reply if it is irrelevant.
If you don't want to watch the video, here is a step by step guide (at your own risk!):

*Step 1 - Remove (backup) the old SOF drivers from your system:*
`sudo mv /lib/firmware/intel/sof* ~/Desktop/old-sof-backup
sudo mv /usr/local/bin/sof-* ~/Desktop/old-sof-backup`

*Step 2 - Download and install the newer drivers from the SOF Project Github repo:*
Link: https://github.com/thesofproject/sof-bin

Open the directory for your desired SOF version in terminal, let's assume v2.1.1.
`sudo rsync -a sof*v2.1.1 /lib/firmware/intel/
sudo ln -s sof-v2.1.1 /lib/firmware/intel/sof
sudo ln -s sof-tplg-v2.1.1 /lib/firmware/intel/sof-tplg
sudo rsync tools-v2.1.1/* /usr/local/bin`

(If you don't want to use symbolic links, refer to the repository for instructions on how to install the drivers without symbolic links)

*Step 3 - Download and install the fixes/patches from the following SOF Project Github repo:*
Link: https://github.com/thesofproject/alsa-ucm-conf/tree/sof_ucm1

(Remove the old _"/usr/share/alsa/ucm"_ directory and replace it with the newly downloaded one from the repo)
`sudo rm -r /usr/share/alsa/ucm
sudo mv ./ucm /usr/share/alsa`

*Step 4 - REBOOT*
After you reboot, all your speakers, microphones and everything will show up and will be working. HOWEVER, the microphone input and speakers volume will be lower than usual. Step 5-6 are the fix for this.

*Step 5 - Raise the input/output volume using ALSAMIXER (after rebooting!)*
a) Open alsamixer in terminal.
b) Press F5 to show all devices.
c) Raise everything (or what you need) to the maximum value possible.

*Step 6 - Save the ALSAMIXER settings permanently for each reboot*
(we use the first "store" command once to store the settings in the designated file, then each time you reboot, the "restore" command will restore the settings from this file)

a) alsactl --file ~/.config/asound.state store
b) Set the command "alsactl --file ~/.config/asound.state restore" to run automatically on each startup so that the stored alsamixer settings in step 6(a) are always restored.

Cheers to the lads here: https://bbs.archlinux.org/viewtopic.php?id=249900&p=4


----------



## bsduck (May 10, 2022)

raubkatzenbaby said:


> I'm not sure if this solution is cross-distro and will work with you as it did on my Mint setup. I'm just sharing and feel free to remove my reply if it is irrelevant.


Thank you for caring but your solution won't work: FreeBSD isn't a Linux distribution and doesn't use the Advanced Linux Sound Architecture (ALSA).


----------

