aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/trident
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/trident')
-rw-r--r--sound/pci/trident/trident.c10
-rw-r--r--sound/pci/trident/trident_main.c773
-rw-r--r--sound/pci/trident/trident_memory.c92
-rw-r--r--sound/pci/trident/trident_synth.c175
4 files changed, 534 insertions, 516 deletions
diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c
index 940d531575c0..2b21df16ad6a 100644
--- a/sound/pci/trident/trident.c
+++ b/sound/pci/trident/trident.c
@@ -76,8 +76,8 @@ static int __devinit snd_trident_probe(struct pci_dev *pci,
76 const struct pci_device_id *pci_id) 76 const struct pci_device_id *pci_id)
77{ 77{
78 static int dev; 78 static int dev;
79 snd_card_t *card; 79 struct snd_card *card;
80 trident_t *trident; 80 struct snd_trident *trident;
81 const char *str; 81 const char *str;
82 int err, pcm_dev = 0; 82 int err, pcm_dev = 0;
83 83
@@ -100,6 +100,7 @@ static int __devinit snd_trident_probe(struct pci_dev *pci,
100 snd_card_free(card); 100 snd_card_free(card);
101 return err; 101 return err;
102 } 102 }
103 card->private_data = trident;
103 104
104 switch (trident->device) { 105 switch (trident->device) {
105 case TRIDENT_DEVICE_ID_DX: 106 case TRIDENT_DEVICE_ID_DX:
@@ -180,7 +181,10 @@ static struct pci_driver driver = {
180 .id_table = snd_trident_ids, 181 .id_table = snd_trident_ids,
181 .probe = snd_trident_probe, 182 .probe = snd_trident_probe,
182 .remove = __devexit_p(snd_trident_remove), 183 .remove = __devexit_p(snd_trident_remove),
183 SND_PCI_PM_CALLBACKS 184#ifdef CONFIG_PM
185 .suspend = snd_trident_suspend,
186 .resume = snd_trident_resume,
187#endif
184}; 188};
185 189
186static int __init alsa_card_trident_init(void) 190static int __init alsa_card_trident_init(void)
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index b9b93c7faafd..83b7d8aba9e6 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -44,17 +44,19 @@
44 44
45#include <asm/io.h> 45#include <asm/io.h>
46 46
47static int snd_trident_pcm_mixer_build(trident_t *trident, snd_trident_voice_t * voice, snd_pcm_substream_t *substream); 47static int snd_trident_pcm_mixer_build(struct snd_trident *trident,
48static int snd_trident_pcm_mixer_free(trident_t *trident, snd_trident_voice_t * voice, snd_pcm_substream_t *substream); 48 struct snd_trident_voice * voice,
49static irqreturn_t snd_trident_interrupt(int irq, void *dev_id, struct pt_regs *regs); 49 struct snd_pcm_substream *substream);
50#ifdef CONFIG_PM 50static int snd_trident_pcm_mixer_free(struct snd_trident *trident,
51static int snd_trident_suspend(snd_card_t *card, pm_message_t state); 51 struct snd_trident_voice * voice,
52static int snd_trident_resume(snd_card_t *card); 52 struct snd_pcm_substream *substream);
53#endif 53static irqreturn_t snd_trident_interrupt(int irq, void *dev_id,
54static int snd_trident_sis_reset(trident_t *trident); 54 struct pt_regs *regs);
55 55static int snd_trident_sis_reset(struct snd_trident *trident);
56static void snd_trident_clear_voices(trident_t * trident, unsigned short v_min, unsigned short v_max); 56
57static int snd_trident_free(trident_t *trident); 57static void snd_trident_clear_voices(struct snd_trident * trident,
58 unsigned short v_min, unsigned short v_max);
59static int snd_trident_free(struct snd_trident *trident);
58 60
59/* 61/*
60 * common I/O routines 62 * common I/O routines
@@ -62,7 +64,7 @@ static int snd_trident_free(trident_t *trident);
62 64
63 65
64#if 0 66#if 0
65static void snd_trident_print_voice_regs(trident_t *trident, int voice) 67static void snd_trident_print_voice_regs(struct snd_trident *trident, int voice)
66{ 68{
67 unsigned int val, tmp; 69 unsigned int val, tmp;
68 70
@@ -104,7 +106,7 @@ static void snd_trident_print_voice_regs(trident_t *trident, int voice)
104#endif 106#endif
105 107
106/*--------------------------------------------------------------------------- 108/*---------------------------------------------------------------------------
107 unsigned short snd_trident_codec_read(ac97_t *ac97, unsigned short reg) 109 unsigned short snd_trident_codec_read(struct snd_ac97 *ac97, unsigned short reg)
108 110
109 Description: This routine will do all of the reading from the external 111 Description: This routine will do all of the reading from the external
110 CODEC (AC97). 112 CODEC (AC97).
@@ -115,12 +117,12 @@ static void snd_trident_print_voice_regs(trident_t *trident, int voice)
115 returns: 16 bit value read from the AC97. 117 returns: 16 bit value read from the AC97.
116 118
117 ---------------------------------------------------------------------------*/ 119 ---------------------------------------------------------------------------*/
118static unsigned short snd_trident_codec_read(ac97_t *ac97, unsigned short reg) 120static unsigned short snd_trident_codec_read(struct snd_ac97 *ac97, unsigned short reg)
119{ 121{
120 unsigned int data = 0, treg; 122 unsigned int data = 0, treg;
121 unsigned short count = 0xffff; 123 unsigned short count = 0xffff;
122 unsigned long flags; 124 unsigned long flags;
123 trident_t *trident = ac97->private_data; 125 struct snd_trident *trident = ac97->private_data;
124 126
125 spin_lock_irqsave(&trident->reg_lock, flags); 127 spin_lock_irqsave(&trident->reg_lock, flags);
126 if (trident->device == TRIDENT_DEVICE_ID_DX) { 128 if (trident->device == TRIDENT_DEVICE_ID_DX) {
@@ -153,7 +155,8 @@ static unsigned short snd_trident_codec_read(ac97_t *ac97, unsigned short reg)
153 } 155 }
154 156
155 if (count == 0 && !trident->ac97_detect) { 157 if (count == 0 && !trident->ac97_detect) {
156 snd_printk(KERN_ERR "ac97 codec read TIMEOUT [0x%x/0x%x]!!!\n", reg, data); 158 snd_printk(KERN_ERR "ac97 codec read TIMEOUT [0x%x/0x%x]!!!\n",
159 reg, data);
157 data = 0; 160 data = 0;
158 } 161 }
159 162
@@ -162,7 +165,8 @@ static unsigned short snd_trident_codec_read(ac97_t *ac97, unsigned short reg)
162} 165}
163 166
164/*--------------------------------------------------------------------------- 167/*---------------------------------------------------------------------------
165 void snd_trident_codec_write(ac97_t *ac97, unsigned short reg, unsigned short wdata) 168 void snd_trident_codec_write(struct snd_ac97 *ac97, unsigned short reg,
169 unsigned short wdata)
166 170
167 Description: This routine will do all of the writing to the external 171 Description: This routine will do all of the writing to the external
168 CODEC (AC97). 172 CODEC (AC97).
@@ -174,12 +178,13 @@ static unsigned short snd_trident_codec_read(ac97_t *ac97, unsigned short reg)
174 returns: TRUE if everything went ok, else FALSE. 178 returns: TRUE if everything went ok, else FALSE.
175 179
176 ---------------------------------------------------------------------------*/ 180 ---------------------------------------------------------------------------*/
177static void snd_trident_codec_write(ac97_t *ac97, unsigned short reg, unsigned short wdata) 181static void snd_trident_codec_write(struct snd_ac97 *ac97, unsigned short reg,
182 unsigned short wdata)
178{ 183{
179 unsigned int address, data; 184 unsigned int address, data;
180 unsigned short count = 0xffff; 185 unsigned short count = 0xffff;
181 unsigned long flags; 186 unsigned long flags;
182 trident_t *trident = ac97->private_data; 187 struct snd_trident *trident = ac97->private_data;
183 188
184 data = ((unsigned long) wdata) << 16; 189 data = ((unsigned long) wdata) << 16;
185 190
@@ -230,7 +235,7 @@ static void snd_trident_codec_write(ac97_t *ac97, unsigned short reg, unsigned s
230} 235}
231 236
232/*--------------------------------------------------------------------------- 237/*---------------------------------------------------------------------------
233 void snd_trident_enable_eso(trident_t *trident) 238 void snd_trident_enable_eso(struct snd_trident *trident)
234 239
235 Description: This routine will enable end of loop interrupts. 240 Description: This routine will enable end of loop interrupts.
236 End of loop interrupts will occur when a running 241 End of loop interrupts will occur when a running
@@ -241,7 +246,7 @@ static void snd_trident_codec_write(ac97_t *ac97, unsigned short reg, unsigned s
241 246
242 ---------------------------------------------------------------------------*/ 247 ---------------------------------------------------------------------------*/
243 248
244static void snd_trident_enable_eso(trident_t * trident) 249static void snd_trident_enable_eso(struct snd_trident * trident)
245{ 250{
246 unsigned int val; 251 unsigned int val;
247 252
@@ -254,7 +259,7 @@ static void snd_trident_enable_eso(trident_t * trident)
254} 259}
255 260
256/*--------------------------------------------------------------------------- 261/*---------------------------------------------------------------------------
257 void snd_trident_disable_eso(trident_t *trident) 262 void snd_trident_disable_eso(struct snd_trident *trident)
258 263
259 Description: This routine will disable end of loop interrupts. 264 Description: This routine will disable end of loop interrupts.
260 End of loop interrupts will occur when a running 265 End of loop interrupts will occur when a running
@@ -268,7 +273,7 @@ static void snd_trident_enable_eso(trident_t * trident)
268 273
269 ---------------------------------------------------------------------------*/ 274 ---------------------------------------------------------------------------*/
270 275
271static void snd_trident_disable_eso(trident_t * trident) 276static void snd_trident_disable_eso(struct snd_trident * trident)
272{ 277{
273 unsigned int tmp; 278 unsigned int tmp;
274 279
@@ -279,7 +284,7 @@ static void snd_trident_disable_eso(trident_t * trident)
279} 284}
280 285
281/*--------------------------------------------------------------------------- 286/*---------------------------------------------------------------------------
282 void snd_trident_start_voice(trident_t * trident, unsigned int voice) 287 void snd_trident_start_voice(struct snd_trident * trident, unsigned int voice)
283 288
284 Description: Start a voice, any channel 0 thru 63. 289 Description: Start a voice, any channel 0 thru 63.
285 This routine automatically handles the fact that there are 290 This routine automatically handles the fact that there are
@@ -292,7 +297,7 @@ static void snd_trident_disable_eso(trident_t * trident)
292 297
293 ---------------------------------------------------------------------------*/ 298 ---------------------------------------------------------------------------*/
294 299
295void snd_trident_start_voice(trident_t * trident, unsigned int voice) 300void snd_trident_start_voice(struct snd_trident * trident, unsigned int voice)
296{ 301{
297 unsigned int mask = 1 << (voice & 0x1f); 302 unsigned int mask = 1 << (voice & 0x1f);
298 unsigned int reg = (voice & 0x20) ? T4D_START_B : T4D_START_A; 303 unsigned int reg = (voice & 0x20) ? T4D_START_B : T4D_START_A;
@@ -301,7 +306,7 @@ void snd_trident_start_voice(trident_t * trident, unsigned int voice)
301} 306}
302 307
303/*--------------------------------------------------------------------------- 308/*---------------------------------------------------------------------------
304 void snd_trident_stop_voice(trident_t * trident, unsigned int voice) 309 void snd_trident_stop_voice(struct snd_trident * trident, unsigned int voice)
305 310
306 Description: Stop a voice, any channel 0 thru 63. 311 Description: Stop a voice, any channel 0 thru 63.
307 This routine automatically handles the fact that there are 312 This routine automatically handles the fact that there are
@@ -314,7 +319,7 @@ void snd_trident_start_voice(trident_t * trident, unsigned int voice)
314 319
315 ---------------------------------------------------------------------------*/ 320 ---------------------------------------------------------------------------*/
316 321
317void snd_trident_stop_voice(trident_t * trident, unsigned int voice) 322void snd_trident_stop_voice(struct snd_trident * trident, unsigned int voice)
318{ 323{
319 unsigned int mask = 1 << (voice & 0x1f); 324 unsigned int mask = 1 << (voice & 0x1f);
320 unsigned int reg = (voice & 0x20) ? T4D_STOP_B : T4D_STOP_A; 325 unsigned int reg = (voice & 0x20) ? T4D_STOP_B : T4D_STOP_A;
@@ -323,7 +328,7 @@ void snd_trident_stop_voice(trident_t * trident, unsigned int voice)
323} 328}
324 329
325/*--------------------------------------------------------------------------- 330/*---------------------------------------------------------------------------
326 int snd_trident_allocate_pcm_channel(trident_t *trident) 331 int snd_trident_allocate_pcm_channel(struct snd_trident *trident)
327 332
328 Description: Allocate hardware channel in Bank B (32-63). 333 Description: Allocate hardware channel in Bank B (32-63).
329 334
@@ -333,7 +338,7 @@ void snd_trident_stop_voice(trident_t * trident, unsigned int voice)
333 338
334 ---------------------------------------------------------------------------*/ 339 ---------------------------------------------------------------------------*/
335 340
336static int snd_trident_allocate_pcm_channel(trident_t * trident) 341static int snd_trident_allocate_pcm_channel(struct snd_trident * trident)
337{ 342{
338 int idx; 343 int idx;
339 344
@@ -361,7 +366,7 @@ static int snd_trident_allocate_pcm_channel(trident_t * trident)
361 366
362 ---------------------------------------------------------------------------*/ 367 ---------------------------------------------------------------------------*/
363 368
364static void snd_trident_free_pcm_channel(trident_t *trident, int channel) 369static void snd_trident_free_pcm_channel(struct snd_trident *trident, int channel)
365{ 370{
366 if (channel < 32 || channel > 63) 371 if (channel < 32 || channel > 63)
367 return; 372 return;
@@ -383,7 +388,7 @@ static void snd_trident_free_pcm_channel(trident_t *trident, int channel)
383 388
384 ---------------------------------------------------------------------------*/ 389 ---------------------------------------------------------------------------*/
385 390
386static int snd_trident_allocate_synth_channel(trident_t * trident) 391static int snd_trident_allocate_synth_channel(struct snd_trident * trident)
387{ 392{
388 int idx; 393 int idx;
389 394
@@ -409,7 +414,7 @@ static int snd_trident_allocate_synth_channel(trident_t * trident)
409 414
410 ---------------------------------------------------------------------------*/ 415 ---------------------------------------------------------------------------*/
411 416
412static void snd_trident_free_synth_channel(trident_t *trident, int channel) 417static void snd_trident_free_synth_channel(struct snd_trident *trident, int channel)
413{ 418{
414 if (channel < 0 || channel > 31) 419 if (channel < 0 || channel > 31)
415 return; 420 return;
@@ -432,8 +437,8 @@ static void snd_trident_free_synth_channel(trident_t *trident, int channel)
432 437
433 ---------------------------------------------------------------------------*/ 438 ---------------------------------------------------------------------------*/
434 439
435void snd_trident_write_voice_regs(trident_t * trident, 440void snd_trident_write_voice_regs(struct snd_trident * trident,
436 snd_trident_voice_t * voice) 441 struct snd_trident_voice * voice)
437{ 442{
438 unsigned int FmcRvolCvol; 443 unsigned int FmcRvolCvol;
439 unsigned int regs[5]; 444 unsigned int regs[5];
@@ -452,14 +457,16 @@ void snd_trident_write_voice_regs(trident_t * trident,
452 (voice->Vol & 0x000003ff) : 457 (voice->Vol & 0x000003ff) :
453 ((voice->Vol & 0x00003fc) << (16-2)) | 458 ((voice->Vol & 0x00003fc) << (16-2)) |
454 (voice->EC & 0x00000fff); 459 (voice->EC & 0x00000fff);
455 regs[0] = (voice->CSO << 16) | ((voice->Alpha & 0x00000fff) << 4) | (voice->FMS & 0x0000000f); 460 regs[0] = (voice->CSO << 16) | ((voice->Alpha & 0x00000fff) << 4) |
461 (voice->FMS & 0x0000000f);
456 regs[2] = (voice->ESO << 16) | (voice->Delta & 0x0ffff); 462 regs[2] = (voice->ESO << 16) | (voice->Delta & 0x0ffff);
457 regs[3] = (voice->Attribute << 16) | FmcRvolCvol; 463 regs[3] = (voice->Attribute << 16) | FmcRvolCvol;
458 break; 464 break;
459 case TRIDENT_DEVICE_ID_DX: 465 case TRIDENT_DEVICE_ID_DX:
460 regs[4] |= ((voice->Vol & 0x000003fc) << (16-2)) | 466 regs[4] |= ((voice->Vol & 0x000003fc) << (16-2)) |
461 (voice->EC & 0x00000fff); 467 (voice->EC & 0x00000fff);
462 regs[0] = (voice->CSO << 16) | ((voice->Alpha & 0x00000fff) << 4) | (voice->FMS & 0x0000000f); 468 regs[0] = (voice->CSO << 16) | ((voice->Alpha & 0x00000fff) << 4) |
469 (voice->FMS & 0x0000000f);
463 regs[2] = (voice->ESO << 16) | (voice->Delta & 0x0ffff); 470 regs[2] = (voice->ESO << 16) | (voice->Delta & 0x0ffff);
464 regs[3] = FmcRvolCvol; 471 regs[3] = FmcRvolCvol;
465 break; 472 break;
@@ -467,8 +474,10 @@ void snd_trident_write_voice_regs(trident_t * trident,
467 regs[4] |= ((voice->Vol & 0x000003fc) << (16-2)) | 474 regs[4] |= ((voice->Vol & 0x000003fc) << (16-2)) |
468 (voice->EC & 0x00000fff); 475 (voice->EC & 0x00000fff);
469 regs[0] = (voice->Delta << 24) | (voice->CSO & 0x00ffffff); 476 regs[0] = (voice->Delta << 24) | (voice->CSO & 0x00ffffff);
470 regs[2] = ((voice->Delta << 16) & 0xff000000) | (voice->ESO & 0x00ffffff); 477 regs[2] = ((voice->Delta << 16) & 0xff000000) |
471 regs[3] = (voice->Alpha << 20) | ((voice->FMS & 0x0000000f) << 16) | FmcRvolCvol; 478 (voice->ESO & 0x00ffffff);
479 regs[3] = (voice->Alpha << 20) |
480 ((voice->FMS & 0x0000000f) << 16) | FmcRvolCvol;
472 break; 481 break;
473 default: 482 default:
474 snd_BUG(); 483 snd_BUG();
@@ -504,14 +513,17 @@ void snd_trident_write_voice_regs(trident_t * trident,
504 513
505 ---------------------------------------------------------------------------*/ 514 ---------------------------------------------------------------------------*/
506 515
507static void snd_trident_write_cso_reg(trident_t * trident, snd_trident_voice_t * voice, unsigned int CSO) 516static void snd_trident_write_cso_reg(struct snd_trident * trident,
517 struct snd_trident_voice * voice,
518 unsigned int CSO)
508{ 519{
509 voice->CSO = CSO; 520 voice->CSO = CSO;
510 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR)); 521 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
511 if (trident->device != TRIDENT_DEVICE_ID_NX) { 522 if (trident->device != TRIDENT_DEVICE_ID_NX) {
512 outw(voice->CSO, TRID_REG(trident, CH_DX_CSO_ALPHA_FMS) + 2); 523 outw(voice->CSO, TRID_REG(trident, CH_DX_CSO_ALPHA_FMS) + 2);
513 } else { 524 } else {
514 outl((voice->Delta << 24) | (voice->CSO & 0x00ffffff), TRID_REG(trident, CH_NX_DELTA_CSO)); 525 outl((voice->Delta << 24) |
526 (voice->CSO & 0x00ffffff), TRID_REG(trident, CH_NX_DELTA_CSO));
515 } 527 }
516} 528}
517 529
@@ -527,14 +539,17 @@ static void snd_trident_write_cso_reg(trident_t * trident, snd_trident_voice_t *
527 539
528 ---------------------------------------------------------------------------*/ 540 ---------------------------------------------------------------------------*/
529 541
530static void snd_trident_write_eso_reg(trident_t * trident, snd_trident_voice_t * voice, unsigned int ESO) 542static void snd_trident_write_eso_reg(struct snd_trident * trident,
543 struct snd_trident_voice * voice,
544 unsigned int ESO)
531{ 545{
532 voice->ESO = ESO; 546 voice->ESO = ESO;
533 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR)); 547 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
534 if (trident->device != TRIDENT_DEVICE_ID_NX) { 548 if (trident->device != TRIDENT_DEVICE_ID_NX) {
535 outw(voice->ESO, TRID_REG(trident, CH_DX_ESO_DELTA) + 2); 549 outw(voice->ESO, TRID_REG(trident, CH_DX_ESO_DELTA) + 2);
536 } else { 550 } else {
537 outl(((voice->Delta << 16) & 0xff000000) | (voice->ESO & 0x00ffffff), TRID_REG(trident, CH_NX_DELTA_ESO)); 551 outl(((voice->Delta << 16) & 0xff000000) | (voice->ESO & 0x00ffffff),
552 TRID_REG(trident, CH_NX_DELTA_ESO));
538 } 553 }
539} 554}
540 555
@@ -550,7 +565,9 @@ static void snd_trident_write_eso_reg(trident_t * trident, snd_trident_voice_t *
550 565
551 ---------------------------------------------------------------------------*/ 566 ---------------------------------------------------------------------------*/
552 567
553static void snd_trident_write_vol_reg(trident_t * trident, snd_trident_voice_t * voice, unsigned int Vol) 568static void snd_trident_write_vol_reg(struct snd_trident * trident,
569 struct snd_trident_voice * voice,
570 unsigned int Vol)
554{ 571{
555 voice->Vol = Vol; 572 voice->Vol = Vol;
556 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR)); 573 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
@@ -561,7 +578,8 @@ static void snd_trident_write_vol_reg(trident_t * trident, snd_trident_voice_t *
561 break; 578 break;
562 case TRIDENT_DEVICE_ID_SI7018: 579 case TRIDENT_DEVICE_ID_SI7018:
563 // printk("voice->Vol = 0x%x\n", voice->Vol); 580 // printk("voice->Vol = 0x%x\n", voice->Vol);
564 outw((voice->CTRL << 12) | voice->Vol, TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC)); 581 outw((voice->CTRL << 12) | voice->Vol,
582 TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC));
565 break; 583 break;
566 } 584 }
567} 585}
@@ -578,11 +596,14 @@ static void snd_trident_write_vol_reg(trident_t * trident, snd_trident_voice_t *
578 596
579 ---------------------------------------------------------------------------*/ 597 ---------------------------------------------------------------------------*/
580 598
581static void snd_trident_write_pan_reg(trident_t * trident, snd_trident_voice_t * voice, unsigned int Pan) 599static void snd_trident_write_pan_reg(struct snd_trident * trident,
600 struct snd_trident_voice * voice,
601 unsigned int Pan)
582{ 602{
583 voice->Pan = Pan; 603 voice->Pan = Pan;
584 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR)); 604 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
585 outb(((voice->GVSel & 0x01) << 7) | (voice->Pan & 0x7f), TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC + 3)); 605 outb(((voice->GVSel & 0x01) << 7) | (voice->Pan & 0x7f),
606 TRID_REG(trident, CH_GVSEL_PAN_VOL_CTRL_EC + 3));
586} 607}
587 608
588/*--------------------------------------------------------------------------- 609/*---------------------------------------------------------------------------
@@ -597,12 +618,16 @@ static void snd_trident_write_pan_reg(trident_t * trident, snd_trident_voice_t *
597 618
598 ---------------------------------------------------------------------------*/ 619 ---------------------------------------------------------------------------*/
599 620
600static void snd_trident_write_rvol_reg(trident_t * trident, snd_trident_voice_t * voice, unsigned int RVol) 621static void snd_trident_write_rvol_reg(struct snd_trident * trident,
622 struct snd_trident_voice * voice,
623 unsigned int RVol)
601{ 624{
602 voice->RVol = RVol; 625 voice->RVol = RVol;
603 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR)); 626 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
604 outw(((voice->FMC & 0x0003) << 14) | ((voice->RVol & 0x007f) << 7) | (voice->CVol & 0x007f), 627 outw(((voice->FMC & 0x0003) << 14) | ((voice->RVol & 0x007f) << 7) |
605 TRID_REG(trident, trident->device == TRIDENT_DEVICE_ID_NX ? CH_NX_ALPHA_FMS_FMC_RVOL_CVOL : CH_DX_FMC_RVOL_CVOL)); 628 (voice->CVol & 0x007f),
629 TRID_REG(trident, trident->device == TRIDENT_DEVICE_ID_NX ?
630 CH_NX_ALPHA_FMS_FMC_RVOL_CVOL : CH_DX_FMC_RVOL_CVOL));
606} 631}
607 632
608/*--------------------------------------------------------------------------- 633/*---------------------------------------------------------------------------
@@ -617,12 +642,16 @@ static void snd_trident_write_rvol_reg(trident_t * trident, snd_trident_voice_t
617 642
618 ---------------------------------------------------------------------------*/ 643 ---------------------------------------------------------------------------*/
619 644
620static void snd_trident_write_cvol_reg(trident_t * trident, snd_trident_voice_t * voice, unsigned int CVol) 645static void snd_trident_write_cvol_reg(struct snd_trident * trident,
646 struct snd_trident_voice * voice,
647 unsigned int CVol)
621{ 648{
622 voice->CVol = CVol; 649 voice->CVol = CVol;
623 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR)); 650 outb(voice->number, TRID_REG(trident, T4D_LFO_GC_CIR));
624 outw(((voice->FMC & 0x0003) << 14) | ((voice->RVol & 0x007f) << 7) | (voice->CVol & 0x007f), 651 outw(((voice->FMC & 0x0003) << 14) | ((voice->RVol & 0x007f) << 7) |
625 TRID_REG(trident, trident->device == TRIDENT_DEVICE_ID_NX ? CH_NX_ALPHA_FMS_FMC_RVOL_CVOL : CH_DX_FMC_RVOL_CVOL)); 652 (voice->CVol & 0x007f),
653 TRID_REG(trident, trident->device == TRIDENT_DEVICE_ID_NX ?
654 CH_NX_ALPHA_FMS_FMC_RVOL_CVOL : CH_DX_FMC_RVOL_CVOL));
626} 655}
627 656
628/*--------------------------------------------------------------------------- 657/*---------------------------------------------------------------------------
@@ -696,7 +725,8 @@ static unsigned int snd_trident_convert_adc_rate(unsigned int rate)
696 Returns: Delta value. 725 Returns: Delta value.
697 726
698 ---------------------------------------------------------------------------*/ 727 ---------------------------------------------------------------------------*/
699static unsigned int snd_trident_spurious_threshold(unsigned int rate, unsigned int period_size) 728static unsigned int snd_trident_spurious_threshold(unsigned int rate,
729 unsigned int period_size)
700{ 730{
701 unsigned int res = (rate * period_size) / 48000; 731 unsigned int res = (rate * period_size) / 48000;
702 if (res < 64) 732 if (res < 64)
@@ -717,10 +747,10 @@ static unsigned int snd_trident_spurious_threshold(unsigned int rate, unsigned i
717 Returns: Control value. 747 Returns: Control value.
718 748
719 ---------------------------------------------------------------------------*/ 749 ---------------------------------------------------------------------------*/
720static unsigned int snd_trident_control_mode(snd_pcm_substream_t *substream) 750static unsigned int snd_trident_control_mode(struct snd_pcm_substream *substream)
721{ 751{
722 unsigned int CTRL; 752 unsigned int CTRL;
723 snd_pcm_runtime_t *runtime = substream->runtime; 753 struct snd_pcm_runtime *runtime = substream->runtime;
724 754
725 /* set ctrl mode 755 /* set ctrl mode
726 CTRL default: 8-bit (unsigned) mono, loop mode enabled 756 CTRL default: 8-bit (unsigned) mono, loop mode enabled
@@ -752,7 +782,7 @@ static unsigned int snd_trident_control_mode(snd_pcm_substream_t *substream)
752 782
753 ---------------------------------------------------------------------------*/ 783 ---------------------------------------------------------------------------*/
754 784
755static int snd_trident_ioctl(snd_pcm_substream_t * substream, 785static int snd_trident_ioctl(struct snd_pcm_substream *substream,
756 unsigned int cmd, 786 unsigned int cmd,
757 void *arg) 787 void *arg)
758{ 788{
@@ -774,12 +804,12 @@ static int snd_trident_ioctl(snd_pcm_substream_t * substream,
774 804
775 ---------------------------------------------------------------------------*/ 805 ---------------------------------------------------------------------------*/
776 806
777static int snd_trident_allocate_pcm_mem(snd_pcm_substream_t * substream, 807static int snd_trident_allocate_pcm_mem(struct snd_pcm_substream *substream,
778 snd_pcm_hw_params_t * hw_params) 808 struct snd_pcm_hw_params *hw_params)
779{ 809{
780 trident_t *trident = snd_pcm_substream_chip(substream); 810 struct snd_trident *trident = snd_pcm_substream_chip(substream);
781 snd_pcm_runtime_t *runtime = substream->runtime; 811 struct snd_pcm_runtime *runtime = substream->runtime;
782 snd_trident_voice_t *voice = (snd_trident_voice_t *) runtime->private_data; 812 struct snd_trident_voice *voice = runtime->private_data;
783 int err; 813 int err;
784 814
785 if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) 815 if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0)
@@ -808,13 +838,13 @@ static int snd_trident_allocate_pcm_mem(snd_pcm_substream_t * substream,
808 838
809 ---------------------------------------------------------------------------*/ 839 ---------------------------------------------------------------------------*/
810 840
811static int snd_trident_allocate_evoice(snd_pcm_substream_t * substream, 841static int snd_trident_allocate_evoice(struct snd_pcm_substream *substream,
812 snd_pcm_hw_params_t * hw_params) 842 struct snd_pcm_hw_params *hw_params)
813{ 843{
814 trident_t *trident = snd_pcm_substream_chip(substream); 844 struct snd_trident *trident = snd_pcm_substream_chip(substream);
815 snd_pcm_runtime_t *runtime = substream->runtime; 845 struct snd_pcm_runtime *runtime = substream->runtime;
816 snd_trident_voice_t *voice = (snd_trident_voice_t *) runtime->private_data; 846 struct snd_trident_voice *voice = runtime->private_data;
817 snd_trident_voice_t *evoice = voice->extra; 847 struct snd_trident_voice *evoice = voice->extra;
818 848
819 /* voice management */ 849 /* voice management */
820 850
@@ -848,8 +878,8 @@ static int snd_trident_allocate_evoice(snd_pcm_substream_t * substream,
848 878
849 ---------------------------------------------------------------------------*/ 879 ---------------------------------------------------------------------------*/
850 880
851static int snd_trident_hw_params(snd_pcm_substream_t * substream, 881static int snd_trident_hw_params(struct snd_pcm_substream *substream,
852 snd_pcm_hw_params_t * hw_params) 882 struct snd_pcm_hw_params *hw_params)
853{ 883{
854 int err; 884 int err;
855 885
@@ -870,12 +900,12 @@ static int snd_trident_hw_params(snd_pcm_substream_t * substream,
870 900
871 ---------------------------------------------------------------------------*/ 901 ---------------------------------------------------------------------------*/
872 902
873static int snd_trident_hw_free(snd_pcm_substream_t * substream) 903static int snd_trident_hw_free(struct snd_pcm_substream *substream)
874{ 904{
875 trident_t *trident = snd_pcm_substream_chip(substream); 905 struct snd_trident *trident = snd_pcm_substream_chip(substream);
876 snd_pcm_runtime_t *runtime = substream->runtime; 906 struct snd_pcm_runtime *runtime = substream->runtime;
877 snd_trident_voice_t *voice = (snd_trident_voice_t *) runtime->private_data; 907 struct snd_trident_voice *voice = runtime->private_data;
878 snd_trident_voice_t *evoice = voice ? voice->extra : NULL; 908 struct snd_trident_voice *evoice = voice ? voice->extra : NULL;
879 909
880 if (trident->tlb.entries) { 910 if (trident->tlb.entries) {
881 if (voice && voice->memblk) { 911 if (voice && voice->memblk) {
@@ -902,13 +932,13 @@ static int snd_trident_hw_free(snd_pcm_substream_t * substream)
902 932
903 ---------------------------------------------------------------------------*/ 933 ---------------------------------------------------------------------------*/
904 934
905static int snd_trident_playback_prepare(snd_pcm_substream_t * substream) 935static int snd_trident_playback_prepare(struct snd_pcm_substream *substream)
906{ 936{
907 trident_t *trident = snd_pcm_substream_chip(substream); 937 struct snd_trident *trident = snd_pcm_substream_chip(substream);
908 snd_pcm_runtime_t *runtime = substream->runtime; 938 struct snd_pcm_runtime *runtime = substream->runtime;
909 snd_trident_voice_t *voice = (snd_trident_voice_t *) runtime->private_data; 939 struct snd_trident_voice *voice = runtime->private_data;
910 snd_trident_voice_t *evoice = voice->extra; 940 struct snd_trident_voice *evoice = voice->extra;
911 snd_trident_pcm_mixer_t *mix = &trident->pcm_mixer[substream->number]; 941 struct snd_trident_pcm_mixer *mix = &trident->pcm_mixer[substream->number];
912 942
913 spin_lock_irq(&trident->reg_lock); 943 spin_lock_irq(&trident->reg_lock);
914 944
@@ -988,8 +1018,8 @@ static int snd_trident_playback_prepare(snd_pcm_substream_t * substream)
988 1018
989 ---------------------------------------------------------------------------*/ 1019 ---------------------------------------------------------------------------*/
990 1020
991static int snd_trident_capture_hw_params(snd_pcm_substream_t * substream, 1021static int snd_trident_capture_hw_params(struct snd_pcm_substream *substream,
992 snd_pcm_hw_params_t * hw_params) 1022 struct snd_pcm_hw_params *hw_params)
993{ 1023{
994 return snd_trident_allocate_pcm_mem(substream, hw_params); 1024 return snd_trident_allocate_pcm_mem(substream, hw_params);
995} 1025}
@@ -1005,11 +1035,11 @@ static int snd_trident_capture_hw_params(snd_pcm_substream_t * substream,
1005 1035
1006 ---------------------------------------------------------------------------*/ 1036 ---------------------------------------------------------------------------*/
1007 1037
1008static int snd_trident_capture_prepare(snd_pcm_substream_t * substream) 1038static int snd_trident_capture_prepare(struct snd_pcm_substream *substream)
1009{ 1039{
1010 trident_t *trident = snd_pcm_substream_chip(substream); 1040 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1011 snd_pcm_runtime_t *runtime = substream->runtime; 1041 struct snd_pcm_runtime *runtime = substream->runtime;
1012 snd_trident_voice_t *voice = (snd_trident_voice_t *) runtime->private_data; 1042 struct snd_trident_voice *voice = runtime->private_data;
1013 unsigned int val, ESO_bytes; 1043 unsigned int val, ESO_bytes;
1014 1044
1015 spin_lock_irq(&trident->reg_lock); 1045 spin_lock_irq(&trident->reg_lock);
@@ -1097,8 +1127,8 @@ static int snd_trident_capture_prepare(snd_pcm_substream_t * substream)
1097 1127
1098 ---------------------------------------------------------------------------*/ 1128 ---------------------------------------------------------------------------*/
1099 1129
1100static int snd_trident_si7018_capture_hw_params(snd_pcm_substream_t * substream, 1130static int snd_trident_si7018_capture_hw_params(struct snd_pcm_substream *substream,
1101 snd_pcm_hw_params_t * hw_params) 1131 struct snd_pcm_hw_params *hw_params)
1102{ 1132{
1103 int err; 1133 int err;
1104 1134
@@ -1119,12 +1149,12 @@ static int snd_trident_si7018_capture_hw_params(snd_pcm_substream_t * substream,
1119 1149
1120 ---------------------------------------------------------------------------*/ 1150 ---------------------------------------------------------------------------*/
1121 1151
1122static int snd_trident_si7018_capture_hw_free(snd_pcm_substream_t * substream) 1152static int snd_trident_si7018_capture_hw_free(struct snd_pcm_substream *substream)
1123{ 1153{
1124 trident_t *trident = snd_pcm_substream_chip(substream); 1154 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1125 snd_pcm_runtime_t *runtime = substream->runtime; 1155 struct snd_pcm_runtime *runtime = substream->runtime;
1126 snd_trident_voice_t *voice = (snd_trident_voice_t *) runtime->private_data; 1156 struct snd_trident_voice *voice = runtime->private_data;
1127 snd_trident_voice_t *evoice = voice ? voice->extra : NULL; 1157 struct snd_trident_voice *evoice = voice ? voice->extra : NULL;
1128 1158
1129 snd_pcm_lib_free_pages(substream); 1159 snd_pcm_lib_free_pages(substream);
1130 if (evoice != NULL) { 1160 if (evoice != NULL) {
@@ -1145,12 +1175,12 @@ static int snd_trident_si7018_capture_hw_free(snd_pcm_substream_t * substream)
1145 1175
1146 ---------------------------------------------------------------------------*/ 1176 ---------------------------------------------------------------------------*/
1147 1177
1148static int snd_trident_si7018_capture_prepare(snd_pcm_substream_t * substream) 1178static int snd_trident_si7018_capture_prepare(struct snd_pcm_substream *substream)
1149{ 1179{
1150 trident_t *trident = snd_pcm_substream_chip(substream); 1180 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1151 snd_pcm_runtime_t *runtime = substream->runtime; 1181 struct snd_pcm_runtime *runtime = substream->runtime;
1152 snd_trident_voice_t *voice = (snd_trident_voice_t *) runtime->private_data; 1182 struct snd_trident_voice *voice = runtime->private_data;
1153 snd_trident_voice_t *evoice = voice->extra; 1183 struct snd_trident_voice *evoice = voice->extra;
1154 1184
1155 spin_lock_irq(&trident->reg_lock); 1185 spin_lock_irq(&trident->reg_lock);
1156 1186
@@ -1216,12 +1246,12 @@ static int snd_trident_si7018_capture_prepare(snd_pcm_substream_t * substream)
1216 1246
1217 ---------------------------------------------------------------------------*/ 1247 ---------------------------------------------------------------------------*/
1218 1248
1219static int snd_trident_foldback_prepare(snd_pcm_substream_t * substream) 1249static int snd_trident_foldback_prepare(struct snd_pcm_substream *substream)
1220{ 1250{
1221 trident_t *trident = snd_pcm_substream_chip(substream); 1251 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1222 snd_pcm_runtime_t *runtime = substream->runtime; 1252 struct snd_pcm_runtime *runtime = substream->runtime;
1223 snd_trident_voice_t *voice = (snd_trident_voice_t *) runtime->private_data; 1253 struct snd_trident_voice *voice = runtime->private_data;
1224 snd_trident_voice_t *evoice = voice->extra; 1254 struct snd_trident_voice *evoice = voice->extra;
1225 1255
1226 spin_lock_irq(&trident->reg_lock); 1256 spin_lock_irq(&trident->reg_lock);
1227 1257
@@ -1294,10 +1324,10 @@ static int snd_trident_foldback_prepare(snd_pcm_substream_t * substream)
1294 1324
1295 ---------------------------------------------------------------------------*/ 1325 ---------------------------------------------------------------------------*/
1296 1326
1297static int snd_trident_spdif_hw_params(snd_pcm_substream_t * substream, 1327static int snd_trident_spdif_hw_params(struct snd_pcm_substream *substream,
1298 snd_pcm_hw_params_t * hw_params) 1328 struct snd_pcm_hw_params *hw_params)
1299{ 1329{
1300 trident_t *trident = snd_pcm_substream_chip(substream); 1330 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1301 unsigned int old_bits = 0, change = 0; 1331 unsigned int old_bits = 0, change = 0;
1302 int err; 1332 int err;
1303 1333
@@ -1359,13 +1389,13 @@ static int snd_trident_spdif_hw_params(snd_pcm_substream_t * substream,
1359 1389
1360 ---------------------------------------------------------------------------*/ 1390 ---------------------------------------------------------------------------*/
1361 1391
1362static int snd_trident_spdif_prepare(snd_pcm_substream_t * substream) 1392static int snd_trident_spdif_prepare(struct snd_pcm_substream *substream)
1363{ 1393{
1364 trident_t *trident = snd_pcm_substream_chip(substream); 1394 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1365 snd_pcm_runtime_t *runtime = substream->runtime; 1395 struct snd_pcm_runtime *runtime = substream->runtime;
1366 snd_trident_voice_t *voice = (snd_trident_voice_t *) runtime->private_data; 1396 struct snd_trident_voice *voice = runtime->private_data;
1367 snd_trident_voice_t *evoice = voice->extra; 1397 struct snd_trident_voice *evoice = voice->extra;
1368 snd_trident_pcm_mixer_t *mix = &trident->pcm_mixer[substream->number]; 1398 struct snd_trident_pcm_mixer *mix = &trident->pcm_mixer[substream->number];
1369 unsigned int RESO, LBAO; 1399 unsigned int RESO, LBAO;
1370 unsigned int temp; 1400 unsigned int temp;
1371 1401
@@ -1498,15 +1528,15 @@ static int snd_trident_spdif_prepare(snd_pcm_substream_t * substream)
1498 1528
1499 ---------------------------------------------------------------------------*/ 1529 ---------------------------------------------------------------------------*/
1500 1530
1501static int snd_trident_trigger(snd_pcm_substream_t *substream, 1531static int snd_trident_trigger(struct snd_pcm_substream *substream,
1502 int cmd) 1532 int cmd)
1503 1533
1504{ 1534{
1505 trident_t *trident = snd_pcm_substream_chip(substream); 1535 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1506 struct list_head *pos; 1536 struct list_head *pos;
1507 snd_pcm_substream_t *s; 1537 struct snd_pcm_substream *s;
1508 unsigned int what, whati, capture_flag, spdif_flag; 1538 unsigned int what, whati, capture_flag, spdif_flag;
1509 snd_trident_voice_t *voice, *evoice; 1539 struct snd_trident_voice *voice, *evoice;
1510 unsigned int val, go; 1540 unsigned int val, go;
1511 1541
1512 switch (cmd) { 1542 switch (cmd) {
@@ -1528,8 +1558,8 @@ static int snd_trident_trigger(snd_pcm_substream_t *substream,
1528 val = inl(TRID_REG(trident, T4D_STIMER)) & 0x00ffffff; 1558 val = inl(TRID_REG(trident, T4D_STIMER)) & 0x00ffffff;
1529 snd_pcm_group_for_each(pos, substream) { 1559 snd_pcm_group_for_each(pos, substream) {
1530 s = snd_pcm_group_substream_entry(pos); 1560 s = snd_pcm_group_substream_entry(pos);
1531 if ((trident_t *) snd_pcm_substream_chip(s) == trident) { 1561 if ((struct snd_trident *) snd_pcm_substream_chip(s) == trident) {
1532 voice = (snd_trident_voice_t *) s->runtime->private_data; 1562 voice = s->runtime->private_data;
1533 evoice = voice->extra; 1563 evoice = voice->extra;
1534 what |= 1 << (voice->number & 0x1f); 1564 what |= 1 << (voice->number & 0x1f);
1535 if (evoice == NULL) { 1565 if (evoice == NULL) {
@@ -1596,11 +1626,11 @@ static int snd_trident_trigger(snd_pcm_substream_t *substream,
1596 1626
1597 ---------------------------------------------------------------------------*/ 1627 ---------------------------------------------------------------------------*/
1598 1628
1599static snd_pcm_uframes_t snd_trident_playback_pointer(snd_pcm_substream_t * substream) 1629static snd_pcm_uframes_t snd_trident_playback_pointer(struct snd_pcm_substream *substream)
1600{ 1630{
1601 trident_t *trident = snd_pcm_substream_chip(substream); 1631 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1602 snd_pcm_runtime_t *runtime = substream->runtime; 1632 struct snd_pcm_runtime *runtime = substream->runtime;
1603 snd_trident_voice_t *voice = (snd_trident_voice_t *) runtime->private_data; 1633 struct snd_trident_voice *voice = runtime->private_data;
1604 unsigned int cso; 1634 unsigned int cso;
1605 1635
1606 if (!voice->running) 1636 if (!voice->running)
@@ -1635,11 +1665,11 @@ static snd_pcm_uframes_t snd_trident_playback_pointer(snd_pcm_substream_t * subs
1635 1665
1636 ---------------------------------------------------------------------------*/ 1666 ---------------------------------------------------------------------------*/
1637 1667
1638static snd_pcm_uframes_t snd_trident_capture_pointer(snd_pcm_substream_t * substream) 1668static snd_pcm_uframes_t snd_trident_capture_pointer(struct snd_pcm_substream *substream)
1639{ 1669{
1640 trident_t *trident = snd_pcm_substream_chip(substream); 1670 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1641 snd_pcm_runtime_t *runtime = substream->runtime; 1671 struct snd_pcm_runtime *runtime = substream->runtime;
1642 snd_trident_voice_t *voice = (snd_trident_voice_t *) runtime->private_data; 1672 struct snd_trident_voice *voice = runtime->private_data;
1643 unsigned int result; 1673 unsigned int result;
1644 1674
1645 if (!voice->running) 1675 if (!voice->running)
@@ -1665,11 +1695,11 @@ static snd_pcm_uframes_t snd_trident_capture_pointer(snd_pcm_substream_t * subst
1665 1695
1666 ---------------------------------------------------------------------------*/ 1696 ---------------------------------------------------------------------------*/
1667 1697
1668static snd_pcm_uframes_t snd_trident_spdif_pointer(snd_pcm_substream_t * substream) 1698static snd_pcm_uframes_t snd_trident_spdif_pointer(struct snd_pcm_substream *substream)
1669{ 1699{
1670 trident_t *trident = snd_pcm_substream_chip(substream); 1700 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1671 snd_pcm_runtime_t *runtime = substream->runtime; 1701 struct snd_pcm_runtime *runtime = substream->runtime;
1672 snd_trident_voice_t *voice = (snd_trident_voice_t *) runtime->private_data; 1702 struct snd_trident_voice *voice = runtime->private_data;
1673 unsigned int result; 1703 unsigned int result;
1674 1704
1675 if (!voice->running) 1705 if (!voice->running)
@@ -1684,7 +1714,7 @@ static snd_pcm_uframes_t snd_trident_spdif_pointer(snd_pcm_substream_t * substre
1684 * Playback support device description 1714 * Playback support device description
1685 */ 1715 */
1686 1716
1687static snd_pcm_hardware_t snd_trident_playback = 1717static struct snd_pcm_hardware snd_trident_playback =
1688{ 1718{
1689 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 1719 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
1690 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1720 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -1709,7 +1739,7 @@ static snd_pcm_hardware_t snd_trident_playback =
1709 * Capture support device description 1739 * Capture support device description
1710 */ 1740 */
1711 1741
1712static snd_pcm_hardware_t snd_trident_capture = 1742static struct snd_pcm_hardware snd_trident_capture =
1713{ 1743{
1714 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 1744 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
1715 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1745 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -1734,7 +1764,7 @@ static snd_pcm_hardware_t snd_trident_capture =
1734 * Foldback capture support device description 1764 * Foldback capture support device description
1735 */ 1765 */
1736 1766
1737static snd_pcm_hardware_t snd_trident_foldback = 1767static struct snd_pcm_hardware snd_trident_foldback =
1738{ 1768{
1739 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 1769 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
1740 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1770 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -1758,7 +1788,7 @@ static snd_pcm_hardware_t snd_trident_foldback =
1758 * SPDIF playback support device description 1788 * SPDIF playback support device description
1759 */ 1789 */
1760 1790
1761static snd_pcm_hardware_t snd_trident_spdif = 1791static struct snd_pcm_hardware snd_trident_spdif =
1762{ 1792{
1763 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 1793 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
1764 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1794 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -1779,7 +1809,7 @@ static snd_pcm_hardware_t snd_trident_spdif =
1779 .fifo_size = 0, 1809 .fifo_size = 0,
1780}; 1810};
1781 1811
1782static snd_pcm_hardware_t snd_trident_spdif_7018 = 1812static struct snd_pcm_hardware snd_trident_spdif_7018 =
1783{ 1813{
1784 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 1814 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
1785 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1815 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -1799,10 +1829,10 @@ static snd_pcm_hardware_t snd_trident_spdif_7018 =
1799 .fifo_size = 0, 1829 .fifo_size = 0,
1800}; 1830};
1801 1831
1802static void snd_trident_pcm_free_substream(snd_pcm_runtime_t *runtime) 1832static void snd_trident_pcm_free_substream(struct snd_pcm_runtime *runtime)
1803{ 1833{
1804 snd_trident_voice_t *voice = (snd_trident_voice_t *) runtime->private_data; 1834 struct snd_trident_voice *voice = runtime->private_data;
1805 trident_t *trident; 1835 struct snd_trident *trident;
1806 1836
1807 if (voice) { 1837 if (voice) {
1808 trident = voice->trident; 1838 trident = voice->trident;
@@ -1810,11 +1840,11 @@ static void snd_trident_pcm_free_substream(snd_pcm_runtime_t *runtime)
1810 } 1840 }
1811} 1841}
1812 1842
1813static int snd_trident_playback_open(snd_pcm_substream_t * substream) 1843static int snd_trident_playback_open(struct snd_pcm_substream *substream)
1814{ 1844{
1815 trident_t *trident = snd_pcm_substream_chip(substream); 1845 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1816 snd_pcm_runtime_t *runtime = substream->runtime; 1846 struct snd_pcm_runtime *runtime = substream->runtime;
1817 snd_trident_voice_t *voice; 1847 struct snd_trident_voice *voice;
1818 1848
1819 voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0); 1849 voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0);
1820 if (voice == NULL) 1850 if (voice == NULL)
@@ -1838,11 +1868,11 @@ static int snd_trident_playback_open(snd_pcm_substream_t * substream)
1838 Parameters: substream - PCM substream class 1868 Parameters: substream - PCM substream class
1839 1869
1840 ---------------------------------------------------------------------------*/ 1870 ---------------------------------------------------------------------------*/
1841static int snd_trident_playback_close(snd_pcm_substream_t * substream) 1871static int snd_trident_playback_close(struct snd_pcm_substream *substream)
1842{ 1872{
1843 trident_t *trident = snd_pcm_substream_chip(substream); 1873 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1844 snd_pcm_runtime_t *runtime = substream->runtime; 1874 struct snd_pcm_runtime *runtime = substream->runtime;
1845 snd_trident_voice_t *voice = (snd_trident_voice_t *) runtime->private_data; 1875 struct snd_trident_voice *voice = runtime->private_data;
1846 1876
1847 snd_trident_pcm_mixer_free(trident, voice, substream); 1877 snd_trident_pcm_mixer_free(trident, voice, substream);
1848 return 0; 1878 return 0;
@@ -1859,11 +1889,11 @@ static int snd_trident_playback_close(snd_pcm_substream_t * substream)
1859 1889
1860 ---------------------------------------------------------------------------*/ 1890 ---------------------------------------------------------------------------*/
1861 1891
1862static int snd_trident_spdif_open(snd_pcm_substream_t * substream) 1892static int snd_trident_spdif_open(struct snd_pcm_substream *substream)
1863{ 1893{
1864 trident_t *trident = snd_pcm_substream_chip(substream); 1894 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1865 snd_trident_voice_t *voice; 1895 struct snd_trident_voice *voice;
1866 snd_pcm_runtime_t *runtime = substream->runtime; 1896 struct snd_pcm_runtime *runtime = substream->runtime;
1867 1897
1868 voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0); 1898 voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0);
1869 if (voice == NULL) 1899 if (voice == NULL)
@@ -1900,9 +1930,9 @@ static int snd_trident_spdif_open(snd_pcm_substream_t * substream)
1900 1930
1901 ---------------------------------------------------------------------------*/ 1931 ---------------------------------------------------------------------------*/
1902 1932
1903static int snd_trident_spdif_close(snd_pcm_substream_t * substream) 1933static int snd_trident_spdif_close(struct snd_pcm_substream *substream)
1904{ 1934{
1905 trident_t *trident = snd_pcm_substream_chip(substream); 1935 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1906 unsigned int temp; 1936 unsigned int temp;
1907 1937
1908 spin_lock_irq(&trident->reg_lock); 1938 spin_lock_irq(&trident->reg_lock);
@@ -1938,11 +1968,11 @@ static int snd_trident_spdif_close(snd_pcm_substream_t * substream)
1938 1968
1939 ---------------------------------------------------------------------------*/ 1969 ---------------------------------------------------------------------------*/
1940 1970
1941static int snd_trident_capture_open(snd_pcm_substream_t * substream) 1971static int snd_trident_capture_open(struct snd_pcm_substream *substream)
1942{ 1972{
1943 trident_t *trident = snd_pcm_substream_chip(substream); 1973 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1944 snd_trident_voice_t *voice; 1974 struct snd_trident_voice *voice;
1945 snd_pcm_runtime_t *runtime = substream->runtime; 1975 struct snd_pcm_runtime *runtime = substream->runtime;
1946 1976
1947 voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0); 1977 voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0);
1948 if (voice == NULL) 1978 if (voice == NULL)
@@ -1966,7 +1996,7 @@ static int snd_trident_capture_open(snd_pcm_substream_t * substream)
1966 Parameters: substream - PCM substream class 1996 Parameters: substream - PCM substream class
1967 1997
1968 ---------------------------------------------------------------------------*/ 1998 ---------------------------------------------------------------------------*/
1969static int snd_trident_capture_close(snd_pcm_substream_t * substream) 1999static int snd_trident_capture_close(struct snd_pcm_substream *substream)
1970{ 2000{
1971 return 0; 2001 return 0;
1972} 2002}
@@ -1982,11 +2012,11 @@ static int snd_trident_capture_close(snd_pcm_substream_t * substream)
1982 2012
1983 ---------------------------------------------------------------------------*/ 2013 ---------------------------------------------------------------------------*/
1984 2014
1985static int snd_trident_foldback_open(snd_pcm_substream_t * substream) 2015static int snd_trident_foldback_open(struct snd_pcm_substream *substream)
1986{ 2016{
1987 trident_t *trident = snd_pcm_substream_chip(substream); 2017 struct snd_trident *trident = snd_pcm_substream_chip(substream);
1988 snd_trident_voice_t *voice; 2018 struct snd_trident_voice *voice;
1989 snd_pcm_runtime_t *runtime = substream->runtime; 2019 struct snd_pcm_runtime *runtime = substream->runtime;
1990 2020
1991 voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0); 2021 voice = snd_trident_alloc_voice(trident, SNDRV_TRIDENT_VOICE_TYPE_PCM, 0, 0);
1992 if (voice == NULL) 2022 if (voice == NULL)
@@ -2009,12 +2039,12 @@ static int snd_trident_foldback_open(snd_pcm_substream_t * substream)
2009 Parameters: substream - PCM substream class 2039 Parameters: substream - PCM substream class
2010 2040
2011 ---------------------------------------------------------------------------*/ 2041 ---------------------------------------------------------------------------*/
2012static int snd_trident_foldback_close(snd_pcm_substream_t * substream) 2042static int snd_trident_foldback_close(struct snd_pcm_substream *substream)
2013{ 2043{
2014 trident_t *trident = snd_pcm_substream_chip(substream); 2044 struct snd_trident *trident = snd_pcm_substream_chip(substream);
2015 snd_trident_voice_t *voice; 2045 struct snd_trident_voice *voice;
2016 snd_pcm_runtime_t *runtime = substream->runtime; 2046 struct snd_pcm_runtime *runtime = substream->runtime;
2017 voice = (snd_trident_voice_t *) runtime->private_data; 2047 voice = runtime->private_data;
2018 2048
2019 /* stop capture channel */ 2049 /* stop capture channel */
2020 spin_lock_irq(&trident->reg_lock); 2050 spin_lock_irq(&trident->reg_lock);
@@ -2027,7 +2057,7 @@ static int snd_trident_foldback_close(snd_pcm_substream_t * substream)
2027 PCM operations 2057 PCM operations
2028 ---------------------------------------------------------------------------*/ 2058 ---------------------------------------------------------------------------*/
2029 2059
2030static snd_pcm_ops_t snd_trident_playback_ops = { 2060static struct snd_pcm_ops snd_trident_playback_ops = {
2031 .open = snd_trident_playback_open, 2061 .open = snd_trident_playback_open,
2032 .close = snd_trident_playback_close, 2062 .close = snd_trident_playback_close,
2033 .ioctl = snd_trident_ioctl, 2063 .ioctl = snd_trident_ioctl,
@@ -2038,7 +2068,7 @@ static snd_pcm_ops_t snd_trident_playback_ops = {
2038 .pointer = snd_trident_playback_pointer, 2068 .pointer = snd_trident_playback_pointer,
2039}; 2069};
2040 2070
2041static snd_pcm_ops_t snd_trident_nx_playback_ops = { 2071static struct snd_pcm_ops snd_trident_nx_playback_ops = {
2042 .open = snd_trident_playback_open, 2072 .open = snd_trident_playback_open,
2043 .close = snd_trident_playback_close, 2073 .close = snd_trident_playback_close,
2044 .ioctl = snd_trident_ioctl, 2074 .ioctl = snd_trident_ioctl,
@@ -2050,7 +2080,7 @@ static snd_pcm_ops_t snd_trident_nx_playback_ops = {
2050 .page = snd_pcm_sgbuf_ops_page, 2080 .page = snd_pcm_sgbuf_ops_page,
2051}; 2081};
2052 2082
2053static snd_pcm_ops_t snd_trident_capture_ops = { 2083static struct snd_pcm_ops snd_trident_capture_ops = {
2054 .open = snd_trident_capture_open, 2084 .open = snd_trident_capture_open,
2055 .close = snd_trident_capture_close, 2085 .close = snd_trident_capture_close,
2056 .ioctl = snd_trident_ioctl, 2086 .ioctl = snd_trident_ioctl,
@@ -2061,7 +2091,7 @@ static snd_pcm_ops_t snd_trident_capture_ops = {
2061 .pointer = snd_trident_capture_pointer, 2091 .pointer = snd_trident_capture_pointer,
2062}; 2092};
2063 2093
2064static snd_pcm_ops_t snd_trident_si7018_capture_ops = { 2094static struct snd_pcm_ops snd_trident_si7018_capture_ops = {
2065 .open = snd_trident_capture_open, 2095 .open = snd_trident_capture_open,
2066 .close = snd_trident_capture_close, 2096 .close = snd_trident_capture_close,
2067 .ioctl = snd_trident_ioctl, 2097 .ioctl = snd_trident_ioctl,
@@ -2072,7 +2102,7 @@ static snd_pcm_ops_t snd_trident_si7018_capture_ops = {
2072 .pointer = snd_trident_playback_pointer, 2102 .pointer = snd_trident_playback_pointer,
2073}; 2103};
2074 2104
2075static snd_pcm_ops_t snd_trident_foldback_ops = { 2105static struct snd_pcm_ops snd_trident_foldback_ops = {
2076 .open = snd_trident_foldback_open, 2106 .open = snd_trident_foldback_open,
2077 .close = snd_trident_foldback_close, 2107 .close = snd_trident_foldback_close,
2078 .ioctl = snd_trident_ioctl, 2108 .ioctl = snd_trident_ioctl,
@@ -2083,7 +2113,7 @@ static snd_pcm_ops_t snd_trident_foldback_ops = {
2083 .pointer = snd_trident_playback_pointer, 2113 .pointer = snd_trident_playback_pointer,
2084}; 2114};
2085 2115
2086static snd_pcm_ops_t snd_trident_nx_foldback_ops = { 2116static struct snd_pcm_ops snd_trident_nx_foldback_ops = {
2087 .open = snd_trident_foldback_open, 2117 .open = snd_trident_foldback_open,
2088 .close = snd_trident_foldback_close, 2118 .close = snd_trident_foldback_close,
2089 .ioctl = snd_trident_ioctl, 2119 .ioctl = snd_trident_ioctl,
@@ -2095,7 +2125,7 @@ static snd_pcm_ops_t snd_trident_nx_foldback_ops = {
2095 .page = snd_pcm_sgbuf_ops_page, 2125 .page = snd_pcm_sgbuf_ops_page,
2096}; 2126};
2097 2127
2098static snd_pcm_ops_t snd_trident_spdif_ops = { 2128static struct snd_pcm_ops snd_trident_spdif_ops = {
2099 .open = snd_trident_spdif_open, 2129 .open = snd_trident_spdif_open,
2100 .close = snd_trident_spdif_close, 2130 .close = snd_trident_spdif_close,
2101 .ioctl = snd_trident_ioctl, 2131 .ioctl = snd_trident_ioctl,
@@ -2106,7 +2136,7 @@ static snd_pcm_ops_t snd_trident_spdif_ops = {
2106 .pointer = snd_trident_spdif_pointer, 2136 .pointer = snd_trident_spdif_pointer,
2107}; 2137};
2108 2138
2109static snd_pcm_ops_t snd_trident_spdif_7018_ops = { 2139static struct snd_pcm_ops snd_trident_spdif_7018_ops = {
2110 .open = snd_trident_spdif_open, 2140 .open = snd_trident_spdif_open,
2111 .close = snd_trident_spdif_close, 2141 .close = snd_trident_spdif_close,
2112 .ioctl = snd_trident_ioctl, 2142 .ioctl = snd_trident_ioctl,
@@ -2118,37 +2148,6 @@ static snd_pcm_ops_t snd_trident_spdif_7018_ops = {
2118}; 2148};
2119 2149
2120/*--------------------------------------------------------------------------- 2150/*---------------------------------------------------------------------------
2121 snd_trident_pcm_free
2122
2123 Description: This routine release the 4DWave private data.
2124
2125 Paramters: private_data - pointer to 4DWave device info.
2126
2127 Returns: None
2128
2129 ---------------------------------------------------------------------------*/
2130static void snd_trident_pcm_free(snd_pcm_t *pcm)
2131{
2132 trident_t *trident = pcm->private_data;
2133 trident->pcm = NULL;
2134 snd_pcm_lib_preallocate_free_for_all(pcm);
2135}
2136
2137static void snd_trident_foldback_pcm_free(snd_pcm_t *pcm)
2138{
2139 trident_t *trident = pcm->private_data;
2140 trident->foldback = NULL;
2141 snd_pcm_lib_preallocate_free_for_all(pcm);
2142}
2143
2144static void snd_trident_spdif_pcm_free(snd_pcm_t *pcm)
2145{
2146 trident_t *trident = pcm->private_data;
2147 trident->spdif = NULL;
2148 snd_pcm_lib_preallocate_free_for_all(pcm);
2149}
2150
2151/*---------------------------------------------------------------------------
2152 snd_trident_pcm 2151 snd_trident_pcm
2153 2152
2154 Description: This routine registers the 4DWave device for PCM support. 2153 Description: This routine registers the 4DWave device for PCM support.
@@ -2159,9 +2158,10 @@ static void snd_trident_spdif_pcm_free(snd_pcm_t *pcm)
2159 2158
2160 ---------------------------------------------------------------------------*/ 2159 ---------------------------------------------------------------------------*/
2161 2160
2162int __devinit snd_trident_pcm(trident_t * trident, int device, snd_pcm_t ** rpcm) 2161int __devinit snd_trident_pcm(struct snd_trident * trident,
2162 int device, struct snd_pcm ** rpcm)
2163{ 2163{
2164 snd_pcm_t *pcm; 2164 struct snd_pcm *pcm;
2165 int err; 2165 int err;
2166 2166
2167 if (rpcm) 2167 if (rpcm)
@@ -2170,7 +2170,6 @@ int __devinit snd_trident_pcm(trident_t * trident, int device, snd_pcm_t ** rpcm
2170 return err; 2170 return err;
2171 2171
2172 pcm->private_data = trident; 2172 pcm->private_data = trident;
2173 pcm->private_free = snd_trident_pcm_free;
2174 2173
2175 if (trident->tlb.entries) { 2174 if (trident->tlb.entries) {
2176 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_trident_nx_playback_ops); 2175 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_trident_nx_playback_ops);
@@ -2188,7 +2187,7 @@ int __devinit snd_trident_pcm(trident_t * trident, int device, snd_pcm_t ** rpcm
2188 trident->pcm = pcm; 2187 trident->pcm = pcm;
2189 2188
2190 if (trident->tlb.entries) { 2189 if (trident->tlb.entries) {
2191 snd_pcm_substream_t *substream; 2190 struct snd_pcm_substream *substream;
2192 for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next) 2191 for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next)
2193 snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV_SG, 2192 snd_pcm_lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV_SG,
2194 snd_dma_pci_data(trident->pci), 2193 snd_dma_pci_data(trident->pci),
@@ -2217,12 +2216,13 @@ int __devinit snd_trident_pcm(trident_t * trident, int device, snd_pcm_t ** rpcm
2217 2216
2218 ---------------------------------------------------------------------------*/ 2217 ---------------------------------------------------------------------------*/
2219 2218
2220int __devinit snd_trident_foldback_pcm(trident_t * trident, int device, snd_pcm_t ** rpcm) 2219int __devinit snd_trident_foldback_pcm(struct snd_trident * trident,
2220 int device, struct snd_pcm ** rpcm)
2221{ 2221{
2222 snd_pcm_t *foldback; 2222 struct snd_pcm *foldback;
2223 int err; 2223 int err;
2224 int num_chan = 3; 2224 int num_chan = 3;
2225 snd_pcm_substream_t *substream; 2225 struct snd_pcm_substream *substream;
2226 2226
2227 if (rpcm) 2227 if (rpcm)
2228 *rpcm = NULL; 2228 *rpcm = NULL;
@@ -2232,7 +2232,6 @@ int __devinit snd_trident_foldback_pcm(trident_t * trident, int device, snd_pcm_
2232 return err; 2232 return err;
2233 2233
2234 foldback->private_data = trident; 2234 foldback->private_data = trident;
2235 foldback->private_free = snd_trident_foldback_pcm_free;
2236 if (trident->tlb.entries) 2235 if (trident->tlb.entries)
2237 snd_pcm_set_ops(foldback, SNDRV_PCM_STREAM_CAPTURE, &snd_trident_nx_foldback_ops); 2236 snd_pcm_set_ops(foldback, SNDRV_PCM_STREAM_CAPTURE, &snd_trident_nx_foldback_ops);
2238 else 2237 else
@@ -2274,9 +2273,10 @@ int __devinit snd_trident_foldback_pcm(trident_t * trident, int device, snd_pcm_
2274 2273
2275 ---------------------------------------------------------------------------*/ 2274 ---------------------------------------------------------------------------*/
2276 2275
2277int __devinit snd_trident_spdif_pcm(trident_t * trident, int device, snd_pcm_t ** rpcm) 2276int __devinit snd_trident_spdif_pcm(struct snd_trident * trident,
2277 int device, struct snd_pcm ** rpcm)
2278{ 2278{
2279 snd_pcm_t *spdif; 2279 struct snd_pcm *spdif;
2280 int err; 2280 int err;
2281 2281
2282 if (rpcm) 2282 if (rpcm)
@@ -2285,7 +2285,6 @@ int __devinit snd_trident_spdif_pcm(trident_t * trident, int device, snd_pcm_t *
2285 return err; 2285 return err;
2286 2286
2287 spdif->private_data = trident; 2287 spdif->private_data = trident;
2288 spdif->private_free = snd_trident_spdif_pcm_free;
2289 if (trident->device != TRIDENT_DEVICE_ID_SI7018) { 2288 if (trident->device != TRIDENT_DEVICE_ID_SI7018) {
2290 snd_pcm_set_ops(spdif, SNDRV_PCM_STREAM_PLAYBACK, &snd_trident_spdif_ops); 2289 snd_pcm_set_ops(spdif, SNDRV_PCM_STREAM_PLAYBACK, &snd_trident_spdif_ops);
2291 } else { 2290 } else {
@@ -2313,7 +2312,8 @@ int __devinit snd_trident_spdif_pcm(trident_t * trident, int device, snd_pcm_t *
2313 Description: enable/disable S/PDIF out from ac97 mixer 2312 Description: enable/disable S/PDIF out from ac97 mixer
2314 ---------------------------------------------------------------------------*/ 2313 ---------------------------------------------------------------------------*/
2315 2314
2316static int snd_trident_spdif_control_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 2315static int snd_trident_spdif_control_info(struct snd_kcontrol *kcontrol,
2316 struct snd_ctl_elem_info *uinfo)
2317{ 2317{
2318 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 2318 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
2319 uinfo->count = 1; 2319 uinfo->count = 1;
@@ -2322,10 +2322,10 @@ static int snd_trident_spdif_control_info(snd_kcontrol_t *kcontrol, snd_ctl_elem
2322 return 0; 2322 return 0;
2323} 2323}
2324 2324
2325static int snd_trident_spdif_control_get(snd_kcontrol_t * kcontrol, 2325static int snd_trident_spdif_control_get(struct snd_kcontrol *kcontrol,
2326 snd_ctl_elem_value_t * ucontrol) 2326 struct snd_ctl_elem_value *ucontrol)
2327{ 2327{
2328 trident_t *trident = snd_kcontrol_chip(kcontrol); 2328 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2329 unsigned char val; 2329 unsigned char val;
2330 2330
2331 spin_lock_irq(&trident->reg_lock); 2331 spin_lock_irq(&trident->reg_lock);
@@ -2335,10 +2335,10 @@ static int snd_trident_spdif_control_get(snd_kcontrol_t * kcontrol,
2335 return 0; 2335 return 0;
2336} 2336}
2337 2337
2338static int snd_trident_spdif_control_put(snd_kcontrol_t * kcontrol, 2338static int snd_trident_spdif_control_put(struct snd_kcontrol *kcontrol,
2339 snd_ctl_elem_value_t * ucontrol) 2339 struct snd_ctl_elem_value *ucontrol)
2340{ 2340{
2341 trident_t *trident = snd_kcontrol_chip(kcontrol); 2341 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2342 unsigned char val; 2342 unsigned char val;
2343 int change; 2343 int change;
2344 2344
@@ -2366,7 +2366,7 @@ static int snd_trident_spdif_control_put(snd_kcontrol_t * kcontrol,
2366 return change; 2366 return change;
2367} 2367}
2368 2368
2369static snd_kcontrol_new_t snd_trident_spdif_control __devinitdata = 2369static struct snd_kcontrol_new snd_trident_spdif_control __devinitdata =
2370{ 2370{
2371 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2371 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2372 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), 2372 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH),
@@ -2382,17 +2382,18 @@ static snd_kcontrol_new_t snd_trident_spdif_control __devinitdata =
2382 Description: put/get the S/PDIF default settings 2382 Description: put/get the S/PDIF default settings
2383 ---------------------------------------------------------------------------*/ 2383 ---------------------------------------------------------------------------*/
2384 2384
2385static int snd_trident_spdif_default_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 2385static int snd_trident_spdif_default_info(struct snd_kcontrol *kcontrol,
2386 struct snd_ctl_elem_info *uinfo)
2386{ 2387{
2387 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; 2388 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
2388 uinfo->count = 1; 2389 uinfo->count = 1;
2389 return 0; 2390 return 0;
2390} 2391}
2391 2392
2392static int snd_trident_spdif_default_get(snd_kcontrol_t * kcontrol, 2393static int snd_trident_spdif_default_get(struct snd_kcontrol *kcontrol,
2393 snd_ctl_elem_value_t * ucontrol) 2394 struct snd_ctl_elem_value *ucontrol)
2394{ 2395{
2395 trident_t *trident = snd_kcontrol_chip(kcontrol); 2396 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2396 2397
2397 spin_lock_irq(&trident->reg_lock); 2398 spin_lock_irq(&trident->reg_lock);
2398 ucontrol->value.iec958.status[0] = (trident->spdif_bits >> 0) & 0xff; 2399 ucontrol->value.iec958.status[0] = (trident->spdif_bits >> 0) & 0xff;
@@ -2403,10 +2404,10 @@ static int snd_trident_spdif_default_get(snd_kcontrol_t * kcontrol,
2403 return 0; 2404 return 0;
2404} 2405}
2405 2406
2406static int snd_trident_spdif_default_put(snd_kcontrol_t * kcontrol, 2407static int snd_trident_spdif_default_put(struct snd_kcontrol *kcontrol,
2407 snd_ctl_elem_value_t * ucontrol) 2408 struct snd_ctl_elem_value *ucontrol)
2408{ 2409{
2409 trident_t *trident = snd_kcontrol_chip(kcontrol); 2410 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2410 unsigned int val; 2411 unsigned int val;
2411 int change; 2412 int change;
2412 2413
@@ -2428,7 +2429,7 @@ static int snd_trident_spdif_default_put(snd_kcontrol_t * kcontrol,
2428 return change; 2429 return change;
2429} 2430}
2430 2431
2431static snd_kcontrol_new_t snd_trident_spdif_default __devinitdata = 2432static struct snd_kcontrol_new snd_trident_spdif_default __devinitdata =
2432{ 2433{
2433 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 2434 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
2434 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), 2435 .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT),
@@ -2443,15 +2444,16 @@ static snd_kcontrol_new_t snd_trident_spdif_default __devinitdata =
2443 Description: put/get the S/PDIF mask 2444 Description: put/get the S/PDIF mask
2444 ---------------------------------------------------------------------------*/ 2445 ---------------------------------------------------------------------------*/
2445 2446
2446static int snd_trident_spdif_mask_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 2447static int snd_trident_spdif_mask_info(struct snd_kcontrol *kcontrol,
2448 struct snd_ctl_elem_info *uinfo)
2447{ 2449{
2448 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; 2450 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
2449 uinfo->count = 1; 2451 uinfo->count = 1;
2450 return 0; 2452 return 0;
2451} 2453}
2452 2454
2453static int snd_trident_spdif_mask_get(snd_kcontrol_t * kcontrol, 2455static int snd_trident_spdif_mask_get(struct snd_kcontrol *kcontrol,
2454 snd_ctl_elem_value_t * ucontrol) 2456 struct snd_ctl_elem_value *ucontrol)
2455{ 2457{
2456 ucontrol->value.iec958.status[0] = 0xff; 2458 ucontrol->value.iec958.status[0] = 0xff;
2457 ucontrol->value.iec958.status[1] = 0xff; 2459 ucontrol->value.iec958.status[1] = 0xff;
@@ -2460,7 +2462,7 @@ static int snd_trident_spdif_mask_get(snd_kcontrol_t * kcontrol,
2460 return 0; 2462 return 0;
2461} 2463}
2462 2464
2463static snd_kcontrol_new_t snd_trident_spdif_mask __devinitdata = 2465static struct snd_kcontrol_new snd_trident_spdif_mask __devinitdata =
2464{ 2466{
2465 .access = SNDRV_CTL_ELEM_ACCESS_READ, 2467 .access = SNDRV_CTL_ELEM_ACCESS_READ,
2466 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 2468 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -2475,17 +2477,18 @@ static snd_kcontrol_new_t snd_trident_spdif_mask __devinitdata =
2475 Description: put/get the S/PDIF stream settings 2477 Description: put/get the S/PDIF stream settings
2476 ---------------------------------------------------------------------------*/ 2478 ---------------------------------------------------------------------------*/
2477 2479
2478static int snd_trident_spdif_stream_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 2480static int snd_trident_spdif_stream_info(struct snd_kcontrol *kcontrol,
2481 struct snd_ctl_elem_info *uinfo)
2479{ 2482{
2480 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; 2483 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
2481 uinfo->count = 1; 2484 uinfo->count = 1;
2482 return 0; 2485 return 0;
2483} 2486}
2484 2487
2485static int snd_trident_spdif_stream_get(snd_kcontrol_t * kcontrol, 2488static int snd_trident_spdif_stream_get(struct snd_kcontrol *kcontrol,
2486 snd_ctl_elem_value_t * ucontrol) 2489 struct snd_ctl_elem_value *ucontrol)
2487{ 2490{
2488 trident_t *trident = snd_kcontrol_chip(kcontrol); 2491 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2489 2492
2490 spin_lock_irq(&trident->reg_lock); 2493 spin_lock_irq(&trident->reg_lock);
2491 ucontrol->value.iec958.status[0] = (trident->spdif_pcm_bits >> 0) & 0xff; 2494 ucontrol->value.iec958.status[0] = (trident->spdif_pcm_bits >> 0) & 0xff;
@@ -2496,10 +2499,10 @@ static int snd_trident_spdif_stream_get(snd_kcontrol_t * kcontrol,
2496 return 0; 2499 return 0;
2497} 2500}
2498 2501
2499static int snd_trident_spdif_stream_put(snd_kcontrol_t * kcontrol, 2502static int snd_trident_spdif_stream_put(struct snd_kcontrol *kcontrol,
2500 snd_ctl_elem_value_t * ucontrol) 2503 struct snd_ctl_elem_value *ucontrol)
2501{ 2504{
2502 trident_t *trident = snd_kcontrol_chip(kcontrol); 2505 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2503 unsigned int val; 2506 unsigned int val;
2504 int change; 2507 int change;
2505 2508
@@ -2521,7 +2524,7 @@ static int snd_trident_spdif_stream_put(snd_kcontrol_t * kcontrol,
2521 return change; 2524 return change;
2522} 2525}
2523 2526
2524static snd_kcontrol_new_t snd_trident_spdif_stream __devinitdata = 2527static struct snd_kcontrol_new snd_trident_spdif_stream __devinitdata =
2525{ 2528{
2526 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE, 2529 .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE,
2527 .iface = SNDRV_CTL_ELEM_IFACE_PCM, 2530 .iface = SNDRV_CTL_ELEM_IFACE_PCM,
@@ -2537,7 +2540,8 @@ static snd_kcontrol_new_t snd_trident_spdif_stream __devinitdata =
2537 Description: enable/disable rear path for ac97 2540 Description: enable/disable rear path for ac97
2538 ---------------------------------------------------------------------------*/ 2541 ---------------------------------------------------------------------------*/
2539 2542
2540static int snd_trident_ac97_control_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 2543static int snd_trident_ac97_control_info(struct snd_kcontrol *kcontrol,
2544 struct snd_ctl_elem_info *uinfo)
2541{ 2545{
2542 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; 2546 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
2543 uinfo->count = 1; 2547 uinfo->count = 1;
@@ -2546,10 +2550,10 @@ static int snd_trident_ac97_control_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_
2546 return 0; 2550 return 0;
2547} 2551}
2548 2552
2549static int snd_trident_ac97_control_get(snd_kcontrol_t * kcontrol, 2553static int snd_trident_ac97_control_get(struct snd_kcontrol *kcontrol,
2550 snd_ctl_elem_value_t * ucontrol) 2554 struct snd_ctl_elem_value *ucontrol)
2551{ 2555{
2552 trident_t *trident = snd_kcontrol_chip(kcontrol); 2556 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2553 unsigned char val; 2557 unsigned char val;
2554 2558
2555 spin_lock_irq(&trident->reg_lock); 2559 spin_lock_irq(&trident->reg_lock);
@@ -2559,10 +2563,10 @@ static int snd_trident_ac97_control_get(snd_kcontrol_t * kcontrol,
2559 return 0; 2563 return 0;
2560} 2564}
2561 2565
2562static int snd_trident_ac97_control_put(snd_kcontrol_t * kcontrol, 2566static int snd_trident_ac97_control_put(struct snd_kcontrol *kcontrol,
2563 snd_ctl_elem_value_t * ucontrol) 2567 struct snd_ctl_elem_value *ucontrol)
2564{ 2568{
2565 trident_t *trident = snd_kcontrol_chip(kcontrol); 2569 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2566 unsigned char val; 2570 unsigned char val;
2567 int change = 0; 2571 int change = 0;
2568 2572
@@ -2578,7 +2582,7 @@ static int snd_trident_ac97_control_put(snd_kcontrol_t * kcontrol,
2578 return change; 2582 return change;
2579} 2583}
2580 2584
2581static snd_kcontrol_new_t snd_trident_ac97_rear_control __devinitdata = 2585static struct snd_kcontrol_new snd_trident_ac97_rear_control __devinitdata =
2582{ 2586{
2583 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2587 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2584 .name = "Rear Path", 2588 .name = "Rear Path",
@@ -2594,7 +2598,8 @@ static snd_kcontrol_new_t snd_trident_ac97_rear_control __devinitdata =
2594 Description: wave & music volume control 2598 Description: wave & music volume control
2595 ---------------------------------------------------------------------------*/ 2599 ---------------------------------------------------------------------------*/
2596 2600
2597static int snd_trident_vol_control_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 2601static int snd_trident_vol_control_info(struct snd_kcontrol *kcontrol,
2602 struct snd_ctl_elem_info *uinfo)
2598{ 2603{
2599 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 2604 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
2600 uinfo->count = 2; 2605 uinfo->count = 2;
@@ -2603,10 +2608,10 @@ static int snd_trident_vol_control_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_i
2603 return 0; 2608 return 0;
2604} 2609}
2605 2610
2606static int snd_trident_vol_control_get(snd_kcontrol_t * kcontrol, 2611static int snd_trident_vol_control_get(struct snd_kcontrol *kcontrol,
2607 snd_ctl_elem_value_t * ucontrol) 2612 struct snd_ctl_elem_value *ucontrol)
2608{ 2613{
2609 trident_t *trident = snd_kcontrol_chip(kcontrol); 2614 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2610 unsigned int val; 2615 unsigned int val;
2611 2616
2612 val = trident->musicvol_wavevol; 2617 val = trident->musicvol_wavevol;
@@ -2615,10 +2620,10 @@ static int snd_trident_vol_control_get(snd_kcontrol_t * kcontrol,
2615 return 0; 2620 return 0;
2616} 2621}
2617 2622
2618static int snd_trident_vol_control_put(snd_kcontrol_t * kcontrol, 2623static int snd_trident_vol_control_put(struct snd_kcontrol *kcontrol,
2619 snd_ctl_elem_value_t * ucontrol) 2624 struct snd_ctl_elem_value *ucontrol)
2620{ 2625{
2621 trident_t *trident = snd_kcontrol_chip(kcontrol); 2626 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2622 unsigned int val; 2627 unsigned int val;
2623 int change = 0; 2628 int change = 0;
2624 2629
@@ -2633,7 +2638,7 @@ static int snd_trident_vol_control_put(snd_kcontrol_t * kcontrol,
2633 return change; 2638 return change;
2634} 2639}
2635 2640
2636static snd_kcontrol_new_t snd_trident_vol_music_control __devinitdata = 2641static struct snd_kcontrol_new snd_trident_vol_music_control __devinitdata =
2637{ 2642{
2638 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2643 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2639 .name = "Music Playback Volume", 2644 .name = "Music Playback Volume",
@@ -2643,7 +2648,7 @@ static snd_kcontrol_new_t snd_trident_vol_music_control __devinitdata =
2643 .private_value = 16, 2648 .private_value = 16,
2644}; 2649};
2645 2650
2646static snd_kcontrol_new_t snd_trident_vol_wave_control __devinitdata = 2651static struct snd_kcontrol_new snd_trident_vol_wave_control __devinitdata =
2647{ 2652{
2648 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2653 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2649 .name = "Wave Playback Volume", 2654 .name = "Wave Playback Volume",
@@ -2659,9 +2664,10 @@ static snd_kcontrol_new_t snd_trident_vol_wave_control __devinitdata =
2659 Description: PCM front volume control 2664 Description: PCM front volume control
2660 ---------------------------------------------------------------------------*/ 2665 ---------------------------------------------------------------------------*/
2661 2666
2662static int snd_trident_pcm_vol_control_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 2667static int snd_trident_pcm_vol_control_info(struct snd_kcontrol *kcontrol,
2668 struct snd_ctl_elem_info *uinfo)
2663{ 2669{
2664 trident_t *trident = snd_kcontrol_chip(kcontrol); 2670 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2665 2671
2666 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 2672 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
2667 uinfo->count = 1; 2673 uinfo->count = 1;
@@ -2672,11 +2678,11 @@ static int snd_trident_pcm_vol_control_info(snd_kcontrol_t *kcontrol, snd_ctl_el
2672 return 0; 2678 return 0;
2673} 2679}
2674 2680
2675static int snd_trident_pcm_vol_control_get(snd_kcontrol_t * kcontrol, 2681static int snd_trident_pcm_vol_control_get(struct snd_kcontrol *kcontrol,
2676 snd_ctl_elem_value_t * ucontrol) 2682 struct snd_ctl_elem_value *ucontrol)
2677{ 2683{
2678 trident_t *trident = snd_kcontrol_chip(kcontrol); 2684 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2679 snd_trident_pcm_mixer_t *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)]; 2685 struct snd_trident_pcm_mixer *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)];
2680 2686
2681 if (trident->device == TRIDENT_DEVICE_ID_SI7018) { 2687 if (trident->device == TRIDENT_DEVICE_ID_SI7018) {
2682 ucontrol->value.integer.value[0] = 1023 - mix->vol; 2688 ucontrol->value.integer.value[0] = 1023 - mix->vol;
@@ -2686,11 +2692,11 @@ static int snd_trident_pcm_vol_control_get(snd_kcontrol_t * kcontrol,
2686 return 0; 2692 return 0;
2687} 2693}
2688 2694
2689static int snd_trident_pcm_vol_control_put(snd_kcontrol_t * kcontrol, 2695static int snd_trident_pcm_vol_control_put(struct snd_kcontrol *kcontrol,
2690 snd_ctl_elem_value_t * ucontrol) 2696 struct snd_ctl_elem_value *ucontrol)
2691{ 2697{
2692 trident_t *trident = snd_kcontrol_chip(kcontrol); 2698 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2693 snd_trident_pcm_mixer_t *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)]; 2699 struct snd_trident_pcm_mixer *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)];
2694 unsigned int val; 2700 unsigned int val;
2695 int change = 0; 2701 int change = 0;
2696 2702
@@ -2708,7 +2714,7 @@ static int snd_trident_pcm_vol_control_put(snd_kcontrol_t * kcontrol,
2708 return change; 2714 return change;
2709} 2715}
2710 2716
2711static snd_kcontrol_new_t snd_trident_pcm_vol_control __devinitdata = 2717static struct snd_kcontrol_new snd_trident_pcm_vol_control __devinitdata =
2712{ 2718{
2713 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2719 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2714 .name = "PCM Front Playback Volume", 2720 .name = "PCM Front Playback Volume",
@@ -2725,7 +2731,8 @@ static snd_kcontrol_new_t snd_trident_pcm_vol_control __devinitdata =
2725 Description: PCM front pan control 2731 Description: PCM front pan control
2726 ---------------------------------------------------------------------------*/ 2732 ---------------------------------------------------------------------------*/
2727 2733
2728static int snd_trident_pcm_pan_control_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 2734static int snd_trident_pcm_pan_control_info(struct snd_kcontrol *kcontrol,
2735 struct snd_ctl_elem_info *uinfo)
2729{ 2736{
2730 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 2737 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
2731 uinfo->count = 1; 2738 uinfo->count = 1;
@@ -2734,11 +2741,11 @@ static int snd_trident_pcm_pan_control_info(snd_kcontrol_t *kcontrol, snd_ctl_el
2734 return 0; 2741 return 0;
2735} 2742}
2736 2743
2737static int snd_trident_pcm_pan_control_get(snd_kcontrol_t * kcontrol, 2744static int snd_trident_pcm_pan_control_get(struct snd_kcontrol *kcontrol,
2738 snd_ctl_elem_value_t * ucontrol) 2745 struct snd_ctl_elem_value *ucontrol)
2739{ 2746{
2740 trident_t *trident = snd_kcontrol_chip(kcontrol); 2747 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2741 snd_trident_pcm_mixer_t *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)]; 2748 struct snd_trident_pcm_mixer *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)];
2742 2749
2743 ucontrol->value.integer.value[0] = mix->pan; 2750 ucontrol->value.integer.value[0] = mix->pan;
2744 if (ucontrol->value.integer.value[0] & 0x40) { 2751 if (ucontrol->value.integer.value[0] & 0x40) {
@@ -2749,11 +2756,11 @@ static int snd_trident_pcm_pan_control_get(snd_kcontrol_t * kcontrol,
2749 return 0; 2756 return 0;
2750} 2757}
2751 2758
2752static int snd_trident_pcm_pan_control_put(snd_kcontrol_t * kcontrol, 2759static int snd_trident_pcm_pan_control_put(struct snd_kcontrol *kcontrol,
2753 snd_ctl_elem_value_t * ucontrol) 2760 struct snd_ctl_elem_value *ucontrol)
2754{ 2761{
2755 trident_t *trident = snd_kcontrol_chip(kcontrol); 2762 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2756 snd_trident_pcm_mixer_t *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)]; 2763 struct snd_trident_pcm_mixer *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)];
2757 unsigned char val; 2764 unsigned char val;
2758 int change = 0; 2765 int change = 0;
2759 2766
@@ -2770,7 +2777,7 @@ static int snd_trident_pcm_pan_control_put(snd_kcontrol_t * kcontrol,
2770 return change; 2777 return change;
2771} 2778}
2772 2779
2773static snd_kcontrol_new_t snd_trident_pcm_pan_control __devinitdata = 2780static struct snd_kcontrol_new snd_trident_pcm_pan_control __devinitdata =
2774{ 2781{
2775 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2782 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2776 .name = "PCM Pan Playback Control", 2783 .name = "PCM Pan Playback Control",
@@ -2787,7 +2794,8 @@ static snd_kcontrol_new_t snd_trident_pcm_pan_control __devinitdata =
2787 Description: PCM reverb volume control 2794 Description: PCM reverb volume control
2788 ---------------------------------------------------------------------------*/ 2795 ---------------------------------------------------------------------------*/
2789 2796
2790static int snd_trident_pcm_rvol_control_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 2797static int snd_trident_pcm_rvol_control_info(struct snd_kcontrol *kcontrol,
2798 struct snd_ctl_elem_info *uinfo)
2791{ 2799{
2792 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 2800 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
2793 uinfo->count = 1; 2801 uinfo->count = 1;
@@ -2796,21 +2804,21 @@ static int snd_trident_pcm_rvol_control_info(snd_kcontrol_t *kcontrol, snd_ctl_e
2796 return 0; 2804 return 0;
2797} 2805}
2798 2806
2799static int snd_trident_pcm_rvol_control_get(snd_kcontrol_t * kcontrol, 2807static int snd_trident_pcm_rvol_control_get(struct snd_kcontrol *kcontrol,
2800 snd_ctl_elem_value_t * ucontrol) 2808 struct snd_ctl_elem_value *ucontrol)
2801{ 2809{
2802 trident_t *trident = snd_kcontrol_chip(kcontrol); 2810 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2803 snd_trident_pcm_mixer_t *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)]; 2811 struct snd_trident_pcm_mixer *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)];
2804 2812
2805 ucontrol->value.integer.value[0] = 127 - mix->rvol; 2813 ucontrol->value.integer.value[0] = 127 - mix->rvol;
2806 return 0; 2814 return 0;
2807} 2815}
2808 2816
2809static int snd_trident_pcm_rvol_control_put(snd_kcontrol_t * kcontrol, 2817static int snd_trident_pcm_rvol_control_put(struct snd_kcontrol *kcontrol,
2810 snd_ctl_elem_value_t * ucontrol) 2818 struct snd_ctl_elem_value *ucontrol)
2811{ 2819{
2812 trident_t *trident = snd_kcontrol_chip(kcontrol); 2820 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2813 snd_trident_pcm_mixer_t *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)]; 2821 struct snd_trident_pcm_mixer *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)];
2814 unsigned short val; 2822 unsigned short val;
2815 int change = 0; 2823 int change = 0;
2816 2824
@@ -2824,7 +2832,7 @@ static int snd_trident_pcm_rvol_control_put(snd_kcontrol_t * kcontrol,
2824 return change; 2832 return change;
2825} 2833}
2826 2834
2827static snd_kcontrol_new_t snd_trident_pcm_rvol_control __devinitdata = 2835static struct snd_kcontrol_new snd_trident_pcm_rvol_control __devinitdata =
2828{ 2836{
2829 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2837 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2830 .name = "PCM Reverb Playback Volume", 2838 .name = "PCM Reverb Playback Volume",
@@ -2841,7 +2849,8 @@ static snd_kcontrol_new_t snd_trident_pcm_rvol_control __devinitdata =
2841 Description: PCM chorus volume control 2849 Description: PCM chorus volume control
2842 ---------------------------------------------------------------------------*/ 2850 ---------------------------------------------------------------------------*/
2843 2851
2844static int snd_trident_pcm_cvol_control_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 2852static int snd_trident_pcm_cvol_control_info(struct snd_kcontrol *kcontrol,
2853 struct snd_ctl_elem_info *uinfo)
2845{ 2854{
2846 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 2855 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
2847 uinfo->count = 1; 2856 uinfo->count = 1;
@@ -2850,21 +2859,21 @@ static int snd_trident_pcm_cvol_control_info(snd_kcontrol_t *kcontrol, snd_ctl_e
2850 return 0; 2859 return 0;
2851} 2860}
2852 2861
2853static int snd_trident_pcm_cvol_control_get(snd_kcontrol_t * kcontrol, 2862static int snd_trident_pcm_cvol_control_get(struct snd_kcontrol *kcontrol,
2854 snd_ctl_elem_value_t * ucontrol) 2863 struct snd_ctl_elem_value *ucontrol)
2855{ 2864{
2856 trident_t *trident = snd_kcontrol_chip(kcontrol); 2865 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2857 snd_trident_pcm_mixer_t *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)]; 2866 struct snd_trident_pcm_mixer *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)];
2858 2867
2859 ucontrol->value.integer.value[0] = 127 - mix->cvol; 2868 ucontrol->value.integer.value[0] = 127 - mix->cvol;
2860 return 0; 2869 return 0;
2861} 2870}
2862 2871
2863static int snd_trident_pcm_cvol_control_put(snd_kcontrol_t * kcontrol, 2872static int snd_trident_pcm_cvol_control_put(struct snd_kcontrol *kcontrol,
2864 snd_ctl_elem_value_t * ucontrol) 2873 struct snd_ctl_elem_value *ucontrol)
2865{ 2874{
2866 trident_t *trident = snd_kcontrol_chip(kcontrol); 2875 struct snd_trident *trident = snd_kcontrol_chip(kcontrol);
2867 snd_trident_pcm_mixer_t *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)]; 2876 struct snd_trident_pcm_mixer *mix = &trident->pcm_mixer[snd_ctl_get_ioffnum(kcontrol, &ucontrol->id)];
2868 unsigned short val; 2877 unsigned short val;
2869 int change = 0; 2878 int change = 0;
2870 2879
@@ -2878,7 +2887,7 @@ static int snd_trident_pcm_cvol_control_put(snd_kcontrol_t * kcontrol,
2878 return change; 2887 return change;
2879} 2888}
2880 2889
2881static snd_kcontrol_new_t snd_trident_pcm_cvol_control __devinitdata = 2890static struct snd_kcontrol_new snd_trident_pcm_cvol_control __devinitdata =
2882{ 2891{
2883 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 2892 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
2884 .name = "PCM Chorus Playback Volume", 2893 .name = "PCM Chorus Playback Volume",
@@ -2889,9 +2898,11 @@ static snd_kcontrol_new_t snd_trident_pcm_cvol_control __devinitdata =
2889 .put = snd_trident_pcm_cvol_control_put, 2898 .put = snd_trident_pcm_cvol_control_put,
2890}; 2899};
2891 2900
2892static void snd_trident_notify_pcm_change1(snd_card_t * card, snd_kcontrol_t *kctl, int num, int activate) 2901static void snd_trident_notify_pcm_change1(struct snd_card *card,
2902 struct snd_kcontrol *kctl,
2903 int num, int activate)
2893{ 2904{
2894 snd_ctl_elem_id_t id; 2905 struct snd_ctl_elem_id id;
2895 2906
2896 if (! kctl) 2907 if (! kctl)
2897 return; 2908 return;
@@ -2904,7 +2915,9 @@ static void snd_trident_notify_pcm_change1(snd_card_t * card, snd_kcontrol_t *kc
2904 snd_ctl_build_ioff(&id, kctl, num)); 2915 snd_ctl_build_ioff(&id, kctl, num));
2905} 2916}
2906 2917
2907static void snd_trident_notify_pcm_change(trident_t *trident, snd_trident_pcm_mixer_t *tmix, int num, int activate) 2918static void snd_trident_notify_pcm_change(struct snd_trident *trident,
2919 struct snd_trident_pcm_mixer *tmix,
2920 int num, int activate)
2908{ 2921{
2909 snd_trident_notify_pcm_change1(trident->card, trident->ctl_vol, num, activate); 2922 snd_trident_notify_pcm_change1(trident->card, trident->ctl_vol, num, activate);
2910 snd_trident_notify_pcm_change1(trident->card, trident->ctl_pan, num, activate); 2923 snd_trident_notify_pcm_change1(trident->card, trident->ctl_pan, num, activate);
@@ -2912,9 +2925,11 @@ static void snd_trident_notify_pcm_change(trident_t *trident, snd_trident_pcm_mi
2912 snd_trident_notify_pcm_change1(trident->card, trident->ctl_cvol, num, activate); 2925 snd_trident_notify_pcm_change1(trident->card, trident->ctl_cvol, num, activate);
2913} 2926}
2914 2927
2915static int snd_trident_pcm_mixer_build(trident_t *trident, snd_trident_voice_t *voice, snd_pcm_substream_t *substream) 2928static int snd_trident_pcm_mixer_build(struct snd_trident *trident,
2929 struct snd_trident_voice *voice,
2930 struct snd_pcm_substream *substream)
2916{ 2931{
2917 snd_trident_pcm_mixer_t *tmix; 2932 struct snd_trident_pcm_mixer *tmix;
2918 2933
2919 snd_assert(trident != NULL && voice != NULL && substream != NULL, return -EINVAL); 2934 snd_assert(trident != NULL && voice != NULL && substream != NULL, return -EINVAL);
2920 tmix = &trident->pcm_mixer[substream->number]; 2935 tmix = &trident->pcm_mixer[substream->number];
@@ -2927,9 +2942,9 @@ static int snd_trident_pcm_mixer_build(trident_t *trident, snd_trident_voice_t *
2927 return 0; 2942 return 0;
2928} 2943}
2929 2944
2930static int snd_trident_pcm_mixer_free(trident_t *trident, snd_trident_voice_t *voice, snd_pcm_substream_t *substream) 2945static int snd_trident_pcm_mixer_free(struct snd_trident *trident, struct snd_trident_voice *voice, struct snd_pcm_substream *substream)
2931{ 2946{
2932 snd_trident_pcm_mixer_t *tmix; 2947 struct snd_trident_pcm_mixer *tmix;
2933 2948
2934 snd_assert(trident != NULL && substream != NULL, return -EINVAL); 2949 snd_assert(trident != NULL && substream != NULL, return -EINVAL);
2935 tmix = &trident->pcm_mixer[substream->number]; 2950 tmix = &trident->pcm_mixer[substream->number];
@@ -2949,14 +2964,14 @@ static int snd_trident_pcm_mixer_free(trident_t *trident, snd_trident_voice_t *v
2949 2964
2950 ---------------------------------------------------------------------------*/ 2965 ---------------------------------------------------------------------------*/
2951 2966
2952static int __devinit snd_trident_mixer(trident_t * trident, int pcm_spdif_device) 2967static int __devinit snd_trident_mixer(struct snd_trident * trident, int pcm_spdif_device)
2953{ 2968{
2954 ac97_template_t _ac97; 2969 struct snd_ac97_template _ac97;
2955 snd_card_t * card = trident->card; 2970 struct snd_card *card = trident->card;
2956 snd_kcontrol_t *kctl; 2971 struct snd_kcontrol *kctl;
2957 snd_ctl_elem_value_t *uctl; 2972 struct snd_ctl_elem_value *uctl;
2958 int idx, err, retries = 2; 2973 int idx, err, retries = 2;
2959 static ac97_bus_ops_t ops = { 2974 static struct snd_ac97_bus_ops ops = {
2960 .write = snd_trident_codec_write, 2975 .write = snd_trident_codec_write,
2961 .read = snd_trident_codec_read, 2976 .read = snd_trident_codec_read,
2962 }; 2977 };
@@ -2993,7 +3008,7 @@ static int __devinit snd_trident_mixer(trident_t * trident, int pcm_spdif_device
2993 snd_printk(KERN_ERR "SI7018: the secondary codec - invalid access\n"); 3008 snd_printk(KERN_ERR "SI7018: the secondary codec - invalid access\n");
2994#if 0 // only for my testing purpose --jk 3009#if 0 // only for my testing purpose --jk
2995 { 3010 {
2996 ac97_t *mc97; 3011 struct snd_ac97 *mc97;
2997 err = snd_ac97_modem(trident->card, &_ac97, &mc97); 3012 err = snd_ac97_modem(trident->card, &_ac97, &mc97);
2998 if (err < 0) 3013 if (err < 0)
2999 snd_printk(KERN_ERR "snd_ac97_modem returned error %i\n", err); 3014 snd_printk(KERN_ERR "snd_ac97_modem returned error %i\n", err);
@@ -3016,7 +3031,7 @@ static int __devinit snd_trident_mixer(trident_t * trident, int pcm_spdif_device
3016 } 3031 }
3017 3032
3018 for (idx = 0; idx < 32; idx++) { 3033 for (idx = 0; idx < 32; idx++) {
3019 snd_trident_pcm_mixer_t *tmix; 3034 struct snd_trident_pcm_mixer *tmix;
3020 3035
3021 tmix = &trident->pcm_mixer[idx]; 3036 tmix = &trident->pcm_mixer[idx];
3022 tmix->voice = NULL; 3037 tmix->voice = NULL;
@@ -3114,7 +3129,7 @@ static int __devinit snd_trident_mixer(trident_t * trident, int pcm_spdif_device
3114 3129
3115static unsigned char snd_trident_gameport_read(struct gameport *gameport) 3130static unsigned char snd_trident_gameport_read(struct gameport *gameport)
3116{ 3131{
3117 trident_t *chip = gameport_get_port_data(gameport); 3132 struct snd_trident *chip = gameport_get_port_data(gameport);
3118 3133
3119 snd_assert(chip, return 0); 3134 snd_assert(chip, return 0);
3120 return inb(TRID_REG(chip, GAMEPORT_LEGACY)); 3135 return inb(TRID_REG(chip, GAMEPORT_LEGACY));
@@ -3122,7 +3137,7 @@ static unsigned char snd_trident_gameport_read(struct gameport *gameport)
3122 3137
3123static void snd_trident_gameport_trigger(struct gameport *gameport) 3138static void snd_trident_gameport_trigger(struct gameport *gameport)
3124{ 3139{
3125 trident_t *chip = gameport_get_port_data(gameport); 3140 struct snd_trident *chip = gameport_get_port_data(gameport);
3126 3141
3127 snd_assert(chip, return); 3142 snd_assert(chip, return);
3128 outb(0xff, TRID_REG(chip, GAMEPORT_LEGACY)); 3143 outb(0xff, TRID_REG(chip, GAMEPORT_LEGACY));
@@ -3130,7 +3145,7 @@ static void snd_trident_gameport_trigger(struct gameport *gameport)
3130 3145
3131static int snd_trident_gameport_cooked_read(struct gameport *gameport, int *axes, int *buttons) 3146static int snd_trident_gameport_cooked_read(struct gameport *gameport, int *axes, int *buttons)
3132{ 3147{
3133 trident_t *chip = gameport_get_port_data(gameport); 3148 struct snd_trident *chip = gameport_get_port_data(gameport);
3134 int i; 3149 int i;
3135 3150
3136 snd_assert(chip, return 0); 3151 snd_assert(chip, return 0);
@@ -3147,7 +3162,7 @@ static int snd_trident_gameport_cooked_read(struct gameport *gameport, int *axes
3147 3162
3148static int snd_trident_gameport_open(struct gameport *gameport, int mode) 3163static int snd_trident_gameport_open(struct gameport *gameport, int mode)
3149{ 3164{
3150 trident_t *chip = gameport_get_port_data(gameport); 3165 struct snd_trident *chip = gameport_get_port_data(gameport);
3151 3166
3152 snd_assert(chip, return 0); 3167 snd_assert(chip, return 0);
3153 3168
@@ -3164,7 +3179,7 @@ static int snd_trident_gameport_open(struct gameport *gameport, int mode)
3164 } 3179 }
3165} 3180}
3166 3181
3167int __devinit snd_trident_create_gameport(trident_t *chip) 3182int __devinit snd_trident_create_gameport(struct snd_trident *chip)
3168{ 3183{
3169 struct gameport *gp; 3184 struct gameport *gp;
3170 3185
@@ -3190,7 +3205,7 @@ int __devinit snd_trident_create_gameport(trident_t *chip)
3190 return 0; 3205 return 0;
3191} 3206}
3192 3207
3193static inline void snd_trident_free_gameport(trident_t *chip) 3208static inline void snd_trident_free_gameport(struct snd_trident *chip)
3194{ 3209{
3195 if (chip->gameport) { 3210 if (chip->gameport) {
3196 gameport_unregister_port(chip->gameport); 3211 gameport_unregister_port(chip->gameport);
@@ -3198,14 +3213,14 @@ static inline void snd_trident_free_gameport(trident_t *chip)
3198 } 3213 }
3199} 3214}
3200#else 3215#else
3201int __devinit snd_trident_create_gameport(trident_t *chip) { return -ENOSYS; } 3216int __devinit snd_trident_create_gameport(struct snd_trident *chip) { return -ENOSYS; }
3202static inline void snd_trident_free_gameport(trident_t *chip) { } 3217static inline void snd_trident_free_gameport(struct snd_trident *chip) { }
3203#endif /* CONFIG_GAMEPORT */ 3218#endif /* CONFIG_GAMEPORT */
3204 3219
3205/* 3220/*
3206 * delay for 1 tick 3221 * delay for 1 tick
3207 */ 3222 */
3208static inline void do_delay(trident_t *chip) 3223static inline void do_delay(struct snd_trident *chip)
3209{ 3224{
3210 schedule_timeout_uninterruptible(1); 3225 schedule_timeout_uninterruptible(1);
3211} 3226}
@@ -3214,7 +3229,7 @@ static inline void do_delay(trident_t *chip)
3214 * SiS reset routine 3229 * SiS reset routine
3215 */ 3230 */
3216 3231
3217static int snd_trident_sis_reset(trident_t *trident) 3232static int snd_trident_sis_reset(struct snd_trident *trident)
3218{ 3233{
3219 unsigned long end_time; 3234 unsigned long end_time;
3220 unsigned int i; 3235 unsigned int i;
@@ -3267,10 +3282,10 @@ static int snd_trident_sis_reset(trident_t *trident)
3267 * /proc interface 3282 * /proc interface
3268 */ 3283 */
3269 3284
3270static void snd_trident_proc_read(snd_info_entry_t *entry, 3285static void snd_trident_proc_read(struct snd_info_entry *entry,
3271 snd_info_buffer_t * buffer) 3286 struct snd_info_buffer *buffer)
3272{ 3287{
3273 trident_t *trident = entry->private_data; 3288 struct snd_trident *trident = entry->private_data;
3274 char *s; 3289 char *s;
3275 3290
3276 switch (trident->device) { 3291 switch (trident->device) {
@@ -3308,9 +3323,9 @@ static void snd_trident_proc_read(snd_info_entry_t *entry,
3308#endif 3323#endif
3309} 3324}
3310 3325
3311static void __devinit snd_trident_proc_init(trident_t * trident) 3326static void __devinit snd_trident_proc_init(struct snd_trident * trident)
3312{ 3327{
3313 snd_info_entry_t *entry; 3328 struct snd_info_entry *entry;
3314 const char *s = "trident"; 3329 const char *s = "trident";
3315 3330
3316 if (trident->device == TRIDENT_DEVICE_ID_SI7018) 3331 if (trident->device == TRIDENT_DEVICE_ID_SI7018)
@@ -3319,9 +3334,9 @@ static void __devinit snd_trident_proc_init(trident_t * trident)
3319 snd_info_set_text_ops(entry, trident, 1024, snd_trident_proc_read); 3334 snd_info_set_text_ops(entry, trident, 1024, snd_trident_proc_read);
3320} 3335}
3321 3336
3322static int snd_trident_dev_free(snd_device_t *device) 3337static int snd_trident_dev_free(struct snd_device *device)
3323{ 3338{
3324 trident_t *trident = device->device_data; 3339 struct snd_trident *trident = device->device_data;
3325 return snd_trident_free(trident); 3340 return snd_trident_free(trident);
3326} 3341}
3327 3342
@@ -3337,7 +3352,7 @@ static int snd_trident_dev_free(snd_device_t *device)
3337 3352
3338 ---------------------------------------------------------------------------*/ 3353 ---------------------------------------------------------------------------*/
3339 3354
3340static int __devinit snd_trident_tlb_alloc(trident_t *trident) 3355static int __devinit snd_trident_tlb_alloc(struct snd_trident *trident)
3341{ 3356{
3342 int i; 3357 int i;
3343 3358
@@ -3352,7 +3367,7 @@ static int __devinit snd_trident_tlb_alloc(trident_t *trident)
3352 trident->tlb.entries = (unsigned int*)(((unsigned long)trident->tlb.buffer.area + SNDRV_TRIDENT_MAX_PAGES * 4 - 1) & ~(SNDRV_TRIDENT_MAX_PAGES * 4 - 1)); 3367 trident->tlb.entries = (unsigned int*)(((unsigned long)trident->tlb.buffer.area + SNDRV_TRIDENT_MAX_PAGES * 4 - 1) & ~(SNDRV_TRIDENT_MAX_PAGES * 4 - 1));
3353 trident->tlb.entries_dmaaddr = (trident->tlb.buffer.addr + SNDRV_TRIDENT_MAX_PAGES * 4 - 1) & ~(SNDRV_TRIDENT_MAX_PAGES * 4 - 1); 3368 trident->tlb.entries_dmaaddr = (trident->tlb.buffer.addr + SNDRV_TRIDENT_MAX_PAGES * 4 - 1) & ~(SNDRV_TRIDENT_MAX_PAGES * 4 - 1);
3354 /* allocate shadow TLB page table (virtual addresses) */ 3369 /* allocate shadow TLB page table (virtual addresses) */
3355 trident->tlb.shadow_entries = (unsigned long *)vmalloc(SNDRV_TRIDENT_MAX_PAGES*sizeof(unsigned long)); 3370 trident->tlb.shadow_entries = vmalloc(SNDRV_TRIDENT_MAX_PAGES*sizeof(unsigned long));
3356 if (trident->tlb.shadow_entries == NULL) { 3371 if (trident->tlb.shadow_entries == NULL) {
3357 snd_printk(KERN_ERR "trident: unable to allocate shadow TLB entries\n"); 3372 snd_printk(KERN_ERR "trident: unable to allocate shadow TLB entries\n");
3358 return -ENOMEM; 3373 return -ENOMEM;
@@ -3374,7 +3389,7 @@ static int __devinit snd_trident_tlb_alloc(trident_t *trident)
3374 if (trident->tlb.memhdr == NULL) 3389 if (trident->tlb.memhdr == NULL)
3375 return -ENOMEM; 3390 return -ENOMEM;
3376 3391
3377 trident->tlb.memhdr->block_extra_size = sizeof(snd_trident_memblk_arg_t); 3392 trident->tlb.memhdr->block_extra_size = sizeof(struct snd_trident_memblk_arg);
3378 return 0; 3393 return 0;
3379} 3394}
3380 3395
@@ -3382,7 +3397,7 @@ static int __devinit snd_trident_tlb_alloc(trident_t *trident)
3382 * initialize 4D DX chip 3397 * initialize 4D DX chip
3383 */ 3398 */
3384 3399
3385static void snd_trident_stop_all_voices(trident_t *trident) 3400static void snd_trident_stop_all_voices(struct snd_trident *trident)
3386{ 3401{
3387 outl(0xffffffff, TRID_REG(trident, T4D_STOP_A)); 3402 outl(0xffffffff, TRID_REG(trident, T4D_STOP_A));
3388 outl(0xffffffff, TRID_REG(trident, T4D_STOP_B)); 3403 outl(0xffffffff, TRID_REG(trident, T4D_STOP_B));
@@ -3390,7 +3405,7 @@ static void snd_trident_stop_all_voices(trident_t *trident)
3390 outl(0, TRID_REG(trident, T4D_AINTEN_B)); 3405 outl(0, TRID_REG(trident, T4D_AINTEN_B));
3391} 3406}
3392 3407
3393static int snd_trident_4d_dx_init(trident_t *trident) 3408static int snd_trident_4d_dx_init(struct snd_trident *trident)
3394{ 3409{
3395 struct pci_dev *pci = trident->pci; 3410 struct pci_dev *pci = trident->pci;
3396 unsigned long end_time; 3411 unsigned long end_time;
@@ -3430,7 +3445,7 @@ static int snd_trident_4d_dx_init(trident_t *trident)
3430/* 3445/*
3431 * initialize 4D NX chip 3446 * initialize 4D NX chip
3432 */ 3447 */
3433static int snd_trident_4d_nx_init(trident_t *trident) 3448static int snd_trident_4d_nx_init(struct snd_trident *trident)
3434{ 3449{
3435 struct pci_dev *pci = trident->pci; 3450 struct pci_dev *pci = trident->pci;
3436 unsigned long end_time; 3451 unsigned long end_time;
@@ -3487,7 +3502,7 @@ static int snd_trident_4d_nx_init(trident_t *trident)
3487/* 3502/*
3488 * initialize sis7018 chip 3503 * initialize sis7018 chip
3489 */ 3504 */
3490static int snd_trident_sis_init(trident_t *trident) 3505static int snd_trident_sis_init(struct snd_trident *trident)
3491{ 3506{
3492 int err; 3507 int err;
3493 3508
@@ -3518,18 +3533,18 @@ static int snd_trident_sis_init(trident_t *trident)
3518 3533
3519 ---------------------------------------------------------------------------*/ 3534 ---------------------------------------------------------------------------*/
3520 3535
3521int __devinit snd_trident_create(snd_card_t * card, 3536int __devinit snd_trident_create(struct snd_card *card,
3522 struct pci_dev *pci, 3537 struct pci_dev *pci,
3523 int pcm_streams, 3538 int pcm_streams,
3524 int pcm_spdif_device, 3539 int pcm_spdif_device,
3525 int max_wavetable_size, 3540 int max_wavetable_size,
3526 trident_t ** rtrident) 3541 struct snd_trident ** rtrident)
3527{ 3542{
3528 trident_t *trident; 3543 struct snd_trident *trident;
3529 int i, err; 3544 int i, err;
3530 snd_trident_voice_t *voice; 3545 struct snd_trident_voice *voice;
3531 snd_trident_pcm_mixer_t *tmix; 3546 struct snd_trident_pcm_mixer *tmix;
3532 static snd_device_ops_t ops = { 3547 static struct snd_device_ops ops = {
3533 .dev_free = snd_trident_dev_free, 3548 .dev_free = snd_trident_dev_free,
3534 }; 3549 };
3535 3550
@@ -3577,7 +3592,8 @@ int __devinit snd_trident_create(snd_card_t * card,
3577 } 3592 }
3578 trident->port = pci_resource_start(pci, 0); 3593 trident->port = pci_resource_start(pci, 0);
3579 3594
3580 if (request_irq(pci->irq, snd_trident_interrupt, SA_INTERRUPT|SA_SHIRQ, "Trident Audio", (void *) trident)) { 3595 if (request_irq(pci->irq, snd_trident_interrupt, SA_INTERRUPT|SA_SHIRQ,
3596 "Trident Audio", trident)) {
3581 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 3597 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
3582 snd_trident_free(trident); 3598 snd_trident_free(trident);
3583 return -EBUSY; 3599 return -EBUSY;
@@ -3641,8 +3657,6 @@ int __devinit snd_trident_create(snd_card_t * card,
3641 3657
3642 snd_trident_enable_eso(trident); 3658 snd_trident_enable_eso(trident);
3643 3659
3644
3645 snd_card_set_pm_callback(card, snd_trident_suspend, snd_trident_resume, trident);
3646 snd_trident_proc_init(trident); 3660 snd_trident_proc_init(trident);
3647 snd_card_set_dev(card, &pci->dev); 3661 snd_card_set_dev(card, &pci->dev);
3648 *rtrident = trident; 3662 *rtrident = trident;
@@ -3661,7 +3675,7 @@ int __devinit snd_trident_create(snd_card_t * card,
3661 3675
3662 ---------------------------------------------------------------------------*/ 3676 ---------------------------------------------------------------------------*/
3663 3677
3664static int snd_trident_free(trident_t *trident) 3678static int snd_trident_free(struct snd_trident *trident)
3665{ 3679{
3666 snd_trident_free_gameport(trident); 3680 snd_trident_free_gameport(trident);
3667 snd_trident_disable_eso(trident); 3681 snd_trident_disable_eso(trident);
@@ -3681,7 +3695,7 @@ static int snd_trident_free(trident_t *trident)
3681 snd_dma_free_pages(&trident->tlb.buffer); 3695 snd_dma_free_pages(&trident->tlb.buffer);
3682 } 3696 }
3683 if (trident->irq >= 0) 3697 if (trident->irq >= 0)
3684 free_irq(trident->irq, (void *)trident); 3698 free_irq(trident->irq, trident);
3685 pci_release_regions(trident->pci); 3699 pci_release_regions(trident->pci);
3686 pci_disable_device(trident->pci); 3700 pci_disable_device(trident->pci);
3687 kfree(trident); 3701 kfree(trident);
@@ -3708,10 +3722,10 @@ static int snd_trident_free(trident_t *trident)
3708 3722
3709static irqreturn_t snd_trident_interrupt(int irq, void *dev_id, struct pt_regs *regs) 3723static irqreturn_t snd_trident_interrupt(int irq, void *dev_id, struct pt_regs *regs)
3710{ 3724{
3711 trident_t *trident = dev_id; 3725 struct snd_trident *trident = dev_id;
3712 unsigned int audio_int, chn_int, stimer, channel, mask, tmp; 3726 unsigned int audio_int, chn_int, stimer, channel, mask, tmp;
3713 int delta; 3727 int delta;
3714 snd_trident_voice_t *voice; 3728 struct snd_trident_voice *voice;
3715 3729
3716 audio_int = inl(TRID_REG(trident, T4D_MISCINT)); 3730 audio_int = inl(TRID_REG(trident, T4D_MISCINT));
3717 if ((audio_int & (ADDRESS_IRQ|MPU401_IRQ)) == 0) 3731 if ((audio_int & (ADDRESS_IRQ|MPU401_IRQ)) == 0)
@@ -3813,21 +3827,21 @@ static irqreturn_t snd_trident_interrupt(int irq, void *dev_id, struct pt_regs *
3813 Returns: None. 3827 Returns: None.
3814 3828
3815 ---------------------------------------------------------------------------*/ 3829 ---------------------------------------------------------------------------*/
3816int snd_trident_attach_synthesizer(trident_t *trident) 3830int snd_trident_attach_synthesizer(struct snd_trident *trident)
3817{ 3831{
3818#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)) 3832#if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))
3819 if (snd_seq_device_new(trident->card, 1, SNDRV_SEQ_DEV_ID_TRIDENT, 3833 if (snd_seq_device_new(trident->card, 1, SNDRV_SEQ_DEV_ID_TRIDENT,
3820 sizeof(trident_t*), &trident->seq_dev) >= 0) { 3834 sizeof(struct snd_trident *), &trident->seq_dev) >= 0) {
3821 strcpy(trident->seq_dev->name, "4DWave"); 3835 strcpy(trident->seq_dev->name, "4DWave");
3822 *(trident_t**)SNDRV_SEQ_DEVICE_ARGPTR(trident->seq_dev) = trident; 3836 *(struct snd_trident **)SNDRV_SEQ_DEVICE_ARGPTR(trident->seq_dev) = trident;
3823 } 3837 }
3824#endif 3838#endif
3825 return 0; 3839 return 0;
3826} 3840}
3827 3841
3828snd_trident_voice_t *snd_trident_alloc_voice(trident_t * trident, int type, int client, int port) 3842struct snd_trident_voice *snd_trident_alloc_voice(struct snd_trident * trident, int type, int client, int port)
3829{ 3843{
3830 snd_trident_voice_t *pvoice; 3844 struct snd_trident_voice *pvoice;
3831 unsigned long flags; 3845 unsigned long flags;
3832 int idx; 3846 int idx;
3833 3847
@@ -3869,10 +3883,10 @@ snd_trident_voice_t *snd_trident_alloc_voice(trident_t * trident, int type, int
3869 return NULL; 3883 return NULL;
3870} 3884}
3871 3885
3872void snd_trident_free_voice(trident_t * trident, snd_trident_voice_t *voice) 3886void snd_trident_free_voice(struct snd_trident * trident, struct snd_trident_voice *voice)
3873{ 3887{
3874 unsigned long flags; 3888 unsigned long flags;
3875 void (*private_free)(snd_trident_voice_t *); 3889 void (*private_free)(struct snd_trident_voice *);
3876 void *private_data; 3890 void *private_data;
3877 3891
3878 if (voice == NULL || !voice->use) 3892 if (voice == NULL || !voice->use)
@@ -3897,7 +3911,7 @@ void snd_trident_free_voice(trident_t * trident, snd_trident_voice_t *voice)
3897 private_free(voice); 3911 private_free(voice);
3898} 3912}
3899 3913
3900static void snd_trident_clear_voices(trident_t * trident, unsigned short v_min, unsigned short v_max) 3914static void snd_trident_clear_voices(struct snd_trident * trident, unsigned short v_min, unsigned short v_max)
3901{ 3915{
3902 unsigned int i, val, mask[2] = { 0, 0 }; 3916 unsigned int i, val, mask[2] = { 0, 0 };
3903 3917
@@ -3918,20 +3932,19 @@ static void snd_trident_clear_voices(trident_t * trident, unsigned short v_min,
3918} 3932}
3919 3933
3920#ifdef CONFIG_PM 3934#ifdef CONFIG_PM
3921static int snd_trident_suspend(snd_card_t *card, pm_message_t state) 3935int snd_trident_suspend(struct pci_dev *pci, pm_message_t state)
3922{ 3936{
3923 trident_t *trident = card->pm_private_data; 3937 struct snd_card *card = pci_get_drvdata(pci);
3938 struct snd_trident *trident = card->private_data;
3924 3939
3925 trident->in_suspend = 1; 3940 trident->in_suspend = 1;
3941 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
3926 snd_pcm_suspend_all(trident->pcm); 3942 snd_pcm_suspend_all(trident->pcm);
3927 if (trident->foldback) 3943 snd_pcm_suspend_all(trident->foldback);
3928 snd_pcm_suspend_all(trident->foldback); 3944 snd_pcm_suspend_all(trident->spdif);
3929 if (trident->spdif)
3930 snd_pcm_suspend_all(trident->spdif);
3931 3945
3932 snd_ac97_suspend(trident->ac97); 3946 snd_ac97_suspend(trident->ac97);
3933 if (trident->ac97_sec) 3947 snd_ac97_suspend(trident->ac97_sec);
3934 snd_ac97_suspend(trident->ac97_sec);
3935 3948
3936 switch (trident->device) { 3949 switch (trident->device) {
3937 case TRIDENT_DEVICE_ID_DX: 3950 case TRIDENT_DEVICE_ID_DX:
@@ -3940,19 +3953,19 @@ static int snd_trident_suspend(snd_card_t *card, pm_message_t state)
3940 case TRIDENT_DEVICE_ID_SI7018: 3953 case TRIDENT_DEVICE_ID_SI7018:
3941 break; 3954 break;
3942 } 3955 }
3943 pci_disable_device(trident->pci); 3956 pci_disable_device(pci);
3957 pci_save_state(pci);
3944 return 0; 3958 return 0;
3945} 3959}
3946 3960
3947static int snd_trident_resume(snd_card_t *card) 3961int snd_trident_resume(struct pci_dev *pci)
3948{ 3962{
3949 trident_t *trident = card->pm_private_data; 3963 struct snd_card *card = pci_get_drvdata(pci);
3964 struct snd_trident *trident = card->private_data;
3950 3965
3951 pci_enable_device(trident->pci); 3966 pci_restore_state(pci);
3952 if (pci_set_dma_mask(trident->pci, 0x3fffffff) < 0 || 3967 pci_enable_device(pci);
3953 pci_set_consistent_dma_mask(trident->pci, 0x3fffffff) < 0) 3968 pci_set_master(pci); /* to be sure */
3954 snd_printk(KERN_WARNING "trident: can't set the proper DMA mask\n");
3955 pci_set_master(trident->pci); /* to be sure */
3956 3969
3957 switch (trident->device) { 3970 switch (trident->device) {
3958 case TRIDENT_DEVICE_ID_DX: 3971 case TRIDENT_DEVICE_ID_DX:
@@ -3967,14 +3980,14 @@ static int snd_trident_resume(snd_card_t *card)
3967 } 3980 }
3968 3981
3969 snd_ac97_resume(trident->ac97); 3982 snd_ac97_resume(trident->ac97);
3970 if (trident->ac97_sec) 3983 snd_ac97_resume(trident->ac97_sec);
3971 snd_ac97_resume(trident->ac97_sec);
3972 3984
3973 /* restore some registers */ 3985 /* restore some registers */
3974 outl(trident->musicvol_wavevol, TRID_REG(trident, T4D_MUSICVOL_WAVEVOL)); 3986 outl(trident->musicvol_wavevol, TRID_REG(trident, T4D_MUSICVOL_WAVEVOL));
3975 3987
3976 snd_trident_enable_eso(trident); 3988 snd_trident_enable_eso(trident);
3977 3989
3990 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
3978 trident->in_suspend = 0; 3991 trident->in_suspend = 0;
3979 return 0; 3992 return 0;
3980} 3993}
diff --git a/sound/pci/trident/trident_memory.c b/sound/pci/trident/trident_memory.c
index f3e6c546af74..cf09ea99755c 100644
--- a/sound/pci/trident/trident_memory.c
+++ b/sound/pci/trident/trident_memory.c
@@ -68,13 +68,14 @@
68#define page_to_addr(trident,page) __tlb_to_addr(trident, (page) << 1) 68#define page_to_addr(trident,page) __tlb_to_addr(trident, (page) << 1)
69 69
70/* fill TLB entries -- we need to fill two entries */ 70/* fill TLB entries -- we need to fill two entries */
71static inline void set_tlb_bus(trident_t *trident, int page, unsigned long ptr, dma_addr_t addr) 71static inline void set_tlb_bus(struct snd_trident *trident, int page,
72 unsigned long ptr, dma_addr_t addr)
72{ 73{
73 page <<= 1; 74 page <<= 1;
74 __set_tlb_bus(trident, page, ptr, addr); 75 __set_tlb_bus(trident, page, ptr, addr);
75 __set_tlb_bus(trident, page+1, ptr + SNDRV_TRIDENT_PAGE_SIZE, addr + SNDRV_TRIDENT_PAGE_SIZE); 76 __set_tlb_bus(trident, page+1, ptr + SNDRV_TRIDENT_PAGE_SIZE, addr + SNDRV_TRIDENT_PAGE_SIZE);
76} 77}
77static inline void set_silent_tlb(trident_t *trident, int page) 78static inline void set_silent_tlb(struct snd_trident *trident, int page)
78{ 79{
79 page <<= 1; 80 page <<= 1;
80 __set_tlb_bus(trident, page, (unsigned long)trident->tlb.silent_page.area, trident->tlb.silent_page.addr); 81 __set_tlb_bus(trident, page, (unsigned long)trident->tlb.silent_page.area, trident->tlb.silent_page.addr);
@@ -97,7 +98,8 @@ static inline void set_silent_tlb(trident_t *trident, int page)
97#define page_to_addr(trident,page) __tlb_to_addr(trident, (page) * UNIT_PAGES) 98#define page_to_addr(trident,page) __tlb_to_addr(trident, (page) * UNIT_PAGES)
98 99
99/* fill TLB entries -- UNIT_PAGES entries must be filled */ 100/* fill TLB entries -- UNIT_PAGES entries must be filled */
100static inline void set_tlb_bus(trident_t *trident, int page, unsigned long ptr, dma_addr_t addr) 101static inline void set_tlb_bus(struct snd_trident *trident, int page,
102 unsigned long ptr, dma_addr_t addr)
101{ 103{
102 int i; 104 int i;
103 page *= UNIT_PAGES; 105 page *= UNIT_PAGES;
@@ -107,7 +109,7 @@ static inline void set_tlb_bus(trident_t *trident, int page, unsigned long ptr,
107 addr += SNDRV_TRIDENT_PAGE_SIZE; 109 addr += SNDRV_TRIDENT_PAGE_SIZE;
108 } 110 }
109} 111}
110static inline void set_silent_tlb(trident_t *trident, int page) 112static inline void set_silent_tlb(struct snd_trident *trident, int page)
111{ 113{
112 int i; 114 int i;
113 page *= UNIT_PAGES; 115 page *= UNIT_PAGES;
@@ -118,7 +120,7 @@ static inline void set_silent_tlb(trident_t *trident, int page)
118#endif /* PAGE_SIZE */ 120#endif /* PAGE_SIZE */
119 121
120/* calculate buffer pointer from offset address */ 122/* calculate buffer pointer from offset address */
121static inline void *offset_ptr(trident_t *trident, int offset) 123static inline void *offset_ptr(struct snd_trident *trident, int offset)
122{ 124{
123 char *ptr; 125 char *ptr;
124 ptr = page_to_ptr(trident, get_aligned_page(offset)); 126 ptr = page_to_ptr(trident, get_aligned_page(offset));
@@ -127,16 +129,16 @@ static inline void *offset_ptr(trident_t *trident, int offset)
127} 129}
128 130
129/* first and last (aligned) pages of memory block */ 131/* first and last (aligned) pages of memory block */
130#define firstpg(blk) (((snd_trident_memblk_arg_t*)snd_util_memblk_argptr(blk))->first_page) 132#define firstpg(blk) (((struct snd_trident_memblk_arg *)snd_util_memblk_argptr(blk))->first_page)
131#define lastpg(blk) (((snd_trident_memblk_arg_t*)snd_util_memblk_argptr(blk))->last_page) 133#define lastpg(blk) (((struct snd_trident_memblk_arg *)snd_util_memblk_argptr(blk))->last_page)
132 134
133/* 135/*
134 * search empty pages which may contain given size 136 * search empty pages which may contain given size
135 */ 137 */
136static snd_util_memblk_t * 138static struct snd_util_memblk *
137search_empty(snd_util_memhdr_t *hdr, int size) 139search_empty(struct snd_util_memhdr *hdr, int size)
138{ 140{
139 snd_util_memblk_t *blk, *prev; 141 struct snd_util_memblk *blk, *prev;
140 int page, psize; 142 int page, psize;
141 struct list_head *p; 143 struct list_head *p;
142 144
@@ -144,7 +146,7 @@ search_empty(snd_util_memhdr_t *hdr, int size)
144 prev = NULL; 146 prev = NULL;
145 page = 0; 147 page = 0;
146 list_for_each(p, &hdr->block) { 148 list_for_each(p, &hdr->block) {
147 blk = list_entry(p, snd_util_memblk_t, list); 149 blk = list_entry(p, struct snd_util_memblk, list);
148 if (page + psize <= firstpg(blk)) 150 if (page + psize <= firstpg(blk))
149 goto __found_pages; 151 goto __found_pages;
150 page = lastpg(blk) + 1; 152 page = lastpg(blk) + 1;
@@ -183,12 +185,13 @@ static int is_valid_page(unsigned long ptr)
183/* 185/*
184 * page allocation for DMA (Scatter-Gather version) 186 * page allocation for DMA (Scatter-Gather version)
185 */ 187 */
186static snd_util_memblk_t * 188static struct snd_util_memblk *
187snd_trident_alloc_sg_pages(trident_t *trident, snd_pcm_substream_t *substream) 189snd_trident_alloc_sg_pages(struct snd_trident *trident,
190 struct snd_pcm_substream *substream)
188{ 191{
189 snd_util_memhdr_t *hdr; 192 struct snd_util_memhdr *hdr;
190 snd_util_memblk_t *blk; 193 struct snd_util_memblk *blk;
191 snd_pcm_runtime_t *runtime = substream->runtime; 194 struct snd_pcm_runtime *runtime = substream->runtime;
192 int idx, page; 195 int idx, page;
193 struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream); 196 struct snd_sg_buf *sgbuf = snd_pcm_substream_sgbuf(substream);
194 197
@@ -230,13 +233,14 @@ snd_trident_alloc_sg_pages(trident_t *trident, snd_pcm_substream_t *substream)
230/* 233/*
231 * page allocation for DMA (contiguous version) 234 * page allocation for DMA (contiguous version)
232 */ 235 */
233static snd_util_memblk_t * 236static struct snd_util_memblk *
234snd_trident_alloc_cont_pages(trident_t *trident, snd_pcm_substream_t *substream) 237snd_trident_alloc_cont_pages(struct snd_trident *trident,
238 struct snd_pcm_substream *substream)
235{ 239{
236 snd_util_memhdr_t *hdr; 240 struct snd_util_memhdr *hdr;
237 snd_util_memblk_t *blk; 241 struct snd_util_memblk *blk;
238 int page; 242 int page;
239 snd_pcm_runtime_t *runtime = substream->runtime; 243 struct snd_pcm_runtime *runtime = substream->runtime;
240 dma_addr_t addr; 244 dma_addr_t addr;
241 unsigned long ptr; 245 unsigned long ptr;
242 246
@@ -270,8 +274,9 @@ snd_trident_alloc_cont_pages(trident_t *trident, snd_pcm_substream_t *substream)
270/* 274/*
271 * page allocation for DMA 275 * page allocation for DMA
272 */ 276 */
273snd_util_memblk_t * 277struct snd_util_memblk *
274snd_trident_alloc_pages(trident_t *trident, snd_pcm_substream_t *substream) 278snd_trident_alloc_pages(struct snd_trident *trident,
279 struct snd_pcm_substream *substream)
275{ 280{
276 snd_assert(trident != NULL, return NULL); 281 snd_assert(trident != NULL, return NULL);
277 snd_assert(substream != NULL, return NULL); 282 snd_assert(substream != NULL, return NULL);
@@ -285,9 +290,10 @@ snd_trident_alloc_pages(trident_t *trident, snd_pcm_substream_t *substream)
285/* 290/*
286 * release DMA buffer from page table 291 * release DMA buffer from page table
287 */ 292 */
288int snd_trident_free_pages(trident_t *trident, snd_util_memblk_t *blk) 293int snd_trident_free_pages(struct snd_trident *trident,
294 struct snd_util_memblk *blk)
289{ 295{
290 snd_util_memhdr_t *hdr; 296 struct snd_util_memhdr *hdr;
291 int page; 297 int page;
292 298
293 snd_assert(trident != NULL, return -EINVAL); 299 snd_assert(trident != NULL, return -EINVAL);
@@ -314,17 +320,17 @@ int snd_trident_free_pages(trident_t *trident, snd_util_memblk_t *blk)
314 320
315/* 321/*
316 */ 322 */
317static int synth_alloc_pages(trident_t *hw, snd_util_memblk_t *blk); 323static int synth_alloc_pages(struct snd_trident *hw, struct snd_util_memblk *blk);
318static int synth_free_pages(trident_t *hw, snd_util_memblk_t *blk); 324static int synth_free_pages(struct snd_trident *hw, struct snd_util_memblk *blk);
319 325
320/* 326/*
321 * allocate a synth sample area 327 * allocate a synth sample area
322 */ 328 */
323snd_util_memblk_t * 329struct snd_util_memblk *
324snd_trident_synth_alloc(trident_t *hw, unsigned int size) 330snd_trident_synth_alloc(struct snd_trident *hw, unsigned int size)
325{ 331{
326 snd_util_memblk_t *blk; 332 struct snd_util_memblk *blk;
327 snd_util_memhdr_t *hdr = hw->tlb.memhdr; 333 struct snd_util_memhdr *hdr = hw->tlb.memhdr;
328 334
329 down(&hdr->block_mutex); 335 down(&hdr->block_mutex);
330 blk = __snd_util_mem_alloc(hdr, size); 336 blk = __snd_util_mem_alloc(hdr, size);
@@ -346,9 +352,9 @@ snd_trident_synth_alloc(trident_t *hw, unsigned int size)
346 * free a synth sample area 352 * free a synth sample area
347 */ 353 */
348int 354int
349snd_trident_synth_free(trident_t *hw, snd_util_memblk_t *blk) 355snd_trident_synth_free(struct snd_trident *hw, struct snd_util_memblk *blk)
350{ 356{
351 snd_util_memhdr_t *hdr = hw->tlb.memhdr; 357 struct snd_util_memhdr *hdr = hw->tlb.memhdr;
352 358
353 down(&hdr->block_mutex); 359 down(&hdr->block_mutex);
354 synth_free_pages(hw, blk); 360 synth_free_pages(hw, blk);
@@ -361,7 +367,7 @@ snd_trident_synth_free(trident_t *hw, snd_util_memblk_t *blk)
361/* 367/*
362 * reset TLB entry and free kernel page 368 * reset TLB entry and free kernel page
363 */ 369 */
364static void clear_tlb(trident_t *trident, int page) 370static void clear_tlb(struct snd_trident *trident, int page)
365{ 371{
366 void *ptr = page_to_ptr(trident, page); 372 void *ptr = page_to_ptr(trident, page);
367 dma_addr_t addr = page_to_addr(trident, page); 373 dma_addr_t addr = page_to_addr(trident, page);
@@ -378,20 +384,22 @@ static void clear_tlb(trident_t *trident, int page)
378} 384}
379 385
380/* check new allocation range */ 386/* check new allocation range */
381static void get_single_page_range(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk, int *first_page_ret, int *last_page_ret) 387static void get_single_page_range(struct snd_util_memhdr *hdr,
388 struct snd_util_memblk *blk,
389 int *first_page_ret, int *last_page_ret)
382{ 390{
383 struct list_head *p; 391 struct list_head *p;
384 snd_util_memblk_t *q; 392 struct snd_util_memblk *q;
385 int first_page, last_page; 393 int first_page, last_page;
386 first_page = firstpg(blk); 394 first_page = firstpg(blk);
387 if ((p = blk->list.prev) != &hdr->block) { 395 if ((p = blk->list.prev) != &hdr->block) {
388 q = list_entry(p, snd_util_memblk_t, list); 396 q = list_entry(p, struct snd_util_memblk, list);
389 if (lastpg(q) == first_page) 397 if (lastpg(q) == first_page)
390 first_page++; /* first page was already allocated */ 398 first_page++; /* first page was already allocated */
391 } 399 }
392 last_page = lastpg(blk); 400 last_page = lastpg(blk);
393 if ((p = blk->list.next) != &hdr->block) { 401 if ((p = blk->list.next) != &hdr->block) {
394 q = list_entry(p, snd_util_memblk_t, list); 402 q = list_entry(p, struct snd_util_memblk, list);
395 if (firstpg(q) == last_page) 403 if (firstpg(q) == last_page)
396 last_page--; /* last page was already allocated */ 404 last_page--; /* last page was already allocated */
397 } 405 }
@@ -402,7 +410,7 @@ static void get_single_page_range(snd_util_memhdr_t *hdr, snd_util_memblk_t *blk
402/* 410/*
403 * allocate kernel pages and assign them to TLB 411 * allocate kernel pages and assign them to TLB
404 */ 412 */
405static int synth_alloc_pages(trident_t *hw, snd_util_memblk_t *blk) 413static int synth_alloc_pages(struct snd_trident *hw, struct snd_util_memblk *blk)
406{ 414{
407 int page, first_page, last_page; 415 int page, first_page, last_page;
408 struct snd_dma_buffer dmab; 416 struct snd_dma_buffer dmab;
@@ -438,7 +446,7 @@ __fail:
438/* 446/*
439 * free pages 447 * free pages
440 */ 448 */
441static int synth_free_pages(trident_t *trident, snd_util_memblk_t *blk) 449static int synth_free_pages(struct snd_trident *trident, struct snd_util_memblk *blk)
442{ 450{
443 int page, first_page, last_page; 451 int page, first_page, last_page;
444 452
@@ -452,7 +460,9 @@ static int synth_free_pages(trident_t *trident, snd_util_memblk_t *blk)
452/* 460/*
453 * copy_from_user(blk + offset, data, size) 461 * copy_from_user(blk + offset, data, size)
454 */ 462 */
455int snd_trident_synth_copy_from_user(trident_t *trident, snd_util_memblk_t *blk, int offset, const char __user *data, int size) 463int snd_trident_synth_copy_from_user(struct snd_trident *trident,
464 struct snd_util_memblk *blk,
465 int offset, const char __user *data, int size)
456{ 466{
457 int page, nextofs, end_offset, temp, temp1; 467 int page, nextofs, end_offset, temp, temp1;
458 468
diff --git a/sound/pci/trident/trident_synth.c b/sound/pci/trident/trident_synth.c
index 5d5a719b0585..cc7af8bc55a0 100644
--- a/sound/pci/trident/trident_synth.c
+++ b/sound/pci/trident/trident_synth.c
@@ -192,15 +192,15 @@ static unsigned short log_from_linear( unsigned short value )
192 * Sample handling operations 192 * Sample handling operations
193 */ 193 */
194 194
195static void sample_start(trident_t * trident, snd_trident_voice_t * voice, snd_seq_position_t position); 195static void sample_start(struct snd_trident * trident, struct snd_trident_voice * voice, snd_seq_position_t position);
196static void sample_stop(trident_t * trident, snd_trident_voice_t * voice, snd_seq_stop_mode_t mode); 196static void sample_stop(struct snd_trident * trident, struct snd_trident_voice * voice, int mode);
197static void sample_freq(trident_t * trident, snd_trident_voice_t * voice, snd_seq_frequency_t freq); 197static void sample_freq(struct snd_trident * trident, struct snd_trident_voice * voice, snd_seq_frequency_t freq);
198static void sample_volume(trident_t * trident, snd_trident_voice_t * voice, snd_seq_ev_volume_t * volume); 198static void sample_volume(struct snd_trident * trident, struct snd_trident_voice * voice, struct snd_seq_ev_volume * volume);
199static void sample_loop(trident_t * trident, snd_trident_voice_t * voice, snd_seq_ev_loop_t * loop); 199static void sample_loop(struct snd_trident * trident, struct snd_trident_voice * voice, struct snd_seq_ev_loop * loop);
200static void sample_pos(trident_t * trident, snd_trident_voice_t * voice, snd_seq_position_t position); 200static void sample_pos(struct snd_trident * trident, struct snd_trident_voice * voice, snd_seq_position_t position);
201static void sample_private1(trident_t * trident, snd_trident_voice_t * voice, unsigned char *data); 201static void sample_private1(struct snd_trident * trident, struct snd_trident_voice * voice, unsigned char *data);
202 202
203static snd_trident_sample_ops_t sample_ops = 203static struct snd_trident_sample_ops sample_ops =
204{ 204{
205 sample_start, 205 sample_start,
206 sample_stop, 206 sample_stop,
@@ -211,7 +211,7 @@ static snd_trident_sample_ops_t sample_ops =
211 sample_private1 211 sample_private1
212}; 212};
213 213
214static void snd_trident_simple_init(snd_trident_voice_t * voice) 214static void snd_trident_simple_init(struct snd_trident_voice * voice)
215{ 215{
216 //voice->handler_wave = interrupt_wave; 216 //voice->handler_wave = interrupt_wave;
217 //voice->handler_volume = interrupt_volume; 217 //voice->handler_volume = interrupt_volume;
@@ -220,10 +220,10 @@ static void snd_trident_simple_init(snd_trident_voice_t * voice)
220 voice->sample_ops = &sample_ops; 220 voice->sample_ops = &sample_ops;
221} 221}
222 222
223static void sample_start(trident_t * trident, snd_trident_voice_t * voice, snd_seq_position_t position) 223static void sample_start(struct snd_trident * trident, struct snd_trident_voice * voice, snd_seq_position_t position)
224{ 224{
225 simple_instrument_t *simple; 225 struct simple_instrument *simple;
226 snd_seq_kinstr_t *instr; 226 struct snd_seq_kinstr *instr;
227 unsigned long flags; 227 unsigned long flags;
228 unsigned int loop_start, loop_end, sample_start, sample_end, start_offset; 228 unsigned int loop_start, loop_end, sample_start, sample_end, start_offset;
229 unsigned int value; 229 unsigned int value;
@@ -305,7 +305,7 @@ static void sample_start(trident_t * trident, snd_trident_voice_t * voice, snd_s
305 snd_seq_instr_free_use(trident->synth.ilist, instr); 305 snd_seq_instr_free_use(trident->synth.ilist, instr);
306} 306}
307 307
308static void sample_stop(trident_t * trident, snd_trident_voice_t * voice, snd_seq_stop_mode_t mode) 308static void sample_stop(struct snd_trident * trident, struct snd_trident_voice * voice, int mode)
309{ 309{
310 unsigned long flags; 310 unsigned long flags;
311 311
@@ -329,7 +329,7 @@ static void sample_stop(trident_t * trident, snd_trident_voice_t * voice, snd_se
329 } 329 }
330} 330}
331 331
332static void sample_freq(trident_t * trident, snd_trident_voice_t * voice, snd_seq_frequency_t freq) 332static void sample_freq(struct snd_trident * trident, struct snd_trident_voice * voice, snd_seq_frequency_t freq)
333{ 333{
334 unsigned long flags; 334 unsigned long flags;
335 freq >>= 4; 335 freq >>= 4;
@@ -355,7 +355,7 @@ static void sample_freq(trident_t * trident, snd_trident_voice_t * voice, snd_se
355 spin_unlock_irqrestore(&trident->reg_lock, flags); 355 spin_unlock_irqrestore(&trident->reg_lock, flags);
356} 356}
357 357
358static void sample_volume(trident_t * trident, snd_trident_voice_t * voice, snd_seq_ev_volume_t * volume) 358static void sample_volume(struct snd_trident * trident, struct snd_trident_voice * voice, struct snd_seq_ev_volume * volume)
359{ 359{
360 unsigned long flags; 360 unsigned long flags;
361 unsigned short value; 361 unsigned short value;
@@ -407,11 +407,11 @@ static void sample_volume(trident_t * trident, snd_trident_voice_t * voice, snd_
407 spin_unlock_irqrestore(&trident->reg_lock, flags); 407 spin_unlock_irqrestore(&trident->reg_lock, flags);
408} 408}
409 409
410static void sample_loop(trident_t * trident, snd_trident_voice_t * voice, snd_seq_ev_loop_t * loop) 410static void sample_loop(struct snd_trident * trident, struct snd_trident_voice * voice, struct snd_seq_ev_loop * loop)
411{ 411{
412 unsigned long flags; 412 unsigned long flags;
413 simple_instrument_t *simple; 413 struct simple_instrument *simple;
414 snd_seq_kinstr_t *instr; 414 struct snd_seq_kinstr *instr;
415 unsigned int loop_start, loop_end; 415 unsigned int loop_start, loop_end;
416 416
417 instr = snd_seq_instr_find(trident->synth.ilist, &voice->instr, 0, 1); 417 instr = snd_seq_instr_find(trident->synth.ilist, &voice->instr, 0, 1);
@@ -446,11 +446,11 @@ static void sample_loop(trident_t * trident, snd_trident_voice_t * voice, snd_se
446 snd_seq_instr_free_use(trident->synth.ilist, instr); 446 snd_seq_instr_free_use(trident->synth.ilist, instr);
447} 447}
448 448
449static void sample_pos(trident_t * trident, snd_trident_voice_t * voice, snd_seq_position_t position) 449static void sample_pos(struct snd_trident * trident, struct snd_trident_voice * voice, snd_seq_position_t position)
450{ 450{
451 unsigned long flags; 451 unsigned long flags;
452 simple_instrument_t *simple; 452 struct simple_instrument *simple;
453 snd_seq_kinstr_t *instr; 453 struct snd_seq_kinstr *instr;
454 unsigned int value; 454 unsigned int value;
455 455
456 instr = snd_seq_instr_find(trident->synth.ilist, &voice->instr, 0, 1); 456 instr = snd_seq_instr_find(trident->synth.ilist, &voice->instr, 0, 1);
@@ -496,7 +496,7 @@ static void sample_pos(trident_t * trident, snd_trident_voice_t * voice, snd_seq
496 snd_seq_instr_free_use(trident->synth.ilist, instr); 496 snd_seq_instr_free_use(trident->synth.ilist, instr);
497} 497}
498 498
499static void sample_private1(trident_t * trident, snd_trident_voice_t * voice, unsigned char *data) 499static void sample_private1(struct snd_trident * trident, struct snd_trident_voice * voice, unsigned char *data)
500{ 500{
501} 501}
502 502
@@ -504,10 +504,11 @@ static void sample_private1(trident_t * trident, snd_trident_voice_t * voice, un
504 * Memory management / sample loading 504 * Memory management / sample loading
505 */ 505 */
506 506
507static int snd_trident_simple_put_sample(void *private_data, simple_instrument_t * instr, 507static int snd_trident_simple_put_sample(void *private_data,
508 struct simple_instrument * instr,
508 char __user *data, long len, int atomic) 509 char __user *data, long len, int atomic)
509{ 510{
510 trident_t *trident = private_data; 511 struct snd_trident *trident = private_data;
511 int size = instr->size; 512 int size = instr->size;
512 int shift = 0; 513 int shift = 0;
513 514
@@ -529,7 +530,7 @@ static int snd_trident_simple_put_sample(void *private_data, simple_instrument_t
529 return -EFAULT; 530 return -EFAULT;
530 531
531 if (trident->tlb.entries) { 532 if (trident->tlb.entries) {
532 snd_util_memblk_t *memblk; 533 struct snd_util_memblk *memblk;
533 memblk = snd_trident_synth_alloc(trident, size); 534 memblk = snd_trident_synth_alloc(trident, size);
534 if (memblk == NULL) 535 if (memblk == NULL)
535 return -ENOMEM; 536 return -ENOMEM;
@@ -557,10 +558,11 @@ static int snd_trident_simple_put_sample(void *private_data, simple_instrument_t
557 return 0; 558 return 0;
558} 559}
559 560
560static int snd_trident_simple_get_sample(void *private_data, simple_instrument_t * instr, 561static int snd_trident_simple_get_sample(void *private_data,
562 struct simple_instrument * instr,
561 char __user *data, long len, int atomic) 563 char __user *data, long len, int atomic)
562{ 564{
563 //trident_t *trident = private_data; 565 //struct snd_trident *trident = private_data;
564 int size = instr->size; 566 int size = instr->size;
565 int shift = 0; 567 int shift = 0;
566 568
@@ -578,10 +580,11 @@ static int snd_trident_simple_get_sample(void *private_data, simple_instrument_t
578 return -EBUSY; 580 return -EBUSY;
579} 581}
580 582
581static int snd_trident_simple_remove_sample(void *private_data, simple_instrument_t * instr, 583static int snd_trident_simple_remove_sample(void *private_data,
584 struct simple_instrument * instr,
582 int atomic) 585 int atomic)
583{ 586{
584 trident_t *trident = private_data; 587 struct snd_trident *trident = private_data;
585 int size = instr->size; 588 int size = instr->size;
586 589
587 if (instr->format & SIMPLE_WAVE_16BIT) 590 if (instr->format & SIMPLE_WAVE_16BIT)
@@ -590,7 +593,7 @@ static int snd_trident_simple_remove_sample(void *private_data, simple_instrumen
590 size <<= 1; 593 size <<= 1;
591 594
592 if (trident->tlb.entries) { 595 if (trident->tlb.entries) {
593 snd_util_memblk_t *memblk = (snd_util_memblk_t*)instr->address.ptr; 596 struct snd_util_memblk *memblk = (struct snd_util_memblk *)instr->address.ptr;
594 if (memblk) 597 if (memblk)
595 snd_trident_synth_free(trident, memblk); 598 snd_trident_synth_free(trident, memblk);
596 else 599 else
@@ -612,9 +615,9 @@ static int snd_trident_simple_remove_sample(void *private_data, simple_instrumen
612 return 0; 615 return 0;
613} 616}
614 617
615static void select_instrument(trident_t * trident, snd_trident_voice_t * v) 618static void select_instrument(struct snd_trident * trident, struct snd_trident_voice * v)
616{ 619{
617 snd_seq_kinstr_t *instr; 620 struct snd_seq_kinstr *instr;
618 instr = snd_seq_instr_find(trident->synth.ilist, &v->instr, 0, 1); 621 instr = snd_seq_instr_find(trident->synth.ilist, &v->instr, 0, 1);
619 if (instr != NULL) { 622 if (instr != NULL) {
620 if (instr->ops) { 623 if (instr->ops) {
@@ -629,7 +632,7 @@ static void select_instrument(trident_t * trident, snd_trident_voice_t * v)
629 632
630 */ 633 */
631 634
632static void event_sample(snd_seq_event_t * ev, snd_trident_port_t * p, snd_trident_voice_t * v) 635static void event_sample(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v)
633{ 636{
634 if (v->sample_ops && v->sample_ops->sample_stop) 637 if (v->sample_ops && v->sample_ops->sample_stop)
635 v->sample_ops->sample_stop(p->trident, v, SAMPLE_STOP_IMMEDIATELY); 638 v->sample_ops->sample_stop(p->trident, v, SAMPLE_STOP_IMMEDIATELY);
@@ -643,7 +646,7 @@ static void event_sample(snd_seq_event_t * ev, snd_trident_port_t * p, snd_tride
643 select_instrument(p->trident, v); 646 select_instrument(p->trident, v);
644} 647}
645 648
646static void event_cluster(snd_seq_event_t * ev, snd_trident_port_t * p, snd_trident_voice_t * v) 649static void event_cluster(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v)
647{ 650{
648 if (v->sample_ops && v->sample_ops->sample_stop) 651 if (v->sample_ops && v->sample_ops->sample_stop)
649 v->sample_ops->sample_stop(p->trident, v, SAMPLE_STOP_IMMEDIATELY); 652 v->sample_ops->sample_stop(p->trident, v, SAMPLE_STOP_IMMEDIATELY);
@@ -651,49 +654,49 @@ static void event_cluster(snd_seq_event_t * ev, snd_trident_port_t * p, snd_trid
651 select_instrument(p->trident, v); 654 select_instrument(p->trident, v);
652} 655}
653 656
654static void event_start(snd_seq_event_t * ev, snd_trident_port_t * p, snd_trident_voice_t * v) 657static void event_start(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v)
655{ 658{
656 if (v->sample_ops && v->sample_ops->sample_start) 659 if (v->sample_ops && v->sample_ops->sample_start)
657 v->sample_ops->sample_start(p->trident, v, ev->data.sample.param.position); 660 v->sample_ops->sample_start(p->trident, v, ev->data.sample.param.position);
658} 661}
659 662
660static void event_stop(snd_seq_event_t * ev, snd_trident_port_t * p, snd_trident_voice_t * v) 663static void event_stop(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v)
661{ 664{
662 if (v->sample_ops && v->sample_ops->sample_stop) 665 if (v->sample_ops && v->sample_ops->sample_stop)
663 v->sample_ops->sample_stop(p->trident, v, ev->data.sample.param.stop_mode); 666 v->sample_ops->sample_stop(p->trident, v, ev->data.sample.param.stop_mode);
664} 667}
665 668
666static void event_freq(snd_seq_event_t * ev, snd_trident_port_t * p, snd_trident_voice_t * v) 669static void event_freq(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v)
667{ 670{
668 if (v->sample_ops && v->sample_ops->sample_freq) 671 if (v->sample_ops && v->sample_ops->sample_freq)
669 v->sample_ops->sample_freq(p->trident, v, ev->data.sample.param.frequency); 672 v->sample_ops->sample_freq(p->trident, v, ev->data.sample.param.frequency);
670} 673}
671 674
672static void event_volume(snd_seq_event_t * ev, snd_trident_port_t * p, snd_trident_voice_t * v) 675static void event_volume(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v)
673{ 676{
674 if (v->sample_ops && v->sample_ops->sample_volume) 677 if (v->sample_ops && v->sample_ops->sample_volume)
675 v->sample_ops->sample_volume(p->trident, v, &ev->data.sample.param.volume); 678 v->sample_ops->sample_volume(p->trident, v, &ev->data.sample.param.volume);
676} 679}
677 680
678static void event_loop(snd_seq_event_t * ev, snd_trident_port_t * p, snd_trident_voice_t * v) 681static void event_loop(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v)
679{ 682{
680 if (v->sample_ops && v->sample_ops->sample_loop) 683 if (v->sample_ops && v->sample_ops->sample_loop)
681 v->sample_ops->sample_loop(p->trident, v, &ev->data.sample.param.loop); 684 v->sample_ops->sample_loop(p->trident, v, &ev->data.sample.param.loop);
682} 685}
683 686
684static void event_position(snd_seq_event_t * ev, snd_trident_port_t * p, snd_trident_voice_t * v) 687static void event_position(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v)
685{ 688{
686 if (v->sample_ops && v->sample_ops->sample_pos) 689 if (v->sample_ops && v->sample_ops->sample_pos)
687 v->sample_ops->sample_pos(p->trident, v, ev->data.sample.param.position); 690 v->sample_ops->sample_pos(p->trident, v, ev->data.sample.param.position);
688} 691}
689 692
690static void event_private1(snd_seq_event_t * ev, snd_trident_port_t * p, snd_trident_voice_t * v) 693static void event_private1(struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v)
691{ 694{
692 if (v->sample_ops && v->sample_ops->sample_private1) 695 if (v->sample_ops && v->sample_ops->sample_private1)
693 v->sample_ops->sample_private1(p->trident, v, (unsigned char *) &ev->data.sample.param.raw8); 696 v->sample_ops->sample_private1(p->trident, v, (unsigned char *) &ev->data.sample.param.raw8);
694} 697}
695 698
696typedef void (trident_sample_event_handler_t) (snd_seq_event_t * ev, snd_trident_port_t * p, snd_trident_voice_t * v); 699typedef void (trident_sample_event_handler_t) (struct snd_seq_event * ev, struct snd_trident_port * p, struct snd_trident_voice * v);
697 700
698static trident_sample_event_handler_t *trident_sample_event_handlers[9] = 701static trident_sample_event_handler_t *trident_sample_event_handlers[9] =
699{ 702{
@@ -708,11 +711,11 @@ static trident_sample_event_handler_t *trident_sample_event_handlers[9] =
708 event_private1 711 event_private1
709}; 712};
710 713
711static void snd_trident_sample_event(snd_seq_event_t * ev, snd_trident_port_t * p) 714static void snd_trident_sample_event(struct snd_seq_event * ev, struct snd_trident_port * p)
712{ 715{
713 int idx, voice; 716 int idx, voice;
714 trident_t *trident = p->trident; 717 struct snd_trident *trident = p->trident;
715 snd_trident_voice_t *v; 718 struct snd_trident_voice *v;
716 unsigned long flags; 719 unsigned long flags;
717 720
718 idx = ev->type - SNDRV_SEQ_EVENT_SAMPLE; 721 idx = ev->type - SNDRV_SEQ_EVENT_SAMPLE;
@@ -735,10 +738,10 @@ static void snd_trident_sample_event(snd_seq_event_t * ev, snd_trident_port_t *
735 738
736 */ 739 */
737 740
738static void snd_trident_synth_free_voices(trident_t * trident, int client, int port) 741static void snd_trident_synth_free_voices(struct snd_trident * trident, int client, int port)
739{ 742{
740 int idx; 743 int idx;
741 snd_trident_voice_t *voice; 744 struct snd_trident_voice *voice;
742 745
743 for (idx = 0; idx < 32; idx++) { 746 for (idx = 0; idx < 32; idx++) {
744 voice = &trident->synth.voices[idx]; 747 voice = &trident->synth.voices[idx];
@@ -747,11 +750,11 @@ static void snd_trident_synth_free_voices(trident_t * trident, int client, int p
747 } 750 }
748} 751}
749 752
750static int snd_trident_synth_use(void *private_data, snd_seq_port_subscribe_t * info) 753static int snd_trident_synth_use(void *private_data, struct snd_seq_port_subscribe * info)
751{ 754{
752 snd_trident_port_t *port = (snd_trident_port_t *) private_data; 755 struct snd_trident_port *port = private_data;
753 trident_t *trident = port->trident; 756 struct snd_trident *trident = port->trident;
754 snd_trident_voice_t *voice; 757 struct snd_trident_voice *voice;
755 unsigned int idx; 758 unsigned int idx;
756 unsigned long flags; 759 unsigned long flags;
757 760
@@ -786,10 +789,10 @@ static int snd_trident_synth_use(void *private_data, snd_seq_port_subscribe_t *
786 return 0; 789 return 0;
787} 790}
788 791
789static int snd_trident_synth_unuse(void *private_data, snd_seq_port_subscribe_t * info) 792static int snd_trident_synth_unuse(void *private_data, struct snd_seq_port_subscribe * info)
790{ 793{
791 snd_trident_port_t *port = (snd_trident_port_t *) private_data; 794 struct snd_trident_port *port = private_data;
792 trident_t *trident = port->trident; 795 struct snd_trident *trident = port->trident;
793 unsigned long flags; 796 unsigned long flags;
794 797
795 spin_lock_irqsave(&trident->reg_lock, flags); 798 spin_lock_irqsave(&trident->reg_lock, flags);
@@ -802,18 +805,18 @@ static int snd_trident_synth_unuse(void *private_data, snd_seq_port_subscribe_t
802 805
803 */ 806 */
804 807
805static void snd_trident_synth_free_private_instruments(snd_trident_port_t * p, int client) 808static void snd_trident_synth_free_private_instruments(struct snd_trident_port * p, int client)
806{ 809{
807 snd_seq_instr_header_t ifree; 810 struct snd_seq_instr_header ifree;
808 811
809 memset(&ifree, 0, sizeof(ifree)); 812 memset(&ifree, 0, sizeof(ifree));
810 ifree.cmd = SNDRV_SEQ_INSTR_FREE_CMD_PRIVATE; 813 ifree.cmd = SNDRV_SEQ_INSTR_FREE_CMD_PRIVATE;
811 snd_seq_instr_list_free_cond(p->trident->synth.ilist, &ifree, client, 0); 814 snd_seq_instr_list_free_cond(p->trident->synth.ilist, &ifree, client, 0);
812} 815}
813 816
814static int snd_trident_synth_event_input(snd_seq_event_t * ev, int direct, void *private_data, int atomic, int hop) 817static int snd_trident_synth_event_input(struct snd_seq_event * ev, int direct, void *private_data, int atomic, int hop)
815{ 818{
816 snd_trident_port_t *p = (snd_trident_port_t *) private_data; 819 struct snd_trident_port *p = (struct snd_trident_port *) private_data;
817 820
818 if (p == NULL) 821 if (p == NULL)
819 return -EINVAL; 822 return -EINVAL;
@@ -841,12 +844,12 @@ static int snd_trident_synth_event_input(snd_seq_event_t * ev, int direct, void
841} 844}
842 845
843static void snd_trident_synth_instr_notify(void *private_data, 846static void snd_trident_synth_instr_notify(void *private_data,
844 snd_seq_kinstr_t * instr, 847 struct snd_seq_kinstr * instr,
845 int what) 848 int what)
846{ 849{
847 int idx; 850 int idx;
848 trident_t *trident = private_data; 851 struct snd_trident *trident = private_data;
849 snd_trident_voice_t *pvoice; 852 struct snd_trident_voice *pvoice;
850 unsigned long flags; 853 unsigned long flags;
851 854
852 spin_lock_irqsave(&trident->event_lock, flags); 855 spin_lock_irqsave(&trident->event_lock, flags);
@@ -870,16 +873,16 @@ static void snd_trident_synth_instr_notify(void *private_data,
870 873
871static void snd_trident_synth_free_port(void *private_data) 874static void snd_trident_synth_free_port(void *private_data)
872{ 875{
873 snd_trident_port_t *p = (snd_trident_port_t *) private_data; 876 struct snd_trident_port *p = (struct snd_trident_port *) private_data;
874 877
875 if (p) 878 if (p)
876 snd_midi_channel_free_set(p->chset); 879 snd_midi_channel_free_set(p->chset);
877} 880}
878 881
879static int snd_trident_synth_create_port(trident_t * trident, int idx) 882static int snd_trident_synth_create_port(struct snd_trident * trident, int idx)
880{ 883{
881 snd_trident_port_t *p; 884 struct snd_trident_port *p;
882 snd_seq_port_callback_t callbacks; 885 struct snd_seq_port_callback callbacks;
883 char name[32]; 886 char name[32];
884 char *str; 887 char *str;
885 int result; 888 int result;
@@ -927,43 +930,31 @@ static int snd_trident_synth_create_port(trident_t * trident, int idx)
927 930
928 */ 931 */
929 932
930static int snd_trident_synth_new_device(snd_seq_device_t *dev) 933static int snd_trident_synth_new_device(struct snd_seq_device *dev)
931{ 934{
932 trident_t *trident; 935 struct snd_trident *trident;
933 int client, i; 936 int client, i;
934 snd_seq_client_callback_t callbacks; 937 struct snd_seq_port_subscribe sub;
935 snd_seq_client_info_t cinfo; 938 struct snd_simple_ops *simpleops;
936 snd_seq_port_subscribe_t sub;
937 snd_simple_ops_t *simpleops;
938 char *str; 939 char *str;
939 940
940 trident = *(trident_t **)SNDRV_SEQ_DEVICE_ARGPTR(dev); 941 trident = *(struct snd_trident **)SNDRV_SEQ_DEVICE_ARGPTR(dev);
941 if (trident == NULL) 942 if (trident == NULL)
942 return -EINVAL; 943 return -EINVAL;
943 944
944 trident->synth.seq_client = -1; 945 trident->synth.seq_client = -1;
945 946
946 /* allocate new client */ 947 /* allocate new client */
947 memset(&callbacks, 0, sizeof(callbacks));
948 callbacks.private_data = trident;
949 callbacks.allow_output = callbacks.allow_input = 1;
950 client = trident->synth.seq_client =
951 snd_seq_create_kernel_client(trident->card, 1, &callbacks);
952 if (client < 0)
953 return client;
954
955 /* change name of client */
956 memset(&cinfo, 0, sizeof(cinfo));
957 cinfo.client = client;
958 cinfo.type = KERNEL_CLIENT;
959 str = "???"; 948 str = "???";
960 switch (trident->device) { 949 switch (trident->device) {
961 case TRIDENT_DEVICE_ID_DX: str = "Trident 4DWave-DX"; break; 950 case TRIDENT_DEVICE_ID_DX: str = "Trident 4DWave-DX"; break;
962 case TRIDENT_DEVICE_ID_NX: str = "Trident 4DWave-NX"; break; 951 case TRIDENT_DEVICE_ID_NX: str = "Trident 4DWave-NX"; break;
963 case TRIDENT_DEVICE_ID_SI7018: str = "SiS 7018"; break; 952 case TRIDENT_DEVICE_ID_SI7018: str = "SiS 7018"; break;
964 } 953 }
965 sprintf(cinfo.name, str); 954 client = trident->synth.seq_client =
966 snd_seq_kernel_client_ctl(client, SNDRV_SEQ_IOCTL_SET_CLIENT_INFO, &cinfo); 955 snd_seq_create_kernel_client(trident->card, 1, str);
956 if (client < 0)
957 return client;
967 958
968 for (i = 0; i < 4; i++) 959 for (i = 0; i < 4; i++)
969 snd_trident_synth_create_port(trident, i); 960 snd_trident_synth_create_port(trident, i);
@@ -993,11 +984,11 @@ static int snd_trident_synth_new_device(snd_seq_device_t *dev)
993 return 0; 984 return 0;
994} 985}
995 986
996static int snd_trident_synth_delete_device(snd_seq_device_t *dev) 987static int snd_trident_synth_delete_device(struct snd_seq_device *dev)
997{ 988{
998 trident_t *trident; 989 struct snd_trident *trident;
999 990
1000 trident = *(trident_t **)SNDRV_SEQ_DEVICE_ARGPTR(dev); 991 trident = *(struct snd_trident **)SNDRV_SEQ_DEVICE_ARGPTR(dev);
1001 if (trident == NULL) 992 if (trident == NULL)
1002 return -EINVAL; 993 return -EINVAL;
1003 994
@@ -1012,14 +1003,14 @@ static int snd_trident_synth_delete_device(snd_seq_device_t *dev)
1012 1003
1013static int __init alsa_trident_synth_init(void) 1004static int __init alsa_trident_synth_init(void)
1014{ 1005{
1015 static snd_seq_dev_ops_t ops = 1006 static struct snd_seq_dev_ops ops =
1016 { 1007 {
1017 snd_trident_synth_new_device, 1008 snd_trident_synth_new_device,
1018 snd_trident_synth_delete_device 1009 snd_trident_synth_delete_device
1019 }; 1010 };
1020 1011
1021 return snd_seq_device_register_driver(SNDRV_SEQ_DEV_ID_TRIDENT, &ops, 1012 return snd_seq_device_register_driver(SNDRV_SEQ_DEV_ID_TRIDENT, &ops,
1022 sizeof(trident_t*)); 1013 sizeof(struct snd_trident *));
1023} 1014}
1024 1015
1025static void __exit alsa_trident_synth_exit(void) 1016static void __exit alsa_trident_synth_exit(void)