diff options
Diffstat (limited to 'sound')
-rw-r--r-- | sound/pci/cmipci.c | 506 |
1 files changed, 264 insertions, 242 deletions
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c index 0309689f37f5..ce156ca5bc6f 100644 --- a/sound/pci/cmipci.c +++ b/sound/pci/cmipci.c | |||
@@ -378,11 +378,8 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address."); | |||
378 | * driver data | 378 | * driver data |
379 | */ | 379 | */ |
380 | 380 | ||
381 | typedef struct snd_stru_cmipci cmipci_t; | 381 | struct cmipci_pcm { |
382 | typedef struct snd_stru_cmipci_pcm cmipci_pcm_t; | 382 | struct snd_pcm_substream *substream; |
383 | |||
384 | struct snd_stru_cmipci_pcm { | ||
385 | snd_pcm_substream_t *substream; | ||
386 | int running; /* dac/adc running? */ | 383 | int running; /* dac/adc running? */ |
387 | unsigned int dma_size; /* in frames */ | 384 | unsigned int dma_size; /* in frames */ |
388 | unsigned int period_size; /* in frames */ | 385 | unsigned int period_size; /* in frames */ |
@@ -408,8 +405,8 @@ static const struct cmipci_mixer_auto_switches cm_saved_mixer[] = { | |||
408 | }; | 405 | }; |
409 | #define CM_SAVED_MIXERS ARRAY_SIZE(cm_saved_mixer) | 406 | #define CM_SAVED_MIXERS ARRAY_SIZE(cm_saved_mixer) |
410 | 407 | ||
411 | struct snd_stru_cmipci { | 408 | struct cmipci { |
412 | snd_card_t *card; | 409 | struct snd_card *card; |
413 | 410 | ||
414 | struct pci_dev *pci; | 411 | struct pci_dev *pci; |
415 | unsigned int device; /* device ID */ | 412 | unsigned int device; /* device ID */ |
@@ -418,9 +415,9 @@ struct snd_stru_cmipci { | |||
418 | unsigned long iobase; | 415 | unsigned long iobase; |
419 | unsigned int ctrl; /* FUNCTRL0 current value */ | 416 | unsigned int ctrl; /* FUNCTRL0 current value */ |
420 | 417 | ||
421 | snd_pcm_t *pcm; /* DAC/ADC PCM */ | 418 | struct snd_pcm *pcm; /* DAC/ADC PCM */ |
422 | snd_pcm_t *pcm2; /* 2nd DAC */ | 419 | struct snd_pcm *pcm2; /* 2nd DAC */ |
423 | snd_pcm_t *pcm_spdif; /* SPDIF */ | 420 | struct snd_pcm *pcm_spdif; /* SPDIF */ |
424 | 421 | ||
425 | int chip_version; | 422 | int chip_version; |
426 | int max_channels; | 423 | int max_channels; |
@@ -437,19 +434,19 @@ struct snd_stru_cmipci { | |||
437 | unsigned int dig_status; | 434 | unsigned int dig_status; |
438 | unsigned int dig_pcm_status; | 435 | unsigned int dig_pcm_status; |
439 | 436 | ||
440 | snd_pcm_hardware_t *hw_info[3]; /* for playbacks */ | 437 | struct snd_pcm_hardware *hw_info[3]; /* for playbacks */ |
441 | 438 | ||
442 | int opened[2]; /* open mode */ | 439 | int opened[2]; /* open mode */ |
443 | struct semaphore open_mutex; | 440 | struct semaphore open_mutex; |
444 | 441 | ||
445 | unsigned int mixer_insensitive: 1; | 442 | unsigned int mixer_insensitive: 1; |
446 | snd_kcontrol_t *mixer_res_ctl[CM_SAVED_MIXERS]; | 443 | struct snd_kcontrol *mixer_res_ctl[CM_SAVED_MIXERS]; |
447 | int mixer_res_status[CM_SAVED_MIXERS]; | 444 | int mixer_res_status[CM_SAVED_MIXERS]; |
448 | 445 | ||
449 | cmipci_pcm_t channel[2]; /* ch0 - DAC, ch1 - ADC or 2nd DAC */ | 446 | struct cmipci_pcm channel[2]; /* ch0 - DAC, ch1 - ADC or 2nd DAC */ |
450 | 447 | ||
451 | /* external MIDI */ | 448 | /* external MIDI */ |
452 | snd_rawmidi_t *rmidi; | 449 | struct snd_rawmidi *rmidi; |
453 | 450 | ||
454 | #ifdef SUPPORT_JOYSTICK | 451 | #ifdef SUPPORT_JOYSTICK |
455 | struct gameport *gameport; | 452 | struct gameport *gameport; |
@@ -460,40 +457,40 @@ struct snd_stru_cmipci { | |||
460 | 457 | ||
461 | 458 | ||
462 | /* read/write operations for dword register */ | 459 | /* read/write operations for dword register */ |
463 | static inline void snd_cmipci_write(cmipci_t *cm, unsigned int cmd, unsigned int data) | 460 | static inline void snd_cmipci_write(struct cmipci *cm, unsigned int cmd, unsigned int data) |
464 | { | 461 | { |
465 | outl(data, cm->iobase + cmd); | 462 | outl(data, cm->iobase + cmd); |
466 | } | 463 | } |
467 | 464 | ||
468 | static inline unsigned int snd_cmipci_read(cmipci_t *cm, unsigned int cmd) | 465 | static inline unsigned int snd_cmipci_read(struct cmipci *cm, unsigned int cmd) |
469 | { | 466 | { |
470 | return inl(cm->iobase + cmd); | 467 | return inl(cm->iobase + cmd); |
471 | } | 468 | } |
472 | 469 | ||
473 | /* read/write operations for word register */ | 470 | /* read/write operations for word register */ |
474 | static inline void snd_cmipci_write_w(cmipci_t *cm, unsigned int cmd, unsigned short data) | 471 | static inline void snd_cmipci_write_w(struct cmipci *cm, unsigned int cmd, unsigned short data) |
475 | { | 472 | { |
476 | outw(data, cm->iobase + cmd); | 473 | outw(data, cm->iobase + cmd); |
477 | } | 474 | } |
478 | 475 | ||
479 | static inline unsigned short snd_cmipci_read_w(cmipci_t *cm, unsigned int cmd) | 476 | static inline unsigned short snd_cmipci_read_w(struct cmipci *cm, unsigned int cmd) |
480 | { | 477 | { |
481 | return inw(cm->iobase + cmd); | 478 | return inw(cm->iobase + cmd); |
482 | } | 479 | } |
483 | 480 | ||
484 | /* read/write operations for byte register */ | 481 | /* read/write operations for byte register */ |
485 | static inline void snd_cmipci_write_b(cmipci_t *cm, unsigned int cmd, unsigned char data) | 482 | static inline void snd_cmipci_write_b(struct cmipci *cm, unsigned int cmd, unsigned char data) |
486 | { | 483 | { |
487 | outb(data, cm->iobase + cmd); | 484 | outb(data, cm->iobase + cmd); |
488 | } | 485 | } |
489 | 486 | ||
490 | static inline unsigned char snd_cmipci_read_b(cmipci_t *cm, unsigned int cmd) | 487 | static inline unsigned char snd_cmipci_read_b(struct cmipci *cm, unsigned int cmd) |
491 | { | 488 | { |
492 | return inb(cm->iobase + cmd); | 489 | return inb(cm->iobase + cmd); |
493 | } | 490 | } |
494 | 491 | ||
495 | /* bit operations for dword register */ | 492 | /* bit operations for dword register */ |
496 | static int snd_cmipci_set_bit(cmipci_t *cm, unsigned int cmd, unsigned int flag) | 493 | static int snd_cmipci_set_bit(struct cmipci *cm, unsigned int cmd, unsigned int flag) |
497 | { | 494 | { |
498 | unsigned int val, oval; | 495 | unsigned int val, oval; |
499 | val = oval = inl(cm->iobase + cmd); | 496 | val = oval = inl(cm->iobase + cmd); |
@@ -504,7 +501,7 @@ static int snd_cmipci_set_bit(cmipci_t *cm, unsigned int cmd, unsigned int flag) | |||
504 | return 1; | 501 | return 1; |
505 | } | 502 | } |
506 | 503 | ||
507 | static int snd_cmipci_clear_bit(cmipci_t *cm, unsigned int cmd, unsigned int flag) | 504 | static int snd_cmipci_clear_bit(struct cmipci *cm, unsigned int cmd, unsigned int flag) |
508 | { | 505 | { |
509 | unsigned int val, oval; | 506 | unsigned int val, oval; |
510 | val = oval = inl(cm->iobase + cmd); | 507 | val = oval = inl(cm->iobase + cmd); |
@@ -516,7 +513,7 @@ static int snd_cmipci_clear_bit(cmipci_t *cm, unsigned int cmd, unsigned int fla | |||
516 | } | 513 | } |
517 | 514 | ||
518 | /* bit operations for byte register */ | 515 | /* bit operations for byte register */ |
519 | static int snd_cmipci_set_bit_b(cmipci_t *cm, unsigned int cmd, unsigned char flag) | 516 | static int snd_cmipci_set_bit_b(struct cmipci *cm, unsigned int cmd, unsigned char flag) |
520 | { | 517 | { |
521 | unsigned char val, oval; | 518 | unsigned char val, oval; |
522 | val = oval = inb(cm->iobase + cmd); | 519 | val = oval = inb(cm->iobase + cmd); |
@@ -527,7 +524,7 @@ static int snd_cmipci_set_bit_b(cmipci_t *cm, unsigned int cmd, unsigned char fl | |||
527 | return 1; | 524 | return 1; |
528 | } | 525 | } |
529 | 526 | ||
530 | static int snd_cmipci_clear_bit_b(cmipci_t *cm, unsigned int cmd, unsigned char flag) | 527 | static int snd_cmipci_clear_bit_b(struct cmipci *cm, unsigned int cmd, unsigned char flag) |
531 | { | 528 | { |
532 | unsigned char val, oval; | 529 | unsigned char val, oval; |
533 | val = oval = inb(cm->iobase + cmd); | 530 | val = oval = inb(cm->iobase + cmd); |
@@ -608,7 +605,7 @@ out: | |||
608 | * at the register CM_REG_FUNCTRL1 (0x04). | 605 | * at the register CM_REG_FUNCTRL1 (0x04). |
609 | * Problem: other ways are also possible (any information about that?) | 606 | * Problem: other ways are also possible (any information about that?) |
610 | */ | 607 | */ |
611 | static void snd_cmipci_set_pll(cmipci_t *cm, unsigned int rate, unsigned int slot) | 608 | static void snd_cmipci_set_pll(struct cmipci *cm, unsigned int rate, unsigned int slot) |
612 | { | 609 | { |
613 | unsigned int reg = CM_REG_PLL + slot; | 610 | unsigned int reg = CM_REG_PLL + slot; |
614 | /* | 611 | /* |
@@ -626,16 +623,16 @@ static void snd_cmipci_set_pll(cmipci_t *cm, unsigned int rate, unsigned int slo | |||
626 | } | 623 | } |
627 | #endif /* USE_VAR48KRATE */ | 624 | #endif /* USE_VAR48KRATE */ |
628 | 625 | ||
629 | static int snd_cmipci_hw_params(snd_pcm_substream_t * substream, | 626 | static int snd_cmipci_hw_params(struct snd_pcm_substream *substream, |
630 | snd_pcm_hw_params_t * hw_params) | 627 | struct snd_pcm_hw_params *hw_params) |
631 | { | 628 | { |
632 | return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); | 629 | return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); |
633 | } | 630 | } |
634 | 631 | ||
635 | static int snd_cmipci_playback2_hw_params(snd_pcm_substream_t * substream, | 632 | static int snd_cmipci_playback2_hw_params(struct snd_pcm_substream *substream, |
636 | snd_pcm_hw_params_t * hw_params) | 633 | struct snd_pcm_hw_params *hw_params) |
637 | { | 634 | { |
638 | cmipci_t *cm = snd_pcm_substream_chip(substream); | 635 | struct cmipci *cm = snd_pcm_substream_chip(substream); |
639 | if (params_channels(hw_params) > 2) { | 636 | if (params_channels(hw_params) > 2) { |
640 | down(&cm->open_mutex); | 637 | down(&cm->open_mutex); |
641 | if (cm->opened[CM_CH_PLAY]) { | 638 | if (cm->opened[CM_CH_PLAY]) { |
@@ -649,7 +646,7 @@ static int snd_cmipci_playback2_hw_params(snd_pcm_substream_t * substream, | |||
649 | return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); | 646 | return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); |
650 | } | 647 | } |
651 | 648 | ||
652 | static void snd_cmipci_ch_reset(cmipci_t *cm, int ch) | 649 | static void snd_cmipci_ch_reset(struct cmipci *cm, int ch) |
653 | { | 650 | { |
654 | int reset = CM_RST_CH0 << (cm->channel[ch].ch); | 651 | int reset = CM_RST_CH0 << (cm->channel[ch].ch); |
655 | snd_cmipci_write(cm, CM_REG_FUNCTRL0, cm->ctrl | reset); | 652 | snd_cmipci_write(cm, CM_REG_FUNCTRL0, cm->ctrl | reset); |
@@ -657,7 +654,7 @@ static void snd_cmipci_ch_reset(cmipci_t *cm, int ch) | |||
657 | udelay(10); | 654 | udelay(10); |
658 | } | 655 | } |
659 | 656 | ||
660 | static int snd_cmipci_hw_free(snd_pcm_substream_t * substream) | 657 | static int snd_cmipci_hw_free(struct snd_pcm_substream *substream) |
661 | { | 658 | { |
662 | return snd_pcm_lib_free_pages(substream); | 659 | return snd_pcm_lib_free_pages(substream); |
663 | } | 660 | } |
@@ -667,23 +664,23 @@ static int snd_cmipci_hw_free(snd_pcm_substream_t * substream) | |||
667 | */ | 664 | */ |
668 | 665 | ||
669 | static unsigned int hw_channels[] = {1, 2, 4, 5, 6, 8}; | 666 | static unsigned int hw_channels[] = {1, 2, 4, 5, 6, 8}; |
670 | static snd_pcm_hw_constraint_list_t hw_constraints_channels_4 = { | 667 | static struct snd_pcm_hw_constraint_list hw_constraints_channels_4 = { |
671 | .count = 3, | 668 | .count = 3, |
672 | .list = hw_channels, | 669 | .list = hw_channels, |
673 | .mask = 0, | 670 | .mask = 0, |
674 | }; | 671 | }; |
675 | static snd_pcm_hw_constraint_list_t hw_constraints_channels_6 = { | 672 | static struct snd_pcm_hw_constraint_list hw_constraints_channels_6 = { |
676 | .count = 5, | 673 | .count = 5, |
677 | .list = hw_channels, | 674 | .list = hw_channels, |
678 | .mask = 0, | 675 | .mask = 0, |
679 | }; | 676 | }; |
680 | static snd_pcm_hw_constraint_list_t hw_constraints_channels_8 = { | 677 | static struct snd_pcm_hw_constraint_list hw_constraints_channels_8 = { |
681 | .count = 6, | 678 | .count = 6, |
682 | .list = hw_channels, | 679 | .list = hw_channels, |
683 | .mask = 0, | 680 | .mask = 0, |
684 | }; | 681 | }; |
685 | 682 | ||
686 | static int set_dac_channels(cmipci_t *cm, cmipci_pcm_t *rec, int channels) | 683 | static int set_dac_channels(struct cmipci *cm, struct cmipci_pcm *rec, int channels) |
687 | { | 684 | { |
688 | if (channels > 2) { | 685 | if (channels > 2) { |
689 | if (! cm->can_multi_ch) | 686 | if (! cm->can_multi_ch) |
@@ -737,11 +734,11 @@ static int set_dac_channels(cmipci_t *cm, cmipci_pcm_t *rec, int channels) | |||
737 | * prepare playback/capture channel | 734 | * prepare playback/capture channel |
738 | * channel to be used must have been set in rec->ch. | 735 | * channel to be used must have been set in rec->ch. |
739 | */ | 736 | */ |
740 | static int snd_cmipci_pcm_prepare(cmipci_t *cm, cmipci_pcm_t *rec, | 737 | static int snd_cmipci_pcm_prepare(struct cmipci *cm, struct cmipci_pcm *rec, |
741 | snd_pcm_substream_t *substream) | 738 | struct snd_pcm_substream *substream) |
742 | { | 739 | { |
743 | unsigned int reg, freq, val; | 740 | unsigned int reg, freq, val; |
744 | snd_pcm_runtime_t *runtime = substream->runtime; | 741 | struct snd_pcm_runtime *runtime = substream->runtime; |
745 | 742 | ||
746 | rec->fmt = 0; | 743 | rec->fmt = 0; |
747 | rec->shift = 0; | 744 | rec->shift = 0; |
@@ -820,8 +817,8 @@ static int snd_cmipci_pcm_prepare(cmipci_t *cm, cmipci_pcm_t *rec, | |||
820 | /* | 817 | /* |
821 | * PCM trigger/stop | 818 | * PCM trigger/stop |
822 | */ | 819 | */ |
823 | static int snd_cmipci_pcm_trigger(cmipci_t *cm, cmipci_pcm_t *rec, | 820 | static int snd_cmipci_pcm_trigger(struct cmipci *cm, struct cmipci_pcm *rec, |
824 | snd_pcm_substream_t *substream, int cmd) | 821 | struct snd_pcm_substream *substream, int cmd) |
825 | { | 822 | { |
826 | unsigned int inthld, chen, reset, pause; | 823 | unsigned int inthld, chen, reset, pause; |
827 | int result = 0; | 824 | int result = 0; |
@@ -870,8 +867,8 @@ static int snd_cmipci_pcm_trigger(cmipci_t *cm, cmipci_pcm_t *rec, | |||
870 | /* | 867 | /* |
871 | * return the current pointer | 868 | * return the current pointer |
872 | */ | 869 | */ |
873 | static snd_pcm_uframes_t snd_cmipci_pcm_pointer(cmipci_t *cm, cmipci_pcm_t *rec, | 870 | static snd_pcm_uframes_t snd_cmipci_pcm_pointer(struct cmipci *cm, struct cmipci_pcm *rec, |
874 | snd_pcm_substream_t *substream) | 871 | struct snd_pcm_substream *substream) |
875 | { | 872 | { |
876 | size_t ptr; | 873 | size_t ptr; |
877 | unsigned int reg; | 874 | unsigned int reg; |
@@ -895,16 +892,16 @@ static snd_pcm_uframes_t snd_cmipci_pcm_pointer(cmipci_t *cm, cmipci_pcm_t *rec, | |||
895 | * playback | 892 | * playback |
896 | */ | 893 | */ |
897 | 894 | ||
898 | static int snd_cmipci_playback_trigger(snd_pcm_substream_t *substream, | 895 | static int snd_cmipci_playback_trigger(struct snd_pcm_substream *substream, |
899 | int cmd) | 896 | int cmd) |
900 | { | 897 | { |
901 | cmipci_t *cm = snd_pcm_substream_chip(substream); | 898 | struct cmipci *cm = snd_pcm_substream_chip(substream); |
902 | return snd_cmipci_pcm_trigger(cm, &cm->channel[CM_CH_PLAY], substream, cmd); | 899 | return snd_cmipci_pcm_trigger(cm, &cm->channel[CM_CH_PLAY], substream, cmd); |
903 | } | 900 | } |
904 | 901 | ||
905 | static snd_pcm_uframes_t snd_cmipci_playback_pointer(snd_pcm_substream_t *substream) | 902 | static snd_pcm_uframes_t snd_cmipci_playback_pointer(struct snd_pcm_substream *substream) |
906 | { | 903 | { |
907 | cmipci_t *cm = snd_pcm_substream_chip(substream); | 904 | struct cmipci *cm = snd_pcm_substream_chip(substream); |
908 | return snd_cmipci_pcm_pointer(cm, &cm->channel[CM_CH_PLAY], substream); | 905 | return snd_cmipci_pcm_pointer(cm, &cm->channel[CM_CH_PLAY], substream); |
909 | } | 906 | } |
910 | 907 | ||
@@ -914,16 +911,16 @@ static snd_pcm_uframes_t snd_cmipci_playback_pointer(snd_pcm_substream_t *substr | |||
914 | * capture | 911 | * capture |
915 | */ | 912 | */ |
916 | 913 | ||
917 | static int snd_cmipci_capture_trigger(snd_pcm_substream_t *substream, | 914 | static int snd_cmipci_capture_trigger(struct snd_pcm_substream *substream, |
918 | int cmd) | 915 | int cmd) |
919 | { | 916 | { |
920 | cmipci_t *cm = snd_pcm_substream_chip(substream); | 917 | struct cmipci *cm = snd_pcm_substream_chip(substream); |
921 | return snd_cmipci_pcm_trigger(cm, &cm->channel[CM_CH_CAPT], substream, cmd); | 918 | return snd_cmipci_pcm_trigger(cm, &cm->channel[CM_CH_CAPT], substream, cmd); |
922 | } | 919 | } |
923 | 920 | ||
924 | static snd_pcm_uframes_t snd_cmipci_capture_pointer(snd_pcm_substream_t *substream) | 921 | static snd_pcm_uframes_t snd_cmipci_capture_pointer(struct snd_pcm_substream *substream) |
925 | { | 922 | { |
926 | cmipci_t *cm = snd_pcm_substream_chip(substream); | 923 | struct cmipci *cm = snd_pcm_substream_chip(substream); |
927 | return snd_cmipci_pcm_pointer(cm, &cm->channel[CM_CH_CAPT], substream); | 924 | return snd_cmipci_pcm_pointer(cm, &cm->channel[CM_CH_CAPT], substream); |
928 | } | 925 | } |
929 | 926 | ||
@@ -932,18 +929,18 @@ static snd_pcm_uframes_t snd_cmipci_capture_pointer(snd_pcm_substream_t *substre | |||
932 | * hw preparation for spdif | 929 | * hw preparation for spdif |
933 | */ | 930 | */ |
934 | 931 | ||
935 | static int snd_cmipci_spdif_default_info(snd_kcontrol_t *kcontrol, | 932 | static int snd_cmipci_spdif_default_info(struct snd_kcontrol *kcontrol, |
936 | snd_ctl_elem_info_t *uinfo) | 933 | struct snd_ctl_elem_info *uinfo) |
937 | { | 934 | { |
938 | uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; | 935 | uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; |
939 | uinfo->count = 1; | 936 | uinfo->count = 1; |
940 | return 0; | 937 | return 0; |
941 | } | 938 | } |
942 | 939 | ||
943 | static int snd_cmipci_spdif_default_get(snd_kcontrol_t *kcontrol, | 940 | static int snd_cmipci_spdif_default_get(struct snd_kcontrol *kcontrol, |
944 | snd_ctl_elem_value_t *ucontrol) | 941 | struct snd_ctl_elem_value *ucontrol) |
945 | { | 942 | { |
946 | cmipci_t *chip = snd_kcontrol_chip(kcontrol); | 943 | struct cmipci *chip = snd_kcontrol_chip(kcontrol); |
947 | int i; | 944 | int i; |
948 | 945 | ||
949 | spin_lock_irq(&chip->reg_lock); | 946 | spin_lock_irq(&chip->reg_lock); |
@@ -953,10 +950,10 @@ static int snd_cmipci_spdif_default_get(snd_kcontrol_t *kcontrol, | |||
953 | return 0; | 950 | return 0; |
954 | } | 951 | } |
955 | 952 | ||
956 | static int snd_cmipci_spdif_default_put(snd_kcontrol_t * kcontrol, | 953 | static int snd_cmipci_spdif_default_put(struct snd_kcontrol *kcontrol, |
957 | snd_ctl_elem_value_t * ucontrol) | 954 | struct snd_ctl_elem_value *ucontrol) |
958 | { | 955 | { |
959 | cmipci_t *chip = snd_kcontrol_chip(kcontrol); | 956 | struct cmipci *chip = snd_kcontrol_chip(kcontrol); |
960 | int i, change; | 957 | int i, change; |
961 | unsigned int val; | 958 | unsigned int val; |
962 | 959 | ||
@@ -970,7 +967,7 @@ static int snd_cmipci_spdif_default_put(snd_kcontrol_t * kcontrol, | |||
970 | return change; | 967 | return change; |
971 | } | 968 | } |
972 | 969 | ||
973 | static snd_kcontrol_new_t snd_cmipci_spdif_default __devinitdata = | 970 | static struct snd_kcontrol_new snd_cmipci_spdif_default __devinitdata = |
974 | { | 971 | { |
975 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 972 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
976 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), | 973 | .name = SNDRV_CTL_NAME_IEC958("",PLAYBACK,DEFAULT), |
@@ -979,16 +976,16 @@ static snd_kcontrol_new_t snd_cmipci_spdif_default __devinitdata = | |||
979 | .put = snd_cmipci_spdif_default_put | 976 | .put = snd_cmipci_spdif_default_put |
980 | }; | 977 | }; |
981 | 978 | ||
982 | static int snd_cmipci_spdif_mask_info(snd_kcontrol_t *kcontrol, | 979 | static int snd_cmipci_spdif_mask_info(struct snd_kcontrol *kcontrol, |
983 | snd_ctl_elem_info_t *uinfo) | 980 | struct snd_ctl_elem_info *uinfo) |
984 | { | 981 | { |
985 | uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; | 982 | uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; |
986 | uinfo->count = 1; | 983 | uinfo->count = 1; |
987 | return 0; | 984 | return 0; |
988 | } | 985 | } |
989 | 986 | ||
990 | static int snd_cmipci_spdif_mask_get(snd_kcontrol_t * kcontrol, | 987 | static int snd_cmipci_spdif_mask_get(struct snd_kcontrol *kcontrol, |
991 | snd_ctl_elem_value_t *ucontrol) | 988 | struct snd_ctl_elem_value *ucontrol) |
992 | { | 989 | { |
993 | ucontrol->value.iec958.status[0] = 0xff; | 990 | ucontrol->value.iec958.status[0] = 0xff; |
994 | ucontrol->value.iec958.status[1] = 0xff; | 991 | ucontrol->value.iec958.status[1] = 0xff; |
@@ -997,7 +994,7 @@ static int snd_cmipci_spdif_mask_get(snd_kcontrol_t * kcontrol, | |||
997 | return 0; | 994 | return 0; |
998 | } | 995 | } |
999 | 996 | ||
1000 | static snd_kcontrol_new_t snd_cmipci_spdif_mask __devinitdata = | 997 | static struct snd_kcontrol_new snd_cmipci_spdif_mask __devinitdata = |
1001 | { | 998 | { |
1002 | .access = SNDRV_CTL_ELEM_ACCESS_READ, | 999 | .access = SNDRV_CTL_ELEM_ACCESS_READ, |
1003 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 1000 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
@@ -1006,18 +1003,18 @@ static snd_kcontrol_new_t snd_cmipci_spdif_mask __devinitdata = | |||
1006 | .get = snd_cmipci_spdif_mask_get, | 1003 | .get = snd_cmipci_spdif_mask_get, |
1007 | }; | 1004 | }; |
1008 | 1005 | ||
1009 | static int snd_cmipci_spdif_stream_info(snd_kcontrol_t *kcontrol, | 1006 | static int snd_cmipci_spdif_stream_info(struct snd_kcontrol *kcontrol, |
1010 | snd_ctl_elem_info_t *uinfo) | 1007 | struct snd_ctl_elem_info *uinfo) |
1011 | { | 1008 | { |
1012 | uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; | 1009 | uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; |
1013 | uinfo->count = 1; | 1010 | uinfo->count = 1; |
1014 | return 0; | 1011 | return 0; |
1015 | } | 1012 | } |
1016 | 1013 | ||
1017 | static int snd_cmipci_spdif_stream_get(snd_kcontrol_t *kcontrol, | 1014 | static int snd_cmipci_spdif_stream_get(struct snd_kcontrol *kcontrol, |
1018 | snd_ctl_elem_value_t *ucontrol) | 1015 | struct snd_ctl_elem_value *ucontrol) |
1019 | { | 1016 | { |
1020 | cmipci_t *chip = snd_kcontrol_chip(kcontrol); | 1017 | struct cmipci *chip = snd_kcontrol_chip(kcontrol); |
1021 | int i; | 1018 | int i; |
1022 | 1019 | ||
1023 | spin_lock_irq(&chip->reg_lock); | 1020 | spin_lock_irq(&chip->reg_lock); |
@@ -1027,10 +1024,10 @@ static int snd_cmipci_spdif_stream_get(snd_kcontrol_t *kcontrol, | |||
1027 | return 0; | 1024 | return 0; |
1028 | } | 1025 | } |
1029 | 1026 | ||
1030 | static int snd_cmipci_spdif_stream_put(snd_kcontrol_t *kcontrol, | 1027 | static int snd_cmipci_spdif_stream_put(struct snd_kcontrol *kcontrol, |
1031 | snd_ctl_elem_value_t *ucontrol) | 1028 | struct snd_ctl_elem_value *ucontrol) |
1032 | { | 1029 | { |
1033 | cmipci_t *chip = snd_kcontrol_chip(kcontrol); | 1030 | struct cmipci *chip = snd_kcontrol_chip(kcontrol); |
1034 | int i, change; | 1031 | int i, change; |
1035 | unsigned int val; | 1032 | unsigned int val; |
1036 | 1033 | ||
@@ -1044,7 +1041,7 @@ static int snd_cmipci_spdif_stream_put(snd_kcontrol_t *kcontrol, | |||
1044 | return change; | 1041 | return change; |
1045 | } | 1042 | } |
1046 | 1043 | ||
1047 | static snd_kcontrol_new_t snd_cmipci_spdif_stream __devinitdata = | 1044 | static struct snd_kcontrol_new snd_cmipci_spdif_stream __devinitdata = |
1048 | { | 1045 | { |
1049 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE, | 1046 | .access = SNDRV_CTL_ELEM_ACCESS_READWRITE | SNDRV_CTL_ELEM_ACCESS_INACTIVE, |
1050 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, | 1047 | .iface = SNDRV_CTL_ELEM_IFACE_PCM, |
@@ -1058,17 +1055,17 @@ static snd_kcontrol_new_t snd_cmipci_spdif_stream __devinitdata = | |||
1058 | */ | 1055 | */ |
1059 | 1056 | ||
1060 | /* save mixer setting and mute for AC3 playback */ | 1057 | /* save mixer setting and mute for AC3 playback */ |
1061 | static int save_mixer_state(cmipci_t *cm) | 1058 | static int save_mixer_state(struct cmipci *cm) |
1062 | { | 1059 | { |
1063 | if (! cm->mixer_insensitive) { | 1060 | if (! cm->mixer_insensitive) { |
1064 | snd_ctl_elem_value_t *val; | 1061 | struct snd_ctl_elem_value *val; |
1065 | unsigned int i; | 1062 | unsigned int i; |
1066 | 1063 | ||
1067 | val = kmalloc(sizeof(*val), GFP_ATOMIC); | 1064 | val = kmalloc(sizeof(*val), GFP_ATOMIC); |
1068 | if (!val) | 1065 | if (!val) |
1069 | return -ENOMEM; | 1066 | return -ENOMEM; |
1070 | for (i = 0; i < CM_SAVED_MIXERS; i++) { | 1067 | for (i = 0; i < CM_SAVED_MIXERS; i++) { |
1071 | snd_kcontrol_t *ctl = cm->mixer_res_ctl[i]; | 1068 | struct snd_kcontrol *ctl = cm->mixer_res_ctl[i]; |
1072 | if (ctl) { | 1069 | if (ctl) { |
1073 | int event; | 1070 | int event; |
1074 | memset(val, 0, sizeof(*val)); | 1071 | memset(val, 0, sizeof(*val)); |
@@ -1092,10 +1089,10 @@ static int save_mixer_state(cmipci_t *cm) | |||
1092 | 1089 | ||
1093 | 1090 | ||
1094 | /* restore the previously saved mixer status */ | 1091 | /* restore the previously saved mixer status */ |
1095 | static void restore_mixer_state(cmipci_t *cm) | 1092 | static void restore_mixer_state(struct cmipci *cm) |
1096 | { | 1093 | { |
1097 | if (cm->mixer_insensitive) { | 1094 | if (cm->mixer_insensitive) { |
1098 | snd_ctl_elem_value_t *val; | 1095 | struct snd_ctl_elem_value *val; |
1099 | unsigned int i; | 1096 | unsigned int i; |
1100 | 1097 | ||
1101 | val = kmalloc(sizeof(*val), GFP_KERNEL); | 1098 | val = kmalloc(sizeof(*val), GFP_KERNEL); |
@@ -1104,7 +1101,7 @@ static void restore_mixer_state(cmipci_t *cm) | |||
1104 | cm->mixer_insensitive = 0; /* at first clear this; | 1101 | cm->mixer_insensitive = 0; /* at first clear this; |
1105 | otherwise the changes will be ignored */ | 1102 | otherwise the changes will be ignored */ |
1106 | for (i = 0; i < CM_SAVED_MIXERS; i++) { | 1103 | for (i = 0; i < CM_SAVED_MIXERS; i++) { |
1107 | snd_kcontrol_t *ctl = cm->mixer_res_ctl[i]; | 1104 | struct snd_kcontrol *ctl = cm->mixer_res_ctl[i]; |
1108 | if (ctl) { | 1105 | if (ctl) { |
1109 | int event; | 1106 | int event; |
1110 | 1107 | ||
@@ -1125,7 +1122,7 @@ static void restore_mixer_state(cmipci_t *cm) | |||
1125 | } | 1122 | } |
1126 | 1123 | ||
1127 | /* spinlock held! */ | 1124 | /* spinlock held! */ |
1128 | static void setup_ac3(cmipci_t *cm, snd_pcm_substream_t *subs, int do_ac3, int rate) | 1125 | static void setup_ac3(struct cmipci *cm, struct snd_pcm_substream *subs, int do_ac3, int rate) |
1129 | { | 1126 | { |
1130 | if (do_ac3) { | 1127 | if (do_ac3) { |
1131 | /* AC3EN for 037 */ | 1128 | /* AC3EN for 037 */ |
@@ -1172,7 +1169,7 @@ static void setup_ac3(cmipci_t *cm, snd_pcm_substream_t *subs, int do_ac3, int r | |||
1172 | } | 1169 | } |
1173 | } | 1170 | } |
1174 | 1171 | ||
1175 | static int setup_spdif_playback(cmipci_t *cm, snd_pcm_substream_t *subs, int up, int do_ac3) | 1172 | static int setup_spdif_playback(struct cmipci *cm, struct snd_pcm_substream *subs, int up, int do_ac3) |
1176 | { | 1173 | { |
1177 | int rate, err; | 1174 | int rate, err; |
1178 | 1175 | ||
@@ -1214,9 +1211,9 @@ static int setup_spdif_playback(cmipci_t *cm, snd_pcm_substream_t *subs, int up, | |||
1214 | */ | 1211 | */ |
1215 | 1212 | ||
1216 | /* playback - enable spdif only on the certain condition */ | 1213 | /* playback - enable spdif only on the certain condition */ |
1217 | static int snd_cmipci_playback_prepare(snd_pcm_substream_t *substream) | 1214 | static int snd_cmipci_playback_prepare(struct snd_pcm_substream *substream) |
1218 | { | 1215 | { |
1219 | cmipci_t *cm = snd_pcm_substream_chip(substream); | 1216 | struct cmipci *cm = snd_pcm_substream_chip(substream); |
1220 | int rate = substream->runtime->rate; | 1217 | int rate = substream->runtime->rate; |
1221 | int err, do_spdif, do_ac3 = 0; | 1218 | int err, do_spdif, do_ac3 = 0; |
1222 | 1219 | ||
@@ -1231,9 +1228,9 @@ static int snd_cmipci_playback_prepare(snd_pcm_substream_t *substream) | |||
1231 | } | 1228 | } |
1232 | 1229 | ||
1233 | /* playback (via device #2) - enable spdif always */ | 1230 | /* playback (via device #2) - enable spdif always */ |
1234 | static int snd_cmipci_playback_spdif_prepare(snd_pcm_substream_t *substream) | 1231 | static int snd_cmipci_playback_spdif_prepare(struct snd_pcm_substream *substream) |
1235 | { | 1232 | { |
1236 | cmipci_t *cm = snd_pcm_substream_chip(substream); | 1233 | struct cmipci *cm = snd_pcm_substream_chip(substream); |
1237 | int err, do_ac3; | 1234 | int err, do_ac3; |
1238 | 1235 | ||
1239 | if (cm->can_ac3_hw) | 1236 | if (cm->can_ac3_hw) |
@@ -1245,25 +1242,25 @@ static int snd_cmipci_playback_spdif_prepare(snd_pcm_substream_t *substream) | |||
1245 | return snd_cmipci_pcm_prepare(cm, &cm->channel[CM_CH_PLAY], substream); | 1242 | return snd_cmipci_pcm_prepare(cm, &cm->channel[CM_CH_PLAY], substream); |
1246 | } | 1243 | } |
1247 | 1244 | ||
1248 | static int snd_cmipci_playback_hw_free(snd_pcm_substream_t *substream) | 1245 | static int snd_cmipci_playback_hw_free(struct snd_pcm_substream *substream) |
1249 | { | 1246 | { |
1250 | cmipci_t *cm = snd_pcm_substream_chip(substream); | 1247 | struct cmipci *cm = snd_pcm_substream_chip(substream); |
1251 | setup_spdif_playback(cm, substream, 0, 0); | 1248 | setup_spdif_playback(cm, substream, 0, 0); |
1252 | restore_mixer_state(cm); | 1249 | restore_mixer_state(cm); |
1253 | return snd_cmipci_hw_free(substream); | 1250 | return snd_cmipci_hw_free(substream); |
1254 | } | 1251 | } |
1255 | 1252 | ||
1256 | /* capture */ | 1253 | /* capture */ |
1257 | static int snd_cmipci_capture_prepare(snd_pcm_substream_t *substream) | 1254 | static int snd_cmipci_capture_prepare(struct snd_pcm_substream *substream) |
1258 | { | 1255 | { |
1259 | cmipci_t *cm = snd_pcm_substream_chip(substream); | 1256 | struct cmipci *cm = snd_pcm_substream_chip(substream); |
1260 | return snd_cmipci_pcm_prepare(cm, &cm->channel[CM_CH_CAPT], substream); | 1257 | return snd_cmipci_pcm_prepare(cm, &cm->channel[CM_CH_CAPT], substream); |
1261 | } | 1258 | } |
1262 | 1259 | ||
1263 | /* capture with spdif (via device #2) */ | 1260 | /* capture with spdif (via device #2) */ |
1264 | static int snd_cmipci_capture_spdif_prepare(snd_pcm_substream_t *substream) | 1261 | static int snd_cmipci_capture_spdif_prepare(struct snd_pcm_substream *substream) |
1265 | { | 1262 | { |
1266 | cmipci_t *cm = snd_pcm_substream_chip(substream); | 1263 | struct cmipci *cm = snd_pcm_substream_chip(substream); |
1267 | 1264 | ||
1268 | spin_lock_irq(&cm->reg_lock); | 1265 | spin_lock_irq(&cm->reg_lock); |
1269 | snd_cmipci_set_bit(cm, CM_REG_FUNCTRL1, CM_CAPTURE_SPDF); | 1266 | snd_cmipci_set_bit(cm, CM_REG_FUNCTRL1, CM_CAPTURE_SPDF); |
@@ -1272,9 +1269,9 @@ static int snd_cmipci_capture_spdif_prepare(snd_pcm_substream_t *substream) | |||
1272 | return snd_cmipci_pcm_prepare(cm, &cm->channel[CM_CH_CAPT], substream); | 1269 | return snd_cmipci_pcm_prepare(cm, &cm->channel[CM_CH_CAPT], substream); |
1273 | } | 1270 | } |
1274 | 1271 | ||
1275 | static int snd_cmipci_capture_spdif_hw_free(snd_pcm_substream_t *subs) | 1272 | static int snd_cmipci_capture_spdif_hw_free(struct snd_pcm_substream *subs) |
1276 | { | 1273 | { |
1277 | cmipci_t *cm = snd_pcm_substream_chip(subs); | 1274 | struct cmipci *cm = snd_pcm_substream_chip(subs); |
1278 | 1275 | ||
1279 | spin_lock_irq(&cm->reg_lock); | 1276 | spin_lock_irq(&cm->reg_lock); |
1280 | snd_cmipci_clear_bit(cm, CM_REG_FUNCTRL1, CM_CAPTURE_SPDF); | 1277 | snd_cmipci_clear_bit(cm, CM_REG_FUNCTRL1, CM_CAPTURE_SPDF); |
@@ -1289,7 +1286,7 @@ static int snd_cmipci_capture_spdif_hw_free(snd_pcm_substream_t *subs) | |||
1289 | */ | 1286 | */ |
1290 | static irqreturn_t snd_cmipci_interrupt(int irq, void *dev_id, struct pt_regs *regs) | 1287 | static irqreturn_t snd_cmipci_interrupt(int irq, void *dev_id, struct pt_regs *regs) |
1291 | { | 1288 | { |
1292 | cmipci_t *cm = dev_id; | 1289 | struct cmipci *cm = dev_id; |
1293 | unsigned int status, mask = 0; | 1290 | unsigned int status, mask = 0; |
1294 | 1291 | ||
1295 | /* fastpath out, to ease interrupt sharing */ | 1292 | /* fastpath out, to ease interrupt sharing */ |
@@ -1324,7 +1321,7 @@ static irqreturn_t snd_cmipci_interrupt(int irq, void *dev_id, struct pt_regs *r | |||
1324 | */ | 1321 | */ |
1325 | 1322 | ||
1326 | /* playback on channel A */ | 1323 | /* playback on channel A */ |
1327 | static snd_pcm_hardware_t snd_cmipci_playback = | 1324 | static struct snd_pcm_hardware snd_cmipci_playback = |
1328 | { | 1325 | { |
1329 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1326 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1330 | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE | | 1327 | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE | |
@@ -1344,7 +1341,7 @@ static snd_pcm_hardware_t snd_cmipci_playback = | |||
1344 | }; | 1341 | }; |
1345 | 1342 | ||
1346 | /* capture on channel B */ | 1343 | /* capture on channel B */ |
1347 | static snd_pcm_hardware_t snd_cmipci_capture = | 1344 | static struct snd_pcm_hardware snd_cmipci_capture = |
1348 | { | 1345 | { |
1349 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1346 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1350 | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE | | 1347 | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE | |
@@ -1364,7 +1361,7 @@ static snd_pcm_hardware_t snd_cmipci_capture = | |||
1364 | }; | 1361 | }; |
1365 | 1362 | ||
1366 | /* playback on channel B - stereo 16bit only? */ | 1363 | /* playback on channel B - stereo 16bit only? */ |
1367 | static snd_pcm_hardware_t snd_cmipci_playback2 = | 1364 | static struct snd_pcm_hardware snd_cmipci_playback2 = |
1368 | { | 1365 | { |
1369 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1366 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1370 | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE | | 1367 | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE | |
@@ -1384,7 +1381,7 @@ static snd_pcm_hardware_t snd_cmipci_playback2 = | |||
1384 | }; | 1381 | }; |
1385 | 1382 | ||
1386 | /* spdif playback on channel A */ | 1383 | /* spdif playback on channel A */ |
1387 | static snd_pcm_hardware_t snd_cmipci_playback_spdif = | 1384 | static struct snd_pcm_hardware snd_cmipci_playback_spdif = |
1388 | { | 1385 | { |
1389 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1386 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1390 | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE | | 1387 | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE | |
@@ -1404,7 +1401,7 @@ static snd_pcm_hardware_t snd_cmipci_playback_spdif = | |||
1404 | }; | 1401 | }; |
1405 | 1402 | ||
1406 | /* spdif playback on channel A (32bit, IEC958 subframes) */ | 1403 | /* spdif playback on channel A (32bit, IEC958 subframes) */ |
1407 | static snd_pcm_hardware_t snd_cmipci_playback_iec958_subframe = | 1404 | static struct snd_pcm_hardware snd_cmipci_playback_iec958_subframe = |
1408 | { | 1405 | { |
1409 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1406 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1410 | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE | | 1407 | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE | |
@@ -1424,7 +1421,7 @@ static snd_pcm_hardware_t snd_cmipci_playback_iec958_subframe = | |||
1424 | }; | 1421 | }; |
1425 | 1422 | ||
1426 | /* spdif capture on channel B */ | 1423 | /* spdif capture on channel B */ |
1427 | static snd_pcm_hardware_t snd_cmipci_capture_spdif = | 1424 | static struct snd_pcm_hardware snd_cmipci_capture_spdif = |
1428 | { | 1425 | { |
1429 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | | 1426 | .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | |
1430 | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE | | 1427 | SNDRV_PCM_INFO_BLOCK_TRANSFER | SNDRV_PCM_INFO_PAUSE | |
@@ -1446,7 +1443,7 @@ static snd_pcm_hardware_t snd_cmipci_capture_spdif = | |||
1446 | /* | 1443 | /* |
1447 | * check device open/close | 1444 | * check device open/close |
1448 | */ | 1445 | */ |
1449 | static int open_device_check(cmipci_t *cm, int mode, snd_pcm_substream_t *subs) | 1446 | static int open_device_check(struct cmipci *cm, int mode, struct snd_pcm_substream *subs) |
1450 | { | 1447 | { |
1451 | int ch = mode & CM_OPEN_CH_MASK; | 1448 | int ch = mode & CM_OPEN_CH_MASK; |
1452 | 1449 | ||
@@ -1473,7 +1470,7 @@ static int open_device_check(cmipci_t *cm, int mode, snd_pcm_substream_t *subs) | |||
1473 | return 0; | 1470 | return 0; |
1474 | } | 1471 | } |
1475 | 1472 | ||
1476 | static void close_device_check(cmipci_t *cm, int mode) | 1473 | static void close_device_check(struct cmipci *cm, int mode) |
1477 | { | 1474 | { |
1478 | int ch = mode & CM_OPEN_CH_MASK; | 1475 | int ch = mode & CM_OPEN_CH_MASK; |
1479 | 1476 | ||
@@ -1499,10 +1496,10 @@ static void close_device_check(cmipci_t *cm, int mode) | |||
1499 | /* | 1496 | /* |
1500 | */ | 1497 | */ |
1501 | 1498 | ||
1502 | static int snd_cmipci_playback_open(snd_pcm_substream_t *substream) | 1499 | static int snd_cmipci_playback_open(struct snd_pcm_substream *substream) |
1503 | { | 1500 | { |
1504 | cmipci_t *cm = snd_pcm_substream_chip(substream); | 1501 | struct cmipci *cm = snd_pcm_substream_chip(substream); |
1505 | snd_pcm_runtime_t *runtime = substream->runtime; | 1502 | struct snd_pcm_runtime *runtime = substream->runtime; |
1506 | int err; | 1503 | int err; |
1507 | 1504 | ||
1508 | if ((err = open_device_check(cm, CM_OPEN_PLAYBACK, substream)) < 0) | 1505 | if ((err = open_device_check(cm, CM_OPEN_PLAYBACK, substream)) < 0) |
@@ -1514,10 +1511,10 @@ static int snd_cmipci_playback_open(snd_pcm_substream_t *substream) | |||
1514 | return 0; | 1511 | return 0; |
1515 | } | 1512 | } |
1516 | 1513 | ||
1517 | static int snd_cmipci_capture_open(snd_pcm_substream_t *substream) | 1514 | static int snd_cmipci_capture_open(struct snd_pcm_substream *substream) |
1518 | { | 1515 | { |
1519 | cmipci_t *cm = snd_pcm_substream_chip(substream); | 1516 | struct cmipci *cm = snd_pcm_substream_chip(substream); |
1520 | snd_pcm_runtime_t *runtime = substream->runtime; | 1517 | struct snd_pcm_runtime *runtime = substream->runtime; |
1521 | int err; | 1518 | int err; |
1522 | 1519 | ||
1523 | if ((err = open_device_check(cm, CM_OPEN_CAPTURE, substream)) < 0) | 1520 | if ((err = open_device_check(cm, CM_OPEN_CAPTURE, substream)) < 0) |
@@ -1531,10 +1528,10 @@ static int snd_cmipci_capture_open(snd_pcm_substream_t *substream) | |||
1531 | return 0; | 1528 | return 0; |
1532 | } | 1529 | } |
1533 | 1530 | ||
1534 | static int snd_cmipci_playback2_open(snd_pcm_substream_t *substream) | 1531 | static int snd_cmipci_playback2_open(struct snd_pcm_substream *substream) |
1535 | { | 1532 | { |
1536 | cmipci_t *cm = snd_pcm_substream_chip(substream); | 1533 | struct cmipci *cm = snd_pcm_substream_chip(substream); |
1537 | snd_pcm_runtime_t *runtime = substream->runtime; | 1534 | struct snd_pcm_runtime *runtime = substream->runtime; |
1538 | int err; | 1535 | int err; |
1539 | 1536 | ||
1540 | if ((err = open_device_check(cm, CM_OPEN_PLAYBACK2, substream)) < 0) /* use channel B */ | 1537 | if ((err = open_device_check(cm, CM_OPEN_PLAYBACK2, substream)) < 0) /* use channel B */ |
@@ -1557,10 +1554,10 @@ static int snd_cmipci_playback2_open(snd_pcm_substream_t *substream) | |||
1557 | return 0; | 1554 | return 0; |
1558 | } | 1555 | } |
1559 | 1556 | ||
1560 | static int snd_cmipci_playback_spdif_open(snd_pcm_substream_t *substream) | 1557 | static int snd_cmipci_playback_spdif_open(struct snd_pcm_substream *substream) |
1561 | { | 1558 | { |
1562 | cmipci_t *cm = snd_pcm_substream_chip(substream); | 1559 | struct cmipci *cm = snd_pcm_substream_chip(substream); |
1563 | snd_pcm_runtime_t *runtime = substream->runtime; | 1560 | struct snd_pcm_runtime *runtime = substream->runtime; |
1564 | int err; | 1561 | int err; |
1565 | 1562 | ||
1566 | if ((err = open_device_check(cm, CM_OPEN_SPDIF_PLAYBACK, substream)) < 0) /* use channel A */ | 1563 | if ((err = open_device_check(cm, CM_OPEN_SPDIF_PLAYBACK, substream)) < 0) /* use channel A */ |
@@ -1577,10 +1574,10 @@ static int snd_cmipci_playback_spdif_open(snd_pcm_substream_t *substream) | |||
1577 | return 0; | 1574 | return 0; |
1578 | } | 1575 | } |
1579 | 1576 | ||
1580 | static int snd_cmipci_capture_spdif_open(snd_pcm_substream_t * substream) | 1577 | static int snd_cmipci_capture_spdif_open(struct snd_pcm_substream *substream) |
1581 | { | 1578 | { |
1582 | cmipci_t *cm = snd_pcm_substream_chip(substream); | 1579 | struct cmipci *cm = snd_pcm_substream_chip(substream); |
1583 | snd_pcm_runtime_t *runtime = substream->runtime; | 1580 | struct snd_pcm_runtime *runtime = substream->runtime; |
1584 | int err; | 1581 | int err; |
1585 | 1582 | ||
1586 | if ((err = open_device_check(cm, CM_OPEN_SPDIF_CAPTURE, substream)) < 0) /* use channel B */ | 1583 | if ((err = open_device_check(cm, CM_OPEN_SPDIF_CAPTURE, substream)) < 0) /* use channel B */ |
@@ -1594,38 +1591,38 @@ static int snd_cmipci_capture_spdif_open(snd_pcm_substream_t * substream) | |||
1594 | /* | 1591 | /* |
1595 | */ | 1592 | */ |
1596 | 1593 | ||
1597 | static int snd_cmipci_playback_close(snd_pcm_substream_t * substream) | 1594 | static int snd_cmipci_playback_close(struct snd_pcm_substream *substream) |
1598 | { | 1595 | { |
1599 | cmipci_t *cm = snd_pcm_substream_chip(substream); | 1596 | struct cmipci *cm = snd_pcm_substream_chip(substream); |
1600 | close_device_check(cm, CM_OPEN_PLAYBACK); | 1597 | close_device_check(cm, CM_OPEN_PLAYBACK); |
1601 | return 0; | 1598 | return 0; |
1602 | } | 1599 | } |
1603 | 1600 | ||
1604 | static int snd_cmipci_capture_close(snd_pcm_substream_t * substream) | 1601 | static int snd_cmipci_capture_close(struct snd_pcm_substream *substream) |
1605 | { | 1602 | { |
1606 | cmipci_t *cm = snd_pcm_substream_chip(substream); | 1603 | struct cmipci *cm = snd_pcm_substream_chip(substream); |
1607 | close_device_check(cm, CM_OPEN_CAPTURE); | 1604 | close_device_check(cm, CM_OPEN_CAPTURE); |
1608 | return 0; | 1605 | return 0; |
1609 | } | 1606 | } |
1610 | 1607 | ||
1611 | static int snd_cmipci_playback2_close(snd_pcm_substream_t * substream) | 1608 | static int snd_cmipci_playback2_close(struct snd_pcm_substream *substream) |
1612 | { | 1609 | { |
1613 | cmipci_t *cm = snd_pcm_substream_chip(substream); | 1610 | struct cmipci *cm = snd_pcm_substream_chip(substream); |
1614 | close_device_check(cm, CM_OPEN_PLAYBACK2); | 1611 | close_device_check(cm, CM_OPEN_PLAYBACK2); |
1615 | close_device_check(cm, CM_OPEN_PLAYBACK_MULTI); | 1612 | close_device_check(cm, CM_OPEN_PLAYBACK_MULTI); |
1616 | return 0; | 1613 | return 0; |
1617 | } | 1614 | } |
1618 | 1615 | ||
1619 | static int snd_cmipci_playback_spdif_close(snd_pcm_substream_t * substream) | 1616 | static int snd_cmipci_playback_spdif_close(struct snd_pcm_substream *substream) |
1620 | { | 1617 | { |
1621 | cmipci_t *cm = snd_pcm_substream_chip(substream); | 1618 | struct cmipci *cm = snd_pcm_substream_chip(substream); |
1622 | close_device_check(cm, CM_OPEN_SPDIF_PLAYBACK); | 1619 | close_device_check(cm, CM_OPEN_SPDIF_PLAYBACK); |
1623 | return 0; | 1620 | return 0; |
1624 | } | 1621 | } |
1625 | 1622 | ||
1626 | static int snd_cmipci_capture_spdif_close(snd_pcm_substream_t * substream) | 1623 | static int snd_cmipci_capture_spdif_close(struct snd_pcm_substream *substream) |
1627 | { | 1624 | { |
1628 | cmipci_t *cm = snd_pcm_substream_chip(substream); | 1625 | struct cmipci *cm = snd_pcm_substream_chip(substream); |
1629 | close_device_check(cm, CM_OPEN_SPDIF_CAPTURE); | 1626 | close_device_check(cm, CM_OPEN_SPDIF_CAPTURE); |
1630 | return 0; | 1627 | return 0; |
1631 | } | 1628 | } |
@@ -1634,7 +1631,7 @@ static int snd_cmipci_capture_spdif_close(snd_pcm_substream_t * substream) | |||
1634 | /* | 1631 | /* |
1635 | */ | 1632 | */ |
1636 | 1633 | ||
1637 | static snd_pcm_ops_t snd_cmipci_playback_ops = { | 1634 | static struct snd_pcm_ops snd_cmipci_playback_ops = { |
1638 | .open = snd_cmipci_playback_open, | 1635 | .open = snd_cmipci_playback_open, |
1639 | .close = snd_cmipci_playback_close, | 1636 | .close = snd_cmipci_playback_close, |
1640 | .ioctl = snd_pcm_lib_ioctl, | 1637 | .ioctl = snd_pcm_lib_ioctl, |
@@ -1645,7 +1642,7 @@ static snd_pcm_ops_t snd_cmipci_playback_ops = { | |||
1645 | .pointer = snd_cmipci_playback_pointer, | 1642 | .pointer = snd_cmipci_playback_pointer, |
1646 | }; | 1643 | }; |
1647 | 1644 | ||
1648 | static snd_pcm_ops_t snd_cmipci_capture_ops = { | 1645 | static struct snd_pcm_ops snd_cmipci_capture_ops = { |
1649 | .open = snd_cmipci_capture_open, | 1646 | .open = snd_cmipci_capture_open, |
1650 | .close = snd_cmipci_capture_close, | 1647 | .close = snd_cmipci_capture_close, |
1651 | .ioctl = snd_pcm_lib_ioctl, | 1648 | .ioctl = snd_pcm_lib_ioctl, |
@@ -1656,7 +1653,7 @@ static snd_pcm_ops_t snd_cmipci_capture_ops = { | |||
1656 | .pointer = snd_cmipci_capture_pointer, | 1653 | .pointer = snd_cmipci_capture_pointer, |
1657 | }; | 1654 | }; |
1658 | 1655 | ||
1659 | static snd_pcm_ops_t snd_cmipci_playback2_ops = { | 1656 | static struct snd_pcm_ops snd_cmipci_playback2_ops = { |
1660 | .open = snd_cmipci_playback2_open, | 1657 | .open = snd_cmipci_playback2_open, |
1661 | .close = snd_cmipci_playback2_close, | 1658 | .close = snd_cmipci_playback2_close, |
1662 | .ioctl = snd_pcm_lib_ioctl, | 1659 | .ioctl = snd_pcm_lib_ioctl, |
@@ -1667,7 +1664,7 @@ static snd_pcm_ops_t snd_cmipci_playback2_ops = { | |||
1667 | .pointer = snd_cmipci_capture_pointer, /* channel B */ | 1664 | .pointer = snd_cmipci_capture_pointer, /* channel B */ |
1668 | }; | 1665 | }; |
1669 | 1666 | ||
1670 | static snd_pcm_ops_t snd_cmipci_playback_spdif_ops = { | 1667 | static struct snd_pcm_ops snd_cmipci_playback_spdif_ops = { |
1671 | .open = snd_cmipci_playback_spdif_open, | 1668 | .open = snd_cmipci_playback_spdif_open, |
1672 | .close = snd_cmipci_playback_spdif_close, | 1669 | .close = snd_cmipci_playback_spdif_close, |
1673 | .ioctl = snd_pcm_lib_ioctl, | 1670 | .ioctl = snd_pcm_lib_ioctl, |
@@ -1678,7 +1675,7 @@ static snd_pcm_ops_t snd_cmipci_playback_spdif_ops = { | |||
1678 | .pointer = snd_cmipci_playback_pointer, | 1675 | .pointer = snd_cmipci_playback_pointer, |
1679 | }; | 1676 | }; |
1680 | 1677 | ||
1681 | static snd_pcm_ops_t snd_cmipci_capture_spdif_ops = { | 1678 | static struct snd_pcm_ops snd_cmipci_capture_spdif_ops = { |
1682 | .open = snd_cmipci_capture_spdif_open, | 1679 | .open = snd_cmipci_capture_spdif_open, |
1683 | .close = snd_cmipci_capture_spdif_close, | 1680 | .close = snd_cmipci_capture_spdif_close, |
1684 | .ioctl = snd_pcm_lib_ioctl, | 1681 | .ioctl = snd_pcm_lib_ioctl, |
@@ -1693,9 +1690,9 @@ static snd_pcm_ops_t snd_cmipci_capture_spdif_ops = { | |||
1693 | /* | 1690 | /* |
1694 | */ | 1691 | */ |
1695 | 1692 | ||
1696 | static int __devinit snd_cmipci_pcm_new(cmipci_t *cm, int device) | 1693 | static int __devinit snd_cmipci_pcm_new(struct cmipci *cm, int device) |
1697 | { | 1694 | { |
1698 | snd_pcm_t *pcm; | 1695 | struct snd_pcm *pcm; |
1699 | int err; | 1696 | int err; |
1700 | 1697 | ||
1701 | err = snd_pcm_new(cm->card, cm->card->driver, device, 1, 1, &pcm); | 1698 | err = snd_pcm_new(cm->card, cm->card->driver, device, 1, 1, &pcm); |
@@ -1716,9 +1713,9 @@ static int __devinit snd_cmipci_pcm_new(cmipci_t *cm, int device) | |||
1716 | return 0; | 1713 | return 0; |
1717 | } | 1714 | } |
1718 | 1715 | ||
1719 | static int __devinit snd_cmipci_pcm2_new(cmipci_t *cm, int device) | 1716 | static int __devinit snd_cmipci_pcm2_new(struct cmipci *cm, int device) |
1720 | { | 1717 | { |
1721 | snd_pcm_t *pcm; | 1718 | struct snd_pcm *pcm; |
1722 | int err; | 1719 | int err; |
1723 | 1720 | ||
1724 | err = snd_pcm_new(cm->card, cm->card->driver, device, 1, 0, &pcm); | 1721 | err = snd_pcm_new(cm->card, cm->card->driver, device, 1, 0, &pcm); |
@@ -1738,9 +1735,9 @@ static int __devinit snd_cmipci_pcm2_new(cmipci_t *cm, int device) | |||
1738 | return 0; | 1735 | return 0; |
1739 | } | 1736 | } |
1740 | 1737 | ||
1741 | static int __devinit snd_cmipci_pcm_spdif_new(cmipci_t *cm, int device) | 1738 | static int __devinit snd_cmipci_pcm_spdif_new(struct cmipci *cm, int device) |
1742 | { | 1739 | { |
1743 | snd_pcm_t *pcm; | 1740 | struct snd_pcm *pcm; |
1744 | int err; | 1741 | int err; |
1745 | 1742 | ||
1746 | err = snd_pcm_new(cm->card, cm->card->driver, device, 1, 1, &pcm); | 1743 | err = snd_pcm_new(cm->card, cm->card->driver, device, 1, 1, &pcm); |
@@ -1770,13 +1767,13 @@ static int __devinit snd_cmipci_pcm_spdif_new(cmipci_t *cm, int device) | |||
1770 | * - Output mute switches | 1767 | * - Output mute switches |
1771 | */ | 1768 | */ |
1772 | 1769 | ||
1773 | static void snd_cmipci_mixer_write(cmipci_t *s, unsigned char idx, unsigned char data) | 1770 | static void snd_cmipci_mixer_write(struct cmipci *s, unsigned char idx, unsigned char data) |
1774 | { | 1771 | { |
1775 | outb(idx, s->iobase + CM_REG_SB16_ADDR); | 1772 | outb(idx, s->iobase + CM_REG_SB16_ADDR); |
1776 | outb(data, s->iobase + CM_REG_SB16_DATA); | 1773 | outb(data, s->iobase + CM_REG_SB16_DATA); |
1777 | } | 1774 | } |
1778 | 1775 | ||
1779 | static unsigned char snd_cmipci_mixer_read(cmipci_t *s, unsigned char idx) | 1776 | static unsigned char snd_cmipci_mixer_read(struct cmipci *s, unsigned char idx) |
1780 | { | 1777 | { |
1781 | unsigned char v; | 1778 | unsigned char v; |
1782 | 1779 | ||
@@ -1788,13 +1785,13 @@ static unsigned char snd_cmipci_mixer_read(cmipci_t *s, unsigned char idx) | |||
1788 | /* | 1785 | /* |
1789 | * general mixer element | 1786 | * general mixer element |
1790 | */ | 1787 | */ |
1791 | typedef struct cmipci_sb_reg { | 1788 | struct cmipci_sb_reg { |
1792 | unsigned int left_reg, right_reg; | 1789 | unsigned int left_reg, right_reg; |
1793 | unsigned int left_shift, right_shift; | 1790 | unsigned int left_shift, right_shift; |
1794 | unsigned int mask; | 1791 | unsigned int mask; |
1795 | unsigned int invert: 1; | 1792 | unsigned int invert: 1; |
1796 | unsigned int stereo: 1; | 1793 | unsigned int stereo: 1; |
1797 | } cmipci_sb_reg_t; | 1794 | }; |
1798 | 1795 | ||
1799 | #define COMPOSE_SB_REG(lreg,rreg,lshift,rshift,mask,invert,stereo) \ | 1796 | #define COMPOSE_SB_REG(lreg,rreg,lshift,rshift,mask,invert,stereo) \ |
1800 | ((lreg) | ((rreg) << 8) | (lshift << 16) | (rshift << 19) | (mask << 24) | (invert << 22) | (stereo << 23)) | 1797 | ((lreg) | ((rreg) << 8) | (lshift << 16) | (rshift << 19) | (mask << 24) | (invert << 22) | (stereo << 23)) |
@@ -1811,7 +1808,7 @@ typedef struct cmipci_sb_reg { | |||
1811 | #define CMIPCI_SB_SW_STEREO(xname,lshift,rshift) CMIPCI_DOUBLE(xname, SB_DSP4_OUTPUT_SW, SB_DSP4_OUTPUT_SW, lshift, rshift, 1, 0, 1) | 1808 | #define CMIPCI_SB_SW_STEREO(xname,lshift,rshift) CMIPCI_DOUBLE(xname, SB_DSP4_OUTPUT_SW, SB_DSP4_OUTPUT_SW, lshift, rshift, 1, 0, 1) |
1812 | #define CMIPCI_SB_SW_MONO(xname,shift) CMIPCI_DOUBLE(xname, SB_DSP4_OUTPUT_SW, SB_DSP4_OUTPUT_SW, shift, shift, 1, 0, 0) | 1809 | #define CMIPCI_SB_SW_MONO(xname,shift) CMIPCI_DOUBLE(xname, SB_DSP4_OUTPUT_SW, SB_DSP4_OUTPUT_SW, shift, shift, 1, 0, 0) |
1813 | 1810 | ||
1814 | static void cmipci_sb_reg_decode(cmipci_sb_reg_t *r, unsigned long val) | 1811 | static void cmipci_sb_reg_decode(struct cmipci_sb_reg *r, unsigned long val) |
1815 | { | 1812 | { |
1816 | r->left_reg = val & 0xff; | 1813 | r->left_reg = val & 0xff; |
1817 | r->right_reg = (val >> 8) & 0xff; | 1814 | r->right_reg = (val >> 8) & 0xff; |
@@ -1822,9 +1819,10 @@ static void cmipci_sb_reg_decode(cmipci_sb_reg_t *r, unsigned long val) | |||
1822 | r->mask = (val >> 24) & 0xff; | 1819 | r->mask = (val >> 24) & 0xff; |
1823 | } | 1820 | } |
1824 | 1821 | ||
1825 | static int snd_cmipci_info_volume(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo) | 1822 | static int snd_cmipci_info_volume(struct snd_kcontrol *kcontrol, |
1823 | struct snd_ctl_elem_info *uinfo) | ||
1826 | { | 1824 | { |
1827 | cmipci_sb_reg_t reg; | 1825 | struct cmipci_sb_reg reg; |
1828 | 1826 | ||
1829 | cmipci_sb_reg_decode(®, kcontrol->private_value); | 1827 | cmipci_sb_reg_decode(®, kcontrol->private_value); |
1830 | uinfo->type = reg.mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; | 1828 | uinfo->type = reg.mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; |
@@ -1834,10 +1832,11 @@ static int snd_cmipci_info_volume(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t | |||
1834 | return 0; | 1832 | return 0; |
1835 | } | 1833 | } |
1836 | 1834 | ||
1837 | static int snd_cmipci_get_volume(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 1835 | static int snd_cmipci_get_volume(struct snd_kcontrol *kcontrol, |
1836 | struct snd_ctl_elem_value *ucontrol) | ||
1838 | { | 1837 | { |
1839 | cmipci_t *cm = snd_kcontrol_chip(kcontrol); | 1838 | struct cmipci *cm = snd_kcontrol_chip(kcontrol); |
1840 | cmipci_sb_reg_t reg; | 1839 | struct cmipci_sb_reg reg; |
1841 | int val; | 1840 | int val; |
1842 | 1841 | ||
1843 | cmipci_sb_reg_decode(®, kcontrol->private_value); | 1842 | cmipci_sb_reg_decode(®, kcontrol->private_value); |
@@ -1856,10 +1855,11 @@ static int snd_cmipci_get_volume(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
1856 | return 0; | 1855 | return 0; |
1857 | } | 1856 | } |
1858 | 1857 | ||
1859 | static int snd_cmipci_put_volume(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 1858 | static int snd_cmipci_put_volume(struct snd_kcontrol *kcontrol, |
1859 | struct snd_ctl_elem_value *ucontrol) | ||
1860 | { | 1860 | { |
1861 | cmipci_t *cm = snd_kcontrol_chip(kcontrol); | 1861 | struct cmipci *cm = snd_kcontrol_chip(kcontrol); |
1862 | cmipci_sb_reg_t reg; | 1862 | struct cmipci_sb_reg reg; |
1863 | int change; | 1863 | int change; |
1864 | int left, right, oleft, oright; | 1864 | int left, right, oleft, oright; |
1865 | 1865 | ||
@@ -1904,7 +1904,8 @@ static int snd_cmipci_put_volume(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t | |||
1904 | .private_value = COMPOSE_SB_REG(SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, left_shift, right_shift, 1, 0, 1), \ | 1904 | .private_value = COMPOSE_SB_REG(SB_DSP4_INPUT_LEFT, SB_DSP4_INPUT_RIGHT, left_shift, right_shift, 1, 0, 1), \ |
1905 | } | 1905 | } |
1906 | 1906 | ||
1907 | static int snd_cmipci_info_input_sw(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo) | 1907 | static int snd_cmipci_info_input_sw(struct snd_kcontrol *kcontrol, |
1908 | struct snd_ctl_elem_info *uinfo) | ||
1908 | { | 1909 | { |
1909 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | 1910 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
1910 | uinfo->count = 4; | 1911 | uinfo->count = 4; |
@@ -1913,10 +1914,11 @@ static int snd_cmipci_info_input_sw(snd_kcontrol_t * kcontrol, snd_ctl_elem_info | |||
1913 | return 0; | 1914 | return 0; |
1914 | } | 1915 | } |
1915 | 1916 | ||
1916 | static int snd_cmipci_get_input_sw(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 1917 | static int snd_cmipci_get_input_sw(struct snd_kcontrol *kcontrol, |
1918 | struct snd_ctl_elem_value *ucontrol) | ||
1917 | { | 1919 | { |
1918 | cmipci_t *cm = snd_kcontrol_chip(kcontrol); | 1920 | struct cmipci *cm = snd_kcontrol_chip(kcontrol); |
1919 | cmipci_sb_reg_t reg; | 1921 | struct cmipci_sb_reg reg; |
1920 | int val1, val2; | 1922 | int val1, val2; |
1921 | 1923 | ||
1922 | cmipci_sb_reg_decode(®, kcontrol->private_value); | 1924 | cmipci_sb_reg_decode(®, kcontrol->private_value); |
@@ -1931,10 +1933,11 @@ static int snd_cmipci_get_input_sw(snd_kcontrol_t * kcontrol, snd_ctl_elem_value | |||
1931 | return 0; | 1933 | return 0; |
1932 | } | 1934 | } |
1933 | 1935 | ||
1934 | static int snd_cmipci_put_input_sw(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 1936 | static int snd_cmipci_put_input_sw(struct snd_kcontrol *kcontrol, |
1937 | struct snd_ctl_elem_value *ucontrol) | ||
1935 | { | 1938 | { |
1936 | cmipci_t *cm = snd_kcontrol_chip(kcontrol); | 1939 | struct cmipci *cm = snd_kcontrol_chip(kcontrol); |
1937 | cmipci_sb_reg_t reg; | 1940 | struct cmipci_sb_reg reg; |
1938 | int change; | 1941 | int change; |
1939 | int val1, val2, oval1, oval2; | 1942 | int val1, val2, oval1, oval2; |
1940 | 1943 | ||
@@ -1987,9 +1990,10 @@ static int snd_cmipci_put_input_sw(snd_kcontrol_t * kcontrol, snd_ctl_elem_value | |||
1987 | .private_value = COMPOSE_SB_REG(reg, reg, shift, shift, mask, 0, 0), \ | 1990 | .private_value = COMPOSE_SB_REG(reg, reg, shift, shift, mask, 0, 0), \ |
1988 | } | 1991 | } |
1989 | 1992 | ||
1990 | static int snd_cmipci_info_native_mixer(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 1993 | static int snd_cmipci_info_native_mixer(struct snd_kcontrol *kcontrol, |
1994 | struct snd_ctl_elem_info *uinfo) | ||
1991 | { | 1995 | { |
1992 | cmipci_sb_reg_t reg; | 1996 | struct cmipci_sb_reg reg; |
1993 | 1997 | ||
1994 | cmipci_sb_reg_decode(®, kcontrol->private_value); | 1998 | cmipci_sb_reg_decode(®, kcontrol->private_value); |
1995 | uinfo->type = reg.mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; | 1999 | uinfo->type = reg.mask == 1 ? SNDRV_CTL_ELEM_TYPE_BOOLEAN : SNDRV_CTL_ELEM_TYPE_INTEGER; |
@@ -2000,10 +2004,11 @@ static int snd_cmipci_info_native_mixer(snd_kcontrol_t *kcontrol, snd_ctl_elem_i | |||
2000 | 2004 | ||
2001 | } | 2005 | } |
2002 | 2006 | ||
2003 | static int snd_cmipci_get_native_mixer(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 2007 | static int snd_cmipci_get_native_mixer(struct snd_kcontrol *kcontrol, |
2008 | struct snd_ctl_elem_value *ucontrol) | ||
2004 | { | 2009 | { |
2005 | cmipci_t *cm = snd_kcontrol_chip(kcontrol); | 2010 | struct cmipci *cm = snd_kcontrol_chip(kcontrol); |
2006 | cmipci_sb_reg_t reg; | 2011 | struct cmipci_sb_reg reg; |
2007 | unsigned char oreg, val; | 2012 | unsigned char oreg, val; |
2008 | 2013 | ||
2009 | cmipci_sb_reg_decode(®, kcontrol->private_value); | 2014 | cmipci_sb_reg_decode(®, kcontrol->private_value); |
@@ -2023,10 +2028,11 @@ static int snd_cmipci_get_native_mixer(snd_kcontrol_t * kcontrol, snd_ctl_elem_v | |||
2023 | return 0; | 2028 | return 0; |
2024 | } | 2029 | } |
2025 | 2030 | ||
2026 | static int snd_cmipci_put_native_mixer(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) | 2031 | static int snd_cmipci_put_native_mixer(struct snd_kcontrol *kcontrol, |
2032 | struct snd_ctl_elem_value *ucontrol) | ||
2027 | { | 2033 | { |
2028 | cmipci_t *cm = snd_kcontrol_chip(kcontrol); | 2034 | struct cmipci *cm = snd_kcontrol_chip(kcontrol); |
2029 | cmipci_sb_reg_t reg; | 2035 | struct cmipci_sb_reg reg; |
2030 | unsigned char oreg, nreg, val; | 2036 | unsigned char oreg, nreg, val; |
2031 | 2037 | ||
2032 | cmipci_sb_reg_decode(®, kcontrol->private_value); | 2038 | cmipci_sb_reg_decode(®, kcontrol->private_value); |
@@ -2052,15 +2058,17 @@ static int snd_cmipci_put_native_mixer(snd_kcontrol_t * kcontrol, snd_ctl_elem_v | |||
2052 | /* | 2058 | /* |
2053 | * special case - check mixer sensitivity | 2059 | * special case - check mixer sensitivity |
2054 | */ | 2060 | */ |
2055 | static int snd_cmipci_get_native_mixer_sensitive(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 2061 | static int snd_cmipci_get_native_mixer_sensitive(struct snd_kcontrol *kcontrol, |
2062 | struct snd_ctl_elem_value *ucontrol) | ||
2056 | { | 2063 | { |
2057 | //cmipci_t *cm = snd_kcontrol_chip(kcontrol); | 2064 | //struct cmipci *cm = snd_kcontrol_chip(kcontrol); |
2058 | return snd_cmipci_get_native_mixer(kcontrol, ucontrol); | 2065 | return snd_cmipci_get_native_mixer(kcontrol, ucontrol); |
2059 | } | 2066 | } |
2060 | 2067 | ||
2061 | static int snd_cmipci_put_native_mixer_sensitive(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 2068 | static int snd_cmipci_put_native_mixer_sensitive(struct snd_kcontrol *kcontrol, |
2069 | struct snd_ctl_elem_value *ucontrol) | ||
2062 | { | 2070 | { |
2063 | cmipci_t *cm = snd_kcontrol_chip(kcontrol); | 2071 | struct cmipci *cm = snd_kcontrol_chip(kcontrol); |
2064 | if (cm->mixer_insensitive) { | 2072 | if (cm->mixer_insensitive) { |
2065 | /* ignored */ | 2073 | /* ignored */ |
2066 | return 0; | 2074 | return 0; |
@@ -2069,7 +2077,7 @@ static int snd_cmipci_put_native_mixer_sensitive(snd_kcontrol_t *kcontrol, snd_c | |||
2069 | } | 2077 | } |
2070 | 2078 | ||
2071 | 2079 | ||
2072 | static snd_kcontrol_new_t snd_cmipci_mixers[] __devinitdata = { | 2080 | static struct snd_kcontrol_new snd_cmipci_mixers[] __devinitdata = { |
2073 | CMIPCI_SB_VOL_STEREO("Master Playback Volume", SB_DSP4_MASTER_DEV, 3, 31), | 2081 | CMIPCI_SB_VOL_STEREO("Master Playback Volume", SB_DSP4_MASTER_DEV, 3, 31), |
2074 | CMIPCI_MIXER_SW_MONO("3D Control - Switch", CM_REG_MIXER1, CM_X3DEN_SHIFT, 0), | 2082 | CMIPCI_MIXER_SW_MONO("3D Control - Switch", CM_REG_MIXER1, CM_X3DEN_SHIFT, 0), |
2075 | CMIPCI_SB_VOL_STEREO("PCM Playback Volume", SB_DSP4_PCM_DEV, 3, 31), | 2083 | CMIPCI_SB_VOL_STEREO("PCM Playback Volume", SB_DSP4_PCM_DEV, 3, 31), |
@@ -2111,15 +2119,18 @@ static snd_kcontrol_new_t snd_cmipci_mixers[] __devinitdata = { | |||
2111 | * other switches | 2119 | * other switches |
2112 | */ | 2120 | */ |
2113 | 2121 | ||
2114 | typedef struct snd_cmipci_switch_args { | 2122 | struct cmipci_switch_args { |
2115 | int reg; /* register index */ | 2123 | int reg; /* register index */ |
2116 | unsigned int mask; /* mask bits */ | 2124 | unsigned int mask; /* mask bits */ |
2117 | unsigned int mask_on; /* mask bits to turn on */ | 2125 | unsigned int mask_on; /* mask bits to turn on */ |
2118 | unsigned int is_byte: 1; /* byte access? */ | 2126 | unsigned int is_byte: 1; /* byte access? */ |
2119 | unsigned int ac3_sensitive: 1; /* access forbidden during non-audio operation? */ | 2127 | unsigned int ac3_sensitive: 1; /* access forbidden during |
2120 | } snd_cmipci_switch_args_t; | 2128 | * non-audio operation? |
2129 | */ | ||
2130 | }; | ||
2121 | 2131 | ||
2122 | static int snd_cmipci_uswitch_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo) | 2132 | static int snd_cmipci_uswitch_info(struct snd_kcontrol *kcontrol, |
2133 | struct snd_ctl_elem_info *uinfo) | ||
2123 | { | 2134 | { |
2124 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | 2135 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; |
2125 | uinfo->count = 1; | 2136 | uinfo->count = 1; |
@@ -2128,10 +2139,12 @@ static int snd_cmipci_uswitch_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t | |||
2128 | return 0; | 2139 | return 0; |
2129 | } | 2140 | } |
2130 | 2141 | ||
2131 | static int _snd_cmipci_uswitch_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol, snd_cmipci_switch_args_t *args) | 2142 | static int _snd_cmipci_uswitch_get(struct snd_kcontrol *kcontrol, |
2143 | struct snd_ctl_elem_value *ucontrol, | ||
2144 | struct cmipci_switch_args *args) | ||
2132 | { | 2145 | { |
2133 | unsigned int val; | 2146 | unsigned int val; |
2134 | cmipci_t *cm = snd_kcontrol_chip(kcontrol); | 2147 | struct cmipci *cm = snd_kcontrol_chip(kcontrol); |
2135 | 2148 | ||
2136 | spin_lock_irq(&cm->reg_lock); | 2149 | spin_lock_irq(&cm->reg_lock); |
2137 | if (args->ac3_sensitive && cm->mixer_insensitive) { | 2150 | if (args->ac3_sensitive && cm->mixer_insensitive) { |
@@ -2148,18 +2161,22 @@ static int _snd_cmipci_uswitch_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_ | |||
2148 | return 0; | 2161 | return 0; |
2149 | } | 2162 | } |
2150 | 2163 | ||
2151 | static int snd_cmipci_uswitch_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 2164 | static int snd_cmipci_uswitch_get(struct snd_kcontrol *kcontrol, |
2165 | struct snd_ctl_elem_value *ucontrol) | ||
2152 | { | 2166 | { |
2153 | snd_cmipci_switch_args_t *args = (snd_cmipci_switch_args_t*)kcontrol->private_value; | 2167 | struct cmipci_switch_args *args; |
2168 | args = (struct cmipci_switch_args *)kcontrol->private_value; | ||
2154 | snd_assert(args != NULL, return -EINVAL); | 2169 | snd_assert(args != NULL, return -EINVAL); |
2155 | return _snd_cmipci_uswitch_get(kcontrol, ucontrol, args); | 2170 | return _snd_cmipci_uswitch_get(kcontrol, ucontrol, args); |
2156 | } | 2171 | } |
2157 | 2172 | ||
2158 | static int _snd_cmipci_uswitch_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol, snd_cmipci_switch_args_t *args) | 2173 | static int _snd_cmipci_uswitch_put(struct snd_kcontrol *kcontrol, |
2174 | struct snd_ctl_elem_value *ucontrol, | ||
2175 | struct cmipci_switch_args *args) | ||
2159 | { | 2176 | { |
2160 | unsigned int val; | 2177 | unsigned int val; |
2161 | int change; | 2178 | int change; |
2162 | cmipci_t *cm = snd_kcontrol_chip(kcontrol); | 2179 | struct cmipci *cm = snd_kcontrol_chip(kcontrol); |
2163 | 2180 | ||
2164 | spin_lock_irq(&cm->reg_lock); | 2181 | spin_lock_irq(&cm->reg_lock); |
2165 | if (args->ac3_sensitive && cm->mixer_insensitive) { | 2182 | if (args->ac3_sensitive && cm->mixer_insensitive) { |
@@ -2187,15 +2204,17 @@ static int _snd_cmipci_uswitch_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_ | |||
2187 | return change; | 2204 | return change; |
2188 | } | 2205 | } |
2189 | 2206 | ||
2190 | static int snd_cmipci_uswitch_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 2207 | static int snd_cmipci_uswitch_put(struct snd_kcontrol *kcontrol, |
2208 | struct snd_ctl_elem_value *ucontrol) | ||
2191 | { | 2209 | { |
2192 | snd_cmipci_switch_args_t *args = (snd_cmipci_switch_args_t*)kcontrol->private_value; | 2210 | struct cmipci_switch_args *args; |
2211 | args = (struct cmipci_switch_args *)kcontrol->private_value; | ||
2193 | snd_assert(args != NULL, return -EINVAL); | 2212 | snd_assert(args != NULL, return -EINVAL); |
2194 | return _snd_cmipci_uswitch_put(kcontrol, ucontrol, args); | 2213 | return _snd_cmipci_uswitch_put(kcontrol, ucontrol, args); |
2195 | } | 2214 | } |
2196 | 2215 | ||
2197 | #define DEFINE_SWITCH_ARG(sname, xreg, xmask, xmask_on, xis_byte, xac3) \ | 2216 | #define DEFINE_SWITCH_ARG(sname, xreg, xmask, xmask_on, xis_byte, xac3) \ |
2198 | static snd_cmipci_switch_args_t cmipci_switch_arg_##sname = { \ | 2217 | static struct cmipci_switch_args cmipci_switch_arg_##sname = { \ |
2199 | .reg = xreg, \ | 2218 | .reg = xreg, \ |
2200 | .mask = xmask, \ | 2219 | .mask = xmask, \ |
2201 | .mask_on = xmask_on, \ | 2220 | .mask_on = xmask_on, \ |
@@ -2252,7 +2271,8 @@ DEFINE_SWITCH_ARG(modem, CM_REG_MISC_CTRL, CM_FLINKON|CM_FLINKOFF, CM_FLINKON, 0 | |||
2252 | * callbacks for spdif output switch | 2271 | * callbacks for spdif output switch |
2253 | * needs toggle two registers.. | 2272 | * needs toggle two registers.. |
2254 | */ | 2273 | */ |
2255 | static int snd_cmipci_spdout_enable_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 2274 | static int snd_cmipci_spdout_enable_get(struct snd_kcontrol *kcontrol, |
2275 | struct snd_ctl_elem_value *ucontrol) | ||
2256 | { | 2276 | { |
2257 | int changed; | 2277 | int changed; |
2258 | changed = _snd_cmipci_uswitch_get(kcontrol, ucontrol, &cmipci_switch_arg_spdif_enable); | 2278 | changed = _snd_cmipci_uswitch_get(kcontrol, ucontrol, &cmipci_switch_arg_spdif_enable); |
@@ -2260,9 +2280,10 @@ static int snd_cmipci_spdout_enable_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_v | |||
2260 | return changed; | 2280 | return changed; |
2261 | } | 2281 | } |
2262 | 2282 | ||
2263 | static int snd_cmipci_spdout_enable_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol) | 2283 | static int snd_cmipci_spdout_enable_put(struct snd_kcontrol *kcontrol, |
2284 | struct snd_ctl_elem_value *ucontrol) | ||
2264 | { | 2285 | { |
2265 | cmipci_t *chip = snd_kcontrol_chip(kcontrol); | 2286 | struct cmipci *chip = snd_kcontrol_chip(kcontrol); |
2266 | int changed; | 2287 | int changed; |
2267 | changed = _snd_cmipci_uswitch_put(kcontrol, ucontrol, &cmipci_switch_arg_spdif_enable); | 2288 | changed = _snd_cmipci_uswitch_put(kcontrol, ucontrol, &cmipci_switch_arg_spdif_enable); |
2268 | changed |= _snd_cmipci_uswitch_put(kcontrol, ucontrol, &cmipci_switch_arg_spdo2dac); | 2289 | changed |= _snd_cmipci_uswitch_put(kcontrol, ucontrol, &cmipci_switch_arg_spdo2dac); |
@@ -2280,10 +2301,10 @@ static int snd_cmipci_spdout_enable_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_v | |||
2280 | } | 2301 | } |
2281 | 2302 | ||
2282 | 2303 | ||
2283 | static int snd_cmipci_line_in_mode_info(snd_kcontrol_t *kcontrol, | 2304 | static int snd_cmipci_line_in_mode_info(struct snd_kcontrol *kcontrol, |
2284 | snd_ctl_elem_info_t *uinfo) | 2305 | struct snd_ctl_elem_info *uinfo) |
2285 | { | 2306 | { |
2286 | cmipci_t *cm = snd_kcontrol_chip(kcontrol); | 2307 | struct cmipci *cm = snd_kcontrol_chip(kcontrol); |
2287 | static char *texts[3] = { "Line-In", "Rear Output", "Bass Output" }; | 2308 | static char *texts[3] = { "Line-In", "Rear Output", "Bass Output" }; |
2288 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 2309 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
2289 | uinfo->count = 1; | 2310 | uinfo->count = 1; |
@@ -2294,7 +2315,7 @@ static int snd_cmipci_line_in_mode_info(snd_kcontrol_t *kcontrol, | |||
2294 | return 0; | 2315 | return 0; |
2295 | } | 2316 | } |
2296 | 2317 | ||
2297 | static inline unsigned int get_line_in_mode(cmipci_t *cm) | 2318 | static inline unsigned int get_line_in_mode(struct cmipci *cm) |
2298 | { | 2319 | { |
2299 | unsigned int val; | 2320 | unsigned int val; |
2300 | if (cm->chip_version >= 39) { | 2321 | if (cm->chip_version >= 39) { |
@@ -2308,10 +2329,10 @@ static inline unsigned int get_line_in_mode(cmipci_t *cm) | |||
2308 | return 0; | 2329 | return 0; |
2309 | } | 2330 | } |
2310 | 2331 | ||
2311 | static int snd_cmipci_line_in_mode_get(snd_kcontrol_t *kcontrol, | 2332 | static int snd_cmipci_line_in_mode_get(struct snd_kcontrol *kcontrol, |
2312 | snd_ctl_elem_value_t *ucontrol) | 2333 | struct snd_ctl_elem_value *ucontrol) |
2313 | { | 2334 | { |
2314 | cmipci_t *cm = snd_kcontrol_chip(kcontrol); | 2335 | struct cmipci *cm = snd_kcontrol_chip(kcontrol); |
2315 | 2336 | ||
2316 | spin_lock_irq(&cm->reg_lock); | 2337 | spin_lock_irq(&cm->reg_lock); |
2317 | ucontrol->value.enumerated.item[0] = get_line_in_mode(cm); | 2338 | ucontrol->value.enumerated.item[0] = get_line_in_mode(cm); |
@@ -2319,10 +2340,10 @@ static int snd_cmipci_line_in_mode_get(snd_kcontrol_t *kcontrol, | |||
2319 | return 0; | 2340 | return 0; |
2320 | } | 2341 | } |
2321 | 2342 | ||
2322 | static int snd_cmipci_line_in_mode_put(snd_kcontrol_t *kcontrol, | 2343 | static int snd_cmipci_line_in_mode_put(struct snd_kcontrol *kcontrol, |
2323 | snd_ctl_elem_value_t *ucontrol) | 2344 | struct snd_ctl_elem_value *ucontrol) |
2324 | { | 2345 | { |
2325 | cmipci_t *cm = snd_kcontrol_chip(kcontrol); | 2346 | struct cmipci *cm = snd_kcontrol_chip(kcontrol); |
2326 | int change; | 2347 | int change; |
2327 | 2348 | ||
2328 | spin_lock_irq(&cm->reg_lock); | 2349 | spin_lock_irq(&cm->reg_lock); |
@@ -2338,8 +2359,8 @@ static int snd_cmipci_line_in_mode_put(snd_kcontrol_t *kcontrol, | |||
2338 | return change; | 2359 | return change; |
2339 | } | 2360 | } |
2340 | 2361 | ||
2341 | static int snd_cmipci_mic_in_mode_info(snd_kcontrol_t *kcontrol, | 2362 | static int snd_cmipci_mic_in_mode_info(struct snd_kcontrol *kcontrol, |
2342 | snd_ctl_elem_info_t *uinfo) | 2363 | struct snd_ctl_elem_info *uinfo) |
2343 | { | 2364 | { |
2344 | static char *texts[2] = { "Mic-In", "Center/LFE Output" }; | 2365 | static char *texts[2] = { "Mic-In", "Center/LFE Output" }; |
2345 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; | 2366 | uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; |
@@ -2351,10 +2372,10 @@ static int snd_cmipci_mic_in_mode_info(snd_kcontrol_t *kcontrol, | |||
2351 | return 0; | 2372 | return 0; |
2352 | } | 2373 | } |
2353 | 2374 | ||
2354 | static int snd_cmipci_mic_in_mode_get(snd_kcontrol_t *kcontrol, | 2375 | static int snd_cmipci_mic_in_mode_get(struct snd_kcontrol *kcontrol, |
2355 | snd_ctl_elem_value_t *ucontrol) | 2376 | struct snd_ctl_elem_value *ucontrol) |
2356 | { | 2377 | { |
2357 | cmipci_t *cm = snd_kcontrol_chip(kcontrol); | 2378 | struct cmipci *cm = snd_kcontrol_chip(kcontrol); |
2358 | /* same bit as spdi_phase */ | 2379 | /* same bit as spdi_phase */ |
2359 | spin_lock_irq(&cm->reg_lock); | 2380 | spin_lock_irq(&cm->reg_lock); |
2360 | ucontrol->value.enumerated.item[0] = | 2381 | ucontrol->value.enumerated.item[0] = |
@@ -2363,10 +2384,10 @@ static int snd_cmipci_mic_in_mode_get(snd_kcontrol_t *kcontrol, | |||
2363 | return 0; | 2384 | return 0; |
2364 | } | 2385 | } |
2365 | 2386 | ||
2366 | static int snd_cmipci_mic_in_mode_put(snd_kcontrol_t *kcontrol, | 2387 | static int snd_cmipci_mic_in_mode_put(struct snd_kcontrol *kcontrol, |
2367 | snd_ctl_elem_value_t *ucontrol) | 2388 | struct snd_ctl_elem_value *ucontrol) |
2368 | { | 2389 | { |
2369 | cmipci_t *cm = snd_kcontrol_chip(kcontrol); | 2390 | struct cmipci *cm = snd_kcontrol_chip(kcontrol); |
2370 | int change; | 2391 | int change; |
2371 | 2392 | ||
2372 | spin_lock_irq(&cm->reg_lock); | 2393 | spin_lock_irq(&cm->reg_lock); |
@@ -2379,7 +2400,7 @@ static int snd_cmipci_mic_in_mode_put(snd_kcontrol_t *kcontrol, | |||
2379 | } | 2400 | } |
2380 | 2401 | ||
2381 | /* both for CM8338/8738 */ | 2402 | /* both for CM8338/8738 */ |
2382 | static snd_kcontrol_new_t snd_cmipci_mixer_switches[] __devinitdata = { | 2403 | static struct snd_kcontrol_new snd_cmipci_mixer_switches[] __devinitdata = { |
2383 | DEFINE_MIXER_SWITCH("Four Channel Mode", fourch), | 2404 | DEFINE_MIXER_SWITCH("Four Channel Mode", fourch), |
2384 | { | 2405 | { |
2385 | .name = "Line-In Mode", | 2406 | .name = "Line-In Mode", |
@@ -2391,11 +2412,11 @@ static snd_kcontrol_new_t snd_cmipci_mixer_switches[] __devinitdata = { | |||
2391 | }; | 2412 | }; |
2392 | 2413 | ||
2393 | /* for non-multichannel chips */ | 2414 | /* for non-multichannel chips */ |
2394 | static snd_kcontrol_new_t snd_cmipci_nomulti_switch __devinitdata = | 2415 | static struct snd_kcontrol_new snd_cmipci_nomulti_switch __devinitdata = |
2395 | DEFINE_MIXER_SWITCH("Exchange DAC", exchange_dac); | 2416 | DEFINE_MIXER_SWITCH("Exchange DAC", exchange_dac); |
2396 | 2417 | ||
2397 | /* only for CM8738 */ | 2418 | /* only for CM8738 */ |
2398 | static snd_kcontrol_new_t snd_cmipci_8738_mixer_switches[] __devinitdata = { | 2419 | static struct snd_kcontrol_new snd_cmipci_8738_mixer_switches[] __devinitdata = { |
2399 | #if 0 /* controlled in pcm device */ | 2420 | #if 0 /* controlled in pcm device */ |
2400 | DEFINE_MIXER_SWITCH("IEC958 In Record", spdif_in), | 2421 | DEFINE_MIXER_SWITCH("IEC958 In Record", spdif_in), |
2401 | DEFINE_MIXER_SWITCH("IEC958 Out", spdif_out), | 2422 | DEFINE_MIXER_SWITCH("IEC958 Out", spdif_out), |
@@ -2417,14 +2438,14 @@ static snd_kcontrol_new_t snd_cmipci_8738_mixer_switches[] __devinitdata = { | |||
2417 | }; | 2438 | }; |
2418 | 2439 | ||
2419 | /* only for model 033/037 */ | 2440 | /* only for model 033/037 */ |
2420 | static snd_kcontrol_new_t snd_cmipci_old_mixer_switches[] __devinitdata = { | 2441 | static struct snd_kcontrol_new snd_cmipci_old_mixer_switches[] __devinitdata = { |
2421 | DEFINE_MIXER_SWITCH("IEC958 Mix Analog", spdif_dac_out), | 2442 | DEFINE_MIXER_SWITCH("IEC958 Mix Analog", spdif_dac_out), |
2422 | DEFINE_MIXER_SWITCH("IEC958 In Phase Inverse", spdi_phase), | 2443 | DEFINE_MIXER_SWITCH("IEC958 In Phase Inverse", spdi_phase), |
2423 | DEFINE_MIXER_SWITCH("IEC958 In Select", spdif_in_sel1), | 2444 | DEFINE_MIXER_SWITCH("IEC958 In Select", spdif_in_sel1), |
2424 | }; | 2445 | }; |
2425 | 2446 | ||
2426 | /* only for model 039 or later */ | 2447 | /* only for model 039 or later */ |
2427 | static snd_kcontrol_new_t snd_cmipci_extra_mixer_switches[] __devinitdata = { | 2448 | static struct snd_kcontrol_new snd_cmipci_extra_mixer_switches[] __devinitdata = { |
2428 | DEFINE_MIXER_SWITCH("IEC958 In Select", spdif_in_sel2), | 2449 | DEFINE_MIXER_SWITCH("IEC958 In Select", spdif_in_sel2), |
2429 | DEFINE_MIXER_SWITCH("IEC958 In Phase Inverse", spdi_phase2), | 2450 | DEFINE_MIXER_SWITCH("IEC958 In Phase Inverse", spdi_phase2), |
2430 | { | 2451 | { |
@@ -2437,17 +2458,17 @@ static snd_kcontrol_new_t snd_cmipci_extra_mixer_switches[] __devinitdata = { | |||
2437 | }; | 2458 | }; |
2438 | 2459 | ||
2439 | /* card control switches */ | 2460 | /* card control switches */ |
2440 | static snd_kcontrol_new_t snd_cmipci_control_switches[] __devinitdata = { | 2461 | static struct snd_kcontrol_new snd_cmipci_control_switches[] __devinitdata = { |
2441 | // DEFINE_CARD_SWITCH("Joystick", joystick), /* now module option */ | 2462 | // DEFINE_CARD_SWITCH("Joystick", joystick), /* now module option */ |
2442 | DEFINE_CARD_SWITCH("Modem", modem), | 2463 | DEFINE_CARD_SWITCH("Modem", modem), |
2443 | }; | 2464 | }; |
2444 | 2465 | ||
2445 | 2466 | ||
2446 | static int __devinit snd_cmipci_mixer_new(cmipci_t *cm, int pcm_spdif_device) | 2467 | static int __devinit snd_cmipci_mixer_new(struct cmipci *cm, int pcm_spdif_device) |
2447 | { | 2468 | { |
2448 | snd_card_t *card; | 2469 | struct snd_card *card; |
2449 | snd_kcontrol_new_t *sw; | 2470 | struct snd_kcontrol_new *sw; |
2450 | snd_kcontrol_t *kctl; | 2471 | struct snd_kcontrol *kctl; |
2451 | unsigned int idx; | 2472 | unsigned int idx; |
2452 | int err; | 2473 | int err; |
2453 | 2474 | ||
@@ -2529,8 +2550,8 @@ static int __devinit snd_cmipci_mixer_new(cmipci_t *cm, int pcm_spdif_device) | |||
2529 | } | 2550 | } |
2530 | 2551 | ||
2531 | for (idx = 0; idx < CM_SAVED_MIXERS; idx++) { | 2552 | for (idx = 0; idx < CM_SAVED_MIXERS; idx++) { |
2532 | snd_ctl_elem_id_t id; | 2553 | struct snd_ctl_elem_id id; |
2533 | snd_kcontrol_t *ctl; | 2554 | struct snd_kcontrol *ctl; |
2534 | memset(&id, 0, sizeof(id)); | 2555 | memset(&id, 0, sizeof(id)); |
2535 | id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; | 2556 | id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; |
2536 | strcpy(id.name, cm_saved_mixer[idx].name); | 2557 | strcpy(id.name, cm_saved_mixer[idx].name); |
@@ -2547,10 +2568,10 @@ static int __devinit snd_cmipci_mixer_new(cmipci_t *cm, int pcm_spdif_device) | |||
2547 | */ | 2568 | */ |
2548 | 2569 | ||
2549 | #ifdef CONFIG_PROC_FS | 2570 | #ifdef CONFIG_PROC_FS |
2550 | static void snd_cmipci_proc_read(snd_info_entry_t *entry, | 2571 | static void snd_cmipci_proc_read(struct snd_info_entry *entry, |
2551 | snd_info_buffer_t *buffer) | 2572 | struct snd_info_buffer *buffer) |
2552 | { | 2573 | { |
2553 | cmipci_t *cm = entry->private_data; | 2574 | struct cmipci *cm = entry->private_data; |
2554 | int i; | 2575 | int i; |
2555 | 2576 | ||
2556 | snd_iprintf(buffer, "%s\n\n", cm->card->longname); | 2577 | snd_iprintf(buffer, "%s\n\n", cm->card->longname); |
@@ -2566,15 +2587,15 @@ static void snd_cmipci_proc_read(snd_info_entry_t *entry, | |||
2566 | } | 2587 | } |
2567 | } | 2588 | } |
2568 | 2589 | ||
2569 | static void __devinit snd_cmipci_proc_init(cmipci_t *cm) | 2590 | static void __devinit snd_cmipci_proc_init(struct cmipci *cm) |
2570 | { | 2591 | { |
2571 | snd_info_entry_t *entry; | 2592 | struct snd_info_entry *entry; |
2572 | 2593 | ||
2573 | if (! snd_card_proc_new(cm->card, "cmipci", &entry)) | 2594 | if (! snd_card_proc_new(cm->card, "cmipci", &entry)) |
2574 | snd_info_set_text_ops(entry, cm, 1024, snd_cmipci_proc_read); | 2595 | snd_info_set_text_ops(entry, cm, 1024, snd_cmipci_proc_read); |
2575 | } | 2596 | } |
2576 | #else /* !CONFIG_PROC_FS */ | 2597 | #else /* !CONFIG_PROC_FS */ |
2577 | static inline void snd_cmipci_proc_init(cmipci_t *cm) {} | 2598 | static inline void snd_cmipci_proc_init(struct cmipci *cm) {} |
2578 | #endif | 2599 | #endif |
2579 | 2600 | ||
2580 | 2601 | ||
@@ -2592,7 +2613,7 @@ static struct pci_device_id snd_cmipci_ids[] = { | |||
2592 | * check chip version and capabilities | 2613 | * check chip version and capabilities |
2593 | * driver name is modified according to the chip model | 2614 | * driver name is modified according to the chip model |
2594 | */ | 2615 | */ |
2595 | static void __devinit query_chip(cmipci_t *cm) | 2616 | static void __devinit query_chip(struct cmipci *cm) |
2596 | { | 2617 | { |
2597 | unsigned int detect; | 2618 | unsigned int detect; |
2598 | 2619 | ||
@@ -2645,7 +2666,7 @@ static void __devinit query_chip(cmipci_t *cm) | |||
2645 | } | 2666 | } |
2646 | 2667 | ||
2647 | #ifdef SUPPORT_JOYSTICK | 2668 | #ifdef SUPPORT_JOYSTICK |
2648 | static int __devinit snd_cmipci_create_gameport(cmipci_t *cm, int dev) | 2669 | static int __devinit snd_cmipci_create_gameport(struct cmipci *cm, int dev) |
2649 | { | 2670 | { |
2650 | static int ports[] = { 0x201, 0x200, 0 }; /* FIXME: majority is 0x201? */ | 2671 | static int ports[] = { 0x201, 0x200, 0 }; /* FIXME: majority is 0x201? */ |
2651 | struct gameport *gp; | 2672 | struct gameport *gp; |
@@ -2691,7 +2712,7 @@ static int __devinit snd_cmipci_create_gameport(cmipci_t *cm, int dev) | |||
2691 | return 0; | 2712 | return 0; |
2692 | } | 2713 | } |
2693 | 2714 | ||
2694 | static void snd_cmipci_free_gameport(cmipci_t *cm) | 2715 | static void snd_cmipci_free_gameport(struct cmipci *cm) |
2695 | { | 2716 | { |
2696 | if (cm->gameport) { | 2717 | if (cm->gameport) { |
2697 | struct resource *r = gameport_get_port_data(cm->gameport); | 2718 | struct resource *r = gameport_get_port_data(cm->gameport); |
@@ -2704,11 +2725,11 @@ static void snd_cmipci_free_gameport(cmipci_t *cm) | |||
2704 | } | 2725 | } |
2705 | } | 2726 | } |
2706 | #else | 2727 | #else |
2707 | static inline int snd_cmipci_create_gameport(cmipci_t *cm, int dev) { return -ENOSYS; } | 2728 | static inline int snd_cmipci_create_gameport(struct cmipci *cm, int dev) { return -ENOSYS; } |
2708 | static inline void snd_cmipci_free_gameport(cmipci_t *cm) { } | 2729 | static inline void snd_cmipci_free_gameport(struct cmipci *cm) { } |
2709 | #endif | 2730 | #endif |
2710 | 2731 | ||
2711 | static int snd_cmipci_free(cmipci_t *cm) | 2732 | static int snd_cmipci_free(struct cmipci *cm) |
2712 | { | 2733 | { |
2713 | if (cm->irq >= 0) { | 2734 | if (cm->irq >= 0) { |
2714 | snd_cmipci_clear_bit(cm, CM_REG_MISC_CTRL, CM_FM_EN); | 2735 | snd_cmipci_clear_bit(cm, CM_REG_MISC_CTRL, CM_FM_EN); |
@@ -2724,7 +2745,7 @@ static int snd_cmipci_free(cmipci_t *cm) | |||
2724 | 2745 | ||
2725 | synchronize_irq(cm->irq); | 2746 | synchronize_irq(cm->irq); |
2726 | 2747 | ||
2727 | free_irq(cm->irq, (void *)cm); | 2748 | free_irq(cm->irq, cm); |
2728 | } | 2749 | } |
2729 | 2750 | ||
2730 | snd_cmipci_free_gameport(cm); | 2751 | snd_cmipci_free_gameport(cm); |
@@ -2734,17 +2755,17 @@ static int snd_cmipci_free(cmipci_t *cm) | |||
2734 | return 0; | 2755 | return 0; |
2735 | } | 2756 | } |
2736 | 2757 | ||
2737 | static int snd_cmipci_dev_free(snd_device_t *device) | 2758 | static int snd_cmipci_dev_free(struct snd_device *device) |
2738 | { | 2759 | { |
2739 | cmipci_t *cm = device->device_data; | 2760 | struct cmipci *cm = device->device_data; |
2740 | return snd_cmipci_free(cm); | 2761 | return snd_cmipci_free(cm); |
2741 | } | 2762 | } |
2742 | 2763 | ||
2743 | static int __devinit snd_cmipci_create_fm(cmipci_t *cm, long fm_port) | 2764 | static int __devinit snd_cmipci_create_fm(struct cmipci *cm, long fm_port) |
2744 | { | 2765 | { |
2745 | long iosynth; | 2766 | long iosynth; |
2746 | unsigned int val; | 2767 | unsigned int val; |
2747 | opl3_t *opl3; | 2768 | struct snd_opl3 *opl3; |
2748 | int err; | 2769 | int err; |
2749 | 2770 | ||
2750 | /* first try FM regs in PCI port range */ | 2771 | /* first try FM regs in PCI port range */ |
@@ -2785,12 +2806,12 @@ static int __devinit snd_cmipci_create_fm(cmipci_t *cm, long fm_port) | |||
2785 | return 0; | 2806 | return 0; |
2786 | } | 2807 | } |
2787 | 2808 | ||
2788 | static int __devinit snd_cmipci_create(snd_card_t *card, struct pci_dev *pci, | 2809 | static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pci, |
2789 | int dev, cmipci_t **rcmipci) | 2810 | int dev, struct cmipci **rcmipci) |
2790 | { | 2811 | { |
2791 | cmipci_t *cm; | 2812 | struct cmipci *cm; |
2792 | int err; | 2813 | int err; |
2793 | static snd_device_ops_t ops = { | 2814 | static struct snd_device_ops ops = { |
2794 | .dev_free = snd_cmipci_dev_free, | 2815 | .dev_free = snd_cmipci_dev_free, |
2795 | }; | 2816 | }; |
2796 | unsigned int val = 0; | 2817 | unsigned int val = 0; |
@@ -2830,7 +2851,8 @@ static int __devinit snd_cmipci_create(snd_card_t *card, struct pci_dev *pci, | |||
2830 | } | 2851 | } |
2831 | cm->iobase = pci_resource_start(pci, 0); | 2852 | cm->iobase = pci_resource_start(pci, 0); |
2832 | 2853 | ||
2833 | if (request_irq(pci->irq, snd_cmipci_interrupt, SA_INTERRUPT|SA_SHIRQ, card->driver, (void *)cm)) { | 2854 | if (request_irq(pci->irq, snd_cmipci_interrupt, |
2855 | SA_INTERRUPT|SA_SHIRQ, card->driver, cm)) { | ||
2834 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); | 2856 | snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); |
2835 | snd_cmipci_free(cm); | 2857 | snd_cmipci_free(cm); |
2836 | return -EBUSY; | 2858 | return -EBUSY; |
@@ -2983,8 +3005,8 @@ static int __devinit snd_cmipci_probe(struct pci_dev *pci, | |||
2983 | const struct pci_device_id *pci_id) | 3005 | const struct pci_device_id *pci_id) |
2984 | { | 3006 | { |
2985 | static int dev; | 3007 | static int dev; |
2986 | snd_card_t *card; | 3008 | struct snd_card *card; |
2987 | cmipci_t *cm; | 3009 | struct cmipci *cm; |
2988 | int err; | 3010 | int err; |
2989 | 3011 | ||
2990 | if (dev >= SNDRV_CARDS) | 3012 | if (dev >= SNDRV_CARDS) |