FedoraForum.org - Fedora Support Forums and Community
Results 1 to 2 of 2
  1. #1
    Join Date
    Feb 2008

    Make Micrphone work with Intel HD Audio (Harder Way)

    I didn't get my microphone and front panel speaker work for quite a long time on Fedora 12. My Intel S975XBX2 motherboard has in-build audio of HDA (High Definition Audio) standard. The audio codec is SigmaTel STAC9227, as shown when i run the command "cat /proc/asound/card0/codec#2". I read several forum posts in different websites, tried to remove pulseaudio related tools, compiled ALSA driver with hda-intel support as instructed at http://www.alsa-project.org/main/ind...dule-hda-intel. But nothing did work. I read somewhere, probably in Linux Kernel documentation for ALSA, that most microphone problems are just wrong connections of pins. I also read that HDA Analyzer from http://www.alsa-project.org/main/index.php/HDA_Analyzer can help fix this issue. So, i downloaded it; but when i did run it, the list of "Nodes" made me all more confused. After some failed attempts to search for alternatives in forum posts, i finally took the plunge and downloaded and read Intel High Defintion Audio Specification from http://www.intel.com/content/dam/doc...cification.pdf. Reading the specification landed me inside the audio controller and finally that "Pin" thing became clear.

    As per HDA specification, HD audio controller communicates with external devices like microphone, speaker, headphone through one or more codecs. Each codec communicates with those external devices through collection of "Pin". On the other hand. each codec communicates with audio controller through Audio In/Out Converter. These Converters and Pins , inside a codec, talk to each other using "Widgets" like Audio Selector(Multiplexer, Amplifier) or other Pins. All these converters, pins, widgets are generally termed as "Node". Hence, in HDA Analyzer GUI, all the items under card-0->codec-2 are shown as Nodes. So, when you hear sound in speaker, the signal flow is Controller->Audio Out Converter->Widget->Pin and when you record sound the signal flow is Pin->Widget->Audio In Converter->Controller.

    The list of nodes in my case were, -
    Node[0x02] to Node[0x05] - AUD_OUT (4)
    Node[0x06] - VENDOR
    Node[0x07] to Node[0x09] - AUD_IN (3)
    Node[0x0a] to Node[0x12] - PIN (9)
    Node[0x13] - VENDOR
    Node[0x14] - VENDOR
    Node[0x15] to Node[0x1d] - AUD_SEL (9)
    Node[0x1e] - AUD_OUT
    Node[0x1f] - VENDOR
    Node[0x20] - AUD_IN
    Node[0x21] to Node[0x22] - PIN (2)
    Node[0x23] - Beep
    Node[0x24] - VOL_KNB

    You can see visually how these nodes are connected to each other by clicking "Graph" button. As my first problem was with microphone, i looked at Audio In Converter or AUD_IN nodes. For example, take the first AUD_IN node, 0x07. It was connected to Audio Selector (AUD_SEL) 0x1b, as seen in "Connection List" parameter, which i saw when i clicked "Node[0x07] AUD_IN" from the tree view. Again, that "Node[0x1b] AUD_SEL" was connected to Audio Selector (AUD_SEL) 0x18. And "Node[0x18] AUD_SEL" was connected to Audio Selector (AUD_SEL) 0x15. That last AUD_SEL 0x15 has several "Pin Complex" or just Pins, in its connection list. So far the path of interconnection was, AUD_IN(0x07)->AUD_SEL(0x1b)->AUD_SEL(0x18)->AUD_SEL(0x15). Now, the first item of the connection list of last AUD_SEL 0x15 was "Pin Complex [0x0e]". This "Node[0x0e] Pin" was showing following "Config Default", -
    Jack Connection: Jack
    Jack type: Speaker
    Jack location: Ext
    Jack location2: Rear
    Jack Connection: 1/8
    Jack Color: Pink

    Now, from the technical specification of motherboard S975XBX2, i knew that Pink color hole at the bank panel was for "Mic In/Retasking Jack". Also, in the "Widget Control" of "Node[0x0e] Pin" the "Out" checkbox was ticked. That means that Pin or Mic In was enabled as Line Out not Line In. In other words, it was marked to play audio not to capture it. So, i removed the tick from "Out", instead ticked on "In" check box. Then i went back to "Node[0x15] AUD_SEL" and selected "Pin Complex [0x0e]" in the connection list. But nothing happened, no recording was there. Then i recallled (from some forum posts) that you may need to increase amplifier gain. So, i tried to increase value of the two sliders, present next to Val[0] and Val[1] in "Node[0x15] AUD_SEL"'s Node Editor window. But still the same. Then, i don't know why, but i went back to Node Editor Window of "Node[0x0e] Pin" and inside "Widget Control" pane, i set VREF to 50. And the microphone finally captured my voice, i was never so happy to hear my voice .

    To test the sound recording i used Jack audio server. First, i opened QjackCtl, started Jack server. Then opened the "Connections" window by clicking "Connect" button of QjackCtl interface. On that "Connections" window, i connected system->capture_1 to system->playback_1 and system->capture_2 to system->playback_2.
    With this setting i tried those above tweaking on HDA Analyzer and finally heard my loud voice.

    Then i experimented with several options shown therein and the front panel speaker also became alive along with front panel microphone.

    For panel speaker, i ticked on "Out" in "Widget Control" pane on the Node Editor window of "Node[0x0a] Pin", becasue its "Config Default" was showing that,
    Jack Connection: Jack
    Jack type: HP Out
    Jack location: Ext
    Jack location2: Front
    Jack Connection: 1/8
    Jack Color: Green

    And from S975XBX2 technical speification, i knew that front panel had "Line Out/Restasking Jack" hole in green color. But still the audio volume as not high. In the Node Editor of "Node[0x0a] Pin", it was shown to be connected with "Audio Output[0x03]". So, i went to Node Editor of "Node[0x03] AUD_OUT" and draw the sliders next to two "Mute" text to the end to give them 127 value. And then my ears felt the joy of loud drum beats

    To enable the front panel microphone, i didn't have to do much. The "Node[0x0b] Pin", the pin for front panel microphone, was correctly configured. When in "Node[0x15] AUD_SEL", i selected "Pin Complex [0x0b]" (which was actually default configuration in my machine), and raised the sliders next to Val[0] and Val[1] to 2, then the audio capture worked.

    But, the change of setting made through HDA Analyzer, does not maintain itself on reboot. Fortunately, HDA Analyzer, had "Exp" (Export) facility. But it didn't work initially for me. At the time of this writing, i found that /dev/shm/hda_Analyzer/hda_codec.py (downloaded by HDA Analyzer) file contains calls to set_vol_knb function at 2 places,( line 790 and line 834), but the containing class HDANode doesn't have any function of such name. May be the developers were working on some recent issues. I didn't think it would be wise to disturb them for such trivial things, and just commented out those two lines. Then "Exp" button worked. It showed the full script which can be run manually or automatically during boot to make the changes in the audio controller. But, the exported script only shows the difference between the present setting and last changed setting. So, if you open and close the Analyzer multiple times and try the export, you will not see the total difference of settings from the original default setting of the audio controller, as set by the controller or bios itself. The "Exp" generated script has two parts. The upper part is same for every export, it just accesses the /dev/snd/hwC0D2 file. The lower part contains the script to make the changes of settings. So, i made a blank file, copied the common upper part, then ran the Analyzer several times as i was experimenting with different options of the nodes. Whenever some settings worked, i just clicked "Exp" button, copied the lower part and appended it to that file. So, didn't have to worry if i had closed Analyzer.

    Finally, i copied that all containing file as /etc/hda_audio_setting.py, then opened up /etc/rc.d/rc.local file and appended the line "python /etc/hda_audio_setting.py". So, on next reboot, i didn't have to run HDA Analyzer again and i was a happy man

  2. #2
    Join Date
    Feb 2008

    Content of hda_audio_setting.py file

    PHP Code:
    #!/usr/bin/env python

    import os
    import struct
    from fcntl import ioctl

    def __ioctl_val
    # workaround for OverFlow bug in python 2.4
    if val 0x80000000:
        return -((

    IOCTL_PVERSION __ioctl_val(0x80044810)
    IOCTL_VERB_WRITE __ioctl_val(0xc0084811)

    def set(nidverbparam):
    verb = (nid << 24) | (verb << 8) | param

    FD os.open("/dev/snd/hwC0D2"os.O_RDONLY)
    info struct.pack('Ii64s80si64s'00''''0'')
    res ioctl(FDIOCTL_INFOinfo)
    name struct.unpack('Ii64s80si64s'res)[3]
    not name.startswith('HDA Codec'):
    raise IOError"unknown HDA hwdep interface"
    res ioctl(FDIOCTL_PVERSIONstruct.pack('I'0))
    version struct.unpack('I'res)
    version 0x00010000:    # 1.0.0
    raise IOError"unknown HDA hwdep version"

    # initialization sequence starts here...

    set(0x0b0x707,   0x21# 0x0b070721 (SET_PIN_WIDGET_CONTROL) | 0x0b => Pin - Front In - Pink
    set(0x0e0x707,   0x21# 0x0e070721 (SET_PIN_WIDGET_CONTROL) | 0x0e => Pin - Rear In - Pink 

    # 0x15 = Multiplexer Volume

    #For Rear Mic
    #set(0x15, 0x300, 0xa004) # 0x1503a004 (SET_AMP_GAIN_MUTE) 
    #set(0x15, 0x701,   0x00) # 0x15070100 (SET_CONNECT_SEL) | Connect to 0x0e - Rear In Pink
    #set(0x15, 0x300, 0x9004) # 0x15039004 (SET_AMP_GAIN_MUTE)

    #Front Front Mic
    set(0x150x3000xa002# 0x1503a002 (SET_AMP_GAIN_MUTE)
    set(0x150x701,   0x03# 0x15070103 (SET_CONNECT_SEL) | Connect to 0x0b - Front In Pink
    set(0x150x3000x9002# 0x15039002 (SET_AMP_GAIN_MUTE)

    #0x0d = Pin - Rear Out - Green
    # 0x02 = Audio Out/Converter - connected to 0x0d - Rear Out Pin
    set(0x020x3000xa07f# 0x0203a07f (SET_AMP_GAIN_MUTE)
    set(0x020x3000x907f# 0x0203907f (SET_AMP_GAIN_MUTE)

    #0x0a = Pin - Front Out - Green
    set(0x0a0x707,   0x41# 0x0a070741 (SET_PIN_WIDGET_CONTROL)

    # 0x03 = Audio Out/Converter - conencted to 0x0a - Front Out Pin
    set(0x030x3000xa07f# 0x0303a07f (SET_AMP_GAIN_MUTE)
    set(0x030x3000x907f# 0x0303907f (SET_AMP_GAIN_MUTE) 

Similar Threads

  1. Replies: 2
    Last Post: 19th April 2010, 12:23 AM
  2. Replies: 4
    Last Post: 22nd August 2009, 09:31 AM
  3. Replies: 3
    Last Post: 31st October 2006, 11:31 AM
  4. can't make Intel 2200BG Wireless work on my dell latitude d600
    By pabloguevara in forum Hardware & Laptops
    Replies: 9
    Last Post: 24th January 2006, 06:27 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts