aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 13:13:38 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 13:13:38 -0400
commitfc8a327db6c46de783b1a4276d846841b9abc24c (patch)
treebee512c142cccea93511debd98ef954581693727 /Documentation
parent92d15c2ccbb3e31a3fc71ad28fdb55e1319383c0 (diff)
parent24837e6f249a2c83667552e6871c1543b4a6b934 (diff)
Merge branch 'linus' of master.kernel.org:/pub/scm/linux/kernel/git/perex/alsa
* 'linus' of master.kernel.org:/pub/scm/linux/kernel/git/perex/alsa: (264 commits) [ALSA] version 1.0.15 [ALSA] Fix thinko in cs4231 mce down check [ALSA] sun-cs4231: improved waiting after MCE down [ALSA] sun-cs4231: use cs4231-regs.h [ALSA] This simplifies and fixes waiting loops of the mce_down() [ALSA] This patch adds support for a wavetable chip on [ALSA] This patch removes open_mutex from the ad1848-lib as [ALSA] fix bootup crash in snd_gus_interrupt() [ALSA] hda-codec - Fix SKU ID function for realtek codecs [ALSA] Support ASUS P701 eeepc [0x1043 0x82a1] support [ALSA] hda-codec - Add array terminator for dmic in STAC codec [ALSA] hdsp - Fix zero division [ALSA] usb-audio - Fix double comment [ALSA] hda-codec - Fix STAC922x volume knob control [ALSA] Changed Jaroslav Kysela's e-mail from perex@suse.cz to perex@perex.cz [ALSA] hda-codec - Fix for Fujitsu Lifebook C1410 [ALSA] mpu-401: remove MPU401_INFO_UART_ONLY flag [ALSA] mpu-401: do not require an ACK byte for the ENTER_UART command [ALSA] via82xx - Add DXS quirk for Shuttle AK31v2 [ALSA] hda-codec - Fix input_mux numbers for vaio stac92xx ...
Diffstat (limited to 'Documentation')
-rw-r--r--Documentation/sound/alsa/ALSA-Configuration.txt115
-rw-r--r--Documentation/sound/alsa/CMIPCI.txt17
-rw-r--r--Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl184
-rw-r--r--Documentation/sound/alsa/OSS-Emulation.txt7
-rw-r--r--Documentation/sound/alsa/hda_codec.txt49
-rw-r--r--Documentation/sound/alsa/powersave.txt41
6 files changed, 330 insertions, 83 deletions
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
index 241e26c4ff92..4b48c2e82c3c 100644
--- a/Documentation/sound/alsa/ALSA-Configuration.txt
+++ b/Documentation/sound/alsa/ALSA-Configuration.txt
@@ -365,13 +365,14 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
365 Module snd-cmipci 365 Module snd-cmipci
366 ----------------- 366 -----------------
367 367
368 Module for C-Media CMI8338 and 8738 PCI sound cards. 368 Module for C-Media CMI8338/8738/8768/8770 PCI sound cards.
369 369
370 mpu_port - 0x300,0x310,0x320,0x330 = legacy port, 370 mpu_port - port address of MIDI interface (8338 only):
371 1 = integrated PCI port, 371 0x300,0x310,0x320,0x330 = legacy port,
372 0 = disable (default) 372 0 = disable (default)
373 fm_port - 0x388 = legacy port, 373 fm_port - port address of OPL-3 FM synthesizer (8x38 only):
374 1 = integrated PCI port (default), 374 0x388 = legacy port,
375 1 = integrated PCI port (default on 8738),
375 0 = disable 376 0 = disable
376 soft_ac3 - Software-conversion of raw SPDIF packets (model 033 only) 377 soft_ac3 - Software-conversion of raw SPDIF packets (model 033 only)
377 (default = 1) 378 (default = 1)
@@ -768,6 +769,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
768 single_cmd - Use single immediate commands to communicate with 769 single_cmd - Use single immediate commands to communicate with
769 codecs (for debugging only) 770 codecs (for debugging only)
770 enable_msi - Enable Message Signaled Interrupt (MSI) (default = off) 771 enable_msi - Enable Message Signaled Interrupt (MSI) (default = off)
772 power_save - Automatic power-saving timtout (in second, 0 =
773 disable)
774 power_save_controller - Reset HD-audio controller in power-saving mode
775 (default = on)
771 776
772 This module supports one card and autoprobe. 777 This module supports one card and autoprobe.
773 778
@@ -828,6 +833,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
828 833
829 ALC268 834 ALC268
830 3stack 3-stack model 835 3stack 3-stack model
836 toshiba Toshiba A205
837 acer Acer laptops
831 auto auto-config reading BIOS (default) 838 auto auto-config reading BIOS (default)
832 839
833 ALC662 840 ALC662
@@ -842,7 +849,11 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
842 3stack-dig 3-jack with SPDIF I/O 849 3stack-dig 3-jack with SPDIF I/O
843 6stack-dig 6-jack digital with SPDIF I/O 850 6stack-dig 6-jack digital with SPDIF I/O
844 arima Arima W820Di1 851 arima Arima W820Di1
852 targa Targa T8, MSI-1049 T8
853 asus-a7j ASUS A7J
854 asus-a7m ASUS A7M
845 macpro MacPro support 855 macpro MacPro support
856 mbp3 Macbook Pro rev3
846 imac24 iMac 24'' with jack detection 857 imac24 iMac 24'' with jack detection
847 w2jc ASUS W2JC 858 w2jc ASUS W2JC
848 auto auto-config reading BIOS (default) 859 auto auto-config reading BIOS (default)
@@ -854,6 +865,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
854 3stack-6ch-dig 3-jack 6-channel with SPDIF I/O 865 3stack-6ch-dig 3-jack 6-channel with SPDIF I/O
855 6stack-dig-demo 6-jack digital for Intel demo board 866 6stack-dig-demo 6-jack digital for Intel demo board
856 acer Acer laptops (Travelmate 3012WTMi, Aspire 5600, etc) 867 acer Acer laptops (Travelmate 3012WTMi, Aspire 5600, etc)
868 acer-aspire Acer Aspire 9810
857 medion Medion Laptops 869 medion Medion Laptops
858 medion-md2 Medion MD2 870 medion-md2 Medion MD2
859 targa-dig Targa/MSI 871 targa-dig Targa/MSI
@@ -862,6 +874,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
862 lenovo-101e Lenovo 101E 874 lenovo-101e Lenovo 101E
863 lenovo-nb0763 Lenovo NB0763 875 lenovo-nb0763 Lenovo NB0763
864 lenovo-ms7195-dig Lenovo MS7195 876 lenovo-ms7195-dig Lenovo MS7195
877 haier-w66 Haier W66
865 6stack-hp HP machines with 6stack (Nettle boards) 878 6stack-hp HP machines with 6stack (Nettle boards)
866 3stack-hp HP machines with 3stack (Lucknow, Samba boards) 879 3stack-hp HP machines with 3stack (Lucknow, Samba boards)
867 auto auto-config reading BIOS (default) 880 auto auto-config reading BIOS (default)
@@ -885,6 +898,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
885 3stack-660-digout 3-jack with SPDIF OUT (for ALC660VD) 898 3stack-660-digout 3-jack with SPDIF OUT (for ALC660VD)
886 lenovo Lenovo 3000 C200 899 lenovo Lenovo 3000 C200
887 dallas Dallas laptops 900 dallas Dallas laptops
901 hp HP TX1000
888 auto auto-config reading BIOS (default) 902 auto auto-config reading BIOS (default)
889 903
890 CMI9880 904 CMI9880
@@ -920,6 +934,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
920 3stack 3-stack, shared surrounds 934 3stack 3-stack, shared surrounds
921 laptop 2-channel only (FSC V2060, Samsung M50) 935 laptop 2-channel only (FSC V2060, Samsung M50)
922 laptop-eapd 2-channel with EAPD (Samsung R65, ASUS A6J) 936 laptop-eapd 2-channel with EAPD (Samsung R65, ASUS A6J)
937 laptop-automute 2-channel with EAPD and HP-automute (Lenovo N100)
923 ultra 2-channel with EAPD (Samsung Ultra tablet PC) 938 ultra 2-channel with EAPD (Samsung Ultra tablet PC)
924 939
925 AD1988 940 AD1988
@@ -945,14 +960,30 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
945 can be adjusted. Appearing only when compiled with 960 can be adjusted. Appearing only when compiled with
946 $CONFIG_SND_DEBUG=y 961 $CONFIG_SND_DEBUG=y
947 962
948 STAC9200/9205/9254 963 STAC9200
949 ref Reference board 964 ref Reference board
965 dell-d21 Dell (unknown)
966 dell-d22 Dell (unknown)
967 dell-d23 Dell (unknown)
968 dell-m21 Dell Inspiron 630m, Dell Inspiron 640m
969 dell-m22 Dell Latitude D620, Dell Latitude D820
970 dell-m23 Dell XPS M1710, Dell Precision M90
971 dell-m24 Dell Latitude 120L
972 dell-m25 Dell Inspiron E1505n
973 dell-m26 Dell Inspiron 1501
974 dell-m27 Dell Inspiron E1705/9400
975 gateway Gateway laptops with EAPD control
976
977 STAC9205/9254
978 ref Reference board
979 dell-m42 Dell (unknown)
980 dell-m43 Dell Precision
981 dell-m44 Dell Inspiron
950 982
951 STAC9220/9221 983 STAC9220/9221
952 ref Reference board 984 ref Reference board
953 3stack D945 3stack 985 3stack D945 3stack
954 5stack D945 5stack + SPDIF 986 5stack D945 5stack + SPDIF
955 dell Dell XPS M1210
956 intel-mac-v1 Intel Mac Type 1 987 intel-mac-v1 Intel Mac Type 1
957 intel-mac-v2 Intel Mac Type 2 988 intel-mac-v2 Intel Mac Type 2
958 intel-mac-v3 Intel Mac Type 3 989 intel-mac-v3 Intel Mac Type 3
@@ -964,6 +995,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
964 macbook-pro Intel Mac Book Pro 2nd generation (eq. type 3) 995 macbook-pro Intel Mac Book Pro 2nd generation (eq. type 3)
965 imac-intel Intel iMac (eq. type 2) 996 imac-intel Intel iMac (eq. type 2)
966 imac-intel-20 Intel iMac (newer version) (eq. type 3) 997 imac-intel-20 Intel iMac (newer version) (eq. type 3)
998 dell-d81 Dell (unknown)
999 dell-d82 Dell (unknown)
1000 dell-m81 Dell (unknown)
1001 dell-m82 Dell XPS M1210
967 1002
968 STAC9202/9250/9251 1003 STAC9202/9250/9251
969 ref Reference board, base config 1004 ref Reference board, base config
@@ -975,6 +1010,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
975 ref Reference board 1010 ref Reference board
976 3stack D965 3stack 1011 3stack D965 3stack
977 5stack D965 5stack + SPDIF 1012 5stack D965 5stack + SPDIF
1013 dell-3stack Dell Dimension E520
978 1014
979 STAC9872 1015 STAC9872
980 vaio Setup for VAIO FE550G/SZ110 1016 vaio Setup for VAIO FE550G/SZ110
@@ -989,6 +1025,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
989 subsystem ID (output of "lspci -nv") to ALSA BTS or alsa-devel 1025 subsystem ID (output of "lspci -nv") to ALSA BTS or alsa-devel
990 ML (see the section "Links and Addresses"). 1026 ML (see the section "Links and Addresses").
991 1027
1028 power_save and power_save_controller options are for power-saving
1029 mode. See powersave.txt for details.
1030
992 Note 2: If you get click noises on output, try the module option 1031 Note 2: If you get click noises on output, try the module option
993 position_fix=1 or 2. position_fix=1 will use the SD_LPIB 1032 position_fix=1 or 2. position_fix=1 will use the SD_LPIB
994 register value without FIFO size correction as the current 1033 register value without FIFO size correction as the current
@@ -1349,7 +1388,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1349 port - port number or -1 (disable) 1388 port - port number or -1 (disable)
1350 irq - IRQ number or -1 (disable) 1389 irq - IRQ number or -1 (disable)
1351 pnp - PnP detection - 0 = disable, 1 = enable (default) 1390 pnp - PnP detection - 0 = disable, 1 = enable (default)
1352 uart_enter - Issue UART_ENTER command at open - bool, default = on
1353 1391
1354 This module supports multiple devices and PnP. 1392 This module supports multiple devices and PnP.
1355 1393
@@ -1630,6 +1668,21 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1630 1668
1631 The power-management is supported. 1669 The power-management is supported.
1632 1670
1671 Module snd-sc6000
1672 -----------------
1673
1674 Module for Gallant SC-6000 soundcard.
1675
1676 port - Port # (0x220 or 0x240)
1677 mss_port - MSS Port # (0x530 or 0xe80)
1678 irq - IRQ # (5,7,9,10,11)
1679 mpu_irq - MPU-401 IRQ # (5,7,9,10) ,0 - no MPU-401 irq
1680 dma - DMA # (1,3,0)
1681
1682 This module supports multiple cards.
1683
1684 This card is also known as Audio Excel DSP 16 or Zoltrix AV302.
1685
1633 Module snd-sgalaxy 1686 Module snd-sgalaxy
1634 ------------------ 1687 ------------------
1635 1688
@@ -1650,9 +1703,11 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1650 Module for ENSONIQ SoundScape PnP cards. 1703 Module for ENSONIQ SoundScape PnP cards.
1651 1704
1652 port - Port # (PnP setup) 1705 port - Port # (PnP setup)
1706 wss_port - WSS Port # (PnP setup)
1653 irq - IRQ # (PnP setup) 1707 irq - IRQ # (PnP setup)
1654 mpu_irq - MPU-401 IRQ # (PnP setup) 1708 mpu_irq - MPU-401 IRQ # (PnP setup)
1655 dma - DMA # (PnP setup) 1709 dma - DMA # (PnP setup)
1710 dma2 - 2nd DMA # (PnP setup, -1 to disable)
1656 1711
1657 This module supports multiple cards. ISA PnP must be enabled. 1712 This module supports multiple cards. ISA PnP must be enabled.
1658 You need sscape_ctl tool in alsa-tools package for loading 1713 You need sscape_ctl tool in alsa-tools package for loading
@@ -1697,8 +1752,52 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1697 dma2 - DMA2 # for CS4232 PCM interface. 1752 dma2 - DMA2 # for CS4232 PCM interface.
1698 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) 1753 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default)
1699 1754
1755 The below are options for wavefront_synth features:
1756 wf_raw - Assume that we need to boot the OS (default:no)
1757 If yes, then during driver loading, the state of the board is
1758 ignored, and we reset the board and load the firmware anyway.
1759 fx_raw - Assume that the FX process needs help (default:yes)
1760 If false, we'll leave the FX processor in whatever state it is
1761 when the driver is loaded. The default is to download the
1762 microprogram and associated coefficients to set it up for
1763 "default" operation, whatever that means.
1764 debug_default - Debug parameters for card initialization
1765 wait_usecs - How long to wait without sleeping, usecs
1766 (default:150)
1767 This magic number seems to give pretty optimal throughput
1768 based on my limited experimentation.
1769 If you want to play around with it and find a better value, be
1770 my guest. Remember, the idea is to get a number that causes us
1771 to just busy wait for as many WaveFront commands as possible,
1772 without coming up with a number so large that we hog the whole
1773 CPU.
1774 Specifically, with this number, out of about 134,000 status
1775 waits, only about 250 result in a sleep.
1776 sleep_interval - How long to sleep when waiting for reply
1777 (default: 100)
1778 sleep_tries - How many times to try sleeping during a wait
1779 (default: 50)
1780 ospath - Pathname to processed ICS2115 OS firmware
1781 (default:wavefront.os)
1782 The path name of the ISC2115 OS firmware. In the recent
1783 version, it's handled via firmware loader framework, so it
1784 must be installed in the proper path, typically,
1785 /lib/firmware.
1786 reset_time - How long to wait for a reset to take effect
1787 (default:2)
1788 ramcheck_time - How many seconds to wait for the RAM test
1789 (default:20)
1790 osrun_time - How many seconds to wait for the ICS2115 OS
1791 (default:10)
1792
1700 This module supports multiple cards and ISA PnP. 1793 This module supports multiple cards and ISA PnP.
1701 1794
1795 Note: the firmware file "wavefront.os" was located in the earlier
1796 version in /etc. Now it's loaded via firmware loader, and
1797 must be in the proper firmware path, such as /lib/firmware.
1798 Copy (or symlink) the file appropriately if you get an error
1799 regarding firmware downloading after upgrading the kernel.
1800
1702 Module snd-sonicvibes 1801 Module snd-sonicvibes
1703 --------------------- 1802 ---------------------
1704 1803
diff --git a/Documentation/sound/alsa/CMIPCI.txt b/Documentation/sound/alsa/CMIPCI.txt
index 4b2b15387056..16935c8561f7 100644
--- a/Documentation/sound/alsa/CMIPCI.txt
+++ b/Documentation/sound/alsa/CMIPCI.txt
@@ -1,5 +1,5 @@
1 Brief Notes on C-Media 8738/8338 Driver 1 Brief Notes on C-Media 8338/8738/8768/8770 Driver
2 ======================================= 2 =================================================
3 3
4 Takashi Iwai <tiwai@suse.de> 4 Takashi Iwai <tiwai@suse.de>
5 5
@@ -209,10 +209,13 @@ In addition to the standard SB mixer, CM8x38 provides more functions.
209MIDI CONTROLLER 209MIDI CONTROLLER
210--------------- 210---------------
211 211
212The MPU401-UART interface is disabled as default. You need to set 212With CMI8338 chips, the MPU401-UART interface is disabled as default.
213module option "mpu_port" with a valid I/O port address to enable the 213You need to set the module option "mpu_port" to a valid I/O port address
214MIDI support. The valid I/O ports are 0x300, 0x310, 0x320 and 0x330. 214to enable MIDI support. Valid I/O ports are 0x300, 0x310, 0x320 and
215Choose the value which doesn't conflict with other cards. 2150x330. Choose a value that doesn't conflict with other cards.
216
217With CMI8738 and newer chips, the MIDI interface is enabled by default
218and the driver automatically chooses a port address.
216 219
217There is _no_ hardware wavetable function on this chip (except for 220There is _no_ hardware wavetable function on this chip (except for
218OPL3 synth below). 221OPL3 synth below).
@@ -230,6 +233,8 @@ Set "fm_port" module option for more cards.
230The output quality of FM OPL/3 is, however, very weird. 233The output quality of FM OPL/3 is, however, very weird.
231I don't know why.. 234I don't know why..
232 235
236CMI8768 and newer chips do not have the FM synth.
237
233 238
234Joystick and Modem 239Joystick and Modem
235------------------ 240------------------
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
index 74d3a35b59bc..2c3fc3cb3b6b 100644
--- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
+++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
@@ -18,8 +18,8 @@
18 </affiliation> 18 </affiliation>
19 </author> 19 </author>
20 20
21 <date>November 17, 2005</date> 21 <date>September 10, 2007</date>
22 <edition>0.3.6</edition> 22 <edition>0.3.7</edition>
23 23
24 <abstract> 24 <abstract>
25 <para> 25 <para>
@@ -405,8 +405,9 @@
405 /* definition of the chip-specific record */ 405 /* definition of the chip-specific record */
406 struct mychip { 406 struct mychip {
407 struct snd_card *card; 407 struct snd_card *card;
408 // rest of implementation will be in the section 408 /* rest of implementation will be in the section
409 // "PCI Resource Managements" 409 * "PCI Resource Managements"
410 */
410 }; 411 };
411 412
412 /* chip-specific destructor 413 /* chip-specific destructor
@@ -414,7 +415,7 @@
414 */ 415 */
415 static int snd_mychip_free(struct mychip *chip) 416 static int snd_mychip_free(struct mychip *chip)
416 { 417 {
417 .... // will be implemented later... 418 .... /* will be implemented later... */
418 } 419 }
419 420
420 /* component-destructor 421 /* component-destructor
@@ -440,8 +441,9 @@
440 441
441 *rchip = NULL; 442 *rchip = NULL;
442 443
443 // check PCI availability here 444 /* check PCI availability here
444 // (see "PCI Resource Managements") 445 * (see "PCI Resource Managements")
446 */
445 .... 447 ....
446 448
447 /* allocate a chip-specific data with zero filled */ 449 /* allocate a chip-specific data with zero filled */
@@ -451,12 +453,13 @@
451 453
452 chip->card = card; 454 chip->card = card;
453 455
454 // rest of initialization here; will be implemented 456 /* rest of initialization here; will be implemented
455 // later, see "PCI Resource Managements" 457 * later, see "PCI Resource Managements"
458 */
456 .... 459 ....
457 460
458 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, 461 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
459 chip, &ops)) < 0) { 462 if (err < 0) {
460 snd_mychip_free(chip); 463 snd_mychip_free(chip);
461 return err; 464 return err;
462 } 465 }
@@ -490,7 +493,8 @@
490 return -ENOMEM; 493 return -ENOMEM;
491 494
492 /* (3) */ 495 /* (3) */
493 if ((err = snd_mychip_create(card, pci, &chip)) < 0) { 496 err = snd_mychip_create(card, pci, &chip);
497 if (err < 0) {
494 snd_card_free(card); 498 snd_card_free(card);
495 return err; 499 return err;
496 } 500 }
@@ -502,10 +506,11 @@
502 card->shortname, chip->ioport, chip->irq); 506 card->shortname, chip->ioport, chip->irq);
503 507
504 /* (5) */ 508 /* (5) */
505 .... // implemented later 509 .... /* implemented later */
506 510
507 /* (6) */ 511 /* (6) */
508 if ((err = snd_card_register(card)) < 0) { 512 err = snd_card_register(card);
513 if (err < 0) {
509 snd_card_free(card); 514 snd_card_free(card);
510 return err; 515 return err;
511 } 516 }
@@ -605,7 +610,8 @@
605<![CDATA[ 610<![CDATA[
606 struct mychip *chip; 611 struct mychip *chip;
607 .... 612 ....
608 if ((err = snd_mychip_create(card, pci, &chip)) < 0) { 613 err = snd_mychip_create(card, pci, &chip);
614 if (err < 0) {
609 snd_card_free(card); 615 snd_card_free(card);
610 return err; 616 return err;
611 } 617 }
@@ -666,7 +672,8 @@
666 <informalexample> 672 <informalexample>
667 <programlisting> 673 <programlisting>
668<![CDATA[ 674<![CDATA[
669 if ((err = snd_card_register(card)) < 0) { 675 err = snd_card_register(card);
676 if (err < 0) {
670 snd_card_free(card); 677 snd_card_free(card);
671 return err; 678 return err;
672 } 679 }
@@ -1091,7 +1098,7 @@
1091 static int snd_mychip_free(struct mychip *chip) 1098 static int snd_mychip_free(struct mychip *chip)
1092 { 1099 {
1093 /* disable hardware here if any */ 1100 /* disable hardware here if any */
1094 .... // (not implemented in this document) 1101 .... /* (not implemented in this document) */
1095 1102
1096 /* release the irq */ 1103 /* release the irq */
1097 if (chip->irq >= 0) 1104 if (chip->irq >= 0)
@@ -1119,7 +1126,8 @@
1119 *rchip = NULL; 1126 *rchip = NULL;
1120 1127
1121 /* initialize the PCI entry */ 1128 /* initialize the PCI entry */
1122 if ((err = pci_enable_device(pci)) < 0) 1129 err = pci_enable_device(pci);
1130 if (err < 0)
1123 return err; 1131 return err;
1124 /* check PCI availability (28bit DMA) */ 1132 /* check PCI availability (28bit DMA) */
1125 if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 || 1133 if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 ||
@@ -1141,7 +1149,8 @@
1141 chip->irq = -1; 1149 chip->irq = -1;
1142 1150
1143 /* (1) PCI resource allocation */ 1151 /* (1) PCI resource allocation */
1144 if ((err = pci_request_regions(pci, "My Chip")) < 0) { 1152 err = pci_request_regions(pci, "My Chip");
1153 if (err < 0) {
1145 kfree(chip); 1154 kfree(chip);
1146 pci_disable_device(pci); 1155 pci_disable_device(pci);
1147 return err; 1156 return err;
@@ -1156,10 +1165,10 @@
1156 chip->irq = pci->irq; 1165 chip->irq = pci->irq;
1157 1166
1158 /* (2) initialization of the chip hardware */ 1167 /* (2) initialization of the chip hardware */
1159 .... // (not implemented in this document) 1168 .... /* (not implemented in this document) */
1160 1169
1161 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, 1170 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
1162 chip, &ops)) < 0) { 1171 if (err < 0) {
1163 snd_mychip_free(chip); 1172 snd_mychip_free(chip);
1164 return err; 1173 return err;
1165 } 1174 }
@@ -1233,7 +1242,8 @@
1233 <informalexample> 1242 <informalexample>
1234 <programlisting> 1243 <programlisting>
1235<![CDATA[ 1244<![CDATA[
1236 if ((err = pci_enable_device(pci)) < 0) 1245 err = pci_enable_device(pci);
1246 if (err < 0)
1237 return err; 1247 return err;
1238 if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 || 1248 if (pci_set_dma_mask(pci, DMA_28BIT_MASK) < 0 ||
1239 pci_set_consistent_dma_mask(pci, DMA_28BIT_MASK) < 0) { 1249 pci_set_consistent_dma_mask(pci, DMA_28BIT_MASK) < 0) {
@@ -1294,7 +1304,8 @@
1294 <informalexample> 1304 <informalexample>
1295 <programlisting> 1305 <programlisting>
1296<![CDATA[ 1306<![CDATA[
1297 if ((err = pci_request_regions(pci, "My Chip")) < 0) { 1307 err = pci_request_regions(pci, "My Chip");
1308 if (err < 0) {
1298 kfree(chip); 1309 kfree(chip);
1299 pci_disable_device(pci); 1310 pci_disable_device(pci);
1300 return err; 1311 return err;
@@ -1322,7 +1333,7 @@
1322 <programlisting> 1333 <programlisting>
1323<![CDATA[ 1334<![CDATA[
1324 if (request_irq(pci->irq, snd_mychip_interrupt, 1335 if (request_irq(pci->irq, snd_mychip_interrupt,
1325 IRQF_DISABLED|IRQF_SHARED, "My Chip", chip)) { 1336 IRQF_SHARED, "My Chip", chip)) {
1326 printk(KERN_ERR "cannot grab irq %d\n", pci->irq); 1337 printk(KERN_ERR "cannot grab irq %d\n", pci->irq);
1327 snd_mychip_free(chip); 1338 snd_mychip_free(chip);
1328 return -EBUSY; 1339 return -EBUSY;
@@ -1773,7 +1784,8 @@
1773 struct snd_pcm_runtime *runtime = substream->runtime; 1784 struct snd_pcm_runtime *runtime = substream->runtime;
1774 1785
1775 runtime->hw = snd_mychip_playback_hw; 1786 runtime->hw = snd_mychip_playback_hw;
1776 // more hardware-initialization will be done here 1787 /* more hardware-initialization will be done here */
1788 ....
1777 return 0; 1789 return 0;
1778 } 1790 }
1779 1791
@@ -1781,7 +1793,8 @@
1781 static int snd_mychip_playback_close(struct snd_pcm_substream *substream) 1793 static int snd_mychip_playback_close(struct snd_pcm_substream *substream)
1782 { 1794 {
1783 struct mychip *chip = snd_pcm_substream_chip(substream); 1795 struct mychip *chip = snd_pcm_substream_chip(substream);
1784 // the hardware-specific codes will be here 1796 /* the hardware-specific codes will be here */
1797 ....
1785 return 0; 1798 return 0;
1786 1799
1787 } 1800 }
@@ -1793,7 +1806,8 @@
1793 struct snd_pcm_runtime *runtime = substream->runtime; 1806 struct snd_pcm_runtime *runtime = substream->runtime;
1794 1807
1795 runtime->hw = snd_mychip_capture_hw; 1808 runtime->hw = snd_mychip_capture_hw;
1796 // more hardware-initialization will be done here 1809 /* more hardware-initialization will be done here */
1810 ....
1797 return 0; 1811 return 0;
1798 } 1812 }
1799 1813
@@ -1801,7 +1815,8 @@
1801 static int snd_mychip_capture_close(struct snd_pcm_substream *substream) 1815 static int snd_mychip_capture_close(struct snd_pcm_substream *substream)
1802 { 1816 {
1803 struct mychip *chip = snd_pcm_substream_chip(substream); 1817 struct mychip *chip = snd_pcm_substream_chip(substream);
1804 // the hardware-specific codes will be here 1818 /* the hardware-specific codes will be here */
1819 ....
1805 return 0; 1820 return 0;
1806 1821
1807 } 1822 }
@@ -1844,10 +1859,12 @@
1844 { 1859 {
1845 switch (cmd) { 1860 switch (cmd) {
1846 case SNDRV_PCM_TRIGGER_START: 1861 case SNDRV_PCM_TRIGGER_START:
1847 // do something to start the PCM engine 1862 /* do something to start the PCM engine */
1863 ....
1848 break; 1864 break;
1849 case SNDRV_PCM_TRIGGER_STOP: 1865 case SNDRV_PCM_TRIGGER_STOP:
1850 // do something to stop the PCM engine 1866 /* do something to stop the PCM engine */
1867 ....
1851 break; 1868 break;
1852 default: 1869 default:
1853 return -EINVAL; 1870 return -EINVAL;
@@ -1900,8 +1917,8 @@
1900 struct snd_pcm *pcm; 1917 struct snd_pcm *pcm;
1901 int err; 1918 int err;
1902 1919
1903 if ((err = snd_pcm_new(chip->card, "My Chip", 0, 1, 1, 1920 err = snd_pcm_new(chip->card, "My Chip", 0, 1, 1, &pcm);
1904 &pcm)) < 0) 1921 if (err < 0)
1905 return err; 1922 return err;
1906 pcm->private_data = chip; 1923 pcm->private_data = chip;
1907 strcpy(pcm->name, "My Chip"); 1924 strcpy(pcm->name, "My Chip");
@@ -1939,8 +1956,8 @@
1939 struct snd_pcm *pcm; 1956 struct snd_pcm *pcm;
1940 int err; 1957 int err;
1941 1958
1942 if ((err = snd_pcm_new(chip->card, "My Chip", 0, 1, 1, 1959 err = snd_pcm_new(chip->card, "My Chip", 0, 1, 1, &pcm);
1943 &pcm)) < 0) 1960 if (err < 0)
1944 return err; 1961 return err;
1945 pcm->private_data = chip; 1962 pcm->private_data = chip;
1946 strcpy(pcm->name, "My Chip"); 1963 strcpy(pcm->name, "My Chip");
@@ -2097,7 +2114,7 @@
2097 struct mychip *chip = snd_pcm_chip(pcm); 2114 struct mychip *chip = snd_pcm_chip(pcm);
2098 /* free your own data */ 2115 /* free your own data */
2099 kfree(chip->my_private_pcm_data); 2116 kfree(chip->my_private_pcm_data);
2100 // do what you like else 2117 /* do what you like else */
2101 .... 2118 ....
2102 } 2119 }
2103 2120
@@ -2884,10 +2901,10 @@ struct _snd_pcm_runtime {
2884<![CDATA[ 2901<![CDATA[
2885 switch (cmd) { 2902 switch (cmd) {
2886 case SNDRV_PCM_TRIGGER_START: 2903 case SNDRV_PCM_TRIGGER_START:
2887 // do something to start the PCM engine 2904 /* do something to start the PCM engine */
2888 break; 2905 break;
2889 case SNDRV_PCM_TRIGGER_STOP: 2906 case SNDRV_PCM_TRIGGER_STOP:
2890 // do something to stop the PCM engine 2907 /* do something to stop the PCM engine */
2891 break; 2908 break;
2892 default: 2909 default:
2893 return -EINVAL; 2910 return -EINVAL;
@@ -3071,7 +3088,7 @@ struct _snd_pcm_runtime {
3071 spin_unlock(&chip->lock); 3088 spin_unlock(&chip->lock);
3072 snd_pcm_period_elapsed(chip->substream); 3089 snd_pcm_period_elapsed(chip->substream);
3073 spin_lock(&chip->lock); 3090 spin_lock(&chip->lock);
3074 // acknowledge the interrupt if necessary 3091 /* acknowledge the interrupt if necessary */
3075 } 3092 }
3076 .... 3093 ....
3077 spin_unlock(&chip->lock); 3094 spin_unlock(&chip->lock);
@@ -3134,7 +3151,7 @@ struct _snd_pcm_runtime {
3134 snd_pcm_period_elapsed(substream); 3151 snd_pcm_period_elapsed(substream);
3135 spin_lock(&chip->lock); 3152 spin_lock(&chip->lock);
3136 } 3153 }
3137 // acknowledge the interrupt if necessary 3154 /* acknowledge the interrupt if necessary */
3138 } 3155 }
3139 .... 3156 ....
3140 spin_unlock(&chip->lock); 3157 spin_unlock(&chip->lock);
@@ -3456,6 +3473,13 @@ struct _snd_pcm_runtime {
3456 </para> 3473 </para>
3457 3474
3458 <para> 3475 <para>
3476 The <structfield>tlv</structfield> field can be used to provide
3477 metadata about the control; see the
3478 <link linkend="control-interface-tlv">
3479 <citetitle>Metadata</citetitle></link> subsection.
3480 </para>
3481
3482 <para>
3459 The other three are 3483 The other three are
3460 <link linkend="control-interface-callbacks"><citetitle> 3484 <link linkend="control-interface-callbacks"><citetitle>
3461 callback functions</citetitle></link>. 3485 callback functions</citetitle></link>.
@@ -3604,7 +3628,7 @@ struct _snd_pcm_runtime {
3604 <title>Example of info callback</title> 3628 <title>Example of info callback</title>
3605 <programlisting> 3629 <programlisting>
3606<![CDATA[ 3630<![CDATA[
3607 static int snd_myctl_info(struct snd_kcontrol *kcontrol, 3631 static int snd_myctl_mono_info(struct snd_kcontrol *kcontrol,
3608 struct snd_ctl_elem_info *uinfo) 3632 struct snd_ctl_elem_info *uinfo)
3609 { 3633 {
3610 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 3634 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
@@ -3639,7 +3663,7 @@ struct _snd_pcm_runtime {
3639 <informalexample> 3663 <informalexample>
3640 <programlisting> 3664 <programlisting>
3641<![CDATA[ 3665<![CDATA[
3642 static int snd_myctl_info(struct snd_kcontrol *kcontrol, 3666 static int snd_myctl_enum_info(struct snd_kcontrol *kcontrol,
3643 struct snd_ctl_elem_info *uinfo) 3667 struct snd_ctl_elem_info *uinfo)
3644 { 3668 {
3645 static char *texts[4] = { 3669 static char *texts[4] = {
@@ -3658,6 +3682,16 @@ struct _snd_pcm_runtime {
3658 </programlisting> 3682 </programlisting>
3659 </informalexample> 3683 </informalexample>
3660 </para> 3684 </para>
3685
3686 <para>
3687 Some common info callbacks are prepared for easy use:
3688 <function>snd_ctl_boolean_mono_info()</function> and
3689 <function>snd_ctl_boolean_stereo_info()</function>.
3690 Obviously, the former is an info callback for a mono channel
3691 boolean item, just like <function>snd_myctl_mono_info</function>
3692 above, and the latter is for a stereo channel boolean item.
3693 </para>
3694
3661 </section> 3695 </section>
3662 3696
3663 <section id="control-interface-callbacks-get"> 3697 <section id="control-interface-callbacks-get">
@@ -3794,7 +3828,8 @@ struct _snd_pcm_runtime {
3794 <informalexample> 3828 <informalexample>
3795 <programlisting> 3829 <programlisting>
3796<![CDATA[ 3830<![CDATA[
3797 if ((err = snd_ctl_add(card, snd_ctl_new1(&my_control, chip))) < 0) 3831 err = snd_ctl_add(card, snd_ctl_new1(&my_control, chip));
3832 if (err < 0)
3798 return err; 3833 return err;
3799]]> 3834]]>
3800 </programlisting> 3835 </programlisting>
@@ -3843,6 +3878,56 @@ struct _snd_pcm_runtime {
3843 </para> 3878 </para>
3844 </section> 3879 </section>
3845 3880
3881 <section id="control-interface-tlv">
3882 <title>Metadata</title>
3883 <para>
3884 To provide information about the dB values of a mixer control, use
3885 on of the <constant>DECLARE_TLV_xxx</constant> macros from
3886 <filename>&lt;sound/tlv.h&gt;</filename> to define a variable
3887 containing this information, set the<structfield>tlv.p
3888 </structfield> field to point to this variable, and include the
3889 <constant>SNDRV_CTL_ELEM_ACCESS_TLV_READ</constant> flag in the
3890 <structfield>access</structfield> field; like this:
3891 <informalexample>
3892 <programlisting>
3893<![CDATA[
3894 static DECLARE_TLV_DB_SCALE(db_scale_my_control, -4050, 150, 0);
3895
3896 static struct snd_kcontrol_new my_control __devinitdata = {
3897 ...
3898 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE |
3899 SNDRV_CTL_ELEM_ACCESS_TLV_READ,
3900 ...
3901 .tlv.p = db_scale_my_control,
3902 };
3903]]>
3904 </programlisting>
3905 </informalexample>
3906 </para>
3907
3908 <para>
3909 The <function>DECLARE_TLV_DB_SCALE</function> macro defines
3910 information about a mixer control where each step in the control's
3911 value changes the dB value by a constant dB amount.
3912 The first parameter is the name of the variable to be defined.
3913 The second parameter is the minimum value, in units of 0.01 dB.
3914 The third parameter is the step size, in units of 0.01 dB.
3915 Set the fourth parameter to 1 if the minimum value actually mutes
3916 the control.
3917 </para>
3918
3919 <para>
3920 The <function>DECLARE_TLV_DB_LINEAR</function> macro defines
3921 information about a mixer control where the control's value affects
3922 the output linearly.
3923 The first parameter is the name of the variable to be defined.
3924 The second parameter is the minimum value, in units of 0.01 dB.
3925 The third parameter is the maximum value, in units of 0.01 dB.
3926 If the minimum value mutes the control, set the second parameter to
3927 <constant>TLV_DB_GAIN_MUTE</constant>.
3928 </para>
3929 </section>
3930
3846 </chapter> 3931 </chapter>
3847 3932
3848 3933
@@ -3880,7 +3965,7 @@ struct _snd_pcm_runtime {
3880 { 3965 {
3881 struct mychip *chip = ac97->private_data; 3966 struct mychip *chip = ac97->private_data;
3882 .... 3967 ....
3883 // read a register value here from the codec 3968 /* read a register value here from the codec */
3884 return the_register_value; 3969 return the_register_value;
3885 } 3970 }
3886 3971
@@ -3889,7 +3974,7 @@ struct _snd_pcm_runtime {
3889 { 3974 {
3890 struct mychip *chip = ac97->private_data; 3975 struct mychip *chip = ac97->private_data;
3891 .... 3976 ....
3892 // write the given register value to the codec 3977 /* write the given register value to the codec */
3893 } 3978 }
3894 3979
3895 static int snd_mychip_ac97(struct mychip *chip) 3980 static int snd_mychip_ac97(struct mychip *chip)
@@ -3902,7 +3987,8 @@ struct _snd_pcm_runtime {
3902 .read = snd_mychip_ac97_read, 3987 .read = snd_mychip_ac97_read,
3903 }; 3988 };
3904 3989
3905 if ((err = snd_ac97_bus(chip->card, 0, &ops, NULL, &bus)) < 0) 3990 err = snd_ac97_bus(chip->card, 0, &ops, NULL, &bus);
3991 if (err < 0)
3906 return err; 3992 return err;
3907 memset(&ac97, 0, sizeof(ac97)); 3993 memset(&ac97, 0, sizeof(ac97));
3908 ac97.private_data = chip; 3994 ac97.private_data = chip;
@@ -4447,10 +4533,10 @@ struct _snd_pcm_runtime {
4447 <informalexample> 4533 <informalexample>
4448 <programlisting> 4534 <programlisting>
4449<![CDATA[ 4535<![CDATA[
4450 struct list_head *list;
4451 struct snd_rawmidi_substream *substream; 4536 struct snd_rawmidi_substream *substream;
4452 list_for_each(list, &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams) { 4537 list_for_each_entry(substream,
4453 substream = list_entry(list, struct snd_rawmidi_substream, list); 4538 &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams,
4539 list {
4454 sprintf(substream->name, "My MIDI Port %d", substream->number + 1); 4540 sprintf(substream->name, "My MIDI Port %d", substream->number + 1);
4455 } 4541 }
4456 /* same for SNDRV_RAWMIDI_STREAM_INPUT */ 4542 /* same for SNDRV_RAWMIDI_STREAM_INPUT */
diff --git a/Documentation/sound/alsa/OSS-Emulation.txt b/Documentation/sound/alsa/OSS-Emulation.txt
index bfa0c9aacb4b..022aaeb0e9dd 100644
--- a/Documentation/sound/alsa/OSS-Emulation.txt
+++ b/Documentation/sound/alsa/OSS-Emulation.txt
@@ -303,10 +303,3 @@ ICE1712 supports only the unconventional format, interleaved
303the buffer as the conventional (mono or 2-channels, 8 or 16bit) format 303the buffer as the conventional (mono or 2-channels, 8 or 16bit) format
304on OSS. 304on OSS.
305 305
306USB devices
307-----------
308Some USB devices support only 24bit format packed in 3bytes. This
309format is not supported by OSS and no conversion is provided by kernel
310OSS emulation. You can use the user-space OSS emulation via libaoss
311instead.
312
diff --git a/Documentation/sound/alsa/hda_codec.txt b/Documentation/sound/alsa/hda_codec.txt
index 4eaae2a45534..8e1b02526698 100644
--- a/Documentation/sound/alsa/hda_codec.txt
+++ b/Documentation/sound/alsa/hda_codec.txt
@@ -49,6 +49,9 @@ struct hda_bus_ops {
49 unsigned int verb, unsigned int parm); 49 unsigned int verb, unsigned int parm);
50 unsigned int (*get_response)(struct hda_codec *codec); 50 unsigned int (*get_response)(struct hda_codec *codec);
51 void (*private_free)(struct hda_bus *); 51 void (*private_free)(struct hda_bus *);
52#ifdef CONFIG_SND_HDA_POWER_SAVE
53 void (*pm_notify)(struct hda_codec *codec);
54#endif
52}; 55};
53 56
54The command callback is called when the codec module needs to send a 57The command callback is called when the codec module needs to send a
@@ -56,9 +59,16 @@ VERB to the controller. It's always a single command.
56The get_response callback is called when the codec requires the answer 59The get_response callback is called when the codec requires the answer
57for the last command. These two callbacks are mandatory and have to 60for the last command. These two callbacks are mandatory and have to
58be given. 61be given.
59The last, private_free callback, is optional. It's called in the 62The third, private_free callback, is optional. It's called in the
60destructor to release any necessary data in the lowlevel driver. 63destructor to release any necessary data in the lowlevel driver.
61 64
65The pm_notify callback is available only with
66CONFIG_SND_HDA_POWER_SAVE kconfig. It's called when the codec needs
67to power up or may power down. The controller should check the all
68belonging codecs on the bus whether they are actually powered off
69(check codec->power_on), and optionally the driver may power down the
70contoller side, too.
71
62The bus instance is created via snd_hda_bus_new(). You need to pass 72The bus instance is created via snd_hda_bus_new(). You need to pass
63the card instance, the template, and the pointer to store the 73the card instance, the template, and the pointer to store the
64resultant bus instance. 74resultant bus instance.
@@ -86,10 +96,8 @@ resultant codec instance (can be NULL if not needed).
86The codec is stored in a linked list of bus instance. You can follow 96The codec is stored in a linked list of bus instance. You can follow
87the codec list like: 97the codec list like:
88 98
89 struct list_head *p;
90 struct hda_codec *codec; 99 struct hda_codec *codec;
91 list_for_each(p, &bus->codec_list) { 100 list_for_each_entry(codec, &bus->codec_list, list) {
92 codec = list_entry(p, struct hda_codec, list);
93 ... 101 ...
94 } 102 }
95 103
@@ -100,10 +108,15 @@ initialization sequence is called when the controls are built later.
100Codec Access 108Codec Access
101============ 109============
102 110
103To access codec, use snd_codec_read() and snd_codec_write(). 111To access codec, use snd_hda_codec_read() and snd_hda_codec_write().
104snd_hda_param_read() is for reading parameters. 112snd_hda_param_read() is for reading parameters.
105For writing a sequence of verbs, use snd_hda_sequence_write(). 113For writing a sequence of verbs, use snd_hda_sequence_write().
106 114
115There are variants of cached read/write, snd_hda_codec_write_cache(),
116snd_hda_sequence_write_cache(). These are used for recording the
117register states for the power-mangement resume. When no PM is needed,
118these are equivalent with non-cached version.
119
107To retrieve the number of sub nodes connected to the given node, use 120To retrieve the number of sub nodes connected to the given node, use
108snd_hda_get_sub_nodes(). The connection list can be obtained via 121snd_hda_get_sub_nodes(). The connection list can be obtained via
109snd_hda_get_connections() call. 122snd_hda_get_connections() call.
@@ -239,6 +252,10 @@ set the codec->patch_ops field. This is defined as below:
239 int (*suspend)(struct hda_codec *codec, pm_message_t state); 252 int (*suspend)(struct hda_codec *codec, pm_message_t state);
240 int (*resume)(struct hda_codec *codec); 253 int (*resume)(struct hda_codec *codec);
241 #endif 254 #endif
255 #ifdef CONFIG_SND_HDA_POWER_SAVE
256 int (*check_power_status)(struct hda_codec *codec,
257 hda_nid_t nid);
258 #endif
242 }; 259 };
243 260
244The build_controls callback is called from snd_hda_build_controls(). 261The build_controls callback is called from snd_hda_build_controls().
@@ -251,6 +268,18 @@ The unsol_event callback is called when an unsolicited event is
251received. 268received.
252 269
253The suspend and resume callbacks are for power management. 270The suspend and resume callbacks are for power management.
271They can be NULL if no special sequence is required. When the resume
272callback is NULL, the driver calls the init callback and resumes the
273registers from the cache. If other handling is needed, you'd need to
274write your own resume callback. There, the amp values can be resumed
275via
276 void snd_hda_codec_resume_amp(struct hda_codec *codec);
277and the other codec registers via
278 void snd_hda_codec_resume_cache(struct hda_codec *codec);
279
280The check_power_status callback is called when the amp value of the
281given widget NID is changed. The codec code can turn on/off the power
282appropriately from this information.
254 283
255Each entry can be NULL if not necessary to be called. 284Each entry can be NULL if not necessary to be called.
256 285
@@ -267,8 +296,7 @@ Digital I/O
267=========== 296===========
268 297
269Call snd_hda_create_spdif_out_ctls() from the patch to create controls 298Call snd_hda_create_spdif_out_ctls() from the patch to create controls
270related with SPDIF out. In the patch resume callback, call 299related with SPDIF out.
271snd_hda_resume_spdif().
272 300
273 301
274Helper Functions 302Helper Functions
@@ -284,12 +312,7 @@ as a module parameter, and PCI subsystem IDs. If the matching entry
284is found, it returns the config field value. 312is found, it returns the config field value.
285 313
286snd_hda_add_new_ctls() can be used to create and add control entries. 314snd_hda_add_new_ctls() can be used to create and add control entries.
287Pass the zero-terminated array of struct snd_kcontrol_new. The same array 315Pass the zero-terminated array of struct snd_kcontrol_new
288can be passed to snd_hda_resume_ctls() for resume.
289Note that this will call control->put callback of these entries. So,
290put callback should check codec->in_resume and force to restore the
291given value if it's non-zero even if the value is identical with the
292cached value.
293 316
294Macros HDA_CODEC_VOLUME(), HDA_CODEC_MUTE() and their variables can be 317Macros HDA_CODEC_VOLUME(), HDA_CODEC_MUTE() and their variables can be
295used for the entry of struct snd_kcontrol_new. 318used for the entry of struct snd_kcontrol_new.
diff --git a/Documentation/sound/alsa/powersave.txt b/Documentation/sound/alsa/powersave.txt
new file mode 100644
index 000000000000..9657e8099228
--- /dev/null
+++ b/Documentation/sound/alsa/powersave.txt
@@ -0,0 +1,41 @@
1Notes on Power-Saving Mode
2==========================
3
4AC97 and HD-audio drivers have the automatic power-saving mode.
5This feature is enabled via Kconfig CONFIG_SND_AC97_POWER_SAVE
6and CONFIG_SND_HDA_POWER_SAVE options, respectively.
7
8With the automatic power-saving, the driver turns off the codec power
9appropriately when no operation is required. When no applications use
10the device and/or no analog loopback is set, the power disablement is
11done fully or partially. It'll save a certain power consumption, thus
12good for laptops (even for desktops).
13
14The time-out for automatic power-off can be specified via power_save
15module option of snd-ac97-codec and snd-hda-intel modules. Specify
16the time-out value in seconds. 0 means to disable the automatic
17power-saving. The default value of timeout is given via
18CONFIG_SND_AC97_POWER_SAVE_DEFAULT and
19CONFIG_SND_HDA_POWER_SAVE_DEFAULT Kconfig options. Setting this to 1
20(the minimum value) isn't recommended because many applications try to
21reopen the device frequently. 10 would be a good choice for normal
22operations.
23
24The power_save option is exported as writable. This means you can
25adjust the value via sysfs on the fly. For example, to turn on the
26automatic power-save mode with 10 seconds, write to
27/sys/modules/snd_ac97_codec/parameters/power_save (usually as root):
28
29 # echo 10 > /sys/modules/snd_ac97_codec/parameters/power_save
30
31
32Note that you might hear click noise/pop when changing the power
33state. Also, it often takes certain time to wake up from the
34power-down to the active state. These are often hardly to fix, so
35don't report extra bug reports unless you have a fix patch ;-)
36
37For HD-audio interface, there is another module option,
38power_save_controller. This enables/disables the power-save mode of
39the controller side. Setting this on may reduce a bit more power
40consumption, but might result in longer wake-up time and click noise.
41Try to turn it off when you experience such a thing too often.