aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/sound/alsa
diff options
context:
space:
mode:
Diffstat (limited to 'Documentation/sound/alsa')
-rw-r--r--Documentation/sound/alsa/ALSA-Configuration.txt194
-rw-r--r--Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl592
-rw-r--r--Documentation/sound/alsa/Procfile.txt16
-rw-r--r--Documentation/sound/alsa/hda_codec.txt14
4 files changed, 500 insertions, 316 deletions
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
index 2f27f391c7cc..d2578013e829 100644
--- a/Documentation/sound/alsa/ALSA-Configuration.txt
+++ b/Documentation/sound/alsa/ALSA-Configuration.txt
@@ -105,7 +105,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
105 Each of top level sound card module takes the following options. 105 Each of top level sound card module takes the following options.
106 106
107 index - index (slot #) of sound card 107 index - index (slot #) of sound card
108 - Values: 0 through 7 or negative 108 - Values: 0 through 31 or negative
109 - If nonnegative, assign that index number 109 - If nonnegative, assign that index number
110 - if negative, interpret as a bitmask of permissible 110 - if negative, interpret as a bitmask of permissible
111 indices; the first free permitted index is assigned 111 indices; the first free permitted index is assigned
@@ -134,7 +134,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
134 dma2 - second DMA # for AD1816A chip (PnP setup) 134 dma2 - second DMA # for AD1816A chip (PnP setup)
135 clockfreq - Clock frequency for AD1816A chip (default = 0, 33000Hz) 135 clockfreq - Clock frequency for AD1816A chip (default = 0, 33000Hz)
136 136
137 Module supports up to 8 cards, autoprobe and PnP. 137 This module supports multiple cards, autoprobe and PnP.
138 138
139 Module snd-ad1848 139 Module snd-ad1848
140 ----------------- 140 -----------------
@@ -145,9 +145,11 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
145 irq - IRQ # for AD1848 chip 145 irq - IRQ # for AD1848 chip
146 dma1 - DMA # for AD1848 chip (0,1,3) 146 dma1 - DMA # for AD1848 chip (0,1,3)
147 147
148 Module supports up to 8 cards. This module does not support autoprobe 148 This module supports multiple cards. It does not support autoprobe
149 thus main port must be specified!!! Other ports are optional. 149 thus main port must be specified!!! Other ports are optional.
150 150
151 The power-management is supported.
152
151 Module snd-ad1889 153 Module snd-ad1889
152 ----------------- 154 -----------------
153 155
@@ -156,7 +158,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
156 ac97_quirk - AC'97 workaround for strange hardware 158 ac97_quirk - AC'97 workaround for strange hardware
157 See the description of intel8x0 module for details. 159 See the description of intel8x0 module for details.
158 160
159 This module supports up to 8 cards. 161 This module supports multiple cards.
160 162
161 Module snd-ali5451 163 Module snd-ali5451
162 ------------------ 164 ------------------
@@ -184,7 +186,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
184 mpu_irq - IRQ # for MPU-401 (PnP setup) 186 mpu_irq - IRQ # for MPU-401 (PnP setup)
185 fm_port - port # for OPL3 FM (PnP setup) 187 fm_port - port # for OPL3 FM (PnP setup)
186 188
187 Module supports up to 8 cards, autoprobe and PnP. 189 This module supports multiple cards, autoprobe and PnP.
190
191 The power-management is supported.
188 192
189 Module snd-als4000 193 Module snd-als4000
190 ------------------ 194 ------------------
@@ -194,7 +198,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
194 joystick_port - port # for legacy joystick support. 198 joystick_port - port # for legacy joystick support.
195 0 = disabled (default), 1 = auto-detect 199 0 = disabled (default), 1 = auto-detect
196 200
197 Module supports up to 8 cards, autoprobe and PnP. 201 This module supports multiple cards, autoprobe and PnP.
202
203 The power-management is supported.
198 204
199 Module snd-atiixp 205 Module snd-atiixp
200 ----------------- 206 -----------------
@@ -213,6 +219,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
213 implementation depends on the motherboard, and you'll need to 219 implementation depends on the motherboard, and you'll need to
214 choose the correct one via spdif_aclink module option. 220 choose the correct one via spdif_aclink module option.
215 221
222 The power-management is supported.
223
216 Module snd-atiixp-modem 224 Module snd-atiixp-modem
217 ----------------------- 225 -----------------------
218 226
@@ -223,6 +231,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
223 Note: The default index value of this module is -2, i.e. the first 231 Note: The default index value of this module is -2, i.e. the first
224 slot is excluded. 232 slot is excluded.
225 233
234 The power-management is supported.
235
226 Module snd-au8810, snd-au8820, snd-au8830 236 Module snd-au8810, snd-au8820, snd-au8830
227 ----------------------------------------- 237 -----------------------------------------
228 238
@@ -263,8 +273,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
263 dma1 - 1st DMA # for AZT2320 (WSS) chip (PnP setup) 273 dma1 - 1st DMA # for AZT2320 (WSS) chip (PnP setup)
264 dma2 - 2nd DMA # for AZT2320 (WSS) chip (PnP setup) 274 dma2 - 2nd DMA # for AZT2320 (WSS) chip (PnP setup)
265 275
266 Module supports up to 8 cards, PnP and autoprobe. 276 This module supports multiple cards, PnP and autoprobe.
267 277
278 The power-management is supported.
279
268 Module snd-azt3328 280 Module snd-azt3328
269 ------------------ 281 ------------------
270 282
@@ -272,7 +284,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
272 284
273 joystick - Enable joystick (default off) 285 joystick - Enable joystick (default off)
274 286
275 Module supports up to 8 cards. 287 This module supports multiple cards.
276 288
277 Module snd-bt87x 289 Module snd-bt87x
278 ---------------- 290 ----------------
@@ -282,7 +294,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
282 digital_rate - Override the default digital rate (Hz) 294 digital_rate - Override the default digital rate (Hz)
283 load_all - Load the driver even if the card model isn't known 295 load_all - Load the driver even if the card model isn't known
284 296
285 Module supports up to 8 cards. 297 This module supports multiple cards.
286 298
287 Note: The default index value of this module is -2, i.e. the first 299 Note: The default index value of this module is -2, i.e. the first
288 slot is excluded. 300 slot is excluded.
@@ -292,7 +304,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
292 304
293 Module for Creative Audigy LS and SB Live 24bit 305 Module for Creative Audigy LS and SB Live 24bit
294 306
295 Module supports up to 8 cards. 307 This module supports multiple cards.
296 308
297 309
298 Module snd-cmi8330 310 Module snd-cmi8330
@@ -308,7 +320,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
308 sbdma8 - 8bit DMA # for CMI8330 chip (SB16) 320 sbdma8 - 8bit DMA # for CMI8330 chip (SB16)
309 sbdma16 - 16bit DMA # for CMI8330 chip (SB16) 321 sbdma16 - 16bit DMA # for CMI8330 chip (SB16)
310 322
311 Module supports up to 8 cards and autoprobe. 323 This module supports multiple cards and autoprobe.
324
325 The power-management is supported.
312 326
313 Module snd-cmipci 327 Module snd-cmipci
314 ----------------- 328 -----------------
@@ -321,8 +335,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
321 (default = 1) 335 (default = 1)
322 joystick_port - Joystick port address (0 = disable, 1 = auto-detect) 336 joystick_port - Joystick port address (0 = disable, 1 = auto-detect)
323 337
324 Module supports autoprobe and multiple chips (max 8). 338 This module supports autoprobe and multiple cards.
325 339
340 The power-management is supported.
341
326 Module snd-cs4231 342 Module snd-cs4231
327 ----------------- 343 -----------------
328 344
@@ -335,7 +351,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
335 dma1 - first DMA # for CS4231 chip 351 dma1 - first DMA # for CS4231 chip
336 dma2 - second DMA # for CS4231 chip 352 dma2 - second DMA # for CS4231 chip
337 353
338 Module supports up to 8 cards. This module does not support autoprobe 354 This module supports multiple cards. This module does not support autoprobe
339 thus main port must be specified!!! Other ports are optional. 355 thus main port must be specified!!! Other ports are optional.
340 356
341 The power-management is supported. 357 The power-management is supported.
@@ -355,7 +371,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
355 dma2 - second DMA # for Yamaha CS4232 chip (0,1,3), -1 = disable 371 dma2 - second DMA # for Yamaha CS4232 chip (0,1,3), -1 = disable
356 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) 372 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default)
357 373
358 Module supports up to 8 cards. This module does not support autoprobe 374 This module supports multiple cards. This module does not support autoprobe
359 thus main port must be specified!!! Other ports are optional. 375 thus main port must be specified!!! Other ports are optional.
360 376
361 The power-management is supported. 377 The power-management is supported.
@@ -376,7 +392,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
376 dma2 - second DMA # for CS4236 chip (0,1,3), -1 = disable 392 dma2 - second DMA # for CS4236 chip (0,1,3), -1 = disable
377 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) 393 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default)
378 394
379 Module supports up to 8 cards. This module does not support autoprobe 395 This module supports multiple cards. This module does not support autoprobe
380 (if ISA PnP is not used) thus main port and control port must be 396 (if ISA PnP is not used) thus main port and control port must be
381 specified!!! Other ports are optional. 397 specified!!! Other ports are optional.
382 398
@@ -389,7 +405,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
389 405
390 dual_codec - Secondary codec ID (0 = disable, default) 406 dual_codec - Secondary codec ID (0 = disable, default)
391 407
392 Module supports up to 8 cards. 408 This module supports multiple cards.
393 409
394 The power-management is supported. 410 The power-management is supported.
395 411
@@ -403,13 +419,20 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
403 thinkpad - Force to enable Thinkpad's CLKRUN control. 419 thinkpad - Force to enable Thinkpad's CLKRUN control.
404 mmap_valid - Support OSS mmap mode (default = 0). 420 mmap_valid - Support OSS mmap mode (default = 0).
405 421
406 Module supports up to 8 cards and autoprobe. 422 This module supports multiple cards and autoprobe.
407 Usually external amp and CLKRUN controls are detected automatically 423 Usually external amp and CLKRUN controls are detected automatically
408 from PCI sub vendor/device ids. If they don't work, give the options 424 from PCI sub vendor/device ids. If they don't work, give the options
409 above explicitly. 425 above explicitly.
410 426
411 The power-management is supported. 427 The power-management is supported.
412 428
429 Module snd-cs5535audio
430 ----------------------
431
432 Module for multifunction CS5535 companion PCI device
433
434 This module supports multiple cards.
435
413 Module snd-dt019x 436 Module snd-dt019x
414 ----------------- 437 -----------------
415 438
@@ -423,9 +446,11 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
423 mpu_irq - IRQ # for MPU-401 (PnP setup) 446 mpu_irq - IRQ # for MPU-401 (PnP setup)
424 dma8 - DMA # (PnP setup) 447 dma8 - DMA # (PnP setup)
425 448
426 Module supports up to 8 cards. This module is enabled only with 449 This module supports multiple cards. This module is enabled only with
427 ISA PnP support. 450 ISA PnP support.
428 451
452 The power-management is supported.
453
429 Module snd-dummy 454 Module snd-dummy
430 ---------------- 455 ----------------
431 456
@@ -433,6 +458,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
433 or input, but you may use this module for any application which 458 or input, but you may use this module for any application which
434 requires a sound card (like RealPlayer). 459 requires a sound card (like RealPlayer).
435 460
461 The power-management is supported.
462
436 Module snd-emu10k1 463 Module snd-emu10k1
437 ------------------ 464 ------------------
438 465
@@ -450,7 +477,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
450 given in MB unit. Default value is 128. 477 given in MB unit. Default value is 128.
451 enable_ir - enable IR 478 enable_ir - enable IR
452 479
453 Module supports up to 8 cards and autoprobe. 480 This module supports multiple cards and autoprobe.
454 481
455 Input & Output configurations [extin/extout] 482 Input & Output configurations [extin/extout]
456 * Creative Card wo/Digital out [0x0003/0x1f03] 483 * Creative Card wo/Digital out [0x0003/0x1f03]
@@ -466,12 +493,14 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
466 * Creative Card 5.1 (c) 2003 [0x3fc3/0x7cff] 493 * Creative Card 5.1 (c) 2003 [0x3fc3/0x7cff]
467 * Creative Card all ins and outs [0x3fff/0x7fff] 494 * Creative Card all ins and outs [0x3fff/0x7fff]
468 495
496 The power-management is supported.
497
469 Module snd-emu10k1x 498 Module snd-emu10k1x
470 ------------------- 499 -------------------
471 500
472 Module for Creative Emu10k1X (SB Live Dell OEM version) 501 Module for Creative Emu10k1X (SB Live Dell OEM version)
473 502
474 Module supports up to 8 cards. 503 This module supports multiple cards.
475 504
476 Module snd-ens1370 505 Module snd-ens1370
477 ------------------ 506 ------------------
@@ -482,7 +511,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
482 511
483 joystick - Enable joystick (default off) 512 joystick - Enable joystick (default off)
484 513
485 Module supports up to 8 cards and autoprobe. 514 This module supports multiple cards and autoprobe.
486 515
487 Module snd-ens1371 516 Module snd-ens1371
488 ------------------ 517 ------------------
@@ -495,7 +524,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
495 joystick_port - port # for joystick (0x200,0x208,0x210,0x218), 524 joystick_port - port # for joystick (0x200,0x208,0x210,0x218),
496 0 = disable (default), 1 = auto-detect 525 0 = disable (default), 1 = auto-detect
497 526
498 Module supports up to 8 cards and autoprobe. 527 This module supports multiple cards and autoprobe.
499 528
500 Module snd-es968 529 Module snd-es968
501 ---------------- 530 ----------------
@@ -506,8 +535,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
506 irq - IRQ # for ES968 (SB8) chip (PnP setup) 535 irq - IRQ # for ES968 (SB8) chip (PnP setup)
507 dma1 - DMA # for ES968 (SB8) chip (PnP setup) 536 dma1 - DMA # for ES968 (SB8) chip (PnP setup)
508 537
509 Module supports up to 8 cards, PnP and autoprobe. 538 This module supports multiple cards, PnP and autoprobe.
510 539
540 The power-management is supported.
541
511 Module snd-es1688 542 Module snd-es1688
512 ----------------- 543 -----------------
513 544
@@ -519,7 +550,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
519 mpu_irq - IRQ # for MPU-401 port (5,7,9,10) 550 mpu_irq - IRQ # for MPU-401 port (5,7,9,10)
520 dma8 - DMA # for ES-1688 chip (0,1,3) 551 dma8 - DMA # for ES-1688 chip (0,1,3)
521 552
522 Module supports up to 8 cards and autoprobe (without MPU-401 port). 553 This module supports multiple cards and autoprobe (without MPU-401 port).
523 554
524 Module snd-es18xx 555 Module snd-es18xx
525 ----------------- 556 -----------------
@@ -534,8 +565,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
534 dma2 - first DMA # for ES-18xx chip (0,1,3) 565 dma2 - first DMA # for ES-18xx chip (0,1,3)
535 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) 566 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default)
536 567
537 Module supports up to 8 cards ISA PnP and autoprobe (without MPU-401 port 568 This module supports multiple cards, ISA PnP and autoprobe (without MPU-401
538 if native ISA PnP routines are not used). 569 port if native ISA PnP routines are not used).
539 When dma2 is equal with dma1, the driver works as half-duplex. 570 When dma2 is equal with dma1, the driver works as half-duplex.
540 571
541 The power-management is supported. 572 The power-management is supported.
@@ -545,7 +576,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
545 576
546 Module for sound cards based on ESS Solo-1 (ES1938,ES1946) chips. 577 Module for sound cards based on ESS Solo-1 (ES1938,ES1946) chips.
547 578
548 Module supports up to 8 cards and autoprobe. 579 This module supports multiple cards and autoprobe.
580
581 The power-management is supported.
549 582
550 Module snd-es1968 583 Module snd-es1968
551 ----------------- 584 -----------------
@@ -561,7 +594,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
561 enable_mpu - enable MPU401 (0 = off, 1 = on, 2 = auto (default)) 594 enable_mpu - enable MPU401 (0 = off, 1 = on, 2 = auto (default))
562 joystick - enable joystick (default off) 595 joystick - enable joystick (default off)
563 596
564 Module supports up to 8 cards and autoprobe. 597 This module supports multiple cards and autoprobe.
565 598
566 The power-management is supported. 599 The power-management is supported.
567 600
@@ -577,8 +610,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
577 - High 16-bits are video (radio) device number + 1 610 - High 16-bits are video (radio) device number + 1
578 - example: 0x10002 (MediaForte 256-PCPR, device 1) 611 - example: 0x10002 (MediaForte 256-PCPR, device 1)
579 612
580 Module supports up to 8 cards and autoprobe. 613 This module supports multiple cards and autoprobe.
581 614
615 The power-management is supported.
616
582 Module snd-gusclassic 617 Module snd-gusclassic
583 --------------------- 618 ---------------------
584 619
@@ -592,7 +627,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
592 voices - GF1 voices limit (14-32) 627 voices - GF1 voices limit (14-32)
593 pcm_voices - reserved PCM voices 628 pcm_voices - reserved PCM voices
594 629
595 Module supports up to 8 cards and autoprobe. 630 This module supports multiple cards and autoprobe.
596 631
597 Module snd-gusextreme 632 Module snd-gusextreme
598 --------------------- 633 ---------------------
@@ -611,7 +646,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
611 voices - GF1 voices limit (14-32) 646 voices - GF1 voices limit (14-32)
612 pcm_voices - reserved PCM voices 647 pcm_voices - reserved PCM voices
613 648
614 Module supports up to 8 cards and autoprobe (without MPU-401 port). 649 This module supports multiple cards and autoprobe (without MPU-401 port).
615 650
616 Module snd-gusmax 651 Module snd-gusmax
617 ----------------- 652 -----------------
@@ -626,7 +661,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
626 voices - GF1 voices limit (14-32) 661 voices - GF1 voices limit (14-32)
627 pcm_voices - reserved PCM voices 662 pcm_voices - reserved PCM voices
628 663
629 Module supports up to 8 cards and autoprobe. 664 This module supports multiple cards and autoprobe.
630 665
631 Module snd-hda-intel 666 Module snd-hda-intel
632 -------------------- 667 --------------------
@@ -688,12 +723,14 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
688 (Usually SD_LPLIB register is more accurate than the 723 (Usually SD_LPLIB register is more accurate than the
689 position buffer.) 724 position buffer.)
690 725
726 The power-management is supported.
727
691 Module snd-hdsp 728 Module snd-hdsp
692 --------------- 729 ---------------
693 730
694 Module for RME Hammerfall DSP audio interface(s) 731 Module for RME Hammerfall DSP audio interface(s)
695 732
696 Module supports up to 8 cards. 733 This module supports multiple cards.
697 734
698 Note: The firmware data can be automatically loaded via hotplug 735 Note: The firmware data can be automatically loaded via hotplug
699 when CONFIG_FW_LOADER is set. Otherwise, you need to load 736 when CONFIG_FW_LOADER is set. Otherwise, you need to load
@@ -751,7 +788,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
751 cs8427_timeout - reset timeout for the CS8427 chip (S/PDIF transciever) 788 cs8427_timeout - reset timeout for the CS8427 chip (S/PDIF transciever)
752 in msec resolution, default value is 500 (0.5 sec) 789 in msec resolution, default value is 500 (0.5 sec)
753 790
754 Module supports up to 8 cards and autoprobe. Note: The consumer part 791 This module supports multiple cards and autoprobe. Note: The consumer part
755 is not used with all Envy24 based cards (for example in the MidiMan Delta 792 is not used with all Envy24 based cards (for example in the MidiMan Delta
756 serie). 793 serie).
757 794
@@ -787,7 +824,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
787 aureon71, universe, k8x800, phase22, phase28, ms300, 824 aureon71, universe, k8x800, phase22, phase28, ms300,
788 av710 825 av710
789 826
790 Module supports up to 8 cards and autoprobe. 827 This module supports multiple cards and autoprobe.
791 828
792 Note: The supported board is detected by reading EEPROM or PCI 829 Note: The supported board is detected by reading EEPROM or PCI
793 SSID (if EEPROM isn't available). You can override the 830 SSID (if EEPROM isn't available). You can override the
@@ -839,6 +876,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
839 Note: The default index value of this module is -2, i.e. the first 876 Note: The default index value of this module is -2, i.e. the first
840 slot is excluded. 877 slot is excluded.
841 878
879 The power-management is supported.
880
842 Module snd-interwave 881 Module snd-interwave
843 -------------------- 882 --------------------
844 883
@@ -855,7 +894,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
855 effect - 1 = InterWave effects enable (default 0); 894 effect - 1 = InterWave effects enable (default 0);
856 requires 8 voices 895 requires 8 voices
857 896
858 Module supports up to 8 cards, autoprobe and ISA PnP. 897 This module supports multiple cards, autoprobe and ISA PnP.
859 898
860 Module snd-interwave-stb 899 Module snd-interwave-stb
861 ------------------------ 900 ------------------------
@@ -875,14 +914,14 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
875 effect - 1 = InterWave effects enable (default 0); 914 effect - 1 = InterWave effects enable (default 0);
876 requires 8 voices 915 requires 8 voices
877 916
878 Module supports up to 8 cards, autoprobe and ISA PnP. 917 This module supports multiple cards, autoprobe and ISA PnP.
879 918
880 Module snd-korg1212 919 Module snd-korg1212
881 ------------------- 920 -------------------
882 921
883 Module for Korg 1212 IO PCI card 922 Module for Korg 1212 IO PCI card
884 923
885 Module supports up to 8 cards. 924 This module supports multiple cards.
886 925
887 Module snd-maestro3 926 Module snd-maestro3
888 ------------------- 927 -------------------
@@ -894,7 +933,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
894 -1 for default pin (8 for allegro, 1 for 933 -1 for default pin (8 for allegro, 1 for
895 others) 934 others)
896 935
897 Module supports autoprobe and multiple chips (max 8). 936 This module supports autoprobe and multiple chips.
898 937
899 Note: the binding of amplifier is dependent on hardware. 938 Note: the binding of amplifier is dependent on hardware.
900 If there is no sound even though all channels are unmuted, try to 939 If there is no sound even though all channels are unmuted, try to
@@ -909,7 +948,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
909 948
910 Module for Digigram miXart8 sound cards. 949 Module for Digigram miXart8 sound cards.
911 950
912 Module supports multiple cards. 951 This module supports multiple cards.
913 Note: One miXart8 board will be represented as 4 alsa cards. 952 Note: One miXart8 board will be represented as 4 alsa cards.
914 See MIXART.txt for details. 953 See MIXART.txt for details.
915 954
@@ -928,7 +967,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
928 irq - IRQ number or -1 (disable) 967 irq - IRQ number or -1 (disable)
929 pnp - PnP detection - 0 = disable, 1 = enable (default) 968 pnp - PnP detection - 0 = disable, 1 = enable (default)
930 969
931 Module supports multiple devices (max 8) and PnP. 970 This module supports multiple devices and PnP.
932 971
933 Module snd-mtpav 972 Module snd-mtpav
934 ---------------- 973 ----------------
@@ -1014,7 +1053,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1014 dma2 - second DMA # for Yamaha OPL3-SA chip (0,1,3), -1 = disable 1053 dma2 - second DMA # for Yamaha OPL3-SA chip (0,1,3), -1 = disable
1015 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) 1054 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default)
1016 1055
1017 Module supports up to 8 cards and ISA PnP. This module does not support 1056 This module supports multiple cards and ISA PnP. It does not support
1018 autoprobe (if ISA PnP is not used) thus all ports must be specified!!! 1057 autoprobe (if ISA PnP is not used) thus all ports must be specified!!!
1019 1058
1020 The power-management is supported. 1059 The power-management is supported.
@@ -1064,6 +1103,13 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1064 1103
1065 This module supports only one card, autoprobe and PnP. 1104 This module supports only one card, autoprobe and PnP.
1066 1105
1106 Module snd-pcxhr
1107 ----------------
1108
1109 Module for Digigram PCXHR boards
1110
1111 This module supports multiple cards.
1112
1067 Module snd-powermac (on ppc only) 1113 Module snd-powermac (on ppc only)
1068 --------------------------------- 1114 ---------------------------------
1069 1115
@@ -1084,20 +1130,22 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1084 1130
1085 For ARM architecture only. 1131 For ARM architecture only.
1086 1132
1133 The power-management is supported.
1134
1087 Module snd-rme32 1135 Module snd-rme32
1088 ---------------- 1136 ----------------
1089 1137
1090 Module for RME Digi32, Digi32 Pro and Digi32/8 (Sek'd Prodif32, 1138 Module for RME Digi32, Digi32 Pro and Digi32/8 (Sek'd Prodif32,
1091 Prodif96 and Prodif Gold) sound cards. 1139 Prodif96 and Prodif Gold) sound cards.
1092 1140
1093 Module supports up to 8 cards. 1141 This module supports multiple cards.
1094 1142
1095 Module snd-rme96 1143 Module snd-rme96
1096 ---------------- 1144 ----------------
1097 1145
1098 Module for RME Digi96, Digi96/8 and Digi96/8 PRO/PAD/PST sound cards. 1146 Module for RME Digi96, Digi96/8 and Digi96/8 PRO/PAD/PST sound cards.
1099 1147
1100 Module supports up to 8 cards. 1148 This module supports multiple cards.
1101 1149
1102 Module snd-rme9652 1150 Module snd-rme9652
1103 ------------------ 1151 ------------------
@@ -1107,7 +1155,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1107 precise_ptr - Enable precise pointer (doesn't work reliably). 1155 precise_ptr - Enable precise pointer (doesn't work reliably).
1108 (default = 0) 1156 (default = 0)
1109 1157
1110 Module supports up to 8 cards. 1158 This module supports multiple cards.
1111 1159
1112 Note: snd-page-alloc module does the job which snd-hammerfall-mem 1160 Note: snd-page-alloc module does the job which snd-hammerfall-mem
1113 module did formerly. It will allocate the buffers in advance 1161 module did formerly. It will allocate the buffers in advance
@@ -1124,6 +1172,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1124 Module supports only one card. 1172 Module supports only one card.
1125 Module has no enable and index options. 1173 Module has no enable and index options.
1126 1174
1175 The power-management is supported.
1176
1127 Module snd-sb8 1177 Module snd-sb8
1128 -------------- 1178 --------------
1129 1179
@@ -1135,8 +1185,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1135 irq - IRQ # for SB DSP chip (5,7,9,10) 1185 irq - IRQ # for SB DSP chip (5,7,9,10)
1136 dma8 - DMA # for SB DSP chip (1,3) 1186 dma8 - DMA # for SB DSP chip (1,3)
1137 1187
1138 Module supports up to 8 cards and autoprobe. 1188 This module supports multiple cards and autoprobe.
1139 1189
1190 The power-management is supported.
1191
1140 Module snd-sb16 and snd-sbawe 1192 Module snd-sb16 and snd-sbawe
1141 ----------------------------- 1193 -----------------------------
1142 1194
@@ -1155,7 +1207,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1155 csp - ASP/CSP chip support - 0 = disable (default), 1 = enable 1207 csp - ASP/CSP chip support - 0 = disable (default), 1 = enable
1156 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) 1208 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default)
1157 1209
1158 Module supports up to 8 cards, autoprobe and ISA PnP. 1210 This module supports multiple cards, autoprobe and ISA PnP.
1159 1211
1160 Note: To use Vibra16X cards in 16-bit half duplex mode, you must 1212 Note: To use Vibra16X cards in 16-bit half duplex mode, you must
1161 disable 16bit DMA with dma16 = -1 module parameter. 1213 disable 16bit DMA with dma16 = -1 module parameter.
@@ -1163,6 +1215,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1163 half duplex mode through 8-bit DMA channel by disabling their 1215 half duplex mode through 8-bit DMA channel by disabling their
1164 16-bit DMA channel. 1216 16-bit DMA channel.
1165 1217
1218 The power-management is supported.
1219
1166 Module snd-sgalaxy 1220 Module snd-sgalaxy
1167 ------------------ 1221 ------------------
1168 1222
@@ -1173,7 +1227,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1173 irq - IRQ # (7,9,10,11) 1227 irq - IRQ # (7,9,10,11)
1174 dma1 - DMA # 1228 dma1 - DMA #
1175 1229
1176 Module supports up to 8 cards. 1230 This module supports multiple cards.
1231
1232 The power-management is supported.
1177 1233
1178 Module snd-sscape 1234 Module snd-sscape
1179 ----------------- 1235 -----------------
@@ -1185,7 +1241,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1185 mpu_irq - MPU-401 IRQ # (PnP setup) 1241 mpu_irq - MPU-401 IRQ # (PnP setup)
1186 dma - DMA # (PnP setup) 1242 dma - DMA # (PnP setup)
1187 1243
1188 Module supports up to 8 cards. ISA PnP must be enabled. 1244 This module supports multiple cards. ISA PnP must be enabled.
1189 You need sscape_ctl tool in alsa-tools package for loading 1245 You need sscape_ctl tool in alsa-tools package for loading
1190 the microcode. 1246 the microcode.
1191 1247
@@ -1194,21 +1250,21 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1194 1250
1195 Module for AMD7930 sound chips found on Sparcs. 1251 Module for AMD7930 sound chips found on Sparcs.
1196 1252
1197 Module supports up to 8 cards. 1253 This module supports multiple cards.
1198 1254
1199 Module snd-sun-cs4231 (on sparc only) 1255 Module snd-sun-cs4231 (on sparc only)
1200 ------------------------------------- 1256 -------------------------------------
1201 1257
1202 Module for CS4231 sound chips found on Sparcs. 1258 Module for CS4231 sound chips found on Sparcs.
1203 1259
1204 Module supports up to 8 cards. 1260 This module supports multiple cards.
1205 1261
1206 Module snd-sun-dbri (on sparc only) 1262 Module snd-sun-dbri (on sparc only)
1207 ----------------------------------- 1263 -----------------------------------
1208 1264
1209 Module for DBRI sound chips found on Sparcs. 1265 Module for DBRI sound chips found on Sparcs.
1210 1266
1211 Module supports up to 8 cards. 1267 This module supports multiple cards.
1212 1268
1213 Module snd-wavefront 1269 Module snd-wavefront
1214 -------------------- 1270 --------------------
@@ -1228,7 +1284,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1228 dma2 - DMA2 # for CS4232 PCM interface. 1284 dma2 - DMA2 # for CS4232 PCM interface.
1229 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default) 1285 isapnp - ISA PnP detection - 0 = disable, 1 = enable (default)
1230 1286
1231 Module supports up to 8 cards and ISA PnP. 1287 This module supports multiple cards and ISA PnP.
1232 1288
1233 Module snd-sonicvibes 1289 Module snd-sonicvibes
1234 --------------------- 1290 ---------------------
@@ -1240,7 +1296,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1240 - SoundCard must have onboard SRAM for this. 1296 - SoundCard must have onboard SRAM for this.
1241 mge - Mic Gain Enable - 1 = enable, 0 = disable (default) 1297 mge - Mic Gain Enable - 1 = enable, 0 = disable (default)
1242 1298
1243 Module supports up to 8 cards and autoprobe. 1299 This module supports multiple cards and autoprobe.
1244 1300
1245 Module snd-serial-u16550 1301 Module snd-serial-u16550
1246 ------------------------ 1302 ------------------------
@@ -1259,7 +1315,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1259 0 = Soundcanvas, 1 = MS-124T, 2 = MS-124W S/A, 1315 0 = Soundcanvas, 1 = MS-124T, 2 = MS-124W S/A,
1260 3 = MS-124W M/B, 4 = Generic 1316 3 = MS-124W M/B, 4 = Generic
1261 1317
1262 Module supports up to 8 cards. This module does not support autoprobe 1318 This module supports multiple cards. This module does not support autoprobe
1263 thus the main port must be specified!!! Other options are optional. 1319 thus the main port must be specified!!! Other options are optional.
1264 1320
1265 Module snd-trident 1321 Module snd-trident
@@ -1278,7 +1334,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1278 pcm_channels - max channels (voices) reserved for PCM 1334 pcm_channels - max channels (voices) reserved for PCM
1279 wavetable_size - max wavetable size in kB (4-?kb) 1335 wavetable_size - max wavetable size in kB (4-?kb)
1280 1336
1281 Module supports up to 8 cards and autoprobe. 1337 This module supports multiple cards and autoprobe.
1282 1338
1283 The power-management is supported. 1339 The power-management is supported.
1284 1340
@@ -1290,14 +1346,14 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1290 vid - Vendor ID for the device (optional) 1346 vid - Vendor ID for the device (optional)
1291 pid - Product ID for the device (optional) 1347 pid - Product ID for the device (optional)
1292 1348
1293 This module supports up to 8 cards, autoprobe and hotplugging. 1349 This module supports multiple devices, autoprobe and hotplugging.
1294 1350
1295 Module snd-usb-usx2y 1351 Module snd-usb-usx2y
1296 -------------------- 1352 --------------------
1297 1353
1298 Module for Tascam USB US-122, US-224 and US-428 devices. 1354 Module for Tascam USB US-122, US-224 and US-428 devices.
1299 1355
1300 This module supports up to 8 cards, autoprobe and hotplugging. 1356 This module supports multiple devices, autoprobe and hotplugging.
1301 1357
1302 Note: you need to load the firmware via usx2yloader utility included 1358 Note: you need to load the firmware via usx2yloader utility included
1303 in alsa-tools and alsa-firmware packages. 1359 in alsa-tools and alsa-firmware packages.
@@ -1356,6 +1412,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1356 Note: for the MPU401 on VIA823x, use snd-mpu401 driver 1412 Note: for the MPU401 on VIA823x, use snd-mpu401 driver
1357 additionally. The mpu_port option is for VIA686 chips only. 1413 additionally. The mpu_port option is for VIA686 chips only.
1358 1414
1415 The power-management is supported.
1416
1359 Module snd-via82xx-modem 1417 Module snd-via82xx-modem
1360 ------------------------ 1418 ------------------------
1361 1419
@@ -1368,6 +1426,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1368 Note: The default index value of this module is -2, i.e. the first 1426 Note: The default index value of this module is -2, i.e. the first
1369 slot is excluded. 1427 slot is excluded.
1370 1428
1429 The power-management is supported.
1430
1371 Module snd-virmidi 1431 Module snd-virmidi
1372 ------------------ 1432 ------------------
1373 1433
@@ -1375,9 +1435,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1375 This module creates virtual rawmidi devices which communicate 1435 This module creates virtual rawmidi devices which communicate
1376 to the corresponding ALSA sequencer ports. 1436 to the corresponding ALSA sequencer ports.
1377 1437
1378 midi_devs - MIDI devices # (1-8, default=4) 1438 midi_devs - MIDI devices # (1-4, default=4)
1379 1439
1380 Module supports up to 8 cards. 1440 This module supports multiple cards.
1381 1441
1382 Module snd-vx222 1442 Module snd-vx222
1383 ---------------- 1443 ----------------
@@ -1387,7 +1447,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1387 mic - Enable Microphone on V222 Mic (NYI) 1447 mic - Enable Microphone on V222 Mic (NYI)
1388 ibl - Capture IBL size. (default = 0, minimum size) 1448 ibl - Capture IBL size. (default = 0, minimum size)
1389 1449
1390 Module supports up to 8 cards. 1450 This module supports multiple cards.
1391 1451
1392 When the driver is compiled as a module and the hotplug firmware 1452 When the driver is compiled as a module and the hotplug firmware
1393 is supported, the firmware data is loaded via hotplug automatically. 1453 is supported, the firmware data is loaded via hotplug automatically.
@@ -1406,6 +1466,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1406 size is chosen. The possible IBL values can be found in 1466 size is chosen. The possible IBL values can be found in
1407 /proc/asound/cardX/vx-status proc file. 1467 /proc/asound/cardX/vx-status proc file.
1408 1468
1469 The power-management is supported.
1470
1409 Module snd-vxpocket 1471 Module snd-vxpocket
1410 ------------------- 1472 -------------------
1411 1473
@@ -1413,7 +1475,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1413 1475
1414 ibl - Capture IBL size. (default = 0, minimum size) 1476 ibl - Capture IBL size. (default = 0, minimum size)
1415 1477
1416 Module supports up to 8 cards. The module is compiled only when 1478 This module supports multiple cards. The module is compiled only when
1417 PCMCIA is supported on kernel. 1479 PCMCIA is supported on kernel.
1418 1480
1419 With the older 2.6.x kernel, to activate the driver via the card 1481 With the older 2.6.x kernel, to activate the driver via the card
@@ -1434,6 +1496,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1434 Note2: snd-vxp440 driver is merged to snd-vxpocket driver since 1496 Note2: snd-vxp440 driver is merged to snd-vxpocket driver since
1435 ALSA 1.0.10. 1497 ALSA 1.0.10.
1436 1498
1499 The power-management is supported.
1500
1437 Module snd-ymfpci 1501 Module snd-ymfpci
1438 ----------------- 1502 -----------------
1439 1503
@@ -1447,7 +1511,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1447 1 (auto-detect) 1511 1 (auto-detect)
1448 rear_switch - enable shared rear/line-in switch (bool) 1512 rear_switch - enable shared rear/line-in switch (bool)
1449 1513
1450 Module supports autoprobe and multiple chips (max 8). 1514 This module supports autoprobe and multiple chips.
1451 1515
1452 The power-management is supported. 1516 The power-management is supported.
1453 1517
@@ -1458,6 +1522,8 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1458 1522
1459 Note: the driver is build only when CONFIG_ISA is set. 1523 Note: the driver is build only when CONFIG_ISA is set.
1460 1524
1525 The power-management is supported.
1526
1461 1527
1462AC97 Quirk Option 1528AC97 Quirk Option
1463================= 1529=================
@@ -1474,7 +1540,7 @@ the proper value with this option.
1474 1540
1475The following strings are accepted: 1541The following strings are accepted:
1476 - default Don't override the default setting 1542 - default Don't override the default setting
1477 - disable Disable the quirk 1543 - none Disable the quirk
1478 - hp_only Bind Master and Headphone controls as a single control 1544 - hp_only Bind Master and Headphone controls as a single control
1479 - swap_hp Swap headphone and master controls 1545 - swap_hp Swap headphone and master controls
1480 - swap_surround Swap master and surround controls 1546 - swap_surround Swap master and surround controls
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
index 260334c98d95..4963d83d1511 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>October 6, 2005</date> 21 <date>November 17, 2005</date>
22 <edition>0.3.5</edition> 22 <edition>0.3.6</edition>
23 23
24 <abstract> 24 <abstract>
25 <para> 25 <para>
@@ -403,9 +403,8 @@
403 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 403 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
404 404
405 /* definition of the chip-specific record */ 405 /* definition of the chip-specific record */
406 typedef struct snd_mychip mychip_t; 406 struct mychip {
407 struct snd_mychip { 407 struct snd_card *card;
408 snd_card_t *card;
409 // rest of implementation will be in the section 408 // rest of implementation will be in the section
410 // "PCI Resource Managements" 409 // "PCI Resource Managements"
411 }; 410 };
@@ -413,7 +412,7 @@
413 /* chip-specific destructor 412 /* chip-specific destructor
414 * (see "PCI Resource Managements") 413 * (see "PCI Resource Managements")
415 */ 414 */
416 static int snd_mychip_free(mychip_t *chip) 415 static int snd_mychip_free(struct mychip *chip)
417 { 416 {
418 .... // will be implemented later... 417 .... // will be implemented later...
419 } 418 }
@@ -421,22 +420,21 @@
421 /* component-destructor 420 /* component-destructor
422 * (see "Management of Cards and Components") 421 * (see "Management of Cards and Components")
423 */ 422 */
424 static int snd_mychip_dev_free(snd_device_t *device) 423 static int snd_mychip_dev_free(struct snd_device *device)
425 { 424 {
426 mychip_t *chip = device->device_data; 425 return snd_mychip_free(device->device_data);
427 return snd_mychip_free(chip);
428 } 426 }
429 427
430 /* chip-specific constructor 428 /* chip-specific constructor
431 * (see "Management of Cards and Components") 429 * (see "Management of Cards and Components")
432 */ 430 */
433 static int __devinit snd_mychip_create(snd_card_t *card, 431 static int __devinit snd_mychip_create(struct snd_card *card,
434 struct pci_dev *pci, 432 struct pci_dev *pci,
435 mychip_t **rchip) 433 struct mychip **rchip)
436 { 434 {
437 mychip_t *chip; 435 struct mychip *chip;
438 int err; 436 int err;
439 static snd_device_ops_t ops = { 437 static struct snd_device_ops ops = {
440 .dev_free = snd_mychip_dev_free, 438 .dev_free = snd_mychip_dev_free,
441 }; 439 };
442 440
@@ -474,8 +472,8 @@
474 const struct pci_device_id *pci_id) 472 const struct pci_device_id *pci_id)
475 { 473 {
476 static int dev; 474 static int dev;
477 snd_card_t *card; 475 struct snd_card *card;
478 mychip_t *chip; 476 struct mychip *chip;
479 int err; 477 int err;
480 478
481 /* (1) */ 479 /* (1) */
@@ -582,7 +580,7 @@
582 <informalexample> 580 <informalexample>
583 <programlisting> 581 <programlisting>
584<![CDATA[ 582<![CDATA[
585 snd_card_t *card; 583 struct snd_card *card;
586 .... 584 ....
587 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 585 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
588]]> 586]]>
@@ -605,7 +603,7 @@
605 <informalexample> 603 <informalexample>
606 <programlisting> 604 <programlisting>
607<![CDATA[ 605<![CDATA[
608 mychip_t *chip; 606 struct mychip *chip;
609 .... 607 ....
610 if ((err = snd_mychip_create(card, pci, &chip)) < 0) { 608 if ((err = snd_mychip_create(card, pci, &chip)) < 0) {
611 snd_card_free(card); 609 snd_card_free(card);
@@ -806,7 +804,7 @@
806 <informalexample> 804 <informalexample>
807 <programlisting> 805 <programlisting>
808<![CDATA[ 806<![CDATA[
809 snd_card_t *card; 807 struct snd_card *card;
810 card = snd_card_new(index, id, module, extra_size); 808 card = snd_card_new(index, id, module, extra_size);
811]]> 809]]>
812 </programlisting> 810 </programlisting>
@@ -830,7 +828,7 @@
830 <para> 828 <para>
831 After the card is created, you can attach the components 829 After the card is created, you can attach the components
832 (devices) to the card instance. On ALSA driver, a component is 830 (devices) to the card instance. On ALSA driver, a component is
833 represented as a <type>snd_device_t</type> object. 831 represented as a struct <structname>snd_device</structname> object.
834 A component can be a PCM instance, a control interface, a raw 832 A component can be a PCM instance, a control interface, a raw
835 MIDI interface, etc. Each of such instances has one component 833 MIDI interface, etc. Each of such instances has one component
836 entry. 834 entry.
@@ -891,14 +889,11 @@
891 The chip-specific information, e.g. the i/o port address, its 889 The chip-specific information, e.g. the i/o port address, its
892 resource pointer, or the irq number, is stored in the 890 resource pointer, or the irq number, is stored in the
893 chip-specific record. 891 chip-specific record.
894 Usually, the chip-specific record is typedef'ed as
895 <type>xxx_t</type> like the following:
896 892
897 <informalexample> 893 <informalexample>
898 <programlisting> 894 <programlisting>
899<![CDATA[ 895<![CDATA[
900 typedef struct snd_mychip mychip_t; 896 struct mychip {
901 struct snd_mychip {
902 .... 897 ....
903 }; 898 };
904]]> 899]]>
@@ -918,12 +913,12 @@
918 <informalexample> 913 <informalexample>
919 <programlisting> 914 <programlisting>
920<![CDATA[ 915<![CDATA[
921 card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(mychip_t)); 916 card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct mychip));
922]]> 917]]>
923 </programlisting> 918 </programlisting>
924 </informalexample> 919 </informalexample>
925 920
926 whether <type>mychip_t</type> is the type of the chip record. 921 whether struct <structname>mychip</structname> is the type of the chip record.
927 </para> 922 </para>
928 923
929 <para> 924 <para>
@@ -932,7 +927,7 @@
932 <informalexample> 927 <informalexample>
933 <programlisting> 928 <programlisting>
934<![CDATA[ 929<![CDATA[
935 mychip_t *chip = (mychip_t *)card->private_data; 930 struct mychip *chip = (struct mychip *)card->private_data;
936]]> 931]]>
937 </programlisting> 932 </programlisting>
938 </informalexample> 933 </informalexample>
@@ -954,8 +949,8 @@
954 <informalexample> 949 <informalexample>
955 <programlisting> 950 <programlisting>
956<![CDATA[ 951<![CDATA[
957 snd_card_t *card; 952 struct snd_card *card;
958 mychip_t *chip; 953 struct mychip *chip;
959 card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL); 954 card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL);
960 ..... 955 .....
961 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 956 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
@@ -971,8 +966,8 @@
971 <informalexample> 966 <informalexample>
972 <programlisting> 967 <programlisting>
973<![CDATA[ 968<![CDATA[
974 struct snd_mychip { 969 struct mychip {
975 snd_card_t *card; 970 struct snd_card *card;
976 .... 971 ....
977 }; 972 };
978]]> 973]]>
@@ -1000,7 +995,7 @@
1000 <informalexample> 995 <informalexample>
1001 <programlisting> 996 <programlisting>
1002<![CDATA[ 997<![CDATA[
1003 static snd_device_ops_t ops = { 998 static struct snd_device_ops ops = {
1004 .dev_free = snd_mychip_dev_free, 999 .dev_free = snd_mychip_dev_free,
1005 }; 1000 };
1006 .... 1001 ....
@@ -1018,10 +1013,9 @@
1018 <informalexample> 1013 <informalexample>
1019 <programlisting> 1014 <programlisting>
1020<![CDATA[ 1015<![CDATA[
1021 static int snd_mychip_dev_free(snd_device_t *device) 1016 static int snd_mychip_dev_free(struct snd_device *device)
1022 { 1017 {
1023 mychip_t *chip = device->device_data; 1018 return snd_mychip_free(device->device_data);
1024 return snd_mychip_free(chip);
1025 } 1019 }
1026]]> 1020]]>
1027 </programlisting> 1021 </programlisting>
@@ -1087,15 +1081,15 @@
1087 <title>PCI Resource Managements Example</title> 1081 <title>PCI Resource Managements Example</title>
1088 <programlisting> 1082 <programlisting>
1089<![CDATA[ 1083<![CDATA[
1090 struct snd_mychip { 1084 struct mychip {
1091 snd_card_t *card; 1085 struct snd_card *card;
1092 struct pci_dev *pci; 1086 struct pci_dev *pci;
1093 1087
1094 unsigned long port; 1088 unsigned long port;
1095 int irq; 1089 int irq;
1096 }; 1090 };
1097 1091
1098 static int snd_mychip_free(mychip_t *chip) 1092 static int snd_mychip_free(struct mychip *chip)
1099 { 1093 {
1100 /* disable hardware here if any */ 1094 /* disable hardware here if any */
1101 .... // (not implemented in this document) 1095 .... // (not implemented in this document)
@@ -1113,13 +1107,13 @@
1113 } 1107 }
1114 1108
1115 /* chip-specific constructor */ 1109 /* chip-specific constructor */
1116 static int __devinit snd_mychip_create(snd_card_t *card, 1110 static int __devinit snd_mychip_create(struct snd_card *card,
1117 struct pci_dev *pci, 1111 struct pci_dev *pci,
1118 mychip_t **rchip) 1112 struct mychip **rchip)
1119 { 1113 {
1120 mychip_t *chip; 1114 struct mychip *chip;
1121 int err; 1115 int err;
1122 static snd_device_ops_t ops = { 1116 static struct snd_device_ops ops = {
1123 .dev_free = snd_mychip_dev_free, 1117 .dev_free = snd_mychip_dev_free,
1124 }; 1118 };
1125 1119
@@ -1155,8 +1149,7 @@
1155 } 1149 }
1156 chip->port = pci_resource_start(pci, 0); 1150 chip->port = pci_resource_start(pci, 0);
1157 if (request_irq(pci->irq, snd_mychip_interrupt, 1151 if (request_irq(pci->irq, snd_mychip_interrupt,
1158 SA_INTERRUPT|SA_SHIRQ, "My Chip", 1152 SA_INTERRUPT|SA_SHIRQ, "My Chip", chip)) {
1159 (void *)chip)) {
1160 printk(KERN_ERR "cannot grab irq %d\n", pci->irq); 1153 printk(KERN_ERR "cannot grab irq %d\n", pci->irq);
1161 snd_mychip_free(chip); 1154 snd_mychip_free(chip);
1162 return -EBUSY; 1155 return -EBUSY;
@@ -1268,14 +1261,14 @@
1268 1261
1269 <para> 1262 <para>
1270 Now assume that this PCI device has an I/O port with 8 bytes 1263 Now assume that this PCI device has an I/O port with 8 bytes
1271 and an interrupt. Then <type>mychip_t</type> will have the 1264 and an interrupt. Then struct <structname>mychip</structname> will have the
1272 following fields: 1265 following fields:
1273 1266
1274 <informalexample> 1267 <informalexample>
1275 <programlisting> 1268 <programlisting>
1276<![CDATA[ 1269<![CDATA[
1277 struct snd_mychip { 1270 struct mychip {
1278 snd_card_t *card; 1271 struct snd_card *card;
1279 1272
1280 unsigned long port; 1273 unsigned long port;
1281 int irq; 1274 int irq;
@@ -1330,8 +1323,7 @@
1330 <programlisting> 1323 <programlisting>
1331<![CDATA[ 1324<![CDATA[
1332 if (request_irq(pci->irq, snd_mychip_interrupt, 1325 if (request_irq(pci->irq, snd_mychip_interrupt,
1333 SA_INTERRUPT|SA_SHIRQ, "My Chip", 1326 SA_INTERRUPT|SA_SHIRQ, "My Chip", chip)) {
1334 (void *)chip)) {
1335 printk(KERN_ERR "cannot grab irq %d\n", pci->irq); 1327 printk(KERN_ERR "cannot grab irq %d\n", pci->irq);
1336 snd_mychip_free(chip); 1328 snd_mychip_free(chip);
1337 return -EBUSY; 1329 return -EBUSY;
@@ -1372,7 +1364,7 @@
1372 static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id, 1364 static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id,
1373 struct pt_regs *regs) 1365 struct pt_regs *regs)
1374 { 1366 {
1375 mychip_t *chip = dev_id; 1367 struct mychip *chip = dev_id;
1376 .... 1368 ....
1377 return IRQ_HANDLED; 1369 return IRQ_HANDLED;
1378 } 1370 }
@@ -1487,7 +1479,7 @@
1487 <informalexample> 1479 <informalexample>
1488 <programlisting> 1480 <programlisting>
1489<![CDATA[ 1481<![CDATA[
1490 struct snd_mychip { 1482 struct mychip {
1491 .... 1483 ....
1492 unsigned long iobase_phys; 1484 unsigned long iobase_phys;
1493 void __iomem *iobase_virt; 1485 void __iomem *iobase_virt;
@@ -1517,7 +1509,7 @@
1517 <informalexample> 1509 <informalexample>
1518 <programlisting> 1510 <programlisting>
1519<![CDATA[ 1511<![CDATA[
1520 static int snd_mychip_free(mychip_t *chip) 1512 static int snd_mychip_free(struct mychip *chip)
1521 { 1513 {
1522 .... 1514 ....
1523 if (chip->iobase_virt) 1515 if (chip->iobase_virt)
@@ -1537,7 +1529,7 @@
1537 <title>Registration of Device Struct</title> 1529 <title>Registration of Device Struct</title>
1538 <para> 1530 <para>
1539 At some point, typically after calling <function>snd_device_new()</function>, 1531 At some point, typically after calling <function>snd_device_new()</function>,
1540 you need to register the <structname>struct device</structname> of the chip 1532 you need to register the struct <structname>device</structname> of the chip
1541 you're handling for udev and co. ALSA provides a macro for compatibility with 1533 you're handling for udev and co. ALSA provides a macro for compatibility with
1542 older kernels. Simply call like the following: 1534 older kernels. Simply call like the following:
1543 <informalexample> 1535 <informalexample>
@@ -1739,7 +1731,7 @@
1739 .... 1731 ....
1740 1732
1741 /* hardware definition */ 1733 /* hardware definition */
1742 static snd_pcm_hardware_t snd_mychip_playback_hw = { 1734 static struct snd_pcm_hardware snd_mychip_playback_hw = {
1743 .info = (SNDRV_PCM_INFO_MMAP | 1735 .info = (SNDRV_PCM_INFO_MMAP |
1744 SNDRV_PCM_INFO_INTERLEAVED | 1736 SNDRV_PCM_INFO_INTERLEAVED |
1745 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1737 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -1758,7 +1750,7 @@
1758 }; 1750 };
1759 1751
1760 /* hardware definition */ 1752 /* hardware definition */
1761 static snd_pcm_hardware_t snd_mychip_capture_hw = { 1753 static struct snd_pcm_hardware snd_mychip_capture_hw = {
1762 .info = (SNDRV_PCM_INFO_MMAP | 1754 .info = (SNDRV_PCM_INFO_MMAP |
1763 SNDRV_PCM_INFO_INTERLEAVED | 1755 SNDRV_PCM_INFO_INTERLEAVED |
1764 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1756 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -1777,10 +1769,10 @@
1777 }; 1769 };
1778 1770
1779 /* open callback */ 1771 /* open callback */
1780 static int snd_mychip_playback_open(snd_pcm_substream_t *substream) 1772 static int snd_mychip_playback_open(struct snd_pcm_substream *substream)
1781 { 1773 {
1782 mychip_t *chip = snd_pcm_substream_chip(substream); 1774 struct mychip *chip = snd_pcm_substream_chip(substream);
1783 snd_pcm_runtime_t *runtime = substream->runtime; 1775 struct snd_pcm_runtime *runtime = substream->runtime;
1784 1776
1785 runtime->hw = snd_mychip_playback_hw; 1777 runtime->hw = snd_mychip_playback_hw;
1786 // more hardware-initialization will be done here 1778 // more hardware-initialization will be done here
@@ -1788,19 +1780,19 @@
1788 } 1780 }
1789 1781
1790 /* close callback */ 1782 /* close callback */
1791 static int snd_mychip_playback_close(snd_pcm_substream_t *substream) 1783 static int snd_mychip_playback_close(struct snd_pcm_substream *substream)
1792 { 1784 {
1793 mychip_t *chip = snd_pcm_substream_chip(substream); 1785 struct mychip *chip = snd_pcm_substream_chip(substream);
1794 // the hardware-specific codes will be here 1786 // the hardware-specific codes will be here
1795 return 0; 1787 return 0;
1796 1788
1797 } 1789 }
1798 1790
1799 /* open callback */ 1791 /* open callback */
1800 static int snd_mychip_capture_open(snd_pcm_substream_t *substream) 1792 static int snd_mychip_capture_open(struct snd_pcm_substream *substream)
1801 { 1793 {
1802 mychip_t *chip = snd_pcm_substream_chip(substream); 1794 struct mychip *chip = snd_pcm_substream_chip(substream);
1803 snd_pcm_runtime_t *runtime = substream->runtime; 1795 struct snd_pcm_runtime *runtime = substream->runtime;
1804 1796
1805 runtime->hw = snd_mychip_capture_hw; 1797 runtime->hw = snd_mychip_capture_hw;
1806 // more hardware-initialization will be done here 1798 // more hardware-initialization will be done here
@@ -1808,33 +1800,33 @@
1808 } 1800 }
1809 1801
1810 /* close callback */ 1802 /* close callback */
1811 static int snd_mychip_capture_close(snd_pcm_substream_t *substream) 1803 static int snd_mychip_capture_close(struct snd_pcm_substream *substream)
1812 { 1804 {
1813 mychip_t *chip = snd_pcm_substream_chip(substream); 1805 struct mychip *chip = snd_pcm_substream_chip(substream);
1814 // the hardware-specific codes will be here 1806 // the hardware-specific codes will be here
1815 return 0; 1807 return 0;
1816 1808
1817 } 1809 }
1818 1810
1819 /* hw_params callback */ 1811 /* hw_params callback */
1820 static int snd_mychip_pcm_hw_params(snd_pcm_substream_t *substream, 1812 static int snd_mychip_pcm_hw_params(struct snd_pcm_substream *substream,
1821 snd_pcm_hw_params_t * hw_params) 1813 struct snd_pcm_hw_params *hw_params)
1822 { 1814 {
1823 return snd_pcm_lib_malloc_pages(substream, 1815 return snd_pcm_lib_malloc_pages(substream,
1824 params_buffer_bytes(hw_params)); 1816 params_buffer_bytes(hw_params));
1825 } 1817 }
1826 1818
1827 /* hw_free callback */ 1819 /* hw_free callback */
1828 static int snd_mychip_pcm_hw_free(snd_pcm_substream_t *substream) 1820 static int snd_mychip_pcm_hw_free(struct snd_pcm_substream *substream)
1829 { 1821 {
1830 return snd_pcm_lib_free_pages(substream); 1822 return snd_pcm_lib_free_pages(substream);
1831 } 1823 }
1832 1824
1833 /* prepare callback */ 1825 /* prepare callback */
1834 static int snd_mychip_pcm_prepare(snd_pcm_substream_t *substream) 1826 static int snd_mychip_pcm_prepare(struct snd_pcm_substream *substream)
1835 { 1827 {
1836 mychip_t *chip = snd_pcm_substream_chip(substream); 1828 struct mychip *chip = snd_pcm_substream_chip(substream);
1837 snd_pcm_runtime_t *runtime = substream->runtime; 1829 struct snd_pcm_runtime *runtime = substream->runtime;
1838 1830
1839 /* set up the hardware with the current configuration 1831 /* set up the hardware with the current configuration
1840 * for example... 1832 * for example...
@@ -1849,7 +1841,7 @@
1849 } 1841 }
1850 1842
1851 /* trigger callback */ 1843 /* trigger callback */
1852 static int snd_mychip_pcm_trigger(snd_pcm_substream_t *substream, 1844 static int snd_mychip_pcm_trigger(struct snd_pcm_substream *substream,
1853 int cmd) 1845 int cmd)
1854 { 1846 {
1855 switch (cmd) { 1847 switch (cmd) {
@@ -1866,9 +1858,9 @@
1866 1858
1867 /* pointer callback */ 1859 /* pointer callback */
1868 static snd_pcm_uframes_t 1860 static snd_pcm_uframes_t
1869 snd_mychip_pcm_pointer(snd_pcm_substream_t *substream) 1861 snd_mychip_pcm_pointer(struct snd_pcm_substream *substream)
1870 { 1862 {
1871 mychip_t *chip = snd_pcm_substream_chip(substream); 1863 struct mychip *chip = snd_pcm_substream_chip(substream);
1872 unsigned int current_ptr; 1864 unsigned int current_ptr;
1873 1865
1874 /* get the current hardware pointer */ 1866 /* get the current hardware pointer */
@@ -1877,7 +1869,7 @@
1877 } 1869 }
1878 1870
1879 /* operators */ 1871 /* operators */
1880 static snd_pcm_ops_t snd_mychip_playback_ops = { 1872 static struct snd_pcm_ops snd_mychip_playback_ops = {
1881 .open = snd_mychip_playback_open, 1873 .open = snd_mychip_playback_open,
1882 .close = snd_mychip_playback_close, 1874 .close = snd_mychip_playback_close,
1883 .ioctl = snd_pcm_lib_ioctl, 1875 .ioctl = snd_pcm_lib_ioctl,
@@ -1889,7 +1881,7 @@
1889 }; 1881 };
1890 1882
1891 /* operators */ 1883 /* operators */
1892 static snd_pcm_ops_t snd_mychip_capture_ops = { 1884 static struct snd_pcm_ops snd_mychip_capture_ops = {
1893 .open = snd_mychip_capture_open, 1885 .open = snd_mychip_capture_open,
1894 .close = snd_mychip_capture_close, 1886 .close = snd_mychip_capture_close,
1895 .ioctl = snd_pcm_lib_ioctl, 1887 .ioctl = snd_pcm_lib_ioctl,
@@ -1905,9 +1897,9 @@
1905 */ 1897 */
1906 1898
1907 /* create a pcm device */ 1899 /* create a pcm device */
1908 static int __devinit snd_mychip_new_pcm(mychip_t *chip) 1900 static int __devinit snd_mychip_new_pcm(struct mychip *chip)
1909 { 1901 {
1910 snd_pcm_t *pcm; 1902 struct snd_pcm *pcm;
1911 int err; 1903 int err;
1912 1904
1913 if ((err = snd_pcm_new(chip->card, "My Chip", 0, 1, 1, 1905 if ((err = snd_pcm_new(chip->card, "My Chip", 0, 1, 1,
@@ -1944,9 +1936,9 @@
1944 <informalexample> 1936 <informalexample>
1945 <programlisting> 1937 <programlisting>
1946<![CDATA[ 1938<![CDATA[
1947 static int __devinit snd_mychip_new_pcm(mychip_t *chip) 1939 static int __devinit snd_mychip_new_pcm(struct mychip *chip)
1948 { 1940 {
1949 snd_pcm_t *pcm; 1941 struct snd_pcm *pcm;
1950 int err; 1942 int err;
1951 1943
1952 if ((err = snd_pcm_new(chip->card, "My Chip", 0, 1, 1, 1944 if ((err = snd_pcm_new(chip->card, "My Chip", 0, 1, 1,
@@ -1989,13 +1981,13 @@
1989 specify more numbers, but they must be handled properly in 1981 specify more numbers, but they must be handled properly in
1990 open/close, etc. callbacks. When you need to know which 1982 open/close, etc. callbacks. When you need to know which
1991 substream you are referring to, then it can be obtained from 1983 substream you are referring to, then it can be obtained from
1992 <type>snd_pcm_substream_t</type> data passed to each callback 1984 struct <structname>snd_pcm_substream</structname> data passed to each callback
1993 as follows: 1985 as follows:
1994 1986
1995 <informalexample> 1987 <informalexample>
1996 <programlisting> 1988 <programlisting>
1997<![CDATA[ 1989<![CDATA[
1998 snd_pcm_substream_t *substream; 1990 struct snd_pcm_substream *substream;
1999 int index = substream->number; 1991 int index = substream->number;
2000]]> 1992]]>
2001 </programlisting> 1993 </programlisting>
@@ -2024,7 +2016,7 @@
2024 <informalexample> 2016 <informalexample>
2025 <programlisting> 2017 <programlisting>
2026<![CDATA[ 2018<![CDATA[
2027 static snd_pcm_ops_t snd_mychip_playback_ops = { 2019 static struct snd_pcm_ops snd_mychip_playback_ops = {
2028 .open = snd_mychip_pcm_open, 2020 .open = snd_mychip_pcm_open,
2029 .close = snd_mychip_pcm_close, 2021 .close = snd_mychip_pcm_close,
2030 .ioctl = snd_pcm_lib_ioctl, 2022 .ioctl = snd_pcm_lib_ioctl,
@@ -2102,18 +2094,18 @@
2102 <title>PCM Instance with a Destructor</title> 2094 <title>PCM Instance with a Destructor</title>
2103 <programlisting> 2095 <programlisting>
2104<![CDATA[ 2096<![CDATA[
2105 static void mychip_pcm_free(snd_pcm_t *pcm) 2097 static void mychip_pcm_free(struct snd_pcm *pcm)
2106 { 2098 {
2107 mychip_t *chip = snd_pcm_chip(pcm); 2099 struct mychip *chip = snd_pcm_chip(pcm);
2108 /* free your own data */ 2100 /* free your own data */
2109 kfree(chip->my_private_pcm_data); 2101 kfree(chip->my_private_pcm_data);
2110 // do what you like else 2102 // do what you like else
2111 .... 2103 ....
2112 } 2104 }
2113 2105
2114 static int __devinit snd_mychip_new_pcm(mychip_t *chip) 2106 static int __devinit snd_mychip_new_pcm(struct mychip *chip)
2115 { 2107 {
2116 snd_pcm_t *pcm; 2108 struct snd_pcm *pcm;
2117 .... 2109 ....
2118 /* allocate your own data */ 2110 /* allocate your own data */
2119 chip->my_private_pcm_data = kmalloc(...); 2111 chip->my_private_pcm_data = kmalloc(...);
@@ -2149,7 +2141,7 @@
2149<![CDATA[ 2141<![CDATA[
2150struct _snd_pcm_runtime { 2142struct _snd_pcm_runtime {
2151 /* -- Status -- */ 2143 /* -- Status -- */
2152 snd_pcm_substream_t *trigger_master; 2144 struct snd_pcm_substream *trigger_master;
2153 snd_timestamp_t trigger_tstamp; /* trigger timestamp */ 2145 snd_timestamp_t trigger_tstamp; /* trigger timestamp */
2154 int overrange; 2146 int overrange;
2155 snd_pcm_uframes_t avail_max; 2147 snd_pcm_uframes_t avail_max;
@@ -2192,8 +2184,8 @@ struct _snd_pcm_runtime {
2192 snd_pcm_sync_id_t sync; /* hardware synchronization ID */ 2184 snd_pcm_sync_id_t sync; /* hardware synchronization ID */
2193 2185
2194 /* -- mmap -- */ 2186 /* -- mmap -- */
2195 volatile snd_pcm_mmap_status_t *status; 2187 volatile struct snd_pcm_mmap_status *status;
2196 volatile snd_pcm_mmap_control_t *control; 2188 volatile struct snd_pcm_mmap_control *control;
2197 atomic_t mmap_count; 2189 atomic_t mmap_count;
2198 2190
2199 /* -- locking / scheduling -- */ 2191 /* -- locking / scheduling -- */
@@ -2204,15 +2196,15 @@ struct _snd_pcm_runtime {
2204 2196
2205 /* -- private section -- */ 2197 /* -- private section -- */
2206 void *private_data; 2198 void *private_data;
2207 void (*private_free)(snd_pcm_runtime_t *runtime); 2199 void (*private_free)(struct snd_pcm_runtime *runtime);
2208 2200
2209 /* -- hardware description -- */ 2201 /* -- hardware description -- */
2210 snd_pcm_hardware_t hw; 2202 struct snd_pcm_hardware hw;
2211 snd_pcm_hw_constraints_t hw_constraints; 2203 struct snd_pcm_hw_constraints hw_constraints;
2212 2204
2213 /* -- interrupt callbacks -- */ 2205 /* -- interrupt callbacks -- */
2214 void (*transfer_ack_begin)(snd_pcm_substream_t *substream); 2206 void (*transfer_ack_begin)(struct snd_pcm_substream *substream);
2215 void (*transfer_ack_end)(snd_pcm_substream_t *substream); 2207 void (*transfer_ack_end)(struct snd_pcm_substream *substream);
2216 2208
2217 /* -- timer -- */ 2209 /* -- timer -- */
2218 unsigned int timer_resolution; /* timer resolution */ 2210 unsigned int timer_resolution; /* timer resolution */
@@ -2226,7 +2218,7 @@ struct _snd_pcm_runtime {
2226 2218
2227#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE) 2219#if defined(CONFIG_SND_PCM_OSS) || defined(CONFIG_SND_PCM_OSS_MODULE)
2228 /* -- OSS things -- */ 2220 /* -- OSS things -- */
2229 snd_pcm_oss_runtime_t oss; 2221 struct snd_pcm_oss_runtime oss;
2230#endif 2222#endif
2231}; 2223};
2232]]> 2224]]>
@@ -2252,7 +2244,7 @@ struct _snd_pcm_runtime {
2252 <section id="pcm-interface-runtime-hw"> 2244 <section id="pcm-interface-runtime-hw">
2253 <title>Hardware Description</title> 2245 <title>Hardware Description</title>
2254 <para> 2246 <para>
2255 The hardware descriptor (<type>snd_pcm_hardware_t</type>) 2247 The hardware descriptor (struct <structname>snd_pcm_hardware</structname>)
2256 contains the definitions of the fundamental hardware 2248 contains the definitions of the fundamental hardware
2257 configuration. Above all, you'll need to define this in 2249 configuration. Above all, you'll need to define this in
2258 <link linkend="pcm-interface-operators-open-callback"><citetitle> 2250 <link linkend="pcm-interface-operators-open-callback"><citetitle>
@@ -2267,7 +2259,7 @@ struct _snd_pcm_runtime {
2267 <informalexample> 2259 <informalexample>
2268 <programlisting> 2260 <programlisting>
2269<![CDATA[ 2261<![CDATA[
2270 snd_pcm_runtime_t *runtime = substream->runtime; 2262 struct snd_pcm_runtime *runtime = substream->runtime;
2271 ... 2263 ...
2272 runtime->hw = snd_mychip_playback_hw; /* common definition */ 2264 runtime->hw = snd_mychip_playback_hw; /* common definition */
2273 if (chip->model == VERY_OLD_ONE) 2265 if (chip->model == VERY_OLD_ONE)
@@ -2282,7 +2274,7 @@ struct _snd_pcm_runtime {
2282 <informalexample> 2274 <informalexample>
2283 <programlisting> 2275 <programlisting>
2284<![CDATA[ 2276<![CDATA[
2285 static snd_pcm_hardware_t snd_mychip_playback_hw = { 2277 static struct snd_pcm_hardware snd_mychip_playback_hw = {
2286 .info = (SNDRV_PCM_INFO_MMAP | 2278 .info = (SNDRV_PCM_INFO_MMAP |
2287 SNDRV_PCM_INFO_INTERLEAVED | 2279 SNDRV_PCM_INFO_INTERLEAVED |
2288 SNDRV_PCM_INFO_BLOCK_TRANSFER | 2280 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -2337,9 +2329,14 @@ struct _snd_pcm_runtime {
2337 <constant>PAUSE</constant> bit means that the pcm supports the 2329 <constant>PAUSE</constant> bit means that the pcm supports the
2338 <quote>pause</quote> operation, while the 2330 <quote>pause</quote> operation, while the
2339 <constant>RESUME</constant> bit means that the pcm supports 2331 <constant>RESUME</constant> bit means that the pcm supports
2340 the <quote>suspend/resume</quote> operation. If these flags 2332 the full <quote>suspend/resume</quote> operation.
2341 are set, the <structfield>trigger</structfield> callback below 2333 If <constant>PAUSE</constant> flag is set,
2342 must handle the corresponding commands. 2334 the <structfield>trigger</structfield> callback below
2335 must handle the corresponding (pause push/release) commands.
2336 The suspend/resume trigger commands can be defined even without
2337 <constant>RESUME</constant> flag. See <link
2338 linkend="power-management"><citetitle>
2339 Power Management</citetitle></link> section for details.
2343 </para> 2340 </para>
2344 2341
2345 <para> 2342 <para>
@@ -2512,7 +2509,7 @@ struct _snd_pcm_runtime {
2512 <title>Running Status</title> 2509 <title>Running Status</title>
2513 <para> 2510 <para>
2514 The running status can be referred via <constant>runtime-&gt;status</constant>. 2511 The running status can be referred via <constant>runtime-&gt;status</constant>.
2515 This is the pointer to <type>snd_pcm_mmap_status_t</type> 2512 This is the pointer to struct <structname>snd_pcm_mmap_status</structname>
2516 record. For example, you can get the current DMA hardware 2513 record. For example, you can get the current DMA hardware
2517 pointer via <constant>runtime-&gt;status-&gt;hw_ptr</constant>. 2514 pointer via <constant>runtime-&gt;status-&gt;hw_ptr</constant>.
2518 </para> 2515 </para>
@@ -2520,7 +2517,7 @@ struct _snd_pcm_runtime {
2520 <para> 2517 <para>
2521 The DMA application pointer can be referred via 2518 The DMA application pointer can be referred via
2522 <constant>runtime-&gt;control</constant>, which points 2519 <constant>runtime-&gt;control</constant>, which points
2523 <type>snd_pcm_mmap_control_t</type> record. 2520 struct <structname>snd_pcm_mmap_control</structname> record.
2524 However, accessing directly to this value is not recommended. 2521 However, accessing directly to this value is not recommended.
2525 </para> 2522 </para>
2526 </section> 2523 </section>
@@ -2542,9 +2539,9 @@ struct _snd_pcm_runtime {
2542 <informalexample> 2539 <informalexample>
2543 <programlisting> 2540 <programlisting>
2544<![CDATA[ 2541<![CDATA[
2545 static int snd_xxx_open(snd_pcm_substream_t *substream) 2542 static int snd_xxx_open(struct snd_pcm_substream *substream)
2546 { 2543 {
2547 my_pcm_data_t *data; 2544 struct my_pcm_data *data;
2548 .... 2545 ....
2549 data = kmalloc(sizeof(*data), GFP_KERNEL); 2546 data = kmalloc(sizeof(*data), GFP_KERNEL);
2550 substream->runtime->private_data = data; 2547 substream->runtime->private_data = data;
@@ -2586,7 +2583,7 @@ struct _snd_pcm_runtime {
2586 2583
2587 <para> 2584 <para>
2588 The callback function takes at least the argument with 2585 The callback function takes at least the argument with
2589 <type>snd_pcm_substream_t</type> pointer. For retrieving the 2586 <structname>snd_pcm_substream</structname> pointer. For retrieving the
2590 chip record from the given substream instance, you can use the 2587 chip record from the given substream instance, you can use the
2591 following macro. 2588 following macro.
2592 2589
@@ -2594,7 +2591,7 @@ struct _snd_pcm_runtime {
2594 <programlisting> 2591 <programlisting>
2595<![CDATA[ 2592<![CDATA[
2596 int xxx() { 2593 int xxx() {
2597 mychip_t *chip = snd_pcm_substream_chip(substream); 2594 struct mychip *chip = snd_pcm_substream_chip(substream);
2598 .... 2595 ....
2599 } 2596 }
2600]]> 2597]]>
@@ -2616,7 +2613,7 @@ struct _snd_pcm_runtime {
2616 <informalexample> 2613 <informalexample>
2617 <programlisting> 2614 <programlisting>
2618<![CDATA[ 2615<![CDATA[
2619 static int snd_xxx_open(snd_pcm_substream_t *substream); 2616 static int snd_xxx_open(struct snd_pcm_substream *substream);
2620]]> 2617]]>
2621 </programlisting> 2618 </programlisting>
2622 </informalexample> 2619 </informalexample>
@@ -2631,10 +2628,10 @@ struct _snd_pcm_runtime {
2631 <informalexample> 2628 <informalexample>
2632 <programlisting> 2629 <programlisting>
2633<![CDATA[ 2630<![CDATA[
2634 static int snd_xxx_open(snd_pcm_substream_t *substream) 2631 static int snd_xxx_open(struct snd_pcm_substream *substream)
2635 { 2632 {
2636 mychip_t *chip = snd_pcm_substream_chip(substream); 2633 struct mychip *chip = snd_pcm_substream_chip(substream);
2637 snd_pcm_runtime_t *runtime = substream->runtime; 2634 struct snd_pcm_runtime *runtime = substream->runtime;
2638 2635
2639 runtime->hw = snd_mychip_playback_hw; 2636 runtime->hw = snd_mychip_playback_hw;
2640 return 0; 2637 return 0;
@@ -2667,7 +2664,7 @@ struct _snd_pcm_runtime {
2667 <informalexample> 2664 <informalexample>
2668 <programlisting> 2665 <programlisting>
2669<![CDATA[ 2666<![CDATA[
2670 static int snd_xxx_close(snd_pcm_substream_t *substream); 2667 static int snd_xxx_close(struct snd_pcm_substream *substream);
2671]]> 2668]]>
2672 </programlisting> 2669 </programlisting>
2673 </informalexample> 2670 </informalexample>
@@ -2682,7 +2679,7 @@ struct _snd_pcm_runtime {
2682 <informalexample> 2679 <informalexample>
2683 <programlisting> 2680 <programlisting>
2684<![CDATA[ 2681<![CDATA[
2685 static int snd_xxx_close(snd_pcm_substream_t *substream) 2682 static int snd_xxx_close(struct snd_pcm_substream *substream)
2686 { 2683 {
2687 .... 2684 ....
2688 kfree(substream->runtime->private_data); 2685 kfree(substream->runtime->private_data);
@@ -2709,8 +2706,8 @@ struct _snd_pcm_runtime {
2709 <informalexample> 2706 <informalexample>
2710 <programlisting> 2707 <programlisting>
2711<![CDATA[ 2708<![CDATA[
2712 static int snd_xxx_hw_params(snd_pcm_substream_t * substream, 2709 static int snd_xxx_hw_params(struct snd_pcm_substream *substream,
2713 snd_pcm_hw_params_t * hw_params); 2710 struct snd_pcm_hw_params *hw_params);
2714]]> 2711]]>
2715 </programlisting> 2712 </programlisting>
2716 </informalexample> 2713 </informalexample>
@@ -2785,7 +2782,7 @@ struct _snd_pcm_runtime {
2785 <informalexample> 2782 <informalexample>
2786 <programlisting> 2783 <programlisting>
2787<![CDATA[ 2784<![CDATA[
2788 static int snd_xxx_hw_free(snd_pcm_substream_t * substream); 2785 static int snd_xxx_hw_free(struct snd_pcm_substream *substream);
2789]]> 2786]]>
2790 </programlisting> 2787 </programlisting>
2791 </informalexample> 2788 </informalexample>
@@ -2820,7 +2817,7 @@ struct _snd_pcm_runtime {
2820 <informalexample> 2817 <informalexample>
2821 <programlisting> 2818 <programlisting>
2822<![CDATA[ 2819<![CDATA[
2823 static int snd_xxx_prepare(snd_pcm_substream_t * substream); 2820 static int snd_xxx_prepare(struct snd_pcm_substream *substream);
2824]]> 2821]]>
2825 </programlisting> 2822 </programlisting>
2826 </informalexample> 2823 </informalexample>
@@ -2869,7 +2866,7 @@ struct _snd_pcm_runtime {
2869 <informalexample> 2866 <informalexample>
2870 <programlisting> 2867 <programlisting>
2871<![CDATA[ 2868<![CDATA[
2872 static int snd_xxx_trigger(snd_pcm_substream_t * substream, int cmd); 2869 static int snd_xxx_trigger(struct snd_pcm_substream *substream, int cmd);
2873]]> 2870]]>
2874 </programlisting> 2871 </programlisting>
2875 </informalexample> 2872 </informalexample>
@@ -2911,8 +2908,8 @@ struct _snd_pcm_runtime {
2911 </para> 2908 </para>
2912 2909
2913 <para> 2910 <para>
2914 When the pcm supports the suspend/resume operation 2911 When the pcm supports the suspend/resume operation,
2915 (i.e. <constant>SNDRV_PCM_INFO_RESUME</constant> flag is set), 2912 regardless of full or partial suspend/resume support,
2916 <constant>SUSPEND</constant> and <constant>RESUME</constant> 2913 <constant>SUSPEND</constant> and <constant>RESUME</constant>
2917 commands must be handled, too. 2914 commands must be handled, too.
2918 These commands are issued when the power-management status is 2915 These commands are issued when the power-management status is
@@ -2921,6 +2918,8 @@ struct _snd_pcm_runtime {
2921 do suspend and resume of the pcm substream, and usually, they 2918 do suspend and resume of the pcm substream, and usually, they
2922 are identical with <constant>STOP</constant> and 2919 are identical with <constant>STOP</constant> and
2923 <constant>START</constant> commands, respectively. 2920 <constant>START</constant> commands, respectively.
2921 See <link linkend="power-management"><citetitle>
2922 Power Management</citetitle></link> section for details.
2924 </para> 2923 </para>
2925 2924
2926 <para> 2925 <para>
@@ -2939,7 +2938,7 @@ struct _snd_pcm_runtime {
2939 <informalexample> 2938 <informalexample>
2940 <programlisting> 2939 <programlisting>
2941<![CDATA[ 2940<![CDATA[
2942 static snd_pcm_uframes_t snd_xxx_pointer(snd_pcm_substream_t * substream) 2941 static snd_pcm_uframes_t snd_xxx_pointer(struct snd_pcm_substream *substream)
2943]]> 2942]]>
2944 </programlisting> 2943 </programlisting>
2945 </informalexample> 2944 </informalexample>
@@ -3067,7 +3066,7 @@ struct _snd_pcm_runtime {
3067 static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id, 3066 static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id,
3068 struct pt_regs *regs) 3067 struct pt_regs *regs)
3069 { 3068 {
3070 mychip_t *chip = dev_id; 3069 struct mychip *chip = dev_id;
3071 spin_lock(&chip->lock); 3070 spin_lock(&chip->lock);
3072 .... 3071 ....
3073 if (pcm_irq_invoked(chip)) { 3072 if (pcm_irq_invoked(chip)) {
@@ -3111,7 +3110,7 @@ struct _snd_pcm_runtime {
3111 static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id, 3110 static irqreturn_t snd_mychip_interrupt(int irq, void *dev_id,
3112 struct pt_regs *regs) 3111 struct pt_regs *regs)
3113 { 3112 {
3114 mychip_t *chip = dev_id; 3113 struct mychip *chip = dev_id;
3115 spin_lock(&chip->lock); 3114 spin_lock(&chip->lock);
3116 .... 3115 ....
3117 if (pcm_irq_invoked(chip)) { 3116 if (pcm_irq_invoked(chip)) {
@@ -3221,13 +3220,13 @@ struct _snd_pcm_runtime {
3221<![CDATA[ 3220<![CDATA[
3222 static unsigned int rates[] = 3221 static unsigned int rates[] =
3223 {4000, 10000, 22050, 44100}; 3222 {4000, 10000, 22050, 44100};
3224 static snd_pcm_hw_constraint_list_t constraints_rates = { 3223 static struct snd_pcm_hw_constraint_list constraints_rates = {
3225 .count = ARRAY_SIZE(rates), 3224 .count = ARRAY_SIZE(rates),
3226 .list = rates, 3225 .list = rates,
3227 .mask = 0, 3226 .mask = 0,
3228 }; 3227 };
3229 3228
3230 static int snd_mychip_pcm_open(snd_pcm_substream_t *substream) 3229 static int snd_mychip_pcm_open(struct snd_pcm_substream *substream)
3231 { 3230 {
3232 int err; 3231 int err;
3233 .... 3232 ....
@@ -3249,19 +3248,20 @@ struct _snd_pcm_runtime {
3249 You can even define your own constraint rules. 3248 You can even define your own constraint rules.
3250 For example, let's suppose my_chip can manage a substream of 1 channel 3249 For example, let's suppose my_chip can manage a substream of 1 channel
3251 if and only if the format is S16_LE, otherwise it supports any format 3250 if and only if the format is S16_LE, otherwise it supports any format
3252 specified in the <type>snd_pcm_hardware_t</type> stucture (or in any 3251 specified in the <structname>snd_pcm_hardware</structname> stucture (or in any
3253 other constraint_list). You can build a rule like this: 3252 other constraint_list). You can build a rule like this:
3254 3253
3255 <example> 3254 <example>
3256 <title>Example of Hardware Constraints for Channels</title> 3255 <title>Example of Hardware Constraints for Channels</title>
3257 <programlisting> 3256 <programlisting>
3258<![CDATA[ 3257<![CDATA[
3259 static int hw_rule_format_by_channels(snd_pcm_hw_params_t *params, 3258 static int hw_rule_format_by_channels(struct snd_pcm_hw_params *params,
3260 snd_pcm_hw_rule_t *rule) 3259 struct snd_pcm_hw_rule *rule)
3261 { 3260 {
3262 snd_interval_t *c = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); 3261 struct snd_interval *c = hw_param_interval(params,
3263 snd_mask_t *f = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); 3262 SNDRV_PCM_HW_PARAM_CHANNELS);
3264 snd_mask_t fmt; 3263 struct snd_mask *f = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
3264 struct snd_mask fmt;
3265 3265
3266 snd_mask_any(&fmt); /* Init the struct */ 3266 snd_mask_any(&fmt); /* Init the struct */
3267 if (c->min < 2) { 3267 if (c->min < 2) {
@@ -3298,12 +3298,13 @@ struct _snd_pcm_runtime {
3298 <title>Example of Hardware Constraints for Channels</title> 3298 <title>Example of Hardware Constraints for Channels</title>
3299 <programlisting> 3299 <programlisting>
3300<![CDATA[ 3300<![CDATA[
3301 static int hw_rule_channels_by_format(snd_pcm_hw_params_t *params, 3301 static int hw_rule_channels_by_format(struct snd_pcm_hw_params *params,
3302 snd_pcm_hw_rule_t *rule) 3302 struct snd_pcm_hw_rule *rule)
3303 { 3303 {
3304 snd_interval_t *c = hw_param_interval(params, SNDRV_PCM_HW_PARAM_CHANNELS); 3304 struct snd_interval *c = hw_param_interval(params,
3305 snd_mask_t *f = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT); 3305 SNDRV_PCM_HW_PARAM_CHANNELS);
3306 snd_interval_t ch; 3306 struct snd_mask *f = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
3307 struct snd_interval ch;
3307 3308
3308 snd_interval_any(&ch); 3309 snd_interval_any(&ch);
3309 if (f->bits[0] == SNDRV_PCM_FMTBIT_S16_LE) { 3310 if (f->bits[0] == SNDRV_PCM_FMTBIT_S16_LE) {
@@ -3376,13 +3377,13 @@ struct _snd_pcm_runtime {
3376 callbacks: <structfield>info</structfield>, 3377 callbacks: <structfield>info</structfield>,
3377 <structfield>get</structfield> and 3378 <structfield>get</structfield> and
3378 <structfield>put</structfield>. Then, define a 3379 <structfield>put</structfield>. Then, define a
3379 <type>snd_kcontrol_new_t</type> record, such as: 3380 struct <structname>snd_kcontrol_new</structname> record, such as:
3380 3381
3381 <example> 3382 <example>
3382 <title>Definition of a Control</title> 3383 <title>Definition of a Control</title>
3383 <programlisting> 3384 <programlisting>
3384<![CDATA[ 3385<![CDATA[
3385 static snd_kcontrol_new_t my_control __devinitdata = { 3386 static struct snd_kcontrol_new my_control __devinitdata = {
3386 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 3387 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
3387 .name = "PCM Playback Switch", 3388 .name = "PCM Playback Switch",
3388 .index = 0, 3389 .index = 0,
@@ -3599,7 +3600,7 @@ struct _snd_pcm_runtime {
3599 <para> 3600 <para>
3600 The <structfield>info</structfield> callback is used to get 3601 The <structfield>info</structfield> callback is used to get
3601 the detailed information of this control. This must store the 3602 the detailed information of this control. This must store the
3602 values of the given <type>snd_ctl_elem_info_t</type> 3603 values of the given struct <structname>snd_ctl_elem_info</structname>
3603 object. For example, for a boolean control with a single 3604 object. For example, for a boolean control with a single
3604 element will be: 3605 element will be:
3605 3606
@@ -3607,8 +3608,8 @@ struct _snd_pcm_runtime {
3607 <title>Example of info callback</title> 3608 <title>Example of info callback</title>
3608 <programlisting> 3609 <programlisting>
3609<![CDATA[ 3610<![CDATA[
3610 static int snd_myctl_info(snd_kcontrol_t *kcontrol, 3611 static int snd_myctl_info(struct snd_kcontrol *kcontrol,
3611 snd_ctl_elem_info_t *uinfo) 3612 struct snd_ctl_elem_info *uinfo)
3612 { 3613 {
3613 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 3614 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
3614 uinfo->count = 1; 3615 uinfo->count = 1;
@@ -3642,8 +3643,8 @@ struct _snd_pcm_runtime {
3642 <informalexample> 3643 <informalexample>
3643 <programlisting> 3644 <programlisting>
3644<![CDATA[ 3645<![CDATA[
3645 static int snd_myctl_info(snd_kcontrol_t *kcontrol, 3646 static int snd_myctl_info(struct snd_kcontrol *kcontrol,
3646 snd_ctl_elem_info_t *uinfo) 3647 struct snd_ctl_elem_info *uinfo)
3647 { 3648 {
3648 static char *texts[4] = { 3649 static char *texts[4] = {
3649 "First", "Second", "Third", "Fourth" 3650 "First", "Second", "Third", "Fourth"
@@ -3678,10 +3679,10 @@ struct _snd_pcm_runtime {
3678 <title>Example of get callback</title> 3679 <title>Example of get callback</title>
3679 <programlisting> 3680 <programlisting>
3680<![CDATA[ 3681<![CDATA[
3681 static int snd_myctl_get(snd_kcontrol_t *kcontrol, 3682 static int snd_myctl_get(struct snd_kcontrol *kcontrol,
3682 snd_ctl_elem_value_t *ucontrol) 3683 struct snd_ctl_elem_value *ucontrol)
3683 { 3684 {
3684 mychip_t *chip = snd_kcontrol_chip(kcontrol); 3685 struct mychip *chip = snd_kcontrol_chip(kcontrol);
3685 ucontrol->value.integer.value[0] = get_some_value(chip); 3686 ucontrol->value.integer.value[0] = get_some_value(chip);
3686 return 0; 3687 return 0;
3687 } 3688 }
@@ -3717,8 +3718,8 @@ struct _snd_pcm_runtime {
3717 <informalexample> 3718 <informalexample>
3718 <programlisting> 3719 <programlisting>
3719<![CDATA[ 3720<![CDATA[
3720 static int snd_sbmixer_get_single(snd_kcontrol_t *kcontrol, 3721 static int snd_sbmixer_get_single(struct snd_kcontrol *kcontrol,
3721 snd_ctl_elem_value_t *ucontrol) 3722 struct snd_ctl_elem_value *ucontrol)
3722 { 3723 {
3723 int reg = kcontrol->private_value & 0xff; 3724 int reg = kcontrol->private_value & 0xff;
3724 int shift = (kcontrol->private_value >> 16) & 0xff; 3725 int shift = (kcontrol->private_value >> 16) & 0xff;
@@ -3754,10 +3755,10 @@ struct _snd_pcm_runtime {
3754 <title>Example of put callback</title> 3755 <title>Example of put callback</title>
3755 <programlisting> 3756 <programlisting>
3756<![CDATA[ 3757<![CDATA[
3757 static int snd_myctl_put(snd_kcontrol_t *kcontrol, 3758 static int snd_myctl_put(struct snd_kcontrol *kcontrol,
3758 snd_ctl_elem_value_t *ucontrol) 3759 struct snd_ctl_elem_value *ucontrol)
3759 { 3760 {
3760 mychip_t *chip = snd_kcontrol_chip(kcontrol); 3761 struct mychip *chip = snd_kcontrol_chip(kcontrol);
3761 int changed = 0; 3762 int changed = 0;
3762 if (chip->current_value != 3763 if (chip->current_value !=
3763 ucontrol->value.integer.value[0]) { 3764 ucontrol->value.integer.value[0]) {
@@ -3814,7 +3815,7 @@ struct _snd_pcm_runtime {
3814 </informalexample> 3815 </informalexample>
3815 3816
3816 where <parameter>my_control</parameter> is the 3817 where <parameter>my_control</parameter> is the
3817 <type>snd_kcontrol_new_t</type> object defined above, and chip 3818 struct <structname>snd_kcontrol_new</structname> object defined above, and chip
3818 is the object pointer to be passed to 3819 is the object pointer to be passed to
3819 kcontrol-&gt;private_data 3820 kcontrol-&gt;private_data
3820 which can be referred in callbacks. 3821 which can be referred in callbacks.
@@ -3822,7 +3823,7 @@ struct _snd_pcm_runtime {
3822 3823
3823 <para> 3824 <para>
3824 <function>snd_ctl_new1()</function> allocates a new 3825 <function>snd_ctl_new1()</function> allocates a new
3825 <type>snd_kcontrol_t</type> instance (that's why the definition 3826 <structname>snd_kcontrol</structname> instance (that's why the definition
3826 of <parameter>my_control</parameter> can be with 3827 of <parameter>my_control</parameter> can be with
3827 <parameter>__devinitdata</parameter> 3828 <parameter>__devinitdata</parameter>
3828 prefix), and <function>snd_ctl_add</function> assigns the given 3829 prefix), and <function>snd_ctl_add</function> assigns the given
@@ -3849,7 +3850,7 @@ struct _snd_pcm_runtime {
3849 control id pointer for the notification. The event-mask 3850 control id pointer for the notification. The event-mask
3850 specifies the types of notification, for example, in the above 3851 specifies the types of notification, for example, in the above
3851 example, the change of control values is notified. 3852 example, the change of control values is notified.
3852 The id pointer is the pointer of <type>snd_ctl_elem_id_t</type> 3853 The id pointer is the pointer of struct <structname>snd_ctl_elem_id</structname>
3853 to be notified. 3854 to be notified.
3854 You can find some examples in <filename>es1938.c</filename> or 3855 You can find some examples in <filename>es1938.c</filename> or
3855 <filename>es1968.c</filename> for hardware volume interrupts. 3856 <filename>es1968.c</filename> for hardware volume interrupts.
@@ -3882,35 +3883,35 @@ struct _snd_pcm_runtime {
3882 <title>Example of AC97 Interface</title> 3883 <title>Example of AC97 Interface</title>
3883 <programlisting> 3884 <programlisting>
3884<![CDATA[ 3885<![CDATA[
3885 struct snd_mychip { 3886 struct mychip {
3886 .... 3887 ....
3887 ac97_t *ac97; 3888 struct snd_ac97 *ac97;
3888 .... 3889 ....
3889 }; 3890 };
3890 3891
3891 static unsigned short snd_mychip_ac97_read(ac97_t *ac97, 3892 static unsigned short snd_mychip_ac97_read(struct snd_ac97 *ac97,
3892 unsigned short reg) 3893 unsigned short reg)
3893 { 3894 {
3894 mychip_t *chip = ac97->private_data; 3895 struct mychip *chip = ac97->private_data;
3895 .... 3896 ....
3896 // read a register value here from the codec 3897 // read a register value here from the codec
3897 return the_register_value; 3898 return the_register_value;
3898 } 3899 }
3899 3900
3900 static void snd_mychip_ac97_write(ac97_t *ac97, 3901 static void snd_mychip_ac97_write(struct snd_ac97 *ac97,
3901 unsigned short reg, unsigned short val) 3902 unsigned short reg, unsigned short val)
3902 { 3903 {
3903 mychip_t *chip = ac97->private_data; 3904 struct mychip *chip = ac97->private_data;
3904 .... 3905 ....
3905 // write the given register value to the codec 3906 // write the given register value to the codec
3906 } 3907 }
3907 3908
3908 static int snd_mychip_ac97(mychip_t *chip) 3909 static int snd_mychip_ac97(struct mychip *chip)
3909 { 3910 {
3910 ac97_bus_t *bus; 3911 struct snd_ac97_bus *bus;
3911 ac97_template_t ac97; 3912 struct snd_ac97_template ac97;
3912 int err; 3913 int err;
3913 static ac97_bus_ops_t ops = { 3914 static struct snd_ac97_bus_ops ops = {
3914 .write = snd_mychip_ac97_write, 3915 .write = snd_mychip_ac97_write,
3915 .read = snd_mychip_ac97_read, 3916 .read = snd_mychip_ac97_read,
3916 }; 3917 };
@@ -3937,8 +3938,8 @@ struct _snd_pcm_runtime {
3937 <informalexample> 3938 <informalexample>
3938 <programlisting> 3939 <programlisting>
3939<![CDATA[ 3940<![CDATA[
3940 ac97_bus_t *bus; 3941 struct snd_ac97_bus *bus;
3941 static ac97_bus_ops_t ops = { 3942 static struct snd_ac97_bus_ops ops = {
3942 .write = snd_mychip_ac97_write, 3943 .write = snd_mychip_ac97_write,
3943 .read = snd_mychip_ac97_read, 3944 .read = snd_mychip_ac97_read,
3944 }; 3945 };
@@ -3952,13 +3953,14 @@ struct _snd_pcm_runtime {
3952 </para> 3953 </para>
3953 3954
3954 <para> 3955 <para>
3955 And then call <function>snd_ac97_mixer()</function> with an <type>ac97_template_t</type> 3956 And then call <function>snd_ac97_mixer()</function> with an
3957 struct <structname>snd_ac97_template</structname>
3956 record together with the bus pointer created above. 3958 record together with the bus pointer created above.
3957 3959
3958 <informalexample> 3960 <informalexample>
3959 <programlisting> 3961 <programlisting>
3960<![CDATA[ 3962<![CDATA[
3961 ac97_template_t ac97; 3963 struct snd_ac97_template ac97;
3962 int err; 3964 int err;
3963 3965
3964 memset(&ac97, 0, sizeof(ac97)); 3966 memset(&ac97, 0, sizeof(ac97));
@@ -3995,10 +3997,10 @@ struct _snd_pcm_runtime {
3995 <informalexample> 3997 <informalexample>
3996 <programlisting> 3998 <programlisting>
3997<![CDATA[ 3999<![CDATA[
3998 static unsigned short snd_mychip_ac97_read(ac97_t *ac97, 4000 static unsigned short snd_mychip_ac97_read(struct snd_ac97 *ac97,
3999 unsigned short reg) 4001 unsigned short reg)
4000 { 4002 {
4001 mychip_t *chip = ac97->private_data; 4003 struct mychip *chip = ac97->private_data;
4002 .... 4004 ....
4003 return the_register_value; 4005 return the_register_value;
4004 } 4006 }
@@ -4016,7 +4018,7 @@ struct _snd_pcm_runtime {
4016 <informalexample> 4018 <informalexample>
4017 <programlisting> 4019 <programlisting>
4018<![CDATA[ 4020<![CDATA[
4019 static void snd_mychip_ac97_write(ac97_t *ac97, 4021 static void snd_mychip_ac97_write(struct snd_ac97 *ac97,
4020 unsigned short reg, unsigned short val) 4022 unsigned short reg, unsigned short val)
4021]]> 4023]]>
4022 </programlisting> 4024 </programlisting>
@@ -4163,7 +4165,7 @@ struct _snd_pcm_runtime {
4163 <title>Multiple Codecs</title> 4165 <title>Multiple Codecs</title>
4164 <para> 4166 <para>
4165 When there are several codecs on the same card, you need to 4167 When there are several codecs on the same card, you need to
4166 call <function>snd_ac97_new()</function> multiple times with 4168 call <function>snd_ac97_mixer()</function> multiple times with
4167 ac97.num=1 or greater. The <structfield>num</structfield> field 4169 ac97.num=1 or greater. The <structfield>num</structfield> field
4168 specifies the codec 4170 specifies the codec
4169 number. 4171 number.
@@ -4212,7 +4214,7 @@ struct _snd_pcm_runtime {
4212 <informalexample> 4214 <informalexample>
4213 <programlisting> 4215 <programlisting>
4214<![CDATA[ 4216<![CDATA[
4215 snd_rawmidi_t *rmidi; 4217 struct snd_rawmidi *rmidi;
4216 snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, port, integrated, 4218 snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, port, integrated,
4217 irq, irq_flags, &rmidi); 4219 irq, irq_flags, &rmidi);
4218]]> 4220]]>
@@ -4253,17 +4255,17 @@ struct _snd_pcm_runtime {
4253 Usually, the port address corresponds to the command port and 4255 Usually, the port address corresponds to the command port and
4254 port + 1 corresponds to the data port. If not, you may change 4256 port + 1 corresponds to the data port. If not, you may change
4255 the <structfield>cport</structfield> field of 4257 the <structfield>cport</structfield> field of
4256 <type>mpu401_t</type> manually 4258 struct <structname>snd_mpu401</structname> manually
4257 afterward. However, <type>mpu401_t</type> pointer is not 4259 afterward. However, <structname>snd_mpu401</structname> pointer is not
4258 returned explicitly by 4260 returned explicitly by
4259 <function>snd_mpu401_uart_new()</function>. You need to cast 4261 <function>snd_mpu401_uart_new()</function>. You need to cast
4260 rmidi-&gt;private_data to 4262 rmidi-&gt;private_data to
4261 <type>mpu401_t</type> explicitly, 4263 <structname>snd_mpu401</structname> explicitly,
4262 4264
4263 <informalexample> 4265 <informalexample>
4264 <programlisting> 4266 <programlisting>
4265<![CDATA[ 4267<![CDATA[
4266 mpu401_t *mpu; 4268 struct snd_mpu401 *mpu;
4267 mpu = rmidi->private_data; 4269 mpu = rmidi->private_data;
4268]]> 4270]]>
4269 </programlisting> 4271 </programlisting>
@@ -4359,7 +4361,7 @@ struct _snd_pcm_runtime {
4359 <informalexample> 4361 <informalexample>
4360 <programlisting> 4362 <programlisting>
4361<![CDATA[ 4363<![CDATA[
4362 snd_rawmidi_t *rmidi; 4364 struct snd_rawmidi *rmidi;
4363 err = snd_rawmidi_new(chip->card, "MyMIDI", 0, outs, ins, &rmidi); 4365 err = snd_rawmidi_new(chip->card, "MyMIDI", 0, outs, ins, &rmidi);
4364 if (err < 0) 4366 if (err < 0)
4365 return err; 4367 return err;
@@ -4419,7 +4421,7 @@ struct _snd_pcm_runtime {
4419 <informalexample> 4421 <informalexample>
4420 <programlisting> 4422 <programlisting>
4421<![CDATA[ 4423<![CDATA[
4422 static snd_rawmidi_ops_t snd_mymidi_output_ops = { 4424 static struct snd_rawmidi_ops snd_mymidi_output_ops = {
4423 .open = snd_mymidi_output_open, 4425 .open = snd_mymidi_output_open,
4424 .close = snd_mymidi_output_close, 4426 .close = snd_mymidi_output_close,
4425 .trigger = snd_mymidi_output_trigger, 4427 .trigger = snd_mymidi_output_trigger,
@@ -4439,9 +4441,9 @@ struct _snd_pcm_runtime {
4439 <programlisting> 4441 <programlisting>
4440<![CDATA[ 4442<![CDATA[
4441 struct list_head *list; 4443 struct list_head *list;
4442 snd_rawmidi_substream_t *substream; 4444 struct snd_rawmidi_substream *substream;
4443 list_for_each(list, &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams) { 4445 list_for_each(list, &rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams) {
4444 substream = list_entry(list, snd_rawmidi_substream_t, list); 4446 substream = list_entry(list, struct snd_rawmidi_substream, list);
4445 sprintf(substream->name, "My MIDI Port %d", substream->number + 1); 4447 sprintf(substream->name, "My MIDI Port %d", substream->number + 1);
4446 } 4448 }
4447 /* same for SNDRV_RAWMIDI_STREAM_INPUT */ 4449 /* same for SNDRV_RAWMIDI_STREAM_INPUT */
@@ -4463,12 +4465,12 @@ struct _snd_pcm_runtime {
4463 4465
4464 <para> 4466 <para>
4465 If there is more than one port, your callbacks can determine the 4467 If there is more than one port, your callbacks can determine the
4466 port index from the snd_rawmidi_substream_t data passed to each 4468 port index from the struct snd_rawmidi_substream data passed to each
4467 callback: 4469 callback:
4468 <informalexample> 4470 <informalexample>
4469 <programlisting> 4471 <programlisting>
4470<![CDATA[ 4472<![CDATA[
4471 snd_rawmidi_substream_t *substream; 4473 struct snd_rawmidi_substream *substream;
4472 int index = substream->number; 4474 int index = substream->number;
4473]]> 4475]]>
4474 </programlisting> 4476 </programlisting>
@@ -4481,7 +4483,7 @@ struct _snd_pcm_runtime {
4481 <informalexample> 4483 <informalexample>
4482 <programlisting> 4484 <programlisting>
4483<![CDATA[ 4485<![CDATA[
4484 static int snd_xxx_open(snd_rawmidi_substream_t *substream); 4486 static int snd_xxx_open(struct snd_rawmidi_substream *substream);
4485]]> 4487]]>
4486 </programlisting> 4488 </programlisting>
4487 </informalexample> 4489 </informalexample>
@@ -4499,7 +4501,7 @@ struct _snd_pcm_runtime {
4499 <informalexample> 4501 <informalexample>
4500 <programlisting> 4502 <programlisting>
4501<![CDATA[ 4503<![CDATA[
4502 static int snd_xxx_close(snd_rawmidi_substream_t *substream); 4504 static int snd_xxx_close(struct snd_rawmidi_substream *substream);
4503]]> 4505]]>
4504 </programlisting> 4506 </programlisting>
4505 </informalexample> 4507 </informalexample>
@@ -4522,7 +4524,7 @@ struct _snd_pcm_runtime {
4522 <informalexample> 4524 <informalexample>
4523 <programlisting> 4525 <programlisting>
4524<![CDATA[ 4526<![CDATA[
4525 static void snd_xxx_output_trigger(snd_rawmidi_substream_t *substream, int up); 4527 static void snd_xxx_output_trigger(struct snd_rawmidi_substream *substream, int up);
4526]]> 4528]]>
4527 </programlisting> 4529 </programlisting>
4528 </informalexample> 4530 </informalexample>
@@ -4547,7 +4549,7 @@ struct _snd_pcm_runtime {
4547<![CDATA[ 4549<![CDATA[
4548 unsigned char data; 4550 unsigned char data;
4549 while (snd_rawmidi_transmit_peek(substream, &data, 1) == 1) { 4551 while (snd_rawmidi_transmit_peek(substream, &data, 1) == 1) {
4550 if (mychip_try_to_transmit(data)) 4552 if (snd_mychip_try_to_transmit(data))
4551 snd_rawmidi_transmit_ack(substream, 1); 4553 snd_rawmidi_transmit_ack(substream, 1);
4552 else 4554 else
4553 break; /* hardware FIFO full */ 4555 break; /* hardware FIFO full */
@@ -4564,11 +4566,11 @@ struct _snd_pcm_runtime {
4564 <informalexample> 4566 <informalexample>
4565 <programlisting> 4567 <programlisting>
4566<![CDATA[ 4568<![CDATA[
4567 while (mychip_transmit_possible()) { 4569 while (snd_mychip_transmit_possible()) {
4568 unsigned char data; 4570 unsigned char data;
4569 if (snd_rawmidi_transmit(substream, &data, 1) != 1) 4571 if (snd_rawmidi_transmit(substream, &data, 1) != 1)
4570 break; /* no more data */ 4572 break; /* no more data */
4571 mychip_transmit(data); 4573 snd_mychip_transmit(data);
4572 } 4574 }
4573]]> 4575]]>
4574 </programlisting> 4576 </programlisting>
@@ -4603,7 +4605,7 @@ struct _snd_pcm_runtime {
4603 <informalexample> 4605 <informalexample>
4604 <programlisting> 4606 <programlisting>
4605<![CDATA[ 4607<![CDATA[
4606 static void snd_xxx_input_trigger(snd_rawmidi_substream_t *substream, int up); 4608 static void snd_xxx_input_trigger(struct snd_rawmidi_substream *substream, int up);
4607]]> 4609]]>
4608 </programlisting> 4610 </programlisting>
4609 </informalexample> 4611 </informalexample>
@@ -4647,7 +4649,7 @@ struct _snd_pcm_runtime {
4647 <informalexample> 4649 <informalexample>
4648 <programlisting> 4650 <programlisting>
4649<![CDATA[ 4651<![CDATA[
4650 static void snd_xxx_drain(snd_rawmidi_substream_t *substream); 4652 static void snd_xxx_drain(struct snd_rawmidi_substream *substream);
4651]]> 4653]]>
4652 </programlisting> 4654 </programlisting>
4653 </informalexample> 4655 </informalexample>
@@ -4661,7 +4663,7 @@ struct _snd_pcm_runtime {
4661 4663
4662 <para> 4664 <para>
4663 This callback is optional. If you do not set 4665 This callback is optional. If you do not set
4664 <structfield>drain</structfield> in the snd_rawmidi_ops_t 4666 <structfield>drain</structfield> in the struct snd_rawmidi_ops
4665 structure, ALSA will simply wait for 50&nbsp;milliseconds 4667 structure, ALSA will simply wait for 50&nbsp;milliseconds
4666 instead. 4668 instead.
4667 </para> 4669 </para>
@@ -4703,7 +4705,7 @@ struct _snd_pcm_runtime {
4703 <informalexample> 4705 <informalexample>
4704 <programlisting> 4706 <programlisting>
4705<![CDATA[ 4707<![CDATA[
4706 opl3_t *opl3; 4708 struct snd_opl3 *opl3;
4707 snd_opl3_create(card, lport, rport, OPL3_HW_OPL3_XXX, 4709 snd_opl3_create(card, lport, rport, OPL3_HW_OPL3_XXX,
4708 integrated, &opl3); 4710 integrated, &opl3);
4709]]> 4711]]>
@@ -4736,7 +4738,7 @@ struct _snd_pcm_runtime {
4736 <informalexample> 4738 <informalexample>
4737 <programlisting> 4739 <programlisting>
4738<![CDATA[ 4740<![CDATA[
4739 opl3_t *opl3; 4741 struct snd_opl3 *opl3;
4740 snd_opl3_new(card, OPL3_HW_OPL3_XXX, &opl3); 4742 snd_opl3_new(card, OPL3_HW_OPL3_XXX, &opl3);
4741]]> 4743]]>
4742 </programlisting> 4744 </programlisting>
@@ -4767,7 +4769,7 @@ struct _snd_pcm_runtime {
4767 <informalexample> 4769 <informalexample>
4768 <programlisting> 4770 <programlisting>
4769<![CDATA[ 4771<![CDATA[
4770 snd_hwdep_t *opl3hwdep; 4772 struct snd_hwdep *opl3hwdep;
4771 snd_opl3_hwdep_new(opl3, 0, 1, &opl3hwdep); 4773 snd_opl3_hwdep_new(opl3, 0, 1, &opl3hwdep);
4772]]> 4774]]>
4773 </programlisting> 4775 </programlisting>
@@ -4804,7 +4806,7 @@ struct _snd_pcm_runtime {
4804 <informalexample> 4806 <informalexample>
4805 <programlisting> 4807 <programlisting>
4806<![CDATA[ 4808<![CDATA[
4807 snd_hwdep_t *hw; 4809 struct snd_hwdep *hw;
4808 snd_hwdep_new(card, "My HWDEP", 0, &hw); 4810 snd_hwdep_new(card, "My HWDEP", 0, &hw);
4809]]> 4811]]>
4810 </programlisting> 4812 </programlisting>
@@ -4823,7 +4825,7 @@ struct _snd_pcm_runtime {
4823 <informalexample> 4825 <informalexample>
4824 <programlisting> 4826 <programlisting>
4825<![CDATA[ 4827<![CDATA[
4826 mydata_t *p = kmalloc(sizeof(*p), GFP_KERNEL); 4828 struct mydata *p = kmalloc(sizeof(*p), GFP_KERNEL);
4827 hw->private_data = p; 4829 hw->private_data = p;
4828 hw->private_free = mydata_free; 4830 hw->private_free = mydata_free;
4829]]> 4831]]>
@@ -4835,9 +4837,9 @@ struct _snd_pcm_runtime {
4835 <informalexample> 4837 <informalexample>
4836 <programlisting> 4838 <programlisting>
4837<![CDATA[ 4839<![CDATA[
4838 static void mydata_free(snd_hwdep_t *hw) 4840 static void mydata_free(struct snd_hwdep *hw)
4839 { 4841 {
4840 mydata_t *p = hw->private_data; 4842 struct mydata *p = hw->private_data;
4841 kfree(p); 4843 kfree(p);
4842 } 4844 }
4843]]> 4845]]>
@@ -5061,9 +5063,9 @@ struct _snd_pcm_runtime {
5061 <informalexample> 5063 <informalexample>
5062 <programlisting> 5064 <programlisting>
5063<![CDATA[ 5065<![CDATA[
5064 static int playback_copy(snd_pcm_substream_t *substream, int channel, 5066 static int playback_copy(struct snd_pcm_substream *substream, int channel,
5065 snd_pcm_uframes_t pos, void *src, snd_pcm_uframes_t count); 5067 snd_pcm_uframes_t pos, void *src, snd_pcm_uframes_t count);
5066 static int capture_copy(snd_pcm_substream_t *substream, int channel, 5068 static int capture_copy(struct snd_pcm_substream *substream, int channel,
5067 snd_pcm_uframes_t pos, void *dst, snd_pcm_uframes_t count); 5069 snd_pcm_uframes_t pos, void *dst, snd_pcm_uframes_t count);
5068]]> 5070]]>
5069 </programlisting> 5071 </programlisting>
@@ -5144,7 +5146,7 @@ struct _snd_pcm_runtime {
5144 <informalexample> 5146 <informalexample>
5145 <programlisting> 5147 <programlisting>
5146<![CDATA[ 5148<![CDATA[
5147 static int silence(snd_pcm_substream_t *substream, int channel, 5149 static int silence(struct snd_pcm_substream *substream, int channel,
5148 snd_pcm_uframes_t pos, snd_pcm_uframes_t count); 5150 snd_pcm_uframes_t pos, snd_pcm_uframes_t count);
5149]]> 5151]]>
5150 </programlisting> 5152 </programlisting>
@@ -5211,7 +5213,7 @@ struct _snd_pcm_runtime {
5211 <informalexample> 5213 <informalexample>
5212 <programlisting> 5214 <programlisting>
5213<![CDATA[ 5215<![CDATA[
5214 snd_pcm_sgbuf_t *sgbuf = (snd_pcm_sgbuf_t*)substream->dma_private; 5216 struct snd_sg_buf *sgbuf = (struct snd_sg_buf_t*)substream->dma_private;
5215]]> 5217]]>
5216 </programlisting> 5218 </programlisting>
5217 </informalexample> 5219 </informalexample>
@@ -5266,7 +5268,7 @@ struct _snd_pcm_runtime {
5266 #include <linux/vmalloc.h> 5268 #include <linux/vmalloc.h>
5267 5269
5268 /* get the physical page pointer on the given offset */ 5270 /* get the physical page pointer on the given offset */
5269 static struct page *mychip_page(snd_pcm_substream_t *substream, 5271 static struct page *mychip_page(struct snd_pcm_substream *substream,
5270 unsigned long offset) 5272 unsigned long offset)
5271 { 5273 {
5272 void *pageptr = substream->runtime->dma_area + offset; 5274 void *pageptr = substream->runtime->dma_area + offset;
@@ -5301,7 +5303,7 @@ struct _snd_pcm_runtime {
5301 <informalexample> 5303 <informalexample>
5302 <programlisting> 5304 <programlisting>
5303<![CDATA[ 5305<![CDATA[
5304 snd_info_entry_t *entry; 5306 struct snd_info_entry *entry;
5305 int err = snd_card_proc_new(card, "my-file", &entry); 5307 int err = snd_card_proc_new(card, "my-file", &entry);
5306]]> 5308]]>
5307 </programlisting> 5309 </programlisting>
@@ -5345,8 +5347,8 @@ struct _snd_pcm_runtime {
5345 <informalexample> 5347 <informalexample>
5346 <programlisting> 5348 <programlisting>
5347<![CDATA[ 5349<![CDATA[
5348 static void my_proc_read(snd_info_entry_t *entry, 5350 static void my_proc_read(struct snd_info_entry *entry,
5349 snd_info_buffer_t *buffer); 5351 struct snd_info_buffer *buffer);
5350]]> 5352]]>
5351 </programlisting> 5353 </programlisting>
5352 </informalexample> 5354 </informalexample>
@@ -5361,10 +5363,10 @@ struct _snd_pcm_runtime {
5361 <informalexample> 5363 <informalexample>
5362 <programlisting> 5364 <programlisting>
5363<![CDATA[ 5365<![CDATA[
5364 static void my_proc_read(snd_info_entry_t *entry, 5366 static void my_proc_read(struct snd_info_entry *entry,
5365 snd_info_buffer_t *buffer) 5367 struct snd_info_buffer *buffer)
5366 { 5368 {
5367 chip_t *chip = entry->private_data; 5369 struct my_chip *chip = entry->private_data;
5368 5370
5369 snd_iprintf(buffer, "This is my chip!\n"); 5371 snd_iprintf(buffer, "This is my chip!\n");
5370 snd_iprintf(buffer, "Port = %ld\n", chip->port); 5372 snd_iprintf(buffer, "Port = %ld\n", chip->port);
@@ -5453,7 +5455,7 @@ struct _snd_pcm_runtime {
5453 <informalexample> 5455 <informalexample>
5454 <programlisting> 5456 <programlisting>
5455<![CDATA[ 5457<![CDATA[
5456 static long my_file_io_read(snd_info_entry_t *entry, 5458 static long my_file_io_read(struct snd_info_entry *entry,
5457 void *file_private_data, 5459 void *file_private_data,
5458 struct file *file, 5460 struct file *file,
5459 char *buf, 5461 char *buf,
@@ -5488,22 +5490,60 @@ struct _snd_pcm_runtime {
5488 <constant>CONFIG_PM</constant>. 5490 <constant>CONFIG_PM</constant>.
5489 </para> 5491 </para>
5490 5492
5493 <para>
5494 If the driver supports the suspend/resume
5495 <emphasis>fully</emphasis>, that is, the device can be
5496 properly resumed to the status at the suspend is called,
5497 you can set <constant>SNDRV_PCM_INFO_RESUME</constant> flag
5498 to pcm info field. Usually, this is possible when the
5499 registers of ths chip can be safely saved and restored to the
5500 RAM. If this is set, the trigger callback is called with
5501 <constant>SNDRV_PCM_TRIGGER_RESUME</constant> after resume
5502 callback is finished.
5503 </para>
5504
5505 <para>
5506 Even if the driver doesn't support PM fully but only the
5507 partial suspend/resume is possible, it's still worthy to
5508 implement suspend/resume callbacks. In such a case, applications
5509 would reset the status by calling
5510 <function>snd_pcm_prepare()</function> and restart the stream
5511 appropriately. Hence, you can define suspend/resume callbacks
5512 below but don't set <constant>SNDRV_PCM_INFO_RESUME</constant>
5513 info flag to the PCM.
5514 </para>
5515
5516 <para>
5517 Note that the trigger with SUSPEND can be always called when
5518 <function>snd_pcm_suspend_all</function> is called,
5519 regardless of <constant>SNDRV_PCM_INFO_RESUME</constant> flag.
5520 The <constant>RESUME</constant> flag affects only the behavior
5521 of <function>snd_pcm_resume()</function>.
5522 (Thus, in theory,
5523 <constant>SNDRV_PCM_TRIGGER_RESUME</constant> isn't needed
5524 to be handled in the trigger callback when no
5525 <constant>SNDRV_PCM_INFO_RESUME</constant> flag is set. But,
5526 it's better to keep it for compatibility reason.)
5527 </para>
5491 <para> 5528 <para>
5492 ALSA provides the common power-management layer. Each card driver 5529 In the earlier version of ALSA drivers, a common
5493 needs to have only low-level suspend and resume callbacks. 5530 power-management layer was provided, but it has been removed.
5531 The driver needs to define the suspend/resume hooks according to
5532 the bus the device is assigned. In the case of PCI driver, the
5533 callbacks look like below:
5494 5534
5495 <informalexample> 5535 <informalexample>
5496 <programlisting> 5536 <programlisting>
5497<![CDATA[ 5537<![CDATA[
5498 #ifdef CONFIG_PM 5538 #ifdef CONFIG_PM
5499 static int snd_my_suspend(snd_card_t *card, pm_message_t state) 5539 static int snd_my_suspend(struct pci_dev *pci, pm_message_t state)
5500 { 5540 {
5501 .... // do things for suspsend 5541 .... /* do things for suspsend */
5502 return 0; 5542 return 0;
5503 } 5543 }
5504 static int snd_my_resume(snd_card_t *card) 5544 static int snd_my_resume(struct pci_dev *pci)
5505 { 5545 {
5506 .... // do things for suspsend 5546 .... /* do things for suspsend */
5507 return 0; 5547 return 0;
5508 } 5548 }
5509 #endif 5549 #endif
@@ -5516,11 +5556,18 @@ struct _snd_pcm_runtime {
5516 The scheme of the real suspend job is as following. 5556 The scheme of the real suspend job is as following.
5517 5557
5518 <orderedlist> 5558 <orderedlist>
5519 <listitem><para>Retrieve the chip data from pm_private_data field.</para></listitem> 5559 <listitem><para>Retrieve the card and the chip data.</para></listitem>
5560 <listitem><para>Call <function>snd_power_change_state()</function> with
5561 <constant>SNDRV_CTL_POWER_D3hot</constant> to change the
5562 power status.</para></listitem>
5520 <listitem><para>Call <function>snd_pcm_suspend_all()</function> to suspend the running PCM streams.</para></listitem> 5563 <listitem><para>Call <function>snd_pcm_suspend_all()</function> to suspend the running PCM streams.</para></listitem>
5564 <listitem><para>If AC97 codecs are used, call
5565 <function>snd_ac97_resume()</function> for each codec.</para></listitem>
5521 <listitem><para>Save the register values if necessary.</para></listitem> 5566 <listitem><para>Save the register values if necessary.</para></listitem>
5522 <listitem><para>Stop the hardware if necessary.</para></listitem> 5567 <listitem><para>Stop the hardware if necessary.</para></listitem>
5523 <listitem><para>Disable the PCI device by calling <function>pci_disable_device()</function>.</para></listitem> 5568 <listitem><para>Disable the PCI device by calling
5569 <function>pci_disable_device()</function>. Then, call
5570 <function>pci_save_state()</function> at last.</para></listitem>
5524 </orderedlist> 5571 </orderedlist>
5525 </para> 5572 </para>
5526 5573
@@ -5530,18 +5577,24 @@ struct _snd_pcm_runtime {
5530 <informalexample> 5577 <informalexample>
5531 <programlisting> 5578 <programlisting>
5532<![CDATA[ 5579<![CDATA[
5533 static int mychip_suspend(snd_card_t *card, pm_message_t state) 5580 static int mychip_suspend(strut pci_dev *pci, pm_message_t state)
5534 { 5581 {
5535 /* (1) */ 5582 /* (1) */
5536 mychip_t *chip = card->pm_private_data; 5583 struct snd_card *card = pci_get_drvdata(pci);
5584 struct mychip *chip = card->private_data;
5537 /* (2) */ 5585 /* (2) */
5538 snd_pcm_suspend_all(chip->pcm); 5586 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
5539 /* (3) */ 5587 /* (3) */
5540 snd_mychip_save_registers(chip); 5588 snd_pcm_suspend_all(chip->pcm);
5541 /* (4) */ 5589 /* (4) */
5542 snd_mychip_stop_hardware(chip); 5590 snd_ac97_suspend(chip->ac97);
5543 /* (5) */ 5591 /* (5) */
5544 pci_disable_device(chip->pci); 5592 snd_mychip_save_registers(chip);
5593 /* (6) */
5594 snd_mychip_stop_hardware(chip);
5595 /* (7) */
5596 pci_disable_device(pci);
5597 pci_save_state(pci);
5545 return 0; 5598 return 0;
5546 } 5599 }
5547]]> 5600]]>
@@ -5553,14 +5606,17 @@ struct _snd_pcm_runtime {
5553 The scheme of the real resume job is as following. 5606 The scheme of the real resume job is as following.
5554 5607
5555 <orderedlist> 5608 <orderedlist>
5556 <listitem><para>Retrieve the chip data from pm_private_data field.</para></listitem> 5609 <listitem><para>Retrieve the card and the chip data.</para></listitem>
5557 <listitem><para>Enable the pci device again by calling 5610 <listitem><para>Set up PCI. First, call <function>pci_restore_state()</function>.
5558 <function>pci_enable_device()</function>.</para></listitem> 5611 Then enable the pci device again by calling <function>pci_enable_device()</function>.
5612 Call <function>pci_set_master()</function> if necessary, too.</para></listitem>
5559 <listitem><para>Re-initialize the chip.</para></listitem> 5613 <listitem><para>Re-initialize the chip.</para></listitem>
5560 <listitem><para>Restore the saved registers if necessary.</para></listitem> 5614 <listitem><para>Restore the saved registers if necessary.</para></listitem>
5561 <listitem><para>Resume the mixer, e.g. calling 5615 <listitem><para>Resume the mixer, e.g. calling
5562 <function>snd_ac97_resume()</function>.</para></listitem> 5616 <function>snd_ac97_resume()</function>.</para></listitem>
5563 <listitem><para>Restart the hardware (if any).</para></listitem> 5617 <listitem><para>Restart the hardware (if any).</para></listitem>
5618 <listitem><para>Call <function>snd_power_change_state()</function> with
5619 <constant>SNDRV_CTL_POWER_D0</constant> to notify the processes.</para></listitem>
5564 </orderedlist> 5620 </orderedlist>
5565 </para> 5621 </para>
5566 5622
@@ -5570,12 +5626,15 @@ struct _snd_pcm_runtime {
5570 <informalexample> 5626 <informalexample>
5571 <programlisting> 5627 <programlisting>
5572<![CDATA[ 5628<![CDATA[
5573 static void mychip_resume(mychip_t *chip) 5629 static int mychip_resume(struct pci_dev *pci)
5574 { 5630 {
5575 /* (1) */ 5631 /* (1) */
5576 mychip_t *chip = card->pm_private_data; 5632 struct snd_card *card = pci_get_drvdata(pci);
5633 struct mychip *chip = card->private_data;
5577 /* (2) */ 5634 /* (2) */
5578 pci_enable_device(chip->pci); 5635 pci_restore_state(pci);
5636 pci_enable_device(pci);
5637 pci_set_master(pci);
5579 /* (3) */ 5638 /* (3) */
5580 snd_mychip_reinit_chip(chip); 5639 snd_mychip_reinit_chip(chip);
5581 /* (4) */ 5640 /* (4) */
@@ -5584,6 +5643,8 @@ struct _snd_pcm_runtime {
5584 snd_ac97_resume(chip->ac97); 5643 snd_ac97_resume(chip->ac97);
5585 /* (6) */ 5644 /* (6) */
5586 snd_mychip_restart_chip(chip); 5645 snd_mychip_restart_chip(chip);
5646 /* (7) */
5647 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
5587 return 0; 5648 return 0;
5588 } 5649 }
5589]]> 5650]]>
@@ -5592,8 +5653,23 @@ struct _snd_pcm_runtime {
5592 </para> 5653 </para>
5593 5654
5594 <para> 5655 <para>
5595 OK, we have all callbacks now. Let's set up them now. In the 5656 As shown in the above, it's better to save registers after
5596 initialization of the card, add the following: 5657 suspending the PCM operations via
5658 <function>snd_pcm_suspend_all()</function> or
5659 <function>snd_pcm_suspend()</function>. It means that the PCM
5660 streams are already stoppped when the register snapshot is
5661 taken. But, remind that you don't have to restart the PCM
5662 stream in the resume callback. It'll be restarted via
5663 trigger call with <constant>SNDRV_PCM_TRIGGER_RESUME</constant>
5664 when necessary.
5665 </para>
5666
5667 <para>
5668 OK, we have all callbacks now. Let's set them up. In the
5669 initialization of the card, make sure that you can get the chip
5670 data from the card instance, typically via
5671 <structfield>private_data</structfield> field, in case you
5672 created the chip data individually.
5597 5673
5598 <informalexample> 5674 <informalexample>
5599 <programlisting> 5675 <programlisting>
@@ -5602,33 +5678,56 @@ struct _snd_pcm_runtime {
5602 const struct pci_device_id *pci_id) 5678 const struct pci_device_id *pci_id)
5603 { 5679 {
5604 .... 5680 ....
5605 snd_card_t *card; 5681 struct snd_card *card;
5606 mychip_t *chip; 5682 struct mychip *chip;
5607 .... 5683 ....
5608 snd_card_set_pm_callback(card, snd_my_suspend, snd_my_resume, chip); 5684 card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL);
5685 ....
5686 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
5687 ....
5688 card->private_data = chip;
5689 ....
5690 }
5691]]>
5692 </programlisting>
5693 </informalexample>
5694
5695 When you created the chip data with
5696 <function>snd_card_new()</function>, it's anyway accessible
5697 via <structfield>private_data</structfield> field.
5698
5699 <informalexample>
5700 <programlisting>
5701<![CDATA[
5702 static int __devinit snd_mychip_probe(struct pci_dev *pci,
5703 const struct pci_device_id *pci_id)
5704 {
5705 ....
5706 struct snd_card *card;
5707 struct mychip *chip;
5708 ....
5709 card = snd_card_new(index[dev], id[dev], THIS_MODULE,
5710 sizeof(struct mychip));
5711 ....
5712 chip = card->private_data;
5609 .... 5713 ....
5610 } 5714 }
5611]]> 5715]]>
5612 </programlisting> 5716 </programlisting>
5613 </informalexample> 5717 </informalexample>
5614 5718
5615 Here you don't have to put ifdef CONFIG_PM around, since it's already
5616 checked in the header and expanded to empty if not needed.
5617 </para> 5719 </para>
5618 5720
5619 <para> 5721 <para>
5620 If you need a space for saving the registers, you'll need to 5722 If you need a space for saving the registers, allocate the
5621 allocate the buffer for it here, too, since it would be fatal 5723 buffer for it here, too, since it would be fatal
5622 if you cannot allocate a memory in the suspend phase. 5724 if you cannot allocate a memory in the suspend phase.
5623 The allocated buffer should be released in the corresponding 5725 The allocated buffer should be released in the corresponding
5624 destructor. 5726 destructor.
5625 </para> 5727 </para>
5626 5728
5627 <para> 5729 <para>
5628 And next, set suspend/resume callbacks to the pci_driver, 5730 And next, set suspend/resume callbacks to the pci_driver.
5629 This can be done by passing a macro SND_PCI_PM_CALLBACKS
5630 in the pci_driver struct. This macro is expanded to the correct
5631 (global) callbacks if CONFIG_PM is set.
5632 5731
5633 <informalexample> 5732 <informalexample>
5634 <programlisting> 5733 <programlisting>
@@ -5638,7 +5737,10 @@ struct _snd_pcm_runtime {
5638 .id_table = snd_my_ids, 5737 .id_table = snd_my_ids,
5639 .probe = snd_my_probe, 5738 .probe = snd_my_probe,
5640 .remove = __devexit_p(snd_my_remove), 5739 .remove = __devexit_p(snd_my_remove),
5641 SND_PCI_PM_CALLBACKS 5740 #ifdef CONFIG_PM
5741 .suspend = snd_my_suspend,
5742 .resume = snd_my_resume,
5743 #endif
5642 }; 5744 };
5643]]> 5745]]>
5644 </programlisting> 5746 </programlisting>
diff --git a/Documentation/sound/alsa/Procfile.txt b/Documentation/sound/alsa/Procfile.txt
index 25c5d648aef6..1fe48846d78f 100644
--- a/Documentation/sound/alsa/Procfile.txt
+++ b/Documentation/sound/alsa/Procfile.txt
@@ -138,6 +138,22 @@ card*/codec97#0/ac97#?-?+regs
138 # echo 02 9f1f > /proc/asound/card0/codec97#0/ac97#0-0+regs 138 # echo 02 9f1f > /proc/asound/card0/codec97#0/ac97#0-0+regs
139 139
140 140
141USB Audio Streams
142-----------------
143
144card*/stream*
145 Shows the assignment and the current status of each audio stream
146 of the given card. This information is very useful for debugging.
147
148
149HD-Audio Codecs
150---------------
151
152card*/codec#*
153 Shows the general codec information and the attribute of each
154 widget node.
155
156
141Sequencer Information 157Sequencer Information
142--------------------- 158---------------------
143 159
diff --git a/Documentation/sound/alsa/hda_codec.txt b/Documentation/sound/alsa/hda_codec.txt
index e9d07b8f1acb..0be57ed81302 100644
--- a/Documentation/sound/alsa/hda_codec.txt
+++ b/Documentation/sound/alsa/hda_codec.txt
@@ -63,7 +63,7 @@ The bus instance is created via snd_hda_bus_new(). You need to pass
63the card instance, the template, and the pointer to store the 63the card instance, the template, and the pointer to store the
64resultant bus instance. 64resultant bus instance.
65 65
66int snd_hda_bus_new(snd_card_t *card, const struct hda_bus_template *temp, 66int snd_hda_bus_new(struct snd_card *card, const struct hda_bus_template *temp,
67 struct hda_bus **busp); 67 struct hda_bus **busp);
68 68
69It returns zero if successful. A negative return value means any 69It returns zero if successful. A negative return value means any
@@ -166,14 +166,14 @@ The ops field contains the following callback functions:
166 166
167struct hda_pcm_ops { 167struct hda_pcm_ops {
168 int (*open)(struct hda_pcm_stream *info, struct hda_codec *codec, 168 int (*open)(struct hda_pcm_stream *info, struct hda_codec *codec,
169 snd_pcm_substream_t *substream); 169 struct snd_pcm_substream *substream);
170 int (*close)(struct hda_pcm_stream *info, struct hda_codec *codec, 170 int (*close)(struct hda_pcm_stream *info, struct hda_codec *codec,
171 snd_pcm_substream_t *substream); 171 struct snd_pcm_substream *substream);
172 int (*prepare)(struct hda_pcm_stream *info, struct hda_codec *codec, 172 int (*prepare)(struct hda_pcm_stream *info, struct hda_codec *codec,
173 unsigned int stream_tag, unsigned int format, 173 unsigned int stream_tag, unsigned int format,
174 snd_pcm_substream_t *substream); 174 struct snd_pcm_substream *substream);
175 int (*cleanup)(struct hda_pcm_stream *info, struct hda_codec *codec, 175 int (*cleanup)(struct hda_pcm_stream *info, struct hda_codec *codec,
176 snd_pcm_substream_t *substream); 176 struct snd_pcm_substream *substream);
177}; 177};
178 178
179All are non-NULL, so you can call them safely without NULL check. 179All are non-NULL, so you can call them safely without NULL check.
@@ -284,7 +284,7 @@ parameter, and PCI subsystem IDs. If the matching entry is found, it
284returns the config field value. 284returns the config field value.
285 285
286snd_hda_add_new_ctls() can be used to create and add control entries. 286snd_hda_add_new_ctls() can be used to create and add control entries.
287Pass the zero-terminated array of snd_kcontrol_new_t. The same array 287Pass the zero-terminated array of struct snd_kcontrol_new. The same array
288can be passed to snd_hda_resume_ctls() for resume. 288can be passed to snd_hda_resume_ctls() for resume.
289Note that this will call control->put callback of these entries. So, 289Note that this will call control->put callback of these entries. So,
290put callback should check codec->in_resume and force to restore the 290put callback should check codec->in_resume and force to restore the
@@ -292,7 +292,7 @@ given value if it's non-zero even if the value is identical with the
292cached value. 292cached value.
293 293
294Macros HDA_CODEC_VOLUME(), HDA_CODEC_MUTE() and their variables can be 294Macros HDA_CODEC_VOLUME(), HDA_CODEC_MUTE() and their variables can be
295used for the entry of snd_kcontrol_new_t. 295used for the entry of struct snd_kcontrol_new.
296 296
297The input MUX helper callbacks for such a control are provided, too: 297The input MUX helper callbacks for such a control are provided, too:
298snd_hda_input_mux_info() and snd_hda_input_mux_put(). See 298snd_hda_input_mux_info() and snd_hda_input_mux_put(). See