xref: /freebsd/share/man/man4/snd_hda.4 (revision 3c6e15bceeab4470243c60c9a4b5b9cafca9abaa)
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 November 8, 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.
60Only audio functions are supported by
61.Nm .
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 the 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.
79The assignment of audio inputs and outputs may be tuned with
80.Xr device.hints 5 .
81The driver's verbose boot messages provide a lot of information about
82the operation of the driver and present audio setup.
83.Pp
84The default audio device may be tuned by setting the
85.Ar hw.snd.default_unit
86sysctl, as described in
87.Xr sound 4 ,
88or explicitly specified in application settings.
89.Ss Boot-time Configuration
90The following variables are available at boot-time through the
91.Xr device.hints 5
92file:
93.Bl -tag -width ".Va hint.hdac.%d.config"-offset indent
94.It Va hint.hdac.%d.config
95Configures a range of possible options.
96Possible values are:
97.Dq Li dmapos ,
98.Dq Li eapdinv ,
99.Dq Li gpio0 ,
100.Dq Li gpio1 ,
101.Dq Li gpio2 ,
102.Dq Li gpio3 ,
103.Dq Li gpio4 ,
104.Dq Li gpio5 ,
105.Dq Li gpio6 ,
106.Dq Li gpio7 ,
107.Dq Li gpioflush ,
108.Dq Li ivref ,
109.Dq Li ivref50 ,
110.Dq Li ivref80 ,
111.Dq Li ivref100 ,
112.Dq Li fixedrate ,
113.Dq Li forcestereo ,
114.Dq Li ovref ,
115.Dq Li ovref50 ,
116.Dq Li ovref80 ,
117.Dq Li ovref100 ,
118.Dq Li senseinv ,
119.Dq Li softpcmvol ,
120and
121.Dq Li vref .
122An option prefixed with
123.Dq Li no ,
124such as
125.Dq Li nofixedrate ,
126will do the opposite and takes precedence.
127Options can be separated by whitespace and commas.
128.Dq Li GPIO Ns s
129are a codec's General Purpose I/O pins which system integrators sometimes
130use to control external muters, amplifiers and so on.
131If you have no sound, or sound volume is not adequate, you may have to
132experiment a bit with the GPIO setup to find the optimal setup for your
133system.
134The
135.Dq Li ivref Ns Ar X
136and
137.Dq Li ovref Ns Ar X
138options control the voltage used to power external microphones.
139.It Va hint.hdac.%d.msi
140Controls MSI (Message Signaled Interrupts) support.
141.It Va hint.hdac.%d.cad%d.nid%d.config
142Overrides codec pin configuration set by BIOS.
143May be specified as a 32-bit hexadecimal value with a leading
144.Dq 0x ,
145or as a set of space-separated
146.Dq Ar option Ns = Ns Ar value
147pairs.
148.El
149.Pp
150Pin configuration is the UAA driver's main source of information about codec
151usage.
152This information is usually provided by the codec manufacturer and tuned
153by system integrators for specific system requirements.
154The
155.Nm
156driver allows users to override it to fix integrator mistakes or to use the
157available codec in alternative ways (for example to get stereo output and 2
158inputs instead of a single 5.1 output).
159.Pp
160The following options are supported:
161.Bl -tag -width ".Va device=" -offset indent
162.It Va as
163Association number.
164Associations are used to group individual pins to form a complex multi-pin
165device.
166For example, to group 4 connectors for 7.1 output, or to treat several
167input connectors as sources for the same input device.
168Association numbers can be specified as numeric values from 0 to 15.
169A value of 0 means disabled pin.
170A value of 15 is a set of independent unassociated pins.
171Each association includes only pins of the same direction (in/out) and is
172detected atomically (all pins or none).
173A separate PCM audio device is created for every pair of input and
174output associations.
175.It Va seq
176Sequence number.
177A unique, per-association number used to order pins inside the
178particular association.
179Sequence numbers can be specified as numeric values from 0 to 15.
180.Pp
181The sequence number 15 has a special meaning for output associations.
182Output pins with this number and device type
183.Dq Ar Headphones
184will duplicate (with automatic mute if jack detection is supported) the
185first pin in that association.
186.It Va device
187Device type.
188Can be specified as a number from 0 to 15 or as a name:
189.Dq Li Line-out ,
190.Dq Li Speaker ,
191.Dq Li Headphones,
192.Dq Li CD ,
193.Dq Li SPDIF-out ,
194.Dq Li Digital-out ,
195.Dq Li Modem-line ,
196.Dq Li Modem-handset ,
197.Dq Li Line-in ,
198.Dq Li AUX ,
199.Dq Li Mic ,
200.Dq Li Telephony ,
201.Dq Li SPDIF-in ,
202.Dq Li Digital-in ,
203.Dq Li Res.E ,
204or
205.Dq Li Other .
206The device type also describes the pin direction (in/out).
207For example,
208.Dq Li CD
209always means an input pin, while
210.Dq Li Headphones
211always means an output.
212.It Va conn
213Connection type.
214Can be specified as a number from 0 to 3.
215The connection type can also be specified as one of the special names
216.Dq Li Jack ,
217.Dq Li None ,
218.Dq Li Fixed ,
219or
220.Dq Li Both .
221Pins with a connection type of
222.Dq Li None
223are disabled.
224.It Va ctype
225Connector physical type.
226Can be specified as a number from 0 to 15.
227This is a reference only value.
228It is ignored by the
229.Nm
230driver.
231.It Va color
232Connector color.
233Can be specified as a number from 0 to 15 or as one of the names
234.Dq Li Unknown ,
235.Dq Li Black ,
236.Dq Li Grey ,
237.Dq Li Blue ,
238.Dq Li Green ,
239.Dq Li Red ,
240.Dq Li Orange ,
241.Dq Li Yellow ,
242.Dq Li Purple ,
243.Dq Li Pink ,
244.Dq Li Res.A ,
245.Dq Li Res.B ,
246.Dq Li Res.C ,
247.Dq Li Res.D ,
248.Dq Li White ,
249or
250.Dq Li Other .
251This is a reference only value.
252It is ignored by the
253.Nm
254driver.
255.It Va loc
256Connector physical location.
257Can be specified as a number from 0 to 63.
258This is a reference only value.
259It is ignored by the
260.Nm
261driver.
262.It Va misc
263Misc bits.
264Can be specified as a number from 0 to 15.
265Bit 0 has a special meaning.  When set it means that jack detection is
266not implemented in hardware.
267.El
268.Ss Runtime Configuration
269The following
270.Xr sysctl 8
271variables are available in addition to those available to all
272.Xr sound 4
273devices:
274.Bl -tag -width ".Va dev.hdac.%d.polling" -offset indent
275.It Va dev.hdac.%d.polling
276Enables polling mode.
277In this mode the driver operates by querying the device state on timer
278ticks using
279.Xr callout 9
280instead of interrupts.
281Polling is disabled by default.
282Do not enable it unless you are facing weird interrupt problems or if the
283device cannot generate interrupts at all.
284.It Va dev.hdac.%d.polling_interval
285Controller/Jack Sense polling interval (1-1000 ms)
286.It Va dev.hdac.%d.pindump
287Setting this to a non-zero value dumps the current pin configuration, main
288capabilities and jack sense status to console and syslog.
289.El
290.Sh EXAMPLES
291Taking HP Compaq DX2300 with Realtek ALC888 HDA codec for example.
292This system has two audio connectors on a front side, three audio connectors
293on a rear side and one internal speaker.
294According to verbose driver output and the codec datasheet,
295this codec has five stereo DACs and two stereo ADCs, all of them are routable to
296any codec pin (external connector).
297All codec pins are reversible (could be configured either as input or output).
298.Pp
299So high codec uniformity and flexibility allow driver to configure it in many
300different ways, depending on requested pins usage decribed by pins configuration.
301Driver reports such default pin configuration when verbose messages enabled:
302.Bd -literal
303hdac0: nid 20 0x01014020 as  2 seq  0   Line-out  Jack jack 1 loc  1 color   Green misc 0
304hdac0: nid 21 0x99130110 as  1 seq  0    Speaker Fixed jack 3 loc 25 color Unknown misc 1
305hdac0: nid 22 0x411111f0 as 15 seq  0    Speaker  None jack 1 loc  1 color   Black misc 1
306hdac0: nid 23 0x411111f0 as 15 seq  0    Speaker  None jack 1 loc  1 color   Black misc 1
307hdac0: nid 24 0x01a19830 as  3 seq  0        Mic  Jack jack 1 loc  1 color    Pink misc 8
308hdac0: nid 25 0x02a1983f as  3 seq 15        Mic  Jack jack 1 loc  2 color    Pink misc 8
309hdac0: nid 26 0x01813031 as  3 seq  1    Line-in  Jack jack 1 loc  1 color    Blue misc 0
310hdac0: nid 27 0x0221401f as  1 seq 15 Headphones  Jack jack 1 loc  2 color   Green misc 0
311hdac0: nid 28 0x411111f0 as 15 seq  0    Speaker  None jack 1 loc  1 color   Black misc 1
312hdac0: nid 30 0x411111f0 as 15 seq  0    Speaker  None jack 1 loc  1 color   Black misc 1
313hdac0: nid 31 0x411111f0 as 15 seq  0    Speaker  None jack 1 loc  1 color   Black misc 1
314.Ed
315.Pp
316Here we can see, that the nodes with ID (nid) 25 and 27 are front pannel
317connectors (Jack, loc 2), nids 20, 24 and 26 are rear pannel connectors
318(Jack, loc 1) and nid 21 is a built-in speaker (Fixed, loc 25).
319Pins with nids 22, 23, 28, 30 and 31 will be disabled by driver due to "None"
320connectivity. So the pin count and description matches to connectors that
321we have.
322.Pp
323Using association (as) and sequence (seq) fields values pins are grouped into
3243 associations:
325.Bd -literal
326hdac0: Association 0 (1) out:
327hdac0:   Pin nid=21 seq=0
328hdac0:   Pin nid=27 seq=15
329hdac0: Association 1 (2) out:
330hdac0:   Pin nid=20 seq=0
331hdac0: Association 2 (3) in:
332hdac0:   Pin nid=24 seq=0
333hdac0:   Pin nid=26 seq=1
334hdac0:   Pin nid=25 seq=15
335.Ed
336.Pp
337Each
338.Xr pcm 4
339device uses two associations: one for playback and one for recording.
340Associations processed and assigned to
341.Xr pcm 4
342devices in increasing numerical order.
343In this case association #0 (1) will become
344.Li pcm0
345device playback, using the internal speakers and
346.Ar Headphones
347jack with speaker automute on the headphones jack connection.
348Association #1 (2) will become
349.Li pcm1
350playback, using the
351.Ar Line-out
352jack.
353Association #2 (3) will become
354.Li pcm0
355recording, using the external microphones and the
356.Ar Line-in
357jack.
358.Pp
359The
360.Nm
361driver provides extensive verbose messages to diagnose its operation
362logic and describe its current codec configuration.
363.Pp
364Using
365.Xr device.hints 5
366it is possible to modify the configuration of the existing pins,
367allowing a broad range of different audio setups.
368Here are a few examples of some setups possible for this particular
369hardware:
370.Ss Example 1
371Setting the
372.Xr device.hints 5
373options
374.Bd -literal
375hint.hdac.0.cad0.nid20.config="as=1"
376hint.hdac.0.cad0.nid21.config="as=2"
377.Ed
378.Pp
379will swap line-out and speaker functions.
380So the
381.Li pcm0
382device will play to the line-out and headphones jacks. Line-out will
383be muted on the headphones jack connection.
384Recording on
385.Li pcm0
386will go from two external microphones and line-in jacks.
387.Li pcm1
388playback will go to the internal speaker.
389.Pp
390.Ss Example 2
391Setting the
392.Xr device.hints 5
393options
394.Bd -literal
395hint.hdac.0.cad0.nid20.config="as=1 seq=15 device=Headphones"
396hint.hdac.0.cad0.nid27.config="as=2 seq=0"
397hint.hdac.0.cad0.nid25.config="as=4 seq=0"
398.Ed
399.Pp
400will split the headphones and one of the microphones to a separate device.
401The
402.Li pcm0
403device will play to the internal speaker and to the line-out jack, with
404speaker automute on the line-out jack connection.
405Recording on
406.Li pcm0
407will use input from one external microphone and the line-in jacks.
408The
409.Li pcm1
410device will be completely dedicated to a headset (headphones and mic)
411connected to the front connectors.
412.Pp
413.Ss Example 3
414Setting the
415.Xr device.hints 5
416options
417.Bd -literal
418hint.hdac.0.cad0.nid20.config="as=1 seq=0"
419hint.hdac.0.cad0.nid26.config="as=2 seq=0"
420hint.hdac.0.cad0.nid27.config="as=3 seq=0"
421hint.hdac.0.cad0.nid25.config="as=4 seq=0"
422hint.hdac.0.cad0.nid24.config="as=5 seq=0 device=Line-out"
423hint.hdac.0.cad0.nid21.config="as=6 seq=0"
424.Ed
425.Pp
426will give 4 independent devices:
427.Li pcm0
428.Pq line-out and line-in ,
429.Li pcm1
430.Pq headphones and mic ,
431.Li pcm2
432.Pq additional line-out via retasked rear mic jack ,
433and
434.Li pcm3
435.Pq internal speaker .
436.Pp
437.Ss Example 4
438Setting the
439.Xr device.hints 5
440options
441.Bd -literal
442hint.hdac.0.cad0.nid20.config="as=1 seq=0"
443hint.hdac.0.cad0.nid24.config="as=1 seq=1 device=Line-out"
444hint.hdac.0.cad0.nid26.config="as=1 seq=2 device=Line-out"
445hint.hdac.0.cad0.nid21.config="as=2 seq=0"
446.Ed
447.Pp
448will give 2 devices:
449.Li pcm0
450for 5.1 playback via 3 rear connectors (line-out and retasked
451mic and line-in) and headset (headphones and mic) at front connectors.
452.Li pcm1
453for internal speaker playback.
454On headphones connection rear connectors will be muted.
455.Sh HARDWARE
456The
457.Nm
458driver supports the following audio chipsets:
459.Pp
460.Bl -bullet -compact
461.It
462ATI SB450
463.It
464ATI SB600
465.It
466Intel 631x/632xESB
467.It
468Intel 82801F
469.It
470Intel 82801G
471.It
472Intel 82801H
473.It
474Intel 82801I
475.It
476nVidia MCP51
477.It
478nVidia MCP55
479.It
480nVidia MCP61A
481.It
482nVidia MCP61B
483.It
484nVidia MCP65A
485.It
486nVidia MCP65B
487.It
488nVidia MCP67A
489.It
490nVidia MCP67B
491.It
492SiS 966
493.It
494VIA VT8251/8237A
495.El
496.Pp
497Generic audio chipsets compatible with the Intel HDA specification should work,
498but have not been verified yet.
499The following codecs have been verified to work:
500.Pp
501.Bl -bullet -compact
502.It
503Analog Devices AD1981HD
504.It
505Analog Devices AD1983
506.It
507Analog Devices AD1984
508.It
509Analog Devices AD1986A
510.It
511Analog Devices AD1988
512.It
513Analog Devices AD1988B
514.It
515CMedia CMI9880
516.It
517Conexant Venice
518.It
519Conexant Waikiki
520.It
521Realtek ALC260
522.It
523Realtek ALC262
524.It
525Realtek ALC268
526.It
527Realtek ALC660
528.It
529Realtek ALC861
530.It
531Realtek ALC861VD
532.It
533Realtek ALC880
534.It
535Realtek ALC882
536.It
537Realtek ALC883
538.It
539Realtek ALC885
540.It
541Realtek ALC888
542.It
543Realtek ALC889
544.It
545Sigmatel STAC9205
546.It
547Sigmatel STAC9220
548.It
549Sigmatel STAC9220D / 9223D
550.It
551Sigmatel STAC9221
552.It
553Sigmatel STAC9221D
554.It
555Sigmatel STAC9227D
556.It
557Sigmatel STAC9227X
558.It
559Sigmatel STAC9228D
560.It
561Sigmatel STAC9228X
562.It
563Sigmatel STAC9229D
564.It
565Sigmatel STAC9229X
566.It
567Sigmatel STAC9230D
568.It
569Sigmatel STAC9230X
570.It
571Sigmatel STAC9271D
572.It
573Sigmatel STAC9872AK
574.It
575VIA VT1708
576.It
577VIA VT1709
578.El
579.Sh SEE ALSO
580.Xr sound 4 ,
581.Xr device.hints 5 ,
582.Xr loader.conf 5 ,
583.Xr sysctl 8
584.Sh HISTORY
585The
586.Nm
587device driver first appeared in
588.Fx 6.3 .
589.Sh AUTHORS
590.An -nosplit
591The
592.Nm
593driver was written by
594.An Stephane E. Potvin Aq sepotvin@videotron.ca ,
595.An Ariff Abdullah Aq ariff@FreeBSD.org
596and
597.An Alexander Motin Aq mav@FreeBSD.org .
598This manual page was written by
599.An Joel Dahl Aq joel@FreeBSD.org ,
600.An Alexander Motin Aq mav@FreeBSD.org
601and
602.An Giorgos Keramidas Aq keramida@FreeBSD.org .
603.Sh BUGS
604A few Hardware/OEM vendors tend to screw up BIOS settings, thus
605rendering the
606.Nm
607driver useless, which usually results in a state where the
608.Nm
609driver seems to attach and work, but without any sound.
610.Pp
611Due to OSS limitation multichannel (not multidevice) playback is not
612supported.
613