1.\" Copyright (c) 2006-2008 Joel Dahl <joel@FreeBSD.org> 2.\" Copyright (c) 2008 Alexander Motin <mav@FreeBSD.org> 3.\" All rights reserved. 4.\" 5.\" Redistribution and use in source and binary forms, with or without 6.\" modification, are permitted provided that the following conditions 7.\" are met: 8.\" 1. Redistributions of source code must retain the above copyright 9.\" notice, this list of conditions and the following disclaimer. 10.\" 2. Redistributions in binary form must reproduce the above copyright 11.\" notice, this list of conditions and the following disclaimer in the 12.\" documentation and/or other materials provided with the distribution. 13.\" 14.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND 15.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 16.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 17.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE 18.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 19.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 20.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 21.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 22.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 23.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 24.\" SUCH DAMAGE. 25.\" 26.\" $FreeBSD$ 27.\" 28.Dd October 24, 2008 29.Dt SND_HDA 4 30.Os 31.Sh NAME 32.Nm snd_hda 33.Nd "Intel High Definition Audio bridge device driver" 34.Sh SYNOPSIS 35To compile this driver into the kernel, place the following lines in your 36kernel configuration file: 37.Bd -ragged -offset indent 38.Cd "device sound" 39.Cd "device snd_hda" 40.Ed 41.Pp 42Alternatively, to load the driver as a module at boot time, place the 43following line in 44.Xr loader.conf 5 : 45.Bd -literal -offset indent 46snd_hda_load="YES" 47.Ed 48.Sh DESCRIPTION 49The High Definition (HD) Audio specification was developed by Intel as the 50logical successor of the old AC'97 specification and has several advantages, 51such as higher bandwidth which allows more channels and more detailed formats, 52support for several logical audio devices, and general purpose DMA channels. 53.Pp 54The 55.Nm 56driver is a HDA bus controller driver and HDA codecs audio functions bridge 57driver that allows the generic audio driver, 58.Xr sound 4 , 59to be used with this hardware. 60.Nm 61only supports audio functions. 62Modem, HDMI and other possible functions are not implemented. 63.Pp 64The 65.Nm 66driver supports hardware that conforms with revision 1.0 of the Intel High 67Definition Audio specification and tries to behave much like the Microsoft 68Universal Audio Architecture (UAA) draft (revision 0.7b) for handling audio 69devices. 70.Pp 71According to HDA and UAA specifications, depending on number of HDA buses 72and codecs present in system, their audio capabilities and BIOS provided 73configuration, the 74.Nm 75driver often provides several PCM audio devices. 76For example, one device for main rear 7.1 output and inputs, one device 77for independent headset connectors at front and one device for SPDIF or 78HDMI audio input/output. 79Usually that assignment may be widely tuned by using device hints. 80A lot of useful information about driver operation and present audio setup may 81be obtained from the driver verbose boot messages. 82.Pp 83You can select audio device to use by default with hw.snd.default_unit 84sysctl described in 85.Xr sound 4 86or explicitly specify it in appliation settings. 87.Ss Boot-time Configuration 88The following variables are available at boot-time through the 89.Xr device.hints 5 90file: 91.Bl -tag -width ".Va hint.hdac.%d.config"-offset indent 92.It Va hint.hdac.%d.config 93Configures a range of possible options. 94Possible values are: 95.Dq Li dmapos , 96.Dq Li eapdinv , 97.Dq Li gpio0 , 98.Dq Li gpio1 , 99.Dq Li gpio2 , 100.Dq Li gpio3 , 101.Dq Li gpio4 , 102.Dq Li gpio5 , 103.Dq Li gpio6 , 104.Dq Li gpio7 , 105.Dq Li gpioflush , 106.Dq Li ivref , 107.Dq Li ivref50 , 108.Dq Li ivref80 , 109.Dq Li ivref100 , 110.Dq Li fixedrate , 111.Dq Li forcestereo , 112.Dq Li ovref , 113.Dq Li ovref50 , 114.Dq Li ovref80 , 115.Dq Li ovref100 , 116.Dq Li senseinv , 117.Dq Li softpcmvol , 118and 119.Dq Li vref . 120An option prefixed with 121.Dq Li no , 122such as 123.Dq Li nofixedrate , 124will do the opposite and takes precedence. 125Options can be separated by whitespace and commas. 126GPIO is a codecs General Purpose I/O pins which system integrators sometimes 127use to control external muters, amplifiers and so on. 128If you have no sound or sound volume is not adequate you may need to find a 129GPIO combination required for your system. 130ivrefX/ovrefX options controls voltage used to power external microphones 131and so on. 132.It Va hint.hdac.%d.msi 133Controls MSI (Message Signaled Interrupts) support. 134.It Va hint.hdac.%d.cad%d.nid%d.config 135Overrides codec pin configuration set by BIOS. 136May be specified as a 32bit HEX value with a leading "0x" or as a set of 137space separated "option=value" pairs. 138.El 139.Pp 140Pin configuration is the UAA driver's main source of information about codec 141usage. 142This information is usually provided by the codec manufacturer and tuned 143by system integrators for specific system requirements. 144The 145.Nm 146driver allows users to override it to fix integrator mistakes or to use codec 147in alternative ways, for example, to get stereo output and 2 inputs 148instead of a single 5.1 output. 149Configuration includes the following options: 150.Bl -tag -width ".Va device=" -offset indent 151.It Va as 152Association number. 153Associations are used to group individual pins to form a complex multipin 154device. 155For example, to group 4 connectors for 7.1 output or to treat several 156input connectors as sources for the same input device. 157Can be specified as number from 0 to 15. 158Association number 0 means disabled pin, number 15 is a set of independent 159unassociated pins. 160Each association includes only pins of the same direction (in/out) and 161detected atomically - all pins or none. 162For every pair of input+output associations in order of their numeration 163separate PCM audio device is created. 164.It Va seq 165Sequence number. 166This unique inside every association number used to order pins inside 167association. 168Can be specified as a number from 0 to 15. 169Sequence number 15 for output associations has also special meaning. 170Output pin with sequence number 15 and device type Headhones will duplicate 171(with automatic mute if jack detection is supported) the first pin in that 172association. 173.It Va device 174Device type. 175Can be specified as a number from 0 to 15 or as a name: 176.Dq Li Line-out , 177.Dq Li Speaker , 178.Dq Li Headphones, 179.Dq Li CD , 180.Dq Li SPDIF-out , 181.Dq Li Digital-out , 182.Dq Li Modem-line , 183.Dq Li Modem-handset , 184.Dq Li Line-in , 185.Dq Li AUX , 186.Dq Li Mic , 187.Dq Li Telephony , 188.Dq Li SPDIF-in , 189.Dq Li Digital-in , 190.Dq Li Res.E , 191or 192.Dq Li Other . 193The device type also describes the pin direction (in/out). 194For example, 195.Dq Li CD 196always means input pin, while 197.Dq Li Headphones 198always means output. 199.It Va conn 200Connection type. 201Can be specified as a number from 0 to 3 or as a name: 202.Dq Li Jack , 203.Dq Li None , 204.Dq Li Fixed , 205or 206.Dq Li Both . 207Pins with 208.Dq Li None 209connection type are disabled. 210.It Va ctype 211Connector physical type. 212Can be specified as a number from 0 to 15. 213This is a reference only value which is ignored by the driver. 214.It Va color 215Connector color. 216Can be specified as a number from 0 to 15 or as a name: 217.Dq Li Unknown , 218.Dq Li Black , 219.Dq Li Grey , 220.Dq Li Blue , 221.Dq Li Green , 222.Dq Li Red , 223.Dq Li Orange , 224.Dq Li Yellow , 225.Dq Li Purple , 226.Dq Li Pink , 227.Dq Li Res.A , 228.Dq Li Res.B , 229.Dq Li Res.C , 230.Dq Li Res.D , 231.Dq Li White , 232or 233.Dq Li Other . 234This is a reference only value which is ignored by the driver. 235.It Va loc 236Connector physical location. 237Can be specified as a number from 0 to 63. 238This is a reference only value which is ignored by the driver. 239.It Va misc 240Misc bits. 241Can be specified as a number from 0 to 15. 242Bit 0, if set, tells that jack detection on this pin supported by the codec 243is not implemented in hardware. 244.El 245.Ss Runtime Configuration 246The following 247.Xr sysctl 8 248variables are available in addition to those available to all 249.Xr sound 4 250devices: 251.Bl -tag -width ".Va dev.hdac.%d.polling" -offset indent 252.It Va dev.hdac.%d.polling 253Enables polling mode, where the driver operates by querying the device 254state on timer ticks using 255.Xr callout 9 256instead of interrupts. 257Polling is disabled by default. 258Do not enable it unless you are facing weird interrupt problems or if the 259device cannot generate interrupts at all. 260.It Va dev.hdac.%d.polling_interval 261Controller/Jack Sense polling interval (1-1000 ms) 262.It Va dev.hdac.%d.pindump 263Setting this to a non-zero value dumps the current pin configuration, main 264capabilities and jack sense status to console and syslog. 265.El 266.Sh EXAMPLES 267Taking HP Compaq DX2300 with Realtek ALC888 HDA codec for example. It has two 268audio connectors on a front side, three audio connectors on a rear side and one 269internal speaker. Codec has five stereo DACs and two ADCs, all are routable to 270any pin. All codec pins are reversible. 271.Pp 272Driver reports such default pin configuration when verbose messages enabled: 273.Bd -literal 274hdac0: nid 20 0x01014020 as 2 seq 0 Line-out Jack jack 1 loc 1 color Green misc 0 275hdac0: nid 21 0x99130110 as 1 seq 0 Speaker Fixed jack 3 loc 25 color Unknown misc 1 276hdac0: nid 22 0x411111f0 as 15 seq 0 Speaker None jack 1 loc 1 color Black misc 1 277hdac0: nid 23 0x411111f0 as 15 seq 0 Speaker None jack 1 loc 1 color Black misc 1 278hdac0: nid 24 0x01a19830 as 3 seq 0 Mic Jack jack 1 loc 1 color Pink misc 8 279hdac0: nid 25 0x02a1983f as 3 seq 15 Mic Jack jack 1 loc 2 color Pink misc 8 280hdac0: nid 26 0x01813031 as 3 seq 1 Line-in Jack jack 1 loc 1 color Blue misc 0 281hdac0: nid 27 0x0221401f as 1 seq 15 Headphones Jack jack 1 loc 2 color Green misc 0 282hdac0: nid 28 0x411111f0 as 15 seq 0 Speaker None jack 1 loc 1 color Black misc 1 283hdac0: nid 30 0x411111f0 as 15 seq 0 Speaker None jack 1 loc 1 color Black misc 1 284hdac0: nid 31 0x411111f0 as 15 seq 0 Speaker None jack 1 loc 1 color Black misc 1 285.Ed 286.Pp 287Pins with nid 21,23,28,30 and 31 are disabled due to "None" connectivity, so 288total pin count matches - six. All present pins by default are grouped into 3 289associations: 290.Bd -literal 291hdac0: Association 0 (1) out: 292hdac0: Pin nid=21 seq=0 293hdac0: Pin nid=27 seq=15 294hdac0: Association 1 (2) out: 295hdac0: Pin nid=20 seq=0 296hdac0: Association 2 (3) in: 297hdac0: Pin nid=24 seq=0 298hdac0: Pin nid=26 seq=1 299hdac0: Pin nid=25 seq=15 300.Ed 301.Pp 302It means that by default pcm0 device will play to the internal speaker and 303headphones jack with speaker automute on headphones connection. 304Recording on pcm0 will go from two external microphones and line-in jack. 305pcm1 playback will go to the Line-out jack. 306.Ss Example 1 307Setting 308.Bd -literal 309hint.hdac.0.cad0.nid20.config="as=1" 310hint.hdac.0.cad0.nid21.config="as=2" 311.Ed 312.Pp 313will swap line-out and speaker functions. So pcm0 device will play to the 314line-out and headphones jacks with line-out automute on headphones connection. 315Recording on pcm0 will go from two external microphones and line-in jacks. 316pcm1 playback will go to the internal speaker. 317.Pp 318.Ss Example 2 319Setting 320.Bd -literal 321hint.hdac.0.cad0.nid20.config="as=1 seq=15 device=Headphones" 322hint.hdac.0.cad0.nid27.config="as=2 seq=0" 323hint.hdac.0.cad0.nid25.config="as=4 seq=0" 324.Ed 325.Pp 326will split headphones and one of mics to separate device. So pcm0 device will 327play to the internal speaker and line-out jack with speaker automute on 328line-out connection. Recording on pcm0 will go from one external microphone 329and line-in jacks. pcm1 will be completely dedicated to headset (headphones and 330mic) connected to the front connectors. 331.Pp 332.Ss Example 3 333Setting 334.Bd -literal 335hint.hdac.0.cad0.nid20.config="as=1 seq=0" 336hint.hdac.0.cad0.nid26.config="as=2 seq=0" 337hint.hdac.0.cad0.nid27.config="as=3 seq=0" 338hint.hdac.0.cad0.nid25.config="as=4 seq=0" 339hint.hdac.0.cad0.nid24.config="as=5 seq=0 device=Line-out" 340hint.hdac.0.cad0.nid21.config="as=6 seq=0" 341.Ed 342.Pp 343will give 4 independent devices: pcm0 - line-out + line-in, pcm1 - headphones 344+ mic, pcm2 - additional line-out via retasked rear mic jack, pcm3 - internal 345speaker. 346.Pp 347.Ss Example 4 348Setting 349.Bd -literal 350hint.hdac.0.cad0.nid20.config="as=1 seq=0" 351hint.hdac.0.cad0.nid24.config="as=1 seq=1 device=Line-out" 352hint.hdac.0.cad0.nid26.config="as=1 seq=2 device=Line-out" 353hint.hdac.0.cad0.nid21.config="as=2 seq=0" 354.Ed 355.Pp 356will give 2 devices: pcm0 - 5.1 playback via 3 rear (line-out and retasked 357mic and line-in) connectors and front headphones with rear connectors automute 358on headphones connection + front mic recording. pcm1 - internal speaker 359playback. 360.Sh HARDWARE 361The 362.Nm 363driver supports the following audio chipsets: 364.Pp 365.Bl -bullet -compact 366.It 367ATI SB450 368.It 369ATI SB600 370.It 371Intel 631x/632xESB 372.It 373Intel 82801F 374.It 375Intel 82801G 376.It 377Intel 82801H 378.It 379Intel 82801I 380.It 381nVidia MCP51 382.It 383nVidia MCP55 384.It 385nVidia MCP61A 386.It 387nVidia MCP61B 388.It 389nVidia MCP65A 390.It 391nVidia MCP65B 392.It 393nVidia MCP67A 394.It 395nVidia MCP67B 396.It 397SiS 966 398.It 399VIA VT8251/8237A 400.El 401.Pp 402Generic audio chipsets compatible with the Intel HDA specification should work, 403but have not been verified yet. 404The following codecs have been verified to work: 405.Pp 406.Bl -bullet -compact 407.It 408Analog Devices AD1981HD 409.It 410Analog Devices AD1983 411.It 412Analog Devices AD1984 413.It 414Analog Devices AD1986A 415.It 416Analog Devices AD1988 417.It 418Analog Devices AD1988B 419.It 420CMedia CMI9880 421.It 422Conexant Venice 423.It 424Conexant Waikiki 425.It 426Realtek ALC260 427.It 428Realtek ALC262 429.It 430Realtek ALC268 431.It 432Realtek ALC660 433.It 434Realtek ALC861 435.It 436Realtek ALC861VD 437.It 438Realtek ALC880 439.It 440Realtek ALC882 441.It 442Realtek ALC883 443.It 444Realtek ALC885 445.It 446Realtek ALC888 447.It 448Realtek ALC889 449.It 450Sigmatel STAC9205 451.It 452Sigmatel STAC9220 453.It 454Sigmatel STAC9220D / 9223D 455.It 456Sigmatel STAC9221 457.It 458Sigmatel STAC9221D 459.It 460Sigmatel STAC9227D 461.It 462Sigmatel STAC9227X 463.It 464Sigmatel STAC9228D 465.It 466Sigmatel STAC9228X 467.It 468Sigmatel STAC9229D 469.It 470Sigmatel STAC9229X 471.It 472Sigmatel STAC9230D 473.It 474Sigmatel STAC9230X 475.It 476Sigmatel STAC9271D 477.It 478Sigmatel STAC9872AK 479.It 480VIA VT1708 481.It 482VIA VT1709 483.El 484.Sh SEE ALSO 485.Xr sound 4 , 486.Xr device.hints 5 , 487.Xr loader.conf 5 , 488.Xr sysctl 8 489.Sh HISTORY 490The 491.Nm 492device driver first appeared in 493.Fx 6.3 . 494.Sh AUTHORS 495.An -nosplit 496The 497.Nm 498driver was written by 499.An Stephane E. Potvin Aq sepotvin@videotron.ca , 500.An Ariff Abdullah Aq ariff@FreeBSD.org 501and 502.An Alexander Motin Aq mav@FreeBSD.org . 503This manual page was written by 504.An Joel Dahl Aq joel@FreeBSD.org 505and 506.An Alexander Motin Aq mav@FreeBSD.org . 507.Sh BUGS 508A few Hardware/OEM vendors tend to screw up BIOS settings, thus 509rendering the 510.Nm 511driver useless, which usually results in a state where the 512.Nm 513driver seems to attach and work, but without any sound. 514.Pp 515Due to OSS limitation multichannel (not multidevice) playback is not 516supported.