diff options
author | Takashi Iwai <tiwai@suse.de> | 2005-11-17 09:03:46 -0500 |
---|---|---|
committer | Jaroslav Kysela <perex@suse.cz> | 2006-01-03 06:19:32 -0500 |
commit | eb3414b4652344972e86c85ce094cc4a780e1a55 (patch) | |
tree | e786703d8a7bbdae9be8739d012bf6f570f18a9b /sound/pci/ens1370.c | |
parent | 93e35f956a1720eedcf95b8337dde25bde22d624 (diff) |
[ALSA] Remove xxx_t typedefs: PCI ENS137x
Modules: ENS1370/1+ driver
Remove xxx_t typedefs from the PCI ENS137x drivers.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci/ens1370.c')
-rw-r--r-- | sound/pci/ens1370.c | 487 |
1 files changed, 269 insertions, 218 deletions
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c index 180c49e4f6af..2cc0f83a0fde 100644 --- a/sound/pci/ens1370.c +++ b/sound/pci/ens1370.c | |||
@@ -367,9 +367,7 @@ MODULE_PARM_DESC(joystick, "Enable joystick."); | |||
367 | 367 | ||
368 | */ | 368 | */ |
369 | 369 | ||
370 | typedef struct _snd_ensoniq ensoniq_t; | 370 | struct ensoniq { |
371 | |||
372 | struct _snd_ensoniq { | ||
373 | spinlock_t reg_lock; | 371 | spinlock_t reg_lock; |
374 | struct semaphore src_mutex; | 372 | struct semaphore src_mutex; |
375 | 373 | ||
@@ -392,12 +390,12 @@ struct _snd_ensoniq { | |||
392 | union { | 390 | union { |
393 | #ifdef CHIP1371 | 391 | #ifdef CHIP1371 |
394 | struct { | 392 | struct { |
395 | ac97_t *ac97; | 393 | struct snd_ac97 *ac97; |
396 | } es1371; | 394 | } es1371; |
397 | #else | 395 | #else |
398 | struct { | 396 | struct { |
399 | int pclkdiv_lock; | 397 | int pclkdiv_lock; |
400 | ak4531_t *ak4531; | 398 | struct snd_ak4531 *ak4531; |
401 | } es1370; | 399 | } es1370; |
402 | #endif | 400 | #endif |
403 | } u; | 401 | } u; |
@@ -405,21 +403,21 @@ struct _snd_ensoniq { | |||
405 | struct pci_dev *pci; | 403 | struct pci_dev *pci; |
406 | unsigned short subsystem_vendor_id; | 404 | unsigned short subsystem_vendor_id; |
407 | unsigned short subsystem_device_id; | 405 | unsigned short subsystem_device_id; |
408 | snd_card_t *card; | 406 | struct snd_card *card; |
409 | snd_pcm_t *pcm1; /* DAC1/ADC PCM */ | 407 | struct snd_pcm *pcm1; /* DAC1/ADC PCM */ |
410 | snd_pcm_t *pcm2; /* DAC2 PCM */ | 408 | struct snd_pcm *pcm2; /* DAC2 PCM */ |
411 | snd_pcm_substream_t *playback1_substream; | 409 | struct snd_pcm_substream *playback1_substream; |
412 | snd_pcm_substream_t *playback2_substream; | 410 | struct snd_pcm_substream *playback2_substream; |
413 | snd_pcm_substream_t *capture_substream; | 411 | struct snd_pcm_substream *capture_substream; |
414 | unsigned int p1_dma_size; | 412 | unsigned int p1_dma_size; |
415 | unsigned int p2_dma_size; | 413 | unsigned int p2_dma_size; |
416 | unsigned int c_dma_size; | 414 | unsigned int c_dma_size; |
417 | unsigned int p1_period_size; | 415 | unsigned int p1_period_size; |
418 | unsigned int p2_period_size; | 416 | unsigned int p2_period_size; |
419 | unsigned int c_period_size; | 417 | unsigned int c_period_size; |
420 | snd_rawmidi_t *rmidi; | 418 | struct snd_rawmidi *rmidi; |
421 | snd_rawmidi_substream_t *midi_input; | 419 | struct snd_rawmidi_substream *midi_input; |
422 | snd_rawmidi_substream_t *midi_output; | 420 | struct snd_rawmidi_substream *midi_output; |
423 | 421 | ||
424 | unsigned int spdif; | 422 | unsigned int spdif; |
425 | unsigned int spdif_default; | 423 | unsigned int spdif_default; |
@@ -459,39 +457,39 @@ MODULE_DEVICE_TABLE(pci, snd_audiopci_ids); | |||
459 | #ifdef CHIP1370 | 457 | #ifdef CHIP1370 |
460 | static unsigned int snd_es1370_fixed_rates[] = | 458 | static unsigned int snd_es1370_fixed_rates[] = |
461 | {5512, 11025, 22050, 44100}; | 459 | {5512, 11025, 22050, 44100}; |
462 | static snd_pcm_hw_constraint_list_t snd_es1370_hw_constraints_rates = { | 460 | static struct snd_pcm_hw_constraint_list snd_es1370_hw_constraints_rates = { |
463 | .count = 4, | 461 | .count = 4, |
464 | .list = snd_es1370_fixed_rates, | 462 | .list = snd_es1370_fixed_rates, |
465 | .mask = 0, | 463 | .mask = 0, |
466 | }; | 464 | }; |
467 | static ratnum_t es1370_clock = { | 465 | static struct snd_ratnum es1370_clock = { |
468 | .num = ES_1370_SRCLOCK, | 466 | .num = ES_1370_SRCLOCK, |
469 | .den_min = 29, | 467 | .den_min = 29, |
470 | .den_max = 353, | 468 | .den_max = 353, |
471 | .den_step = 1, | 469 | .den_step = 1, |
472 | }; | 470 | }; |
473 | static snd_pcm_hw_constraint_ratnums_t snd_es1370_hw_constraints_clock = { | 471 | static struct snd_pcm_hw_constraint_ratnums snd_es1370_hw_constraints_clock = { |
474 | .nrats = 1, | 472 | .nrats = 1, |
475 | .rats = &es1370_clock, | 473 | .rats = &es1370_clock, |
476 | }; | 474 | }; |
477 | #else | 475 | #else |
478 | static ratden_t es1371_dac_clock = { | 476 | static struct snd_ratden es1371_dac_clock = { |
479 | .num_min = 3000 * (1 << 15), | 477 | .num_min = 3000 * (1 << 15), |
480 | .num_max = 48000 * (1 << 15), | 478 | .num_max = 48000 * (1 << 15), |
481 | .num_step = 3000, | 479 | .num_step = 3000, |
482 | .den = 1 << 15, | 480 | .den = 1 << 15, |
483 | }; | 481 | }; |
484 | static snd_pcm_hw_constraint_ratdens_t snd_es1371_hw_constraints_dac_clock = { | 482 | static struct snd_pcm_hw_constraint_ratdens snd_es1371_hw_constraints_dac_clock = { |
485 | .nrats = 1, | 483 | .nrats = 1, |
486 | .rats = &es1371_dac_clock, | 484 | .rats = &es1371_dac_clock, |
487 | }; | 485 | }; |
488 | static ratnum_t es1371_adc_clock = { | 486 | static struct snd_ratnum es1371_adc_clock = { |
489 | .num = 48000 << 15, | 487 | .num = 48000 << 15, |
490 | .den_min = 32768, | 488 | .den_min = 32768, |
491 | .den_max = 393216, | 489 | .den_max = 393216, |
492 | .den_step = 1, | 490 | .den_step = 1, |
493 | }; | 491 | }; |
494 | static snd_pcm_hw_constraint_ratnums_t snd_es1371_hw_constraints_adc_clock = { | 492 | static struct snd_pcm_hw_constraint_ratnums snd_es1371_hw_constraints_adc_clock = { |
495 | .nrats = 1, | 493 | .nrats = 1, |
496 | .rats = &es1371_adc_clock, | 494 | .rats = &es1371_adc_clock, |
497 | }; | 495 | }; |
@@ -505,7 +503,7 @@ static const unsigned int snd_ensoniq_sample_shift[] = | |||
505 | 503 | ||
506 | #ifdef CHIP1371 | 504 | #ifdef CHIP1371 |
507 | 505 | ||
508 | static unsigned int snd_es1371_wait_src_ready(ensoniq_t * ensoniq) | 506 | static unsigned int snd_es1371_wait_src_ready(struct ensoniq * ensoniq) |
509 | { | 507 | { |
510 | unsigned int t, r = 0; | 508 | unsigned int t, r = 0; |
511 | 509 | ||
@@ -515,11 +513,12 @@ static unsigned int snd_es1371_wait_src_ready(ensoniq_t * ensoniq) | |||
515 | return r; | 513 | return r; |
516 | cond_resched(); | 514 | cond_resched(); |
517 | } | 515 | } |
518 | snd_printk(KERN_ERR "wait source ready timeout 0x%lx [0x%x]\n", ES_REG(ensoniq, 1371_SMPRATE), r); | 516 | snd_printk(KERN_ERR "wait source ready timeout 0x%lx [0x%x]\n", |
517 | ES_REG(ensoniq, 1371_SMPRATE), r); | ||
519 | return 0; | 518 | return 0; |
520 | } | 519 | } |
521 | 520 | ||
522 | static unsigned int snd_es1371_src_read(ensoniq_t * ensoniq, unsigned short reg) | 521 | static unsigned int snd_es1371_src_read(struct ensoniq * ensoniq, unsigned short reg) |
523 | { | 522 | { |
524 | unsigned int temp, i, orig, r; | 523 | unsigned int temp, i, orig, r; |
525 | 524 | ||
@@ -553,7 +552,7 @@ static unsigned int snd_es1371_src_read(ensoniq_t * ensoniq, unsigned short reg) | |||
553 | return temp; | 552 | return temp; |
554 | } | 553 | } |
555 | 554 | ||
556 | static void snd_es1371_src_write(ensoniq_t * ensoniq, | 555 | static void snd_es1371_src_write(struct ensoniq * ensoniq, |
557 | unsigned short reg, unsigned short data) | 556 | unsigned short reg, unsigned short data) |
558 | { | 557 | { |
559 | unsigned int r; | 558 | unsigned int r; |
@@ -569,14 +568,15 @@ static void snd_es1371_src_write(ensoniq_t * ensoniq, | |||
569 | 568 | ||
570 | #ifdef CHIP1370 | 569 | #ifdef CHIP1370 |
571 | 570 | ||
572 | static void snd_es1370_codec_write(ak4531_t *ak4531, | 571 | static void snd_es1370_codec_write(struct snd_ak4531 *ak4531, |
573 | unsigned short reg, unsigned short val) | 572 | unsigned short reg, unsigned short val) |
574 | { | 573 | { |
575 | ensoniq_t *ensoniq = ak4531->private_data; | 574 | struct ensoniq *ensoniq = ak4531->private_data; |
576 | unsigned long end_time = jiffies + HZ / 10; | 575 | unsigned long end_time = jiffies + HZ / 10; |
577 | 576 | ||
578 | #if 0 | 577 | #if 0 |
579 | printk("CODEC WRITE: reg = 0x%x, val = 0x%x (0x%x), creg = 0x%x\n", reg, val, ES_1370_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1370_CODEC)); | 578 | printk("CODEC WRITE: reg = 0x%x, val = 0x%x (0x%x), creg = 0x%x\n", |
579 | reg, val, ES_1370_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1370_CODEC)); | ||
580 | #endif | 580 | #endif |
581 | do { | 581 | do { |
582 | if (!(inl(ES_REG(ensoniq, STATUS)) & ES_1370_CSTAT)) { | 582 | if (!(inl(ES_REG(ensoniq, STATUS)) & ES_1370_CSTAT)) { |
@@ -585,17 +585,18 @@ static void snd_es1370_codec_write(ak4531_t *ak4531, | |||
585 | } | 585 | } |
586 | schedule_timeout_uninterruptible(1); | 586 | schedule_timeout_uninterruptible(1); |
587 | } while (time_after(end_time, jiffies)); | 587 | } while (time_after(end_time, jiffies)); |
588 | snd_printk(KERN_ERR "codec write timeout, status = 0x%x\n", inl(ES_REG(ensoniq, STATUS))); | 588 | snd_printk(KERN_ERR "codec write timeout, status = 0x%x\n", |
589 | inl(ES_REG(ensoniq, STATUS))); | ||
589 | } | 590 | } |
590 | 591 | ||
591 | #endif /* CHIP1370 */ | 592 | #endif /* CHIP1370 */ |
592 | 593 | ||
593 | #ifdef CHIP1371 | 594 | #ifdef CHIP1371 |
594 | 595 | ||
595 | static void snd_es1371_codec_write(ac97_t *ac97, | 596 | static void snd_es1371_codec_write(struct snd_ac97 *ac97, |
596 | unsigned short reg, unsigned short val) | 597 | unsigned short reg, unsigned short val) |
597 | { | 598 | { |
598 | ensoniq_t *ensoniq = ac97->private_data; | 599 | struct ensoniq *ensoniq = ac97->private_data; |
599 | unsigned int t, x; | 600 | unsigned int t, x; |
600 | 601 | ||
601 | down(&ensoniq->src_mutex); | 602 | down(&ensoniq->src_mutex); |
@@ -609,12 +610,14 @@ static void snd_es1371_codec_write(ac97_t *ac97, | |||
609 | /* wait for not busy (state 0) first to avoid | 610 | /* wait for not busy (state 0) first to avoid |
610 | transition states */ | 611 | transition states */ |
611 | for (t = 0; t < POLL_COUNT; t++) { | 612 | for (t = 0; t < POLL_COUNT; t++) { |
612 | if ((inl(ES_REG(ensoniq, 1371_SMPRATE)) & 0x00870000) == 0x00000000) | 613 | if ((inl(ES_REG(ensoniq, 1371_SMPRATE)) & 0x00870000) == |
614 | 0x00000000) | ||
613 | break; | 615 | break; |
614 | } | 616 | } |
615 | /* wait for a SAFE time to write addr/data and then do it, dammit */ | 617 | /* wait for a SAFE time to write addr/data and then do it, dammit */ |
616 | for (t = 0; t < POLL_COUNT; t++) { | 618 | for (t = 0; t < POLL_COUNT; t++) { |
617 | if ((inl(ES_REG(ensoniq, 1371_SMPRATE)) & 0x00870000) == 0x00010000) | 619 | if ((inl(ES_REG(ensoniq, 1371_SMPRATE)) & 0x00870000) == |
620 | 0x00010000) | ||
618 | break; | 621 | break; |
619 | } | 622 | } |
620 | outl(ES_1371_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1371_CODEC)); | 623 | outl(ES_1371_CODEC_WRITE(reg, val), ES_REG(ensoniq, 1371_CODEC)); |
@@ -626,13 +629,14 @@ static void snd_es1371_codec_write(ac97_t *ac97, | |||
626 | } | 629 | } |
627 | } | 630 | } |
628 | up(&ensoniq->src_mutex); | 631 | up(&ensoniq->src_mutex); |
629 | snd_printk(KERN_ERR "codec write timeout at 0x%lx [0x%x]\n", ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC))); | 632 | snd_printk(KERN_ERR "codec write timeout at 0x%lx [0x%x]\n", |
633 | ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC))); | ||
630 | } | 634 | } |
631 | 635 | ||
632 | static unsigned short snd_es1371_codec_read(ac97_t *ac97, | 636 | static unsigned short snd_es1371_codec_read(struct snd_ac97 *ac97, |
633 | unsigned short reg) | 637 | unsigned short reg) |
634 | { | 638 | { |
635 | ensoniq_t *ensoniq = ac97->private_data; | 639 | struct ensoniq *ensoniq = ac97->private_data; |
636 | unsigned int t, x, fail = 0; | 640 | unsigned int t, x, fail = 0; |
637 | 641 | ||
638 | __again: | 642 | __again: |
@@ -647,12 +651,14 @@ static unsigned short snd_es1371_codec_read(ac97_t *ac97, | |||
647 | /* wait for not busy (state 0) first to avoid | 651 | /* wait for not busy (state 0) first to avoid |
648 | transition states */ | 652 | transition states */ |
649 | for (t = 0; t < POLL_COUNT; t++) { | 653 | for (t = 0; t < POLL_COUNT; t++) { |
650 | if ((inl(ES_REG(ensoniq, 1371_SMPRATE)) & 0x00870000) == 0x00000000) | 654 | if ((inl(ES_REG(ensoniq, 1371_SMPRATE)) & 0x00870000) == |
655 | 0x00000000) | ||
651 | break; | 656 | break; |
652 | } | 657 | } |
653 | /* wait for a SAFE time to write addr/data and then do it, dammit */ | 658 | /* wait for a SAFE time to write addr/data and then do it, dammit */ |
654 | for (t = 0; t < POLL_COUNT; t++) { | 659 | for (t = 0; t < POLL_COUNT; t++) { |
655 | if ((inl(ES_REG(ensoniq, 1371_SMPRATE)) & 0x00870000) == 0x00010000) | 660 | if ((inl(ES_REG(ensoniq, 1371_SMPRATE)) & 0x00870000) == |
661 | 0x00010000) | ||
656 | break; | 662 | break; |
657 | } | 663 | } |
658 | outl(ES_1371_CODEC_READS(reg), ES_REG(ensoniq, 1371_CODEC)); | 664 | outl(ES_1371_CODEC_READS(reg), ES_REG(ensoniq, 1371_CODEC)); |
@@ -673,18 +679,22 @@ static unsigned short snd_es1371_codec_read(ac97_t *ac97, | |||
673 | } | 679 | } |
674 | up(&ensoniq->src_mutex); | 680 | up(&ensoniq->src_mutex); |
675 | if (++fail > 10) { | 681 | if (++fail > 10) { |
676 | snd_printk(KERN_ERR "codec read timeout (final) at 0x%lx, reg = 0x%x [0x%x]\n", ES_REG(ensoniq, 1371_CODEC), reg, inl(ES_REG(ensoniq, 1371_CODEC))); | 682 | snd_printk(KERN_ERR "codec read timeout (final) " |
683 | "at 0x%lx, reg = 0x%x [0x%x]\n", | ||
684 | ES_REG(ensoniq, 1371_CODEC), reg, | ||
685 | inl(ES_REG(ensoniq, 1371_CODEC))); | ||
677 | return 0; | 686 | return 0; |
678 | } | 687 | } |
679 | goto __again; | 688 | goto __again; |
680 | } | 689 | } |
681 | } | 690 | } |
682 | up(&ensoniq->src_mutex); | 691 | up(&ensoniq->src_mutex); |
683 | snd_printk(KERN_ERR "es1371: codec read timeout at 0x%lx [0x%x]\n", ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC))); | 692 | snd_printk(KERN_ERR "es1371: codec read timeout at 0x%lx [0x%x]\n", |
693 | ES_REG(ensoniq, 1371_CODEC), inl(ES_REG(ensoniq, 1371_CODEC))); | ||
684 | return 0; | 694 | return 0; |
685 | } | 695 | } |
686 | 696 | ||
687 | static void snd_es1371_codec_wait(ac97_t *ac97) | 697 | static void snd_es1371_codec_wait(struct snd_ac97 *ac97) |
688 | { | 698 | { |
689 | msleep(750); | 699 | msleep(750); |
690 | snd_es1371_codec_read(ac97, AC97_RESET); | 700 | snd_es1371_codec_read(ac97, AC97_RESET); |
@@ -693,7 +703,7 @@ static void snd_es1371_codec_wait(ac97_t *ac97) | |||
693 | msleep(50); | 703 | msleep(50); |
694 | } | 704 | } |
695 | 705 | ||
696 | static void snd_es1371_adc_rate(ensoniq_t * ensoniq, unsigned int rate) | 706 | static void snd_es1371_adc_rate(struct ensoniq * ensoniq, unsigned int rate) |
697 | { | 707 | { |
698 | unsigned int n, truncm, freq, result; | 708 | unsigned int n, truncm, freq, result; |
699 | 709 | ||
@@ -716,60 +726,70 @@ static void snd_es1371_adc_rate(ensoniq_t * ensoniq, unsigned int rate) | |||
716 | 0x8000 | (((119 - truncm) >> 1) << 9) | (n << 4)); | 726 | 0x8000 | (((119 - truncm) >> 1) << 9) | (n << 4)); |
717 | } | 727 | } |
718 | snd_es1371_src_write(ensoniq, ES_SMPREG_ADC + ES_SMPREG_INT_REGS, | 728 | snd_es1371_src_write(ensoniq, ES_SMPREG_ADC + ES_SMPREG_INT_REGS, |
719 | (snd_es1371_src_read(ensoniq, ES_SMPREG_ADC + ES_SMPREG_INT_REGS) & 0x00ff) | | 729 | (snd_es1371_src_read(ensoniq, ES_SMPREG_ADC + |
720 | ((freq >> 5) & 0xfc00)); | 730 | ES_SMPREG_INT_REGS) & 0x00ff) | |
731 | ((freq >> 5) & 0xfc00)); | ||
721 | snd_es1371_src_write(ensoniq, ES_SMPREG_ADC + ES_SMPREG_VFREQ_FRAC, freq & 0x7fff); | 732 | snd_es1371_src_write(ensoniq, ES_SMPREG_ADC + ES_SMPREG_VFREQ_FRAC, freq & 0x7fff); |
722 | snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC, n << 8); | 733 | snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC, n << 8); |
723 | snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC + 1, n << 8); | 734 | snd_es1371_src_write(ensoniq, ES_SMPREG_VOL_ADC + 1, n << 8); |
724 | up(&ensoniq->src_mutex); | 735 | up(&ensoniq->src_mutex); |
725 | } | 736 | } |
726 | 737 | ||
727 | static void snd_es1371_dac1_rate(ensoniq_t * ensoniq, unsigned int rate) | 738 | static void snd_es1371_dac1_rate(struct ensoniq * ensoniq, unsigned int rate) |
728 | { | 739 | { |
729 | unsigned int freq, r; | 740 | unsigned int freq, r; |
730 | 741 | ||
731 | down(&ensoniq->src_mutex); | 742 | down(&ensoniq->src_mutex); |
732 | freq = ((rate << 15) + 1500) / 3000; | 743 | freq = ((rate << 15) + 1500) / 3000; |
733 | r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | ES_1371_DIS_P2 | ES_1371_DIS_R1)) | ES_1371_DIS_P1; | 744 | r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | |
745 | ES_1371_DIS_P2 | ES_1371_DIS_R1)) | | ||
746 | ES_1371_DIS_P1; | ||
734 | outl(r, ES_REG(ensoniq, 1371_SMPRATE)); | 747 | outl(r, ES_REG(ensoniq, 1371_SMPRATE)); |
735 | snd_es1371_src_write(ensoniq, ES_SMPREG_DAC1 + ES_SMPREG_INT_REGS, | 748 | snd_es1371_src_write(ensoniq, ES_SMPREG_DAC1 + ES_SMPREG_INT_REGS, |
736 | (snd_es1371_src_read(ensoniq, ES_SMPREG_DAC1 + ES_SMPREG_INT_REGS) & 0x00ff) | | 749 | (snd_es1371_src_read(ensoniq, ES_SMPREG_DAC1 + |
750 | ES_SMPREG_INT_REGS) & 0x00ff) | | ||
737 | ((freq >> 5) & 0xfc00)); | 751 | ((freq >> 5) & 0xfc00)); |
738 | snd_es1371_src_write(ensoniq, ES_SMPREG_DAC1 + ES_SMPREG_VFREQ_FRAC, freq & 0x7fff); | 752 | snd_es1371_src_write(ensoniq, ES_SMPREG_DAC1 + ES_SMPREG_VFREQ_FRAC, freq & 0x7fff); |
739 | r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | ES_1371_DIS_P2 | ES_1371_DIS_R1)); | 753 | r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | |
754 | ES_1371_DIS_P2 | ES_1371_DIS_R1)); | ||
740 | outl(r, ES_REG(ensoniq, 1371_SMPRATE)); | 755 | outl(r, ES_REG(ensoniq, 1371_SMPRATE)); |
741 | up(&ensoniq->src_mutex); | 756 | up(&ensoniq->src_mutex); |
742 | } | 757 | } |
743 | 758 | ||
744 | static void snd_es1371_dac2_rate(ensoniq_t * ensoniq, unsigned int rate) | 759 | static void snd_es1371_dac2_rate(struct ensoniq * ensoniq, unsigned int rate) |
745 | { | 760 | { |
746 | unsigned int freq, r; | 761 | unsigned int freq, r; |
747 | 762 | ||
748 | down(&ensoniq->src_mutex); | 763 | down(&ensoniq->src_mutex); |
749 | freq = ((rate << 15) + 1500) / 3000; | 764 | freq = ((rate << 15) + 1500) / 3000; |
750 | r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | ES_1371_DIS_P1 | ES_1371_DIS_R1)) | ES_1371_DIS_P2; | 765 | r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | |
766 | ES_1371_DIS_P1 | ES_1371_DIS_R1)) | | ||
767 | ES_1371_DIS_P2; | ||
751 | outl(r, ES_REG(ensoniq, 1371_SMPRATE)); | 768 | outl(r, ES_REG(ensoniq, 1371_SMPRATE)); |
752 | snd_es1371_src_write(ensoniq, ES_SMPREG_DAC2 + ES_SMPREG_INT_REGS, | 769 | snd_es1371_src_write(ensoniq, ES_SMPREG_DAC2 + ES_SMPREG_INT_REGS, |
753 | (snd_es1371_src_read(ensoniq, ES_SMPREG_DAC2 + ES_SMPREG_INT_REGS) & 0x00ff) | | 770 | (snd_es1371_src_read(ensoniq, ES_SMPREG_DAC2 + |
771 | ES_SMPREG_INT_REGS) & 0x00ff) | | ||
754 | ((freq >> 5) & 0xfc00)); | 772 | ((freq >> 5) & 0xfc00)); |
755 | snd_es1371_src_write(ensoniq, ES_SMPREG_DAC2 + ES_SMPREG_VFREQ_FRAC, freq & 0x7fff); | 773 | snd_es1371_src_write(ensoniq, ES_SMPREG_DAC2 + ES_SMPREG_VFREQ_FRAC, |
756 | r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | ES_1371_DIS_P1 | ES_1371_DIS_R1)); | 774 | freq & 0x7fff); |
775 | r = (snd_es1371_wait_src_ready(ensoniq) & (ES_1371_SRC_DISABLE | | ||
776 | ES_1371_DIS_P1 | ES_1371_DIS_R1)); | ||
757 | outl(r, ES_REG(ensoniq, 1371_SMPRATE)); | 777 | outl(r, ES_REG(ensoniq, 1371_SMPRATE)); |
758 | up(&ensoniq->src_mutex); | 778 | up(&ensoniq->src_mutex); |
759 | } | 779 | } |
760 | 780 | ||
761 | #endif /* CHIP1371 */ | 781 | #endif /* CHIP1371 */ |
762 | 782 | ||
763 | static int snd_ensoniq_trigger(snd_pcm_substream_t *substream, int cmd) | 783 | static int snd_ensoniq_trigger(struct snd_pcm_substream *substream, int cmd) |
764 | { | 784 | { |
765 | ensoniq_t *ensoniq = snd_pcm_substream_chip(substream); | 785 | struct ensoniq *ensoniq = snd_pcm_substream_chip(substream); |
766 | switch (cmd) { | 786 | switch (cmd) { |
767 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: | 787 | case SNDRV_PCM_TRIGGER_PAUSE_PUSH: |
768 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: | 788 | case SNDRV_PCM_TRIGGER_PAUSE_RELEASE: |
769 | { | 789 | { |
770 | unsigned int what = 0; | 790 | unsigned int what = 0; |
771 | struct list_head *pos; | 791 | struct list_head *pos; |
772 | snd_pcm_substream_t *s; | 792 | struct snd_pcm_substream *s; |
773 | snd_pcm_group_for_each(pos, substream) { | 793 | snd_pcm_group_for_each(pos, substream) { |
774 | s = snd_pcm_group_substream_entry(pos); | 794 | s = snd_pcm_group_substream_entry(pos); |
775 | if (s == ensoniq->playback1_substream) { | 795 | if (s == ensoniq->playback1_substream) { |
@@ -795,7 +815,7 @@ static int snd_ensoniq_trigger(snd_pcm_substream_t *substream, int cmd) | |||
795 | { | 815 | { |
796 | unsigned int what = 0; | 816 | unsigned int what = 0; |
797 | struct list_head *pos; | 817 | struct list_head *pos; |
798 | snd_pcm_substream_t *s; | 818 | struct snd_pcm_substream *s; |
799 | snd_pcm_group_for_each(pos, substream) { | 819 | snd_pcm_group_for_each(pos, substream) { |
800 | s = snd_pcm_group_substream_entry(pos); | 820 | s = snd_pcm_group_substream_entry(pos); |
801 | if (s == ensoniq->playback1_substream) { | 821 | if (s == ensoniq->playback1_substream) { |
@@ -828,21 +848,21 @@ static int snd_ensoniq_trigger(snd_pcm_substream_t *substream, int cmd) | |||
828 | * PCM part | 848 | * PCM part |
829 | */ | 849 | */ |
830 | 850 | ||
831 | static int snd_ensoniq_hw_params(snd_pcm_substream_t * substream, | 851 | static int snd_ensoniq_hw_params(struct snd_pcm_substream *substream, |
832 | snd_pcm_hw_params_t * hw_params) | 852 | struct snd_pcm_hw_params *hw_params) |
833 | { | 853 | { |
834 | return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); | 854 | return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); |
835 | } | 855 | } |
836 | 856 | ||
837 | static int snd_ensoniq_hw_free(snd_pcm_substream_t * substream) | 857 | static int snd_ensoniq_hw_free(struct snd_pcm_substream *substream) |
838 | { | 858 | { |
839 | return snd_pcm_lib_free_pages(substream); | 859 | return snd_pcm_lib_free_pages(substream); |
840 | } | 860 | } |
841 | 861 | ||
842 | static int snd_ensoniq_playback1_prepare(snd_pcm_substream_t * substream) | 862 | static int snd_ensoniq_playback1_prepare(struct snd_pcm_substream *substream) |
843 | { | 863 | { |
844 | ensoniq_t *ensoniq = snd_pcm_substream_chip(substream); | 864 | struct ensoniq *ensoniq = snd_pcm_substream_chip(substream); |
845 | snd_pcm_runtime_t *runtime = substream->runtime; | 865 | struct snd_pcm_runtime *runtime = substream->runtime; |
846 | unsigned int mode = 0; | 866 | unsigned int mode = 0; |
847 | 867 | ||
848 | ensoniq->p1_dma_size = snd_pcm_lib_buffer_bytes(substream); | 868 | ensoniq->p1_dma_size = snd_pcm_lib_buffer_bytes(substream); |
@@ -867,7 +887,8 @@ static int snd_ensoniq_playback1_prepare(snd_pcm_substream_t * substream) | |||
867 | ensoniq->sctrl &= ~(ES_P1_LOOP_SEL | ES_P1_PAUSE | ES_P1_SCT_RLD | ES_P1_MODEM); | 887 | ensoniq->sctrl &= ~(ES_P1_LOOP_SEL | ES_P1_PAUSE | ES_P1_SCT_RLD | ES_P1_MODEM); |
868 | ensoniq->sctrl |= ES_P1_INT_EN | ES_P1_MODEO(mode); | 888 | ensoniq->sctrl |= ES_P1_INT_EN | ES_P1_MODEO(mode); |
869 | outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL)); | 889 | outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL)); |
870 | outl((ensoniq->p1_period_size >> snd_ensoniq_sample_shift[mode]) - 1, ES_REG(ensoniq, DAC1_COUNT)); | 890 | outl((ensoniq->p1_period_size >> snd_ensoniq_sample_shift[mode]) - 1, |
891 | ES_REG(ensoniq, DAC1_COUNT)); | ||
871 | #ifdef CHIP1370 | 892 | #ifdef CHIP1370 |
872 | ensoniq->ctrl &= ~ES_1370_WTSRSELM; | 893 | ensoniq->ctrl &= ~ES_1370_WTSRSELM; |
873 | switch (runtime->rate) { | 894 | switch (runtime->rate) { |
@@ -886,10 +907,10 @@ static int snd_ensoniq_playback1_prepare(snd_pcm_substream_t * substream) | |||
886 | return 0; | 907 | return 0; |
887 | } | 908 | } |
888 | 909 | ||
889 | static int snd_ensoniq_playback2_prepare(snd_pcm_substream_t * substream) | 910 | static int snd_ensoniq_playback2_prepare(struct snd_pcm_substream *substream) |
890 | { | 911 | { |
891 | ensoniq_t *ensoniq = snd_pcm_substream_chip(substream); | 912 | struct ensoniq *ensoniq = snd_pcm_substream_chip(substream); |
892 | snd_pcm_runtime_t *runtime = substream->runtime; | 913 | struct snd_pcm_runtime *runtime = substream->runtime; |
893 | unsigned int mode = 0; | 914 | unsigned int mode = 0; |
894 | 915 | ||
895 | ensoniq->p2_dma_size = snd_pcm_lib_buffer_bytes(substream); | 916 | ensoniq->p2_dma_size = snd_pcm_lib_buffer_bytes(substream); |
@@ -909,7 +930,8 @@ static int snd_ensoniq_playback2_prepare(snd_pcm_substream_t * substream) | |||
909 | ensoniq->sctrl |= ES_P2_INT_EN | ES_P2_MODEO(mode) | | 930 | ensoniq->sctrl |= ES_P2_INT_EN | ES_P2_MODEO(mode) | |
910 | ES_P2_END_INCO(mode & 2 ? 2 : 1) | ES_P2_ST_INCO(0); | 931 | ES_P2_END_INCO(mode & 2 ? 2 : 1) | ES_P2_ST_INCO(0); |
911 | outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL)); | 932 | outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL)); |
912 | outl((ensoniq->p2_period_size >> snd_ensoniq_sample_shift[mode]) - 1, ES_REG(ensoniq, DAC2_COUNT)); | 933 | outl((ensoniq->p2_period_size >> snd_ensoniq_sample_shift[mode]) - 1, |
934 | ES_REG(ensoniq, DAC2_COUNT)); | ||
913 | #ifdef CHIP1370 | 935 | #ifdef CHIP1370 |
914 | if (!(ensoniq->u.es1370.pclkdiv_lock & ES_MODE_CAPTURE)) { | 936 | if (!(ensoniq->u.es1370.pclkdiv_lock & ES_MODE_CAPTURE)) { |
915 | ensoniq->ctrl &= ~ES_1370_PCLKDIVM; | 937 | ensoniq->ctrl &= ~ES_1370_PCLKDIVM; |
@@ -925,10 +947,10 @@ static int snd_ensoniq_playback2_prepare(snd_pcm_substream_t * substream) | |||
925 | return 0; | 947 | return 0; |
926 | } | 948 | } |
927 | 949 | ||
928 | static int snd_ensoniq_capture_prepare(snd_pcm_substream_t * substream) | 950 | static int snd_ensoniq_capture_prepare(struct snd_pcm_substream *substream) |
929 | { | 951 | { |
930 | ensoniq_t *ensoniq = snd_pcm_substream_chip(substream); | 952 | struct ensoniq *ensoniq = snd_pcm_substream_chip(substream); |
931 | snd_pcm_runtime_t *runtime = substream->runtime; | 953 | struct snd_pcm_runtime *runtime = substream->runtime; |
932 | unsigned int mode = 0; | 954 | unsigned int mode = 0; |
933 | 955 | ||
934 | ensoniq->c_dma_size = snd_pcm_lib_buffer_bytes(substream); | 956 | ensoniq->c_dma_size = snd_pcm_lib_buffer_bytes(substream); |
@@ -946,7 +968,8 @@ static int snd_ensoniq_capture_prepare(snd_pcm_substream_t * substream) | |||
946 | ensoniq->sctrl &= ~(ES_R1_LOOP_SEL | ES_R1_MODEM); | 968 | ensoniq->sctrl &= ~(ES_R1_LOOP_SEL | ES_R1_MODEM); |
947 | ensoniq->sctrl |= ES_R1_INT_EN | ES_R1_MODEO(mode); | 969 | ensoniq->sctrl |= ES_R1_INT_EN | ES_R1_MODEO(mode); |
948 | outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL)); | 970 | outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL)); |
949 | outl((ensoniq->c_period_size >> snd_ensoniq_sample_shift[mode]) - 1, ES_REG(ensoniq, ADC_COUNT)); | 971 | outl((ensoniq->c_period_size >> snd_ensoniq_sample_shift[mode]) - 1, |
972 | ES_REG(ensoniq, ADC_COUNT)); | ||
950 | #ifdef CHIP1370 | 973 | #ifdef CHIP1370 |
951 | if (!(ensoniq->u.es1370.pclkdiv_lock & ES_MODE_PLAY2)) { | 974 | if (!(ensoniq->u.es1370.pclkdiv_lock & ES_MODE_PLAY2)) { |
952 | ensoniq->ctrl &= ~ES_1370_PCLKDIVM; | 975 | ensoniq->ctrl &= ~ES_1370_PCLKDIVM; |
@@ -962,9 +985,9 @@ static int snd_ensoniq_capture_prepare(snd_pcm_substream_t * substream) | |||
962 | return 0; | 985 | return 0; |
963 | } | 986 | } |
964 | 987 | ||
965 | static snd_pcm_uframes_t snd_ensoniq_playback1_pointer(snd_pcm_substream_t * substream) | 988 | static snd_pcm_uframes_t snd_ensoniq_playback1_pointer(struct snd_pcm_substream *substream) |
966 | { | 989 | { |
967 | ensoniq_t *ensoniq = snd_pcm_substream_chip(substream); | 990 | struct ensoniq *ensoniq = snd_pcm_substream_chip(substream); |
968 | size_t ptr; | 991 | size_t ptr; |
969 | 992 | ||
970 | spin_lock(&ensoniq->reg_lock); | 993 | spin_lock(&ensoniq->reg_lock); |
@@ -979,9 +1002,9 @@ static snd_pcm_uframes_t snd_ensoniq_playback1_pointer(snd_pcm_substream_t * sub | |||
979 | return ptr; | 1002 | return ptr; |
980 | } | 1003 | } |
981 | 1004 | ||
982 | static snd_pcm_uframes_t snd_ensoniq_playback2_pointer(snd_pcm_substream_t * substream) | 1005 | static snd_pcm_uframes_t snd_ensoniq_playback2_pointer(struct snd_pcm_substream *substream) |
983 | { | 1006 | { |
984 | ensoniq_t *ensoniq = snd_pcm_substream_chip(substream); | 1007 | struct ensoniq *ensoniq = snd_pcm_substream_chip(substream); |
985 | size_t ptr; | 1008 | size_t ptr; |
986 | 1009 | ||
987 | spin_lock(&ensoniq->reg_lock); | 1010 | spin_lock(&ensoniq->reg_lock); |
@@ -996,9 +1019,9 @@ static snd_pcm_uframes_t snd_ensoniq_playback2_pointer(snd_pcm_substream_t * sub | |||
996 | return ptr; | 1019 | return ptr; |
997 | } | 1020 | } |
998 | 1021 | ||
999 | static snd_pcm_uframes_t snd_ensoniq_capture_pointer(snd_pcm_substream_t * substream) | 1022 | static snd_pcm_uframes_t snd_ensoniq_capture_pointer(struct snd_pcm_substream *substream) |
1000 | { | 1023 | { |
1001 | ensoniq_t *ensoniq = snd_pcm_substream_chip(substream); | 1024 | struct ensoniq *ensoniq = snd_pcm_substream_chip(substream); |
1002 | size_t ptr; | 1025 | size_t ptr; |
1003 | 1026 | ||
1004 | spin_lock(&ensoniq->reg_lock); | 1027 | spin_lock(&ensoniq->reg_lock); |
@@ -1013,7 +1036,7 @@ static snd_pcm_uframes_t snd_ensoniq_capture_pointer(snd_pcm_substream_t * subst | |||
1013 | return ptr; | 1036 | return ptr; |
1014 | } | 1037 | } |
1015 | 1038 | ||
1016 | static snd_pcm_hardware_t snd_ensoniq_playback1 = | 1039 | static struct snd_pcm_hardware snd_ensoniq_playback1 = |
1017 | { | 1040 | { |
1018 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1041 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1019 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 1042 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
@@ -1040,7 +1063,7 @@ static snd_pcm_hardware_t snd_ensoniq_playback1 = | |||
1040 | .fifo_size = 0, | 1063 | .fifo_size = 0, |
1041 | }; | 1064 | }; |
1042 | 1065 | ||
1043 | static snd_pcm_hardware_t snd_ensoniq_playback2 = | 1066 | static struct snd_pcm_hardware snd_ensoniq_playback2 = |
1044 | { | 1067 | { |
1045 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1068 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1046 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 1069 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
@@ -1060,7 +1083,7 @@ static snd_pcm_hardware_t snd_ensoniq_playback2 = | |||
1060 | .fifo_size = 0, | 1083 | .fifo_size = 0, |
1061 | }; | 1084 | }; |
1062 | 1085 | ||
1063 | static snd_pcm_hardware_t snd_ensoniq_capture = | 1086 | static struct snd_pcm_hardware snd_ensoniq_capture = |
1064 | { | 1087 | { |
1065 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1088 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1066 | SNDRV_PCM_INFO_BLOCK_TRANSFER | | 1089 | SNDRV_PCM_INFO_BLOCK_TRANSFER | |
@@ -1079,10 +1102,10 @@ static snd_pcm_hardware_t snd_ensoniq_capture = | |||
1079 | .fifo_size = 0, | 1102 | .fifo_size = 0, |
1080 | }; | 1103 | }; |
1081 | 1104 | ||
1082 | static int snd_ensoniq_playback1_open(snd_pcm_substream_t * substream) | 1105 | static int snd_ensoniq_playback1_open(struct snd_pcm_substream *substream) |
1083 | { | 1106 | { |
1084 | ensoniq_t *ensoniq = snd_pcm_substream_chip(substream); | 1107 | struct ensoniq *ensoniq = snd_pcm_substream_chip(substream); |
1085 | snd_pcm_runtime_t *runtime = substream->runtime; | 1108 | struct snd_pcm_runtime *runtime = substream->runtime; |
1086 | 1109 | ||
1087 | ensoniq->mode |= ES_MODE_PLAY1; | 1110 | ensoniq->mode |= ES_MODE_PLAY1; |
1088 | ensoniq->playback1_substream = substream; | 1111 | ensoniq->playback1_substream = substream; |
@@ -1102,10 +1125,10 @@ static int snd_ensoniq_playback1_open(snd_pcm_substream_t * substream) | |||
1102 | return 0; | 1125 | return 0; |
1103 | } | 1126 | } |
1104 | 1127 | ||
1105 | static int snd_ensoniq_playback2_open(snd_pcm_substream_t * substream) | 1128 | static int snd_ensoniq_playback2_open(struct snd_pcm_substream *substream) |
1106 | { | 1129 | { |
1107 | ensoniq_t *ensoniq = snd_pcm_substream_chip(substream); | 1130 | struct ensoniq *ensoniq = snd_pcm_substream_chip(substream); |
1108 | snd_pcm_runtime_t *runtime = substream->runtime; | 1131 | struct snd_pcm_runtime *runtime = substream->runtime; |
1109 | 1132 | ||
1110 | ensoniq->mode |= ES_MODE_PLAY2; | 1133 | ensoniq->mode |= ES_MODE_PLAY2; |
1111 | ensoniq->playback2_substream = substream; | 1134 | ensoniq->playback2_substream = substream; |
@@ -1125,10 +1148,10 @@ static int snd_ensoniq_playback2_open(snd_pcm_substream_t * substream) | |||
1125 | return 0; | 1148 | return 0; |
1126 | } | 1149 | } |
1127 | 1150 | ||
1128 | static int snd_ensoniq_capture_open(snd_pcm_substream_t * substream) | 1151 | static int snd_ensoniq_capture_open(struct snd_pcm_substream *substream) |
1129 | { | 1152 | { |
1130 | ensoniq_t *ensoniq = snd_pcm_substream_chip(substream); | 1153 | struct ensoniq *ensoniq = snd_pcm_substream_chip(substream); |
1131 | snd_pcm_runtime_t *runtime = substream->runtime; | 1154 | struct snd_pcm_runtime *runtime = substream->runtime; |
1132 | 1155 | ||
1133 | ensoniq->mode |= ES_MODE_CAPTURE; | 1156 | ensoniq->mode |= ES_MODE_CAPTURE; |
1134 | ensoniq->capture_substream = substream; | 1157 | ensoniq->capture_substream = substream; |
@@ -1144,18 +1167,18 @@ static int snd_ensoniq_capture_open(snd_pcm_substream_t * substream) | |||
1144 | return 0; | 1167 | return 0; |
1145 | } | 1168 | } |
1146 | 1169 | ||
1147 | static int snd_ensoniq_playback1_close(snd_pcm_substream_t * substream) | 1170 | static int snd_ensoniq_playback1_close(struct snd_pcm_substream *substream) |
1148 | { | 1171 | { |
1149 | ensoniq_t *ensoniq = snd_pcm_substream_chip(substream); | 1172 | struct ensoniq *ensoniq = snd_pcm_substream_chip(substream); |
1150 | 1173 | ||
1151 | ensoniq->playback1_substream = NULL; | 1174 | ensoniq->playback1_substream = NULL; |
1152 | ensoniq->mode &= ~ES_MODE_PLAY1; | 1175 | ensoniq->mode &= ~ES_MODE_PLAY1; |
1153 | return 0; | 1176 | return 0; |
1154 | } | 1177 | } |
1155 | 1178 | ||
1156 | static int snd_ensoniq_playback2_close(snd_pcm_substream_t * substream) | 1179 | static int snd_ensoniq_playback2_close(struct snd_pcm_substream *substream) |
1157 | { | 1180 | { |
1158 | ensoniq_t *ensoniq = snd_pcm_substream_chip(substream); | 1181 | struct ensoniq *ensoniq = snd_pcm_substream_chip(substream); |
1159 | 1182 | ||
1160 | ensoniq->playback2_substream = NULL; | 1183 | ensoniq->playback2_substream = NULL; |
1161 | spin_lock_irq(&ensoniq->reg_lock); | 1184 | spin_lock_irq(&ensoniq->reg_lock); |
@@ -1167,9 +1190,9 @@ static int snd_ensoniq_playback2_close(snd_pcm_substream_t * substream) | |||
1167 | return 0; | 1190 | return 0; |
1168 | } | 1191 | } |
1169 | 1192 | ||
1170 | static int snd_ensoniq_capture_close(snd_pcm_substream_t * substream) | 1193 | static int snd_ensoniq_capture_close(struct snd_pcm_substream *substream) |
1171 | { | 1194 | { |
1172 | ensoniq_t *ensoniq = snd_pcm_substream_chip(substream); | 1195 | struct ensoniq *ensoniq = snd_pcm_substream_chip(substream); |
1173 | 1196 | ||
1174 | ensoniq->capture_substream = NULL; | 1197 | ensoniq->capture_substream = NULL; |
1175 | spin_lock_irq(&ensoniq->reg_lock); | 1198 | spin_lock_irq(&ensoniq->reg_lock); |
@@ -1181,7 +1204,7 @@ static int snd_ensoniq_capture_close(snd_pcm_substream_t * substream) | |||
1181 | return 0; | 1204 | return 0; |
1182 | } | 1205 | } |
1183 | 1206 | ||
1184 | static snd_pcm_ops_t snd_ensoniq_playback1_ops = { | 1207 | static struct snd_pcm_ops snd_ensoniq_playback1_ops = { |
1185 | .open = snd_ensoniq_playback1_open, | 1208 | .open = snd_ensoniq_playback1_open, |
1186 | .close = snd_ensoniq_playback1_close, | 1209 | .close = snd_ensoniq_playback1_close, |
1187 | .ioctl = snd_pcm_lib_ioctl, | 1210 | .ioctl = snd_pcm_lib_ioctl, |
@@ -1192,7 +1215,7 @@ static snd_pcm_ops_t snd_ensoniq_playback1_ops = { | |||
1192 | .pointer = snd_ensoniq_playback1_pointer, | 1215 | .pointer = snd_ensoniq_playback1_pointer, |
1193 | }; | 1216 | }; |
1194 | 1217 | ||
1195 | static snd_pcm_ops_t snd_ensoniq_playback2_ops = { | 1218 | static struct snd_pcm_ops snd_ensoniq_playback2_ops = { |
1196 | .open = snd_ensoniq_playback2_open, | 1219 | .open = snd_ensoniq_playback2_open, |
1197 | .close = snd_ensoniq_playback2_close, | 1220 | .close = snd_ensoniq_playback2_close, |
1198 | .ioctl = snd_pcm_lib_ioctl, | 1221 | .ioctl = snd_pcm_lib_ioctl, |
@@ -1203,7 +1226,7 @@ static snd_pcm_ops_t snd_ensoniq_playback2_ops = { | |||
1203 | .pointer = snd_ensoniq_playback2_pointer, | 1226 | .pointer = snd_ensoniq_playback2_pointer, |
1204 | }; | 1227 | }; |
1205 | 1228 | ||
1206 | static snd_pcm_ops_t snd_ensoniq_capture_ops = { | 1229 | static struct snd_pcm_ops snd_ensoniq_capture_ops = { |
1207 | .open = snd_ensoniq_capture_open, | 1230 | .open = snd_ensoniq_capture_open, |
1208 | .close = snd_ensoniq_capture_close, | 1231 | .close = snd_ensoniq_capture_close, |
1209 | .ioctl = snd_pcm_lib_ioctl, | 1232 | .ioctl = snd_pcm_lib_ioctl, |
@@ -1214,9 +1237,10 @@ static snd_pcm_ops_t snd_ensoniq_capture_ops = { | |||
1214 | .pointer = snd_ensoniq_capture_pointer, | 1237 | .pointer = snd_ensoniq_capture_pointer, |
1215 | }; | 1238 | }; |
1216 | 1239 | ||
1217 | static int __devinit snd_ensoniq_pcm(ensoniq_t * ensoniq, int device, snd_pcm_t ** rpcm) | 1240 | static int __devinit snd_ensoniq_pcm(struct ensoniq * ensoniq, int device, |
1241 | struct snd_pcm ** rpcm) | ||
1218 | { | 1242 | { |
1219 | snd_pcm_t *pcm; | 1243 | struct snd_pcm *pcm; |
1220 | int err; | 1244 | int err; |
1221 | 1245 | ||
1222 | if (rpcm) | 1246 | if (rpcm) |
@@ -1253,9 +1277,10 @@ static int __devinit snd_ensoniq_pcm(ensoniq_t * ensoniq, int device, snd_pcm_t | |||
1253 | return 0; | 1277 | return 0; |
1254 | } | 1278 | } |
1255 | 1279 | ||
1256 | static int __devinit snd_ensoniq_pcm2(ensoniq_t * ensoniq, int device, snd_pcm_t ** rpcm) | 1280 | static int __devinit snd_ensoniq_pcm2(struct ensoniq * ensoniq, int device, |
1281 | struct snd_pcm ** rpcm) | ||
1257 | { | 1282 | { |
1258 | snd_pcm_t *pcm; | 1283 | struct snd_pcm *pcm; |
1259 | int err; | 1284 | int err; |
1260 | 1285 | ||
1261 | if (rpcm) | 1286 | if (rpcm) |
@@ -1298,17 +1323,18 @@ static int __devinit snd_ensoniq_pcm2(ensoniq_t * ensoniq, int device, snd_pcm_t | |||
1298 | * ENS1371 mixer (including SPDIF interface) | 1323 | * ENS1371 mixer (including SPDIF interface) |
1299 | */ | 1324 | */ |
1300 | #ifdef CHIP1371 | 1325 | #ifdef CHIP1371 |
1301 | static int snd_ens1373_spdif_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) | 1326 | static int snd_ens1373_spdif_info(struct snd_kcontrol *kcontrol, |
1327 | struct snd_ctl_elem_info *uinfo) | ||
1302 | { | 1328 | { |
1303 | uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; | 1329 | uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; |
1304 | uinfo->count = 1; | 1330 | uinfo->count = 1; |
1305 | return 0; | 1331 | return 0; |
1306 | } | 1332 | } |
1307 | 1333 | ||
1308 | static int snd_ens1373_spdif_default_get(snd_kcontrol_t * kcontrol, | 1334 | static int snd_ens1373_spdif_default_get(struct snd_kcontrol *kcontrol, |
1309 | snd_ctl_elem_value_t * ucontrol) | 1335 | struct snd_ctl_elem_value *ucontrol) |
1310 | { | 1336 | { |
1311 | ensoniq_t *ensoniq = snd_kcontrol_chip(kcontrol); | 1337 | struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol); |
1312 | spin_lock_irq(&ensoniq->reg_lock); | 1338 | spin_lock_irq(&ensoniq->reg_lock); |
1313 | ucontrol->value.iec958.status[0] = (ensoniq->spdif_default >> 0) & 0xff; | 1339 | ucontrol->value.iec958.status[0] = (ensoniq->spdif_default >> 0) & 0xff; |
1314 | ucontrol->value.iec958.status[1] = (ensoniq->spdif_default >> 8) & 0xff; | 1340 | ucontrol->value.iec958.status[1] = (ensoniq->spdif_default >> 8) & 0xff; |
@@ -1318,10 +1344,10 @@ static int snd_ens1373_spdif_default_get(snd_kcontrol_t * kcontrol, | |||
1318 | return 0; | 1344 | return 0; |
1319 | } | 1345 | } |
1320 | 1346 | ||
1321 | static int snd_ens1373_spdif_default_put(snd_kcontrol_t * kcontrol, | 1347 | static int snd_ens1373_spdif_default_put(struct snd_kcontrol *kcontrol, |
1322 | snd_ctl_elem_value_t * ucontrol) | 1348 | struct snd_ctl_elem_value *ucontrol) |
1323 | { | 1349 | { |
1324 | ensoniq_t *ensoniq = snd_kcontrol_chip(kcontrol); | 1350 | struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol); |
1325 | unsigned int val; | 1351 | unsigned int val; |
1326 | int change; | 1352 | int change; |
1327 | 1353 | ||
@@ -1332,14 +1358,15 @@ static int snd_ens1373_spdif_default_put(snd_kcontrol_t * kcontrol, | |||
1332 | spin_lock_irq(&ensoniq->reg_lock); | 1358 | spin_lock_irq(&ensoniq->reg_lock); |
1333 | change = ensoniq->spdif_default != val; | 1359 | change = ensoniq->spdif_default != val; |
1334 | ensoniq->spdif_default = val; | 1360 | ensoniq->spdif_default = val; |
1335 | if (change && ensoniq->playback1_substream == NULL && ensoniq->playback2_substream == NULL) | 1361 | if (change && ensoniq->playback1_substream == NULL && |
1362 | ensoniq->playback2_substream == NULL) | ||
1336 | outl(val, ES_REG(ensoniq, CHANNEL_STATUS)); | 1363 | outl(val, ES_REG(ensoniq, CHANNEL_STATUS)); |
1337 | spin_unlock_irq(&ensoniq->reg_lock); | 1364 | spin_unlock_irq(&ensoniq->reg_lock); |
1338 | return change; | 1365 | return change; |
1339 | } | 1366 | } |
1340 | 1367 | ||
1341 | static int snd_ens1373_spdif_mask_get(snd_kcontrol_t * kcontrol, | 1368 | static int snd_ens1373_spdif_mask_get(struct snd_kcontrol *kcontrol, |
1342 | snd_ctl_elem_value_t * ucontrol) | 1369 | struct snd_ctl_elem_value *ucontrol) |
1343 | { | 1370 | { |
1344 | ucontrol->value.iec958.status[0] = 0xff; | 1371 | ucontrol->value.iec958.status[0] = 0xff; |
1345 | ucontrol->value.iec958.status[1] = 0xff; | 1372 | ucontrol->value.iec958.status[1] = 0xff; |
@@ -1348,10 +1375,10 @@ static int snd_ens1373_spdif_mask_get(snd_kcontrol_t * kcontrol, | |||
1348 | return 0; | 1375 | return 0; |
1349 | } | 1376 | } |
1350 | 1377 | ||
1351 | static int snd_ens1373_spdif_stream_get(snd_kcontrol_t * kcontrol, | 1378 | static int snd_ens1373_spdif_stream_get(struct snd_kcontrol *kcontrol, |
1352 | snd_ctl_elem_value_t * ucontrol) | 1379 | struct snd_ctl_elem_value *ucontrol) |
1353 | { | 1380 | { |
1354 | ensoniq_t *ensoniq = snd_kcontrol_chip(kcontrol); | 1381 | struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol); |
1355 | spin_lock_irq(&ensoniq->reg_lock); | 1382 | spin_lock_irq(&ensoniq->reg_lock); |
1356 | ucontrol->value.iec958.status[0] = (ensoniq->spdif_stream >> 0) & 0xff; | 1383 | ucontrol->value.iec958.status[0] = (ensoniq->spdif_stream >> 0) & 0xff; |
1357 | ucontrol->value.iec958.status[1] = (ensoniq->spdif_stream >> 8) & 0xff; | 1384 | ucontrol->value.iec958.status[1] = (ensoniq->spdif_stream >> 8) & 0xff; |
@@ -1361,10 +1388,10 @@ static int snd_ens1373_spdif_stream_get(snd_kcontrol_t * kcontrol, | |||
1361 | return 0; | 1388 | return 0; |
1362 | } | 1389 | } |
1363 | 1390 | ||
1364 | static int snd_ens1373_spdif_stream_put(snd_kcontrol_t * kcontrol, | 1391 | static int snd_ens1373_spdif_stream_put(struct snd_kcontrol *kcontrol, |
1365 | snd_ctl_elem_value_t * ucontrol) | 1392 | struct snd_ctl_elem_value *ucontrol) |
1366 | { | 1393 | { |
1367 | ensoniq_t *ensoniq = snd_kcontrol_chip(kcontrol); | 1394 | struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol); |
1368 | unsigned int val; | 1395 | unsigned int val; |
1369 | int change; | 1396 | int change; |
1370 | 1397 | ||
@@ -1375,7 +1402,8 @@ static int snd_ens1373_spdif_stream_put(snd_kcontrol_t * kcontrol, | |||
1375 | spin_lock_irq(&ensoniq->reg_lock); | 1402 | spin_lock_irq(&ensoniq->reg_lock); |
1376 | change = ensoniq->spdif_stream != val; | 1403 | change = ensoniq->spdif_stream != val; |
1377 | ensoniq->spdif_stream = val; | 1404 | ensoniq->spdif_stream = val; |
1378 | if (change && (ensoniq->playback1_substream != NULL || ensoniq->playback2_substream != NULL)) | 1405 | if (change && (ensoniq->playback1_substream != NULL || |
1406 | ensoniq->playback2_substream != NULL)) | ||
1379 | outl(val, ES_REG(ensoniq, CHANNEL_STATUS)); | 1407 | outl(val, ES_REG(ensoniq, CHANNEL_STATUS)); |
1380 | spin_unlock_irq(&ensoniq->reg_lock); | 1408 | spin_unlock_irq(&ensoniq->reg_lock); |
1381 | return change; | 1409 | return change; |
@@ -1385,7 +1413,8 @@ static int snd_ens1373_spdif_stream_put(snd_kcontrol_t * kcontrol, | |||
1385 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .info = snd_es1371_spdif_info, \ | 1413 | { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .info = snd_es1371_spdif_info, \ |
1386 | .get = snd_es1371_spdif_get, .put = snd_es1371_spdif_put } | 1414 | .get = snd_es1371_spdif_get, .put = snd_es1371_spdif_put } |
1387 | 1415 | ||
1388 | static int snd_es1371_spdif_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 1416 | static int snd_es1371_spdif_info(struct snd_kcontrol *kcontrol, |
1417 | struct snd_ctl_elem_info *uinfo) | ||
1389 | { | 1418 | { |
1390 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | 1419 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
1391 | uinfo->count = 1; | 1420 | uinfo->count = 1; |
@@ -1394,9 +1423,10 @@ static int snd_es1371_spdif_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * | |||
1394 | return 0; | 1423 | return 0; |
1395 | } | 1424 | } |
1396 | 1425 | ||
1397 | static int snd_es1371_spdif_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 1426 | static int snd_es1371_spdif_get(struct snd_kcontrol *kcontrol, |
1427 | struct snd_ctl_elem_value *ucontrol) | ||
1398 | { | 1428 | { |
1399 | ensoniq_t *ensoniq = snd_kcontrol_chip(kcontrol); | 1429 | struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol); |
1400 | 1430 | ||
1401 | spin_lock_irq(&ensoniq->reg_lock); | 1431 | spin_lock_irq(&ensoniq->reg_lock); |
1402 | ucontrol->value.integer.value[0] = ensoniq->ctrl & ES_1373_SPDIF_THRU ? 1 : 0; | 1432 | ucontrol->value.integer.value[0] = ensoniq->ctrl & ES_1373_SPDIF_THRU ? 1 : 0; |
@@ -1404,9 +1434,10 @@ static int snd_es1371_spdif_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
1404 | return 0; | 1434 | return 0; |
1405 | } | 1435 | } |
1406 | 1436 | ||
1407 | static int snd_es1371_spdif_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 1437 | static int snd_es1371_spdif_put(struct snd_kcontrol *kcontrol, |
1438 | struct snd_ctl_elem_value *ucontrol) | ||
1408 | { | 1439 | { |
1409 | ensoniq_t *ensoniq = snd_kcontrol_chip(kcontrol); | 1440 | struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol); |
1410 | unsigned int nval1, nval2; | 1441 | unsigned int nval1, nval2; |
1411 | int change; | 1442 | int change; |
1412 | 1443 | ||
@@ -1426,7 +1457,7 @@ static int snd_es1371_spdif_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
1426 | 1457 | ||
1427 | 1458 | ||
1428 | /* spdif controls */ | 1459 | /* spdif controls */ |
1429 | static snd_kcontrol_new_t snd_es1371_mixer_spdif[] __devinitdata = { | 1460 | static struct snd_kcontrol_new snd_es1371_mixer_spdif[] __devinitdata = { |
1430 | ES1371_SPDIF(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH)), | 1461 | ES1371_SPDIF(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH)), |
1431 | { | 1462 | { |
1432 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 1463 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
@@ -1452,7 +1483,8 @@ static snd_kcontrol_new_t snd_es1371_mixer_spdif[] __devinitdata = { | |||
1452 | }; | 1483 | }; |
1453 | 1484 | ||
1454 | 1485 | ||
1455 | static int snd_es1373_rear_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 1486 | static int snd_es1373_rear_info(struct snd_kcontrol *kcontrol, |
1487 | struct snd_ctl_elem_info *uinfo) | ||
1456 | { | 1488 | { |
1457 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | 1489 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
1458 | uinfo->count = 1; | 1490 | uinfo->count = 1; |
@@ -1461,28 +1493,33 @@ static int snd_es1373_rear_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *u | |||
1461 | return 0; | 1493 | return 0; |
1462 | } | 1494 | } |
1463 | 1495 | ||
1464 | static int snd_es1373_rear_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 1496 | static int snd_es1373_rear_get(struct snd_kcontrol *kcontrol, |
1497 | struct snd_ctl_elem_value *ucontrol) | ||
1465 | { | 1498 | { |
1466 | ensoniq_t *ensoniq = snd_kcontrol_chip(kcontrol); | 1499 | struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol); |
1467 | int val = 0; | 1500 | int val = 0; |
1468 | 1501 | ||
1469 | spin_lock_irq(&ensoniq->reg_lock); | 1502 | spin_lock_irq(&ensoniq->reg_lock); |
1470 | if ((ensoniq->cssr & (ES_1373_REAR_BIT27|ES_1373_REAR_BIT26|ES_1373_REAR_BIT24)) == ES_1373_REAR_BIT26) | 1503 | if ((ensoniq->cssr & (ES_1373_REAR_BIT27|ES_1373_REAR_BIT26| |
1504 | ES_1373_REAR_BIT24)) == ES_1373_REAR_BIT26) | ||
1471 | val = 1; | 1505 | val = 1; |
1472 | ucontrol->value.integer.value[0] = val; | 1506 | ucontrol->value.integer.value[0] = val; |
1473 | spin_unlock_irq(&ensoniq->reg_lock); | 1507 | spin_unlock_irq(&ensoniq->reg_lock); |
1474 | return 0; | 1508 | return 0; |
1475 | } | 1509 | } |
1476 | 1510 | ||
1477 | static int snd_es1373_rear_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 1511 | static int snd_es1373_rear_put(struct snd_kcontrol *kcontrol, |
1512 | struct snd_ctl_elem_value *ucontrol) | ||
1478 | { | 1513 | { |
1479 | ensoniq_t *ensoniq = snd_kcontrol_chip(kcontrol); | 1514 | struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol); |
1480 | unsigned int nval1; | 1515 | unsigned int nval1; |
1481 | int change; | 1516 | int change; |
1482 | 1517 | ||
1483 | nval1 = ucontrol->value.integer.value[0] ? ES_1373_REAR_BIT26 : (ES_1373_REAR_BIT27|ES_1373_REAR_BIT24); | 1518 | nval1 = ucontrol->value.integer.value[0] ? |
1519 | ES_1373_REAR_BIT26 : (ES_1373_REAR_BIT27|ES_1373_REAR_BIT24); | ||
1484 | spin_lock_irq(&ensoniq->reg_lock); | 1520 | spin_lock_irq(&ensoniq->reg_lock); |
1485 | change = (ensoniq->cssr & (ES_1373_REAR_BIT27|ES_1373_REAR_BIT26|ES_1373_REAR_BIT24)) != nval1; | 1521 | change = (ensoniq->cssr & (ES_1373_REAR_BIT27| |
1522 | ES_1373_REAR_BIT26|ES_1373_REAR_BIT24)) != nval1; | ||
1486 | ensoniq->cssr &= ~(ES_1373_REAR_BIT27|ES_1373_REAR_BIT26|ES_1373_REAR_BIT24); | 1523 | ensoniq->cssr &= ~(ES_1373_REAR_BIT27|ES_1373_REAR_BIT26|ES_1373_REAR_BIT24); |
1487 | ensoniq->cssr |= nval1; | 1524 | ensoniq->cssr |= nval1; |
1488 | outl(ensoniq->cssr, ES_REG(ensoniq, STATUS)); | 1525 | outl(ensoniq->cssr, ES_REG(ensoniq, STATUS)); |
@@ -1490,7 +1527,7 @@ static int snd_es1373_rear_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * | |||
1490 | return change; | 1527 | return change; |
1491 | } | 1528 | } |
1492 | 1529 | ||
1493 | static snd_kcontrol_new_t snd_ens1373_rear __devinitdata = | 1530 | static struct snd_kcontrol_new snd_ens1373_rear __devinitdata = |
1494 | { | 1531 | { |
1495 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1532 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1496 | .name = "AC97 2ch->4ch Copy Switch", | 1533 | .name = "AC97 2ch->4ch Copy Switch", |
@@ -1499,7 +1536,8 @@ static snd_kcontrol_new_t snd_ens1373_rear __devinitdata = | |||
1499 | .put = snd_es1373_rear_put, | 1536 | .put = snd_es1373_rear_put, |
1500 | }; | 1537 | }; |
1501 | 1538 | ||
1502 | static int snd_es1373_line_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 1539 | static int snd_es1373_line_info(struct snd_kcontrol *kcontrol, |
1540 | struct snd_ctl_elem_info *uinfo) | ||
1503 | { | 1541 | { |
1504 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | 1542 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
1505 | uinfo->count = 1; | 1543 | uinfo->count = 1; |
@@ -1508,9 +1546,10 @@ static int snd_es1373_line_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *u | |||
1508 | return 0; | 1546 | return 0; |
1509 | } | 1547 | } |
1510 | 1548 | ||
1511 | static int snd_es1373_line_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 1549 | static int snd_es1373_line_get(struct snd_kcontrol *kcontrol, |
1550 | struct snd_ctl_elem_value *ucontrol) | ||
1512 | { | 1551 | { |
1513 | ensoniq_t *ensoniq = snd_kcontrol_chip(kcontrol); | 1552 | struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol); |
1514 | int val = 0; | 1553 | int val = 0; |
1515 | 1554 | ||
1516 | spin_lock_irq(&ensoniq->reg_lock); | 1555 | spin_lock_irq(&ensoniq->reg_lock); |
@@ -1521,9 +1560,10 @@ static int snd_es1373_line_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * | |||
1521 | return 0; | 1560 | return 0; |
1522 | } | 1561 | } |
1523 | 1562 | ||
1524 | static int snd_es1373_line_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 1563 | static int snd_es1373_line_put(struct snd_kcontrol *kcontrol, |
1564 | struct snd_ctl_elem_value *ucontrol) | ||
1525 | { | 1565 | { |
1526 | ensoniq_t *ensoniq = snd_kcontrol_chip(kcontrol); | 1566 | struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol); |
1527 | int changed; | 1567 | int changed; |
1528 | unsigned int ctrl; | 1568 | unsigned int ctrl; |
1529 | 1569 | ||
@@ -1540,7 +1580,7 @@ static int snd_es1373_line_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * | |||
1540 | return changed; | 1580 | return changed; |
1541 | } | 1581 | } |
1542 | 1582 | ||
1543 | static snd_kcontrol_new_t snd_ens1373_line __devinitdata = | 1583 | static struct snd_kcontrol_new snd_ens1373_line __devinitdata = |
1544 | { | 1584 | { |
1545 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 1585 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
1546 | .name = "Line In->Rear Out Switch", | 1586 | .name = "Line In->Rear Out Switch", |
@@ -1549,9 +1589,9 @@ static snd_kcontrol_new_t snd_ens1373_line __devinitdata = | |||
1549 | .put = snd_es1373_line_put, | 1589 | .put = snd_es1373_line_put, |
1550 | }; | 1590 | }; |
1551 | 1591 | ||
1552 | static void snd_ensoniq_mixer_free_ac97(ac97_t *ac97) | 1592 | static void snd_ensoniq_mixer_free_ac97(struct snd_ac97 *ac97) |
1553 | { | 1593 | { |
1554 | ensoniq_t *ensoniq = ac97->private_data; | 1594 | struct ensoniq *ensoniq = ac97->private_data; |
1555 | ensoniq->u.es1371.ac97 = NULL; | 1595 | ensoniq->u.es1371.ac97 = NULL; |
1556 | } | 1596 | } |
1557 | 1597 | ||
@@ -1568,13 +1608,13 @@ static struct { | |||
1568 | { .vid = PCI_ANY_ID, .did = PCI_ANY_ID } | 1608 | { .vid = PCI_ANY_ID, .did = PCI_ANY_ID } |
1569 | }; | 1609 | }; |
1570 | 1610 | ||
1571 | static int snd_ensoniq_1371_mixer(ensoniq_t * ensoniq) | 1611 | static int snd_ensoniq_1371_mixer(struct ensoniq * ensoniq) |
1572 | { | 1612 | { |
1573 | snd_card_t *card = ensoniq->card; | 1613 | struct snd_card *card = ensoniq->card; |
1574 | ac97_bus_t *pbus; | 1614 | struct snd_ac97_bus *pbus; |
1575 | ac97_template_t ac97; | 1615 | struct snd_ac97_template ac97; |
1576 | int err, idx; | 1616 | int err, idx; |
1577 | static ac97_bus_ops_t ops = { | 1617 | static struct snd_ac97_bus_ops ops = { |
1578 | .write = snd_es1371_codec_write, | 1618 | .write = snd_es1371_codec_write, |
1579 | .read = snd_es1371_codec_read, | 1619 | .read = snd_es1371_codec_read, |
1580 | .wait = snd_es1371_codec_wait, | 1620 | .wait = snd_es1371_codec_wait, |
@@ -1593,10 +1633,11 @@ static int snd_ensoniq_1371_mixer(ensoniq_t * ensoniq) | |||
1593 | if (ensoniq->pci->vendor == es1371_spdif_present[idx].vid && | 1633 | if (ensoniq->pci->vendor == es1371_spdif_present[idx].vid && |
1594 | ensoniq->pci->device == es1371_spdif_present[idx].did && | 1634 | ensoniq->pci->device == es1371_spdif_present[idx].did && |
1595 | ensoniq->rev == es1371_spdif_present[idx].rev) { | 1635 | ensoniq->rev == es1371_spdif_present[idx].rev) { |
1596 | snd_kcontrol_t *kctl; | 1636 | struct snd_kcontrol *kctl; |
1597 | int i, index = 0; | 1637 | int i, index = 0; |
1598 | 1638 | ||
1599 | ensoniq->spdif_default = ensoniq->spdif_stream = SNDRV_PCM_DEFAULT_CON_SPDIF; | 1639 | ensoniq->spdif_default = ensoniq->spdif_stream = |
1640 | SNDRV_PCM_DEFAULT_CON_SPDIF; | ||
1600 | outl(ensoniq->spdif_default, ES_REG(ensoniq, CHANNEL_STATUS)); | 1641 | outl(ensoniq->spdif_default, ES_REG(ensoniq, CHANNEL_STATUS)); |
1601 | 1642 | ||
1602 | if (ensoniq->u.es1371.ac97->ext_id & AC97_EI_SPDIF) | 1643 | if (ensoniq->u.es1371.ac97->ext_id & AC97_EI_SPDIF) |
@@ -1641,7 +1682,8 @@ static int snd_ensoniq_1371_mixer(ensoniq_t * ensoniq) | |||
1641 | .get = snd_ensoniq_control_get, .put = snd_ensoniq_control_put, \ | 1682 | .get = snd_ensoniq_control_get, .put = snd_ensoniq_control_put, \ |
1642 | .private_value = mask } | 1683 | .private_value = mask } |
1643 | 1684 | ||
1644 | static int snd_ensoniq_control_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 1685 | static int snd_ensoniq_control_info(struct snd_kcontrol *kcontrol, |
1686 | struct snd_ctl_elem_info *uinfo) | ||
1645 | { | 1687 | { |
1646 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | 1688 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
1647 | uinfo->count = 1; | 1689 | uinfo->count = 1; |
@@ -1650,9 +1692,10 @@ static int snd_ensoniq_control_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_ | |||
1650 | return 0; | 1692 | return 0; |
1651 | } | 1693 | } |
1652 | 1694 | ||
1653 | static int snd_ensoniq_control_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 1695 | static int snd_ensoniq_control_get(struct snd_kcontrol *kcontrol, |
1696 | struct snd_ctl_elem_value *ucontrol) | ||
1654 | { | 1697 | { |
1655 | ensoniq_t *ensoniq = snd_kcontrol_chip(kcontrol); | 1698 | struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol); |
1656 | int mask = kcontrol->private_value; | 1699 | int mask = kcontrol->private_value; |
1657 | 1700 | ||
1658 | spin_lock_irq(&ensoniq->reg_lock); | 1701 | spin_lock_irq(&ensoniq->reg_lock); |
@@ -1661,9 +1704,10 @@ static int snd_ensoniq_control_get(snd_kcontrol_t * kcontrol, snd_ctl_elem_value | |||
1661 | return 0; | 1704 | return 0; |
1662 | } | 1705 | } |
1663 | 1706 | ||
1664 | static int snd_ensoniq_control_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 1707 | static int snd_ensoniq_control_put(struct snd_kcontrol *kcontrol, |
1708 | struct snd_ctl_elem_value *ucontrol) | ||
1665 | { | 1709 | { |
1666 | ensoniq_t *ensoniq = snd_kcontrol_chip(kcontrol); | 1710 | struct ensoniq *ensoniq = snd_kcontrol_chip(kcontrol); |
1667 | int mask = kcontrol->private_value; | 1711 | int mask = kcontrol->private_value; |
1668 | unsigned int nval; | 1712 | unsigned int nval; |
1669 | int change; | 1713 | int change; |
@@ -1682,23 +1726,23 @@ static int snd_ensoniq_control_put(snd_kcontrol_t * kcontrol, snd_ctl_elem_value | |||
1682 | * ENS1370 mixer | 1726 | * ENS1370 mixer |
1683 | */ | 1727 | */ |
1684 | 1728 | ||
1685 | static snd_kcontrol_new_t snd_es1370_controls[2] __devinitdata = { | 1729 | static struct snd_kcontrol_new snd_es1370_controls[2] __devinitdata = { |
1686 | ENSONIQ_CONTROL("PCM 0 Output also on Line-In Jack", ES_1370_XCTL0), | 1730 | ENSONIQ_CONTROL("PCM 0 Output also on Line-In Jack", ES_1370_XCTL0), |
1687 | ENSONIQ_CONTROL("Mic +5V bias", ES_1370_XCTL1) | 1731 | ENSONIQ_CONTROL("Mic +5V bias", ES_1370_XCTL1) |
1688 | }; | 1732 | }; |
1689 | 1733 | ||
1690 | #define ES1370_CONTROLS ARRAY_SIZE(snd_es1370_controls) | 1734 | #define ES1370_CONTROLS ARRAY_SIZE(snd_es1370_controls) |
1691 | 1735 | ||
1692 | static void snd_ensoniq_mixer_free_ak4531(ak4531_t *ak4531) | 1736 | static void snd_ensoniq_mixer_free_ak4531(struct snd_ak4531 *ak4531) |
1693 | { | 1737 | { |
1694 | ensoniq_t *ensoniq = ak4531->private_data; | 1738 | struct ensoniq *ensoniq = ak4531->private_data; |
1695 | ensoniq->u.es1370.ak4531 = NULL; | 1739 | ensoniq->u.es1370.ak4531 = NULL; |
1696 | } | 1740 | } |
1697 | 1741 | ||
1698 | static int __devinit snd_ensoniq_1370_mixer(ensoniq_t * ensoniq) | 1742 | static int __devinit snd_ensoniq_1370_mixer(struct ensoniq * ensoniq) |
1699 | { | 1743 | { |
1700 | snd_card_t *card = ensoniq->card; | 1744 | struct snd_card *card = ensoniq->card; |
1701 | ak4531_t ak4531; | 1745 | struct snd_ak4531 ak4531; |
1702 | unsigned int idx; | 1746 | unsigned int idx; |
1703 | int err; | 1747 | int err; |
1704 | 1748 | ||
@@ -1752,7 +1796,7 @@ static inline int snd_ensoniq_get_joystick_port(int dev) | |||
1752 | } | 1796 | } |
1753 | #endif | 1797 | #endif |
1754 | 1798 | ||
1755 | static int __devinit snd_ensoniq_create_gameport(ensoniq_t *ensoniq, int dev) | 1799 | static int __devinit snd_ensoniq_create_gameport(struct ensoniq *ensoniq, int dev) |
1756 | { | 1800 | { |
1757 | struct gameport *gp; | 1801 | struct gameport *gp; |
1758 | int io_port; | 1802 | int io_port; |
@@ -1775,7 +1819,8 @@ static int __devinit snd_ensoniq_create_gameport(ensoniq_t *ensoniq, int dev) | |||
1775 | 1819 | ||
1776 | default: | 1820 | default: |
1777 | if (!request_region(io_port, 8, "ens137x: gameport")) { | 1821 | if (!request_region(io_port, 8, "ens137x: gameport")) { |
1778 | printk(KERN_WARNING "ens137x: gameport io port 0x%#x in use\n", io_port); | 1822 | printk(KERN_WARNING "ens137x: gameport io port 0x%#x in use\n", |
1823 | io_port); | ||
1779 | return -EBUSY; | 1824 | return -EBUSY; |
1780 | } | 1825 | } |
1781 | break; | 1826 | break; |
@@ -1805,7 +1850,7 @@ static int __devinit snd_ensoniq_create_gameport(ensoniq_t *ensoniq, int dev) | |||
1805 | return 0; | 1850 | return 0; |
1806 | } | 1851 | } |
1807 | 1852 | ||
1808 | static void snd_ensoniq_free_gameport(ensoniq_t *ensoniq) | 1853 | static void snd_ensoniq_free_gameport(struct ensoniq *ensoniq) |
1809 | { | 1854 | { |
1810 | if (ensoniq->gameport) { | 1855 | if (ensoniq->gameport) { |
1811 | int port = ensoniq->gameport->io; | 1856 | int port = ensoniq->gameport->io; |
@@ -1818,36 +1863,40 @@ static void snd_ensoniq_free_gameport(ensoniq_t *ensoniq) | |||
1818 | } | 1863 | } |
1819 | } | 1864 | } |
1820 | #else | 1865 | #else |
1821 | static inline int snd_ensoniq_create_gameport(ensoniq_t *ensoniq, long port) { return -ENOSYS; } | 1866 | static inline int snd_ensoniq_create_gameport(struct ensoniq *ensoniq, long port) { return -ENOSYS; } |
1822 | static inline void snd_ensoniq_free_gameport(ensoniq_t *ensoniq) { } | 1867 | static inline void snd_ensoniq_free_gameport(struct ensoniq *ensoniq) { } |
1823 | #endif /* SUPPORT_JOYSTICK */ | 1868 | #endif /* SUPPORT_JOYSTICK */ |
1824 | 1869 | ||
1825 | /* | 1870 | /* |
1826 | 1871 | ||
1827 | */ | 1872 | */ |
1828 | 1873 | ||
1829 | static void snd_ensoniq_proc_read(snd_info_entry_t *entry, | 1874 | static void snd_ensoniq_proc_read(struct snd_info_entry *entry, |
1830 | snd_info_buffer_t * buffer) | 1875 | struct snd_info_buffer *buffer) |
1831 | { | 1876 | { |
1832 | ensoniq_t *ensoniq = entry->private_data; | 1877 | struct ensoniq *ensoniq = entry->private_data; |
1833 | 1878 | ||
1834 | #ifdef CHIP1370 | 1879 | #ifdef CHIP1370 |
1835 | snd_iprintf(buffer, "Ensoniq AudioPCI ES1370\n\n"); | 1880 | snd_iprintf(buffer, "Ensoniq AudioPCI ES1370\n\n"); |
1836 | #else | 1881 | #else |
1837 | snd_iprintf(buffer, "Ensoniq AudioPCI ES1371\n\n"); | 1882 | snd_iprintf(buffer, "Ensoniq AudioPCI ES1371\n\n"); |
1838 | #endif | 1883 | #endif |
1839 | snd_iprintf(buffer, "Joystick enable : %s\n", ensoniq->ctrl & ES_JYSTK_EN ? "on" : "off"); | 1884 | snd_iprintf(buffer, "Joystick enable : %s\n", |
1885 | ensoniq->ctrl & ES_JYSTK_EN ? "on" : "off"); | ||
1840 | #ifdef CHIP1370 | 1886 | #ifdef CHIP1370 |
1841 | snd_iprintf(buffer, "MIC +5V bias : %s\n", ensoniq->ctrl & ES_1370_XCTL1 ? "on" : "off"); | 1887 | snd_iprintf(buffer, "MIC +5V bias : %s\n", |
1842 | snd_iprintf(buffer, "Line In to AOUT : %s\n", ensoniq->ctrl & ES_1370_XCTL0 ? "on" : "off"); | 1888 | ensoniq->ctrl & ES_1370_XCTL1 ? "on" : "off"); |
1889 | snd_iprintf(buffer, "Line In to AOUT : %s\n", | ||
1890 | ensoniq->ctrl & ES_1370_XCTL0 ? "on" : "off"); | ||
1843 | #else | 1891 | #else |
1844 | snd_iprintf(buffer, "Joystick port : 0x%x\n", (ES_1371_JOY_ASELI(ensoniq->ctrl) * 8) + 0x200); | 1892 | snd_iprintf(buffer, "Joystick port : 0x%x\n", |
1893 | (ES_1371_JOY_ASELI(ensoniq->ctrl) * 8) + 0x200); | ||
1845 | #endif | 1894 | #endif |
1846 | } | 1895 | } |
1847 | 1896 | ||
1848 | static void __devinit snd_ensoniq_proc_init(ensoniq_t * ensoniq) | 1897 | static void __devinit snd_ensoniq_proc_init(struct ensoniq * ensoniq) |
1849 | { | 1898 | { |
1850 | snd_info_entry_t *entry; | 1899 | struct snd_info_entry *entry; |
1851 | 1900 | ||
1852 | if (! snd_card_proc_new(ensoniq->card, "audiopci", &entry)) | 1901 | if (! snd_card_proc_new(ensoniq->card, "audiopci", &entry)) |
1853 | snd_info_set_text_ops(entry, ensoniq, 1024, snd_ensoniq_proc_read); | 1902 | snd_info_set_text_ops(entry, ensoniq, 1024, snd_ensoniq_proc_read); |
@@ -1857,7 +1906,7 @@ static void __devinit snd_ensoniq_proc_init(ensoniq_t * ensoniq) | |||
1857 | 1906 | ||
1858 | */ | 1907 | */ |
1859 | 1908 | ||
1860 | static int snd_ensoniq_free(ensoniq_t *ensoniq) | 1909 | static int snd_ensoniq_free(struct ensoniq *ensoniq) |
1861 | { | 1910 | { |
1862 | snd_ensoniq_free_gameport(ensoniq); | 1911 | snd_ensoniq_free_gameport(ensoniq); |
1863 | if (ensoniq->irq < 0) | 1912 | if (ensoniq->irq < 0) |
@@ -1877,16 +1926,16 @@ static int snd_ensoniq_free(ensoniq_t *ensoniq) | |||
1877 | snd_dma_free_pages(&ensoniq->dma_bug); | 1926 | snd_dma_free_pages(&ensoniq->dma_bug); |
1878 | #endif | 1927 | #endif |
1879 | if (ensoniq->irq >= 0) | 1928 | if (ensoniq->irq >= 0) |
1880 | free_irq(ensoniq->irq, (void *)ensoniq); | 1929 | free_irq(ensoniq->irq, ensoniq); |
1881 | pci_release_regions(ensoniq->pci); | 1930 | pci_release_regions(ensoniq->pci); |
1882 | pci_disable_device(ensoniq->pci); | 1931 | pci_disable_device(ensoniq->pci); |
1883 | kfree(ensoniq); | 1932 | kfree(ensoniq); |
1884 | return 0; | 1933 | return 0; |
1885 | } | 1934 | } |
1886 | 1935 | ||
1887 | static int snd_ensoniq_dev_free(snd_device_t *device) | 1936 | static int snd_ensoniq_dev_free(struct snd_device *device) |
1888 | { | 1937 | { |
1889 | ensoniq_t *ensoniq = device->device_data; | 1938 | struct ensoniq *ensoniq = device->device_data; |
1890 | return snd_ensoniq_free(ensoniq); | 1939 | return snd_ensoniq_free(ensoniq); |
1891 | } | 1940 | } |
1892 | 1941 | ||
@@ -1915,13 +1964,15 @@ static struct { | |||
1915 | }; | 1964 | }; |
1916 | #endif | 1965 | #endif |
1917 | 1966 | ||
1918 | static void snd_ensoniq_chip_init(ensoniq_t * ensoniq) | 1967 | static void snd_ensoniq_chip_init(struct ensoniq *ensoniq) |
1919 | { | 1968 | { |
1920 | #ifdef CHIP1371 | 1969 | #ifdef CHIP1371 |
1921 | int idx; | 1970 | int idx; |
1922 | struct pci_dev *pci = ensoniq->pci; | 1971 | struct pci_dev *pci = ensoniq->pci; |
1923 | #endif | 1972 | #endif |
1924 | // this code was part of snd_ensoniq_create before intruduction of suspend/resume | 1973 | /* this code was part of snd_ensoniq_create before intruduction |
1974 | * of suspend/resume | ||
1975 | */ | ||
1925 | #ifdef CHIP1370 | 1976 | #ifdef CHIP1370 |
1926 | outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL)); | 1977 | outl(ensoniq->ctrl, ES_REG(ensoniq, CONTROL)); |
1927 | outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL)); | 1978 | outl(ensoniq->sctrl, ES_REG(ensoniq, SERIAL)); |
@@ -1983,10 +2034,9 @@ static void snd_ensoniq_chip_init(ensoniq_t * ensoniq) | |||
1983 | } | 2034 | } |
1984 | 2035 | ||
1985 | #ifdef CONFIG_PM | 2036 | #ifdef CONFIG_PM |
1986 | static int snd_ensoniq_suspend (snd_card_t * card, | 2037 | static int snd_ensoniq_suspend(struct snd_card *card, pm_message_t state) |
1987 | pm_message_t state) | ||
1988 | { | 2038 | { |
1989 | ensoniq_t *ensoniq = card->pm_private_data; | 2039 | struct ensoniq *ensoniq = card->pm_private_data; |
1990 | 2040 | ||
1991 | snd_pcm_suspend_all(ensoniq->pcm1); | 2041 | snd_pcm_suspend_all(ensoniq->pcm1); |
1992 | snd_pcm_suspend_all(ensoniq->pcm2); | 2042 | snd_pcm_suspend_all(ensoniq->pcm2); |
@@ -1997,16 +2047,14 @@ static int snd_ensoniq_suspend (snd_card_t * card, | |||
1997 | #else | 2047 | #else |
1998 | /* FIXME */ | 2048 | /* FIXME */ |
1999 | #endif | 2049 | #endif |
2000 | pci_set_power_state(ensoniq->pci, 3); | 2050 | pci_set_power_state(ensoniq->pci, 3); |
2001 | pci_disable_device(ensoniq->pci); | 2051 | pci_disable_device(ensoniq->pci); |
2002 | // snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); // only 2.6.10 | ||
2003 | return 0; | 2052 | return 0; |
2004 | } | 2053 | } |
2005 | 2054 | ||
2006 | static int snd_ensoniq_resume (snd_card_t * card | 2055 | static int snd_ensoniq_resume(struct snd_card *card) |
2007 | ) | ||
2008 | { | 2056 | { |
2009 | ensoniq_t *ensoniq = card->pm_private_data; | 2057 | struct ensoniq *ensoniq = card->pm_private_data; |
2010 | 2058 | ||
2011 | pci_enable_device(ensoniq->pci); | 2059 | pci_enable_device(ensoniq->pci); |
2012 | pci_set_power_state(ensoniq->pci, 0); | 2060 | pci_set_power_state(ensoniq->pci, 0); |
@@ -2020,24 +2068,23 @@ static int snd_ensoniq_resume (snd_card_t * card | |||
2020 | #else | 2068 | #else |
2021 | /* FIXME */ | 2069 | /* FIXME */ |
2022 | #endif | 2070 | #endif |
2023 | // snd_power_change_state(card, SNDRV_CTL_POWER_D0); // only 2.6.10 | ||
2024 | return 0; | 2071 | return 0; |
2025 | } | 2072 | } |
2026 | #endif /* CONFIG_PM */ | 2073 | #endif /* CONFIG_PM */ |
2027 | 2074 | ||
2028 | 2075 | ||
2029 | static int __devinit snd_ensoniq_create(snd_card_t * card, | 2076 | static int __devinit snd_ensoniq_create(struct snd_card *card, |
2030 | struct pci_dev *pci, | 2077 | struct pci_dev *pci, |
2031 | ensoniq_t ** rensoniq) | 2078 | struct ensoniq ** rensoniq) |
2032 | { | 2079 | { |
2033 | ensoniq_t *ensoniq; | 2080 | struct ensoniq *ensoniq; |
2034 | unsigned short cmdw; | 2081 | unsigned short cmdw; |
2035 | unsigned char cmdb; | 2082 | unsigned char cmdb; |
2036 | #ifdef CHIP1371 | 2083 | #ifdef CHIP1371 |
2037 | int idx; | 2084 | int idx; |
2038 | #endif | 2085 | #endif |
2039 | int err; | 2086 | int err; |
2040 | static snd_device_ops_t ops = { | 2087 | static struct snd_device_ops ops = { |
2041 | .dev_free = snd_ensoniq_dev_free, | 2088 | .dev_free = snd_ensoniq_dev_free, |
2042 | }; | 2089 | }; |
2043 | 2090 | ||
@@ -2060,7 +2107,8 @@ static int __devinit snd_ensoniq_create(snd_card_t * card, | |||
2060 | return err; | 2107 | return err; |
2061 | } | 2108 | } |
2062 | ensoniq->port = pci_resource_start(pci, 0); | 2109 | ensoniq->port = pci_resource_start(pci, 0); |
2063 | if (request_irq(pci->irq, snd_audiopci_interrupt, SA_INTERRUPT|SA_SHIRQ, "Ensoniq AudioPCI", (void *)ensoniq)) { | 2110 | if (request_irq(pci->irq, snd_audiopci_interrupt, SA_INTERRUPT|SA_SHIRQ, |
2111 | "Ensoniq AudioPCI", ensoniq)) { | ||
2064 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 2112 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
2065 | snd_ensoniq_free(ensoniq); | 2113 | snd_ensoniq_free(ensoniq); |
2066 | return -EBUSY; | 2114 | return -EBUSY; |
@@ -2083,7 +2131,8 @@ static int __devinit snd_ensoniq_create(snd_card_t * card, | |||
2083 | ensoniq->subsystem_device_id = cmdw; | 2131 | ensoniq->subsystem_device_id = cmdw; |
2084 | #ifdef CHIP1370 | 2132 | #ifdef CHIP1370 |
2085 | #if 0 | 2133 | #if 0 |
2086 | ensoniq->ctrl = ES_1370_CDC_EN | ES_1370_SERR_DISABLE | ES_1370_PCLKDIVO(ES_1370_SRTODIV(8000)); | 2134 | ensoniq->ctrl = ES_1370_CDC_EN | ES_1370_SERR_DISABLE | |
2135 | ES_1370_PCLKDIVO(ES_1370_SRTODIV(8000)); | ||
2087 | #else /* get microphone working */ | 2136 | #else /* get microphone working */ |
2088 | ensoniq->ctrl = ES_1370_CDC_EN | ES_1370_PCLKDIVO(ES_1370_SRTODIV(8000)); | 2137 | ensoniq->ctrl = ES_1370_CDC_EN | ES_1370_PCLKDIVO(ES_1370_SRTODIV(8000)); |
2089 | #endif | 2138 | #endif |
@@ -2128,9 +2177,9 @@ static int __devinit snd_ensoniq_create(snd_card_t * card, | |||
2128 | * MIDI section | 2177 | * MIDI section |
2129 | */ | 2178 | */ |
2130 | 2179 | ||
2131 | static void snd_ensoniq_midi_interrupt(ensoniq_t * ensoniq) | 2180 | static void snd_ensoniq_midi_interrupt(struct ensoniq * ensoniq) |
2132 | { | 2181 | { |
2133 | snd_rawmidi_t * rmidi = ensoniq->rmidi; | 2182 | struct snd_rawmidi *rmidi = ensoniq->rmidi; |
2134 | unsigned char status, mask, byte; | 2183 | unsigned char status, mask, byte; |
2135 | 2184 | ||
2136 | if (rmidi == NULL) | 2185 | if (rmidi == NULL) |
@@ -2165,9 +2214,9 @@ static void snd_ensoniq_midi_interrupt(ensoniq_t * ensoniq) | |||
2165 | spin_unlock(&ensoniq->reg_lock); | 2214 | spin_unlock(&ensoniq->reg_lock); |
2166 | } | 2215 | } |
2167 | 2216 | ||
2168 | static int snd_ensoniq_midi_input_open(snd_rawmidi_substream_t * substream) | 2217 | static int snd_ensoniq_midi_input_open(struct snd_rawmidi_substream *substream) |
2169 | { | 2218 | { |
2170 | ensoniq_t *ensoniq = substream->rmidi->private_data; | 2219 | struct ensoniq *ensoniq = substream->rmidi->private_data; |
2171 | 2220 | ||
2172 | spin_lock_irq(&ensoniq->reg_lock); | 2221 | spin_lock_irq(&ensoniq->reg_lock); |
2173 | ensoniq->uartm |= ES_MODE_INPUT; | 2222 | ensoniq->uartm |= ES_MODE_INPUT; |
@@ -2181,9 +2230,9 @@ static int snd_ensoniq_midi_input_open(snd_rawmidi_substream_t * substream) | |||
2181 | return 0; | 2230 | return 0; |
2182 | } | 2231 | } |
2183 | 2232 | ||
2184 | static int snd_ensoniq_midi_input_close(snd_rawmidi_substream_t * substream) | 2233 | static int snd_ensoniq_midi_input_close(struct snd_rawmidi_substream *substream) |
2185 | { | 2234 | { |
2186 | ensoniq_t *ensoniq = substream->rmidi->private_data; | 2235 | struct ensoniq *ensoniq = substream->rmidi->private_data; |
2187 | 2236 | ||
2188 | spin_lock_irq(&ensoniq->reg_lock); | 2237 | spin_lock_irq(&ensoniq->reg_lock); |
2189 | if (!(ensoniq->uartm & ES_MODE_OUTPUT)) { | 2238 | if (!(ensoniq->uartm & ES_MODE_OUTPUT)) { |
@@ -2198,9 +2247,9 @@ static int snd_ensoniq_midi_input_close(snd_rawmidi_substream_t * substream) | |||
2198 | return 0; | 2247 | return 0; |
2199 | } | 2248 | } |
2200 | 2249 | ||
2201 | static int snd_ensoniq_midi_output_open(snd_rawmidi_substream_t * substream) | 2250 | static int snd_ensoniq_midi_output_open(struct snd_rawmidi_substream *substream) |
2202 | { | 2251 | { |
2203 | ensoniq_t *ensoniq = substream->rmidi->private_data; | 2252 | struct ensoniq *ensoniq = substream->rmidi->private_data; |
2204 | 2253 | ||
2205 | spin_lock_irq(&ensoniq->reg_lock); | 2254 | spin_lock_irq(&ensoniq->reg_lock); |
2206 | ensoniq->uartm |= ES_MODE_OUTPUT; | 2255 | ensoniq->uartm |= ES_MODE_OUTPUT; |
@@ -2214,9 +2263,9 @@ static int snd_ensoniq_midi_output_open(snd_rawmidi_substream_t * substream) | |||
2214 | return 0; | 2263 | return 0; |
2215 | } | 2264 | } |
2216 | 2265 | ||
2217 | static int snd_ensoniq_midi_output_close(snd_rawmidi_substream_t * substream) | 2266 | static int snd_ensoniq_midi_output_close(struct snd_rawmidi_substream *substream) |
2218 | { | 2267 | { |
2219 | ensoniq_t *ensoniq = substream->rmidi->private_data; | 2268 | struct ensoniq *ensoniq = substream->rmidi->private_data; |
2220 | 2269 | ||
2221 | spin_lock_irq(&ensoniq->reg_lock); | 2270 | spin_lock_irq(&ensoniq->reg_lock); |
2222 | if (!(ensoniq->uartm & ES_MODE_INPUT)) { | 2271 | if (!(ensoniq->uartm & ES_MODE_INPUT)) { |
@@ -2231,10 +2280,10 @@ static int snd_ensoniq_midi_output_close(snd_rawmidi_substream_t * substream) | |||
2231 | return 0; | 2280 | return 0; |
2232 | } | 2281 | } |
2233 | 2282 | ||
2234 | static void snd_ensoniq_midi_input_trigger(snd_rawmidi_substream_t * substream, int up) | 2283 | static void snd_ensoniq_midi_input_trigger(struct snd_rawmidi_substream *substream, int up) |
2235 | { | 2284 | { |
2236 | unsigned long flags; | 2285 | unsigned long flags; |
2237 | ensoniq_t *ensoniq = substream->rmidi->private_data; | 2286 | struct ensoniq *ensoniq = substream->rmidi->private_data; |
2238 | int idx; | 2287 | int idx; |
2239 | 2288 | ||
2240 | spin_lock_irqsave(&ensoniq->reg_lock, flags); | 2289 | spin_lock_irqsave(&ensoniq->reg_lock, flags); |
@@ -2255,10 +2304,10 @@ static void snd_ensoniq_midi_input_trigger(snd_rawmidi_substream_t * substream, | |||
2255 | spin_unlock_irqrestore(&ensoniq->reg_lock, flags); | 2304 | spin_unlock_irqrestore(&ensoniq->reg_lock, flags); |
2256 | } | 2305 | } |
2257 | 2306 | ||
2258 | static void snd_ensoniq_midi_output_trigger(snd_rawmidi_substream_t * substream, int up) | 2307 | static void snd_ensoniq_midi_output_trigger(struct snd_rawmidi_substream *substream, int up) |
2259 | { | 2308 | { |
2260 | unsigned long flags; | 2309 | unsigned long flags; |
2261 | ensoniq_t *ensoniq = substream->rmidi->private_data; | 2310 | struct ensoniq *ensoniq = substream->rmidi->private_data; |
2262 | unsigned char byte; | 2311 | unsigned char byte; |
2263 | 2312 | ||
2264 | spin_lock_irqsave(&ensoniq->reg_lock, flags); | 2313 | spin_lock_irqsave(&ensoniq->reg_lock, flags); |
@@ -2285,23 +2334,24 @@ static void snd_ensoniq_midi_output_trigger(snd_rawmidi_substream_t * substream, | |||
2285 | spin_unlock_irqrestore(&ensoniq->reg_lock, flags); | 2334 | spin_unlock_irqrestore(&ensoniq->reg_lock, flags); |
2286 | } | 2335 | } |
2287 | 2336 | ||
2288 | static snd_rawmidi_ops_t snd_ensoniq_midi_output = | 2337 | static struct snd_rawmidi_ops snd_ensoniq_midi_output = |
2289 | { | 2338 | { |
2290 | .open = snd_ensoniq_midi_output_open, | 2339 | .open = snd_ensoniq_midi_output_open, |
2291 | .close = snd_ensoniq_midi_output_close, | 2340 | .close = snd_ensoniq_midi_output_close, |
2292 | .trigger = snd_ensoniq_midi_output_trigger, | 2341 | .trigger = snd_ensoniq_midi_output_trigger, |
2293 | }; | 2342 | }; |
2294 | 2343 | ||
2295 | static snd_rawmidi_ops_t snd_ensoniq_midi_input = | 2344 | static struct snd_rawmidi_ops snd_ensoniq_midi_input = |
2296 | { | 2345 | { |
2297 | .open = snd_ensoniq_midi_input_open, | 2346 | .open = snd_ensoniq_midi_input_open, |
2298 | .close = snd_ensoniq_midi_input_close, | 2347 | .close = snd_ensoniq_midi_input_close, |
2299 | .trigger = snd_ensoniq_midi_input_trigger, | 2348 | .trigger = snd_ensoniq_midi_input_trigger, |
2300 | }; | 2349 | }; |
2301 | 2350 | ||
2302 | static int __devinit snd_ensoniq_midi(ensoniq_t * ensoniq, int device, snd_rawmidi_t **rrawmidi) | 2351 | static int __devinit snd_ensoniq_midi(struct ensoniq * ensoniq, int device, |
2352 | struct snd_rawmidi **rrawmidi) | ||
2303 | { | 2353 | { |
2304 | snd_rawmidi_t *rmidi; | 2354 | struct snd_rawmidi *rmidi; |
2305 | int err; | 2355 | int err; |
2306 | 2356 | ||
2307 | if (rrawmidi) | 2357 | if (rrawmidi) |
@@ -2315,7 +2365,8 @@ static int __devinit snd_ensoniq_midi(ensoniq_t * ensoniq, int device, snd_rawmi | |||
2315 | #endif | 2365 | #endif |
2316 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_ensoniq_midi_output); | 2366 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_ensoniq_midi_output); |
2317 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_ensoniq_midi_input); | 2367 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_INPUT, &snd_ensoniq_midi_input); |
2318 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | SNDRV_RAWMIDI_INFO_DUPLEX; | 2368 | rmidi->info_flags |= SNDRV_RAWMIDI_INFO_OUTPUT | SNDRV_RAWMIDI_INFO_INPUT | |
2369 | SNDRV_RAWMIDI_INFO_DUPLEX; | ||
2319 | rmidi->private_data = ensoniq; | 2370 | rmidi->private_data = ensoniq; |
2320 | ensoniq->rmidi = rmidi; | 2371 | ensoniq->rmidi = rmidi; |
2321 | if (rrawmidi) | 2372 | if (rrawmidi) |
@@ -2329,7 +2380,7 @@ static int __devinit snd_ensoniq_midi(ensoniq_t * ensoniq, int device, snd_rawmi | |||
2329 | 2380 | ||
2330 | static irqreturn_t snd_audiopci_interrupt(int irq, void *dev_id, struct pt_regs *regs) | 2381 | static irqreturn_t snd_audiopci_interrupt(int irq, void *dev_id, struct pt_regs *regs) |
2331 | { | 2382 | { |
2332 | ensoniq_t *ensoniq = dev_id; | 2383 | struct ensoniq *ensoniq = dev_id; |
2333 | unsigned int status, sctrl; | 2384 | unsigned int status, sctrl; |
2334 | 2385 | ||
2335 | if (ensoniq == NULL) | 2386 | if (ensoniq == NULL) |
@@ -2366,8 +2417,8 @@ static int __devinit snd_audiopci_probe(struct pci_dev *pci, | |||
2366 | const struct pci_device_id *pci_id) | 2417 | const struct pci_device_id *pci_id) |
2367 | { | 2418 | { |
2368 | static int dev; | 2419 | static int dev; |
2369 | snd_card_t *card; | 2420 | struct snd_card *card; |
2370 | ensoniq_t *ensoniq; | 2421 | struct ensoniq *ensoniq; |
2371 | int err, pcm_devs[2]; | 2422 | int err, pcm_devs[2]; |
2372 | 2423 | ||
2373 | if (dev >= SNDRV_CARDS) | 2424 | if (dev >= SNDRV_CARDS) |