aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/cs4281.c276
1 files changed, 143 insertions, 133 deletions
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index c99bb1f2bfa8..116cdc1c5528 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -427,11 +427,8 @@ MODULE_PARM_DESC(dual_codec, "Secondary Codec ID (0 = disabled).");
427 * 427 *
428 */ 428 */
429 429
430typedef struct snd_cs4281 cs4281_t; 430struct cs4281_dma {
431typedef struct snd_cs4281_dma cs4281_dma_t; 431 struct snd_pcm_substream *substream;
432
433struct snd_cs4281_dma {
434 snd_pcm_substream_t *substream;
435 unsigned int regDBA; /* offset to DBA register */ 432 unsigned int regDBA; /* offset to DBA register */
436 unsigned int regDCA; /* offset to DCA register */ 433 unsigned int regDCA; /* offset to DCA register */
437 unsigned int regDBC; /* offset to DBC register */ 434 unsigned int regDBC; /* offset to DBC register */
@@ -452,7 +449,7 @@ struct snd_cs4281_dma {
452 449
453#define SUSPEND_REGISTERS 20 450#define SUSPEND_REGISTERS 20
454 451
455struct snd_cs4281 { 452struct cs4281 {
456 int irq; 453 int irq;
457 454
458 void __iomem *ba0; /* virtual (accessible) address */ 455 void __iomem *ba0; /* virtual (accessible) address */
@@ -462,18 +459,18 @@ struct snd_cs4281 {
462 459
463 int dual_codec; 460 int dual_codec;
464 461
465 ac97_bus_t *ac97_bus; 462 struct snd_ac97_bus *ac97_bus;
466 ac97_t *ac97; 463 struct snd_ac97 *ac97;
467 ac97_t *ac97_secondary; 464 struct snd_ac97 *ac97_secondary;
468 465
469 struct pci_dev *pci; 466 struct pci_dev *pci;
470 snd_card_t *card; 467 struct snd_card *card;
471 snd_pcm_t *pcm; 468 struct snd_pcm *pcm;
472 snd_rawmidi_t *rmidi; 469 struct snd_rawmidi *rmidi;
473 snd_rawmidi_substream_t *midi_input; 470 struct snd_rawmidi_substream *midi_input;
474 snd_rawmidi_substream_t *midi_output; 471 struct snd_rawmidi_substream *midi_output;
475 472
476 cs4281_dma_t dma[4]; 473 struct cs4281_dma dma[4];
477 474
478 unsigned char src_left_play_slot; 475 unsigned char src_left_play_slot;
479 unsigned char src_right_play_slot; 476 unsigned char src_right_play_slot;
@@ -514,17 +511,18 @@ MODULE_DEVICE_TABLE(pci, snd_cs4281_ids);
514 * common I/O routines 511 * common I/O routines
515 */ 512 */
516 513
517static inline void snd_cs4281_pokeBA0(cs4281_t *chip, unsigned long offset, unsigned int val) 514static inline void snd_cs4281_pokeBA0(struct cs4281 *chip, unsigned long offset,
515 unsigned int val)
518{ 516{
519 writel(val, chip->ba0 + offset); 517 writel(val, chip->ba0 + offset);
520} 518}
521 519
522static inline unsigned int snd_cs4281_peekBA0(cs4281_t *chip, unsigned long offset) 520static inline unsigned int snd_cs4281_peekBA0(struct cs4281 *chip, unsigned long offset)
523{ 521{
524 return readl(chip->ba0 + offset); 522 return readl(chip->ba0 + offset);
525} 523}
526 524
527static void snd_cs4281_ac97_write(ac97_t *ac97, 525static void snd_cs4281_ac97_write(struct snd_ac97 *ac97,
528 unsigned short reg, unsigned short val) 526 unsigned short reg, unsigned short val)
529{ 527{
530 /* 528 /*
@@ -534,7 +532,7 @@ static void snd_cs4281_ac97_write(ac97_t *ac97,
534 * 4. Read ACCTL = 460h, DCV should be reset by now and 460h = 07h 532 * 4. Read ACCTL = 460h, DCV should be reset by now and 460h = 07h
535 * 5. if DCV not cleared, break and return error 533 * 5. if DCV not cleared, break and return error
536 */ 534 */
537 cs4281_t *chip = ac97->private_data; 535 struct cs4281 *chip = ac97->private_data;
538 int count; 536 int count;
539 537
540 /* 538 /*
@@ -569,15 +567,15 @@ static void snd_cs4281_ac97_write(ac97_t *ac97,
569 snd_printk(KERN_ERR "AC'97 write problem, reg = 0x%x, val = 0x%x\n", reg, val); 567 snd_printk(KERN_ERR "AC'97 write problem, reg = 0x%x, val = 0x%x\n", reg, val);
570} 568}
571 569
572static unsigned short snd_cs4281_ac97_read(ac97_t *ac97, 570static unsigned short snd_cs4281_ac97_read(struct snd_ac97 *ac97,
573 unsigned short reg) 571 unsigned short reg)
574{ 572{
575 cs4281_t *chip = ac97->private_data; 573 struct cs4281 *chip = ac97->private_data;
576 int count; 574 int count;
577 unsigned short result; 575 unsigned short result;
578 // FIXME: volatile is necessary in the following due to a bug of 576 // FIXME: volatile is necessary in the following due to a bug of
579 // some gcc versions 577 // some gcc versions
580 volatile int ac97_num = ((volatile ac97_t *)ac97)->num; 578 volatile int ac97_num = ((volatile struct snd_ac97 *)ac97)->num;
581 579
582 /* 580 /*
583 * 1. Write ACCAD = Command Address Register = 46Ch for AC97 register address 581 * 1. Write ACCAD = Command Address Register = 46Ch for AC97 register address
@@ -664,10 +662,10 @@ static unsigned short snd_cs4281_ac97_read(ac97_t *ac97,
664 * PCM part 662 * PCM part
665 */ 663 */
666 664
667static int snd_cs4281_trigger(snd_pcm_substream_t *substream, int cmd) 665static int snd_cs4281_trigger(struct snd_pcm_substream *substream, int cmd)
668{ 666{
669 cs4281_dma_t *dma = (cs4281_dma_t *)substream->runtime->private_data; 667 struct cs4281_dma *dma = substream->runtime->private_data;
670 cs4281_t *chip = snd_pcm_substream_chip(substream); 668 struct cs4281 *chip = snd_pcm_substream_chip(substream);
671 669
672 spin_lock(&chip->reg_lock); 670 spin_lock(&chip->reg_lock);
673 switch (cmd) { 671 switch (cmd) {
@@ -730,7 +728,9 @@ static unsigned int snd_cs4281_rate(unsigned int rate, unsigned int *real_rate)
730 return val; 728 return val;
731} 729}
732 730
733static void snd_cs4281_mode(cs4281_t *chip, cs4281_dma_t *dma, snd_pcm_runtime_t *runtime, int capture, int src) 731static void snd_cs4281_mode(struct cs4281 *chip, struct cs4281_dma *dma,
732 struct snd_pcm_runtime *runtime,
733 int capture, int src)
734{ 734{
735 int rec_mono; 735 int rec_mono;
736 736
@@ -793,22 +793,22 @@ static void snd_cs4281_mode(cs4281_t *chip, cs4281_dma_t *dma, snd_pcm_runtime_t
793 snd_cs4281_pokeBA0(chip, dma->regFSIC, 0); 793 snd_cs4281_pokeBA0(chip, dma->regFSIC, 0);
794} 794}
795 795
796static int snd_cs4281_hw_params(snd_pcm_substream_t * substream, 796static int snd_cs4281_hw_params(struct snd_pcm_substream *substream,
797 snd_pcm_hw_params_t * hw_params) 797 struct snd_pcm_hw_params *hw_params)
798{ 798{
799 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); 799 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
800} 800}
801 801
802static int snd_cs4281_hw_free(snd_pcm_substream_t * substream) 802static int snd_cs4281_hw_free(struct snd_pcm_substream *substream)
803{ 803{
804 return snd_pcm_lib_free_pages(substream); 804 return snd_pcm_lib_free_pages(substream);
805} 805}
806 806
807static int snd_cs4281_playback_prepare(snd_pcm_substream_t * substream) 807static int snd_cs4281_playback_prepare(struct snd_pcm_substream *substream)
808{ 808{
809 snd_pcm_runtime_t *runtime = substream->runtime; 809 struct snd_pcm_runtime *runtime = substream->runtime;
810 cs4281_dma_t *dma = (cs4281_dma_t *)runtime->private_data; 810 struct cs4281_dma *dma = runtime->private_data;
811 cs4281_t *chip = snd_pcm_substream_chip(substream); 811 struct cs4281 *chip = snd_pcm_substream_chip(substream);
812 812
813 spin_lock_irq(&chip->reg_lock); 813 spin_lock_irq(&chip->reg_lock);
814 snd_cs4281_mode(chip, dma, runtime, 0, 1); 814 snd_cs4281_mode(chip, dma, runtime, 0, 1);
@@ -816,11 +816,11 @@ static int snd_cs4281_playback_prepare(snd_pcm_substream_t * substream)
816 return 0; 816 return 0;
817} 817}
818 818
819static int snd_cs4281_capture_prepare(snd_pcm_substream_t * substream) 819static int snd_cs4281_capture_prepare(struct snd_pcm_substream *substream)
820{ 820{
821 snd_pcm_runtime_t *runtime = substream->runtime; 821 struct snd_pcm_runtime *runtime = substream->runtime;
822 cs4281_dma_t *dma = (cs4281_dma_t *)runtime->private_data; 822 struct cs4281_dma *dma = runtime->private_data;
823 cs4281_t *chip = snd_pcm_substream_chip(substream); 823 struct cs4281 *chip = snd_pcm_substream_chip(substream);
824 824
825 spin_lock_irq(&chip->reg_lock); 825 spin_lock_irq(&chip->reg_lock);
826 snd_cs4281_mode(chip, dma, runtime, 1, 1); 826 snd_cs4281_mode(chip, dma, runtime, 1, 1);
@@ -828,18 +828,18 @@ static int snd_cs4281_capture_prepare(snd_pcm_substream_t * substream)
828 return 0; 828 return 0;
829} 829}
830 830
831static snd_pcm_uframes_t snd_cs4281_pointer(snd_pcm_substream_t * substream) 831static snd_pcm_uframes_t snd_cs4281_pointer(struct snd_pcm_substream *substream)
832{ 832{
833 snd_pcm_runtime_t *runtime = substream->runtime; 833 struct snd_pcm_runtime *runtime = substream->runtime;
834 cs4281_dma_t *dma = (cs4281_dma_t *)runtime->private_data; 834 struct cs4281_dma *dma = runtime->private_data;
835 cs4281_t *chip = snd_pcm_substream_chip(substream); 835 struct cs4281 *chip = snd_pcm_substream_chip(substream);
836 836
837 // printk("DCC = 0x%x, buffer_size = 0x%x, jiffies = %li\n", snd_cs4281_peekBA0(chip, dma->regDCC), runtime->buffer_size, jiffies); 837 // printk("DCC = 0x%x, buffer_size = 0x%x, jiffies = %li\n", snd_cs4281_peekBA0(chip, dma->regDCC), runtime->buffer_size, jiffies);
838 return runtime->buffer_size - 838 return runtime->buffer_size -
839 snd_cs4281_peekBA0(chip, dma->regDCC) - 1; 839 snd_cs4281_peekBA0(chip, dma->regDCC) - 1;
840} 840}
841 841
842static snd_pcm_hardware_t snd_cs4281_playback = 842static struct snd_pcm_hardware snd_cs4281_playback =
843{ 843{
844 .info = (SNDRV_PCM_INFO_MMAP | 844 .info = (SNDRV_PCM_INFO_MMAP |
845 SNDRV_PCM_INFO_INTERLEAVED | 845 SNDRV_PCM_INFO_INTERLEAVED |
@@ -865,7 +865,7 @@ static snd_pcm_hardware_t snd_cs4281_playback =
865 .fifo_size = CS4281_FIFO_SIZE, 865 .fifo_size = CS4281_FIFO_SIZE,
866}; 866};
867 867
868static snd_pcm_hardware_t snd_cs4281_capture = 868static struct snd_pcm_hardware snd_cs4281_capture =
869{ 869{
870 .info = (SNDRV_PCM_INFO_MMAP | 870 .info = (SNDRV_PCM_INFO_MMAP |
871 SNDRV_PCM_INFO_INTERLEAVED | 871 SNDRV_PCM_INFO_INTERLEAVED |
@@ -891,11 +891,11 @@ static snd_pcm_hardware_t snd_cs4281_capture =
891 .fifo_size = CS4281_FIFO_SIZE, 891 .fifo_size = CS4281_FIFO_SIZE,
892}; 892};
893 893
894static int snd_cs4281_playback_open(snd_pcm_substream_t * substream) 894static int snd_cs4281_playback_open(struct snd_pcm_substream *substream)
895{ 895{
896 cs4281_t *chip = snd_pcm_substream_chip(substream); 896 struct cs4281 *chip = snd_pcm_substream_chip(substream);
897 snd_pcm_runtime_t *runtime = substream->runtime; 897 struct snd_pcm_runtime *runtime = substream->runtime;
898 cs4281_dma_t *dma; 898 struct cs4281_dma *dma;
899 899
900 dma = &chip->dma[0]; 900 dma = &chip->dma[0];
901 dma->substream = substream; 901 dma->substream = substream;
@@ -911,11 +911,11 @@ static int snd_cs4281_playback_open(snd_pcm_substream_t * substream)
911 return 0; 911 return 0;
912} 912}
913 913
914static int snd_cs4281_capture_open(snd_pcm_substream_t * substream) 914static int snd_cs4281_capture_open(struct snd_pcm_substream *substream)
915{ 915{
916 cs4281_t *chip = snd_pcm_substream_chip(substream); 916 struct cs4281 *chip = snd_pcm_substream_chip(substream);
917 snd_pcm_runtime_t *runtime = substream->runtime; 917 struct snd_pcm_runtime *runtime = substream->runtime;
918 cs4281_dma_t *dma; 918 struct cs4281_dma *dma;
919 919
920 dma = &chip->dma[1]; 920 dma = &chip->dma[1];
921 dma->substream = substream; 921 dma->substream = substream;
@@ -931,23 +931,23 @@ static int snd_cs4281_capture_open(snd_pcm_substream_t * substream)
931 return 0; 931 return 0;
932} 932}
933 933
934static int snd_cs4281_playback_close(snd_pcm_substream_t * substream) 934static int snd_cs4281_playback_close(struct snd_pcm_substream *substream)
935{ 935{
936 cs4281_dma_t *dma = (cs4281_dma_t *)substream->runtime->private_data; 936 struct cs4281_dma *dma = substream->runtime->private_data;
937 937
938 dma->substream = NULL; 938 dma->substream = NULL;
939 return 0; 939 return 0;
940} 940}
941 941
942static int snd_cs4281_capture_close(snd_pcm_substream_t * substream) 942static int snd_cs4281_capture_close(struct snd_pcm_substream *substream)
943{ 943{
944 cs4281_dma_t *dma = (cs4281_dma_t *)substream->runtime->private_data; 944 struct cs4281_dma *dma = substream->runtime->private_data;
945 945
946 dma->substream = NULL; 946 dma->substream = NULL;
947 return 0; 947 return 0;
948} 948}
949 949
950static snd_pcm_ops_t snd_cs4281_playback_ops = { 950static struct snd_pcm_ops snd_cs4281_playback_ops = {
951 .open = snd_cs4281_playback_open, 951 .open = snd_cs4281_playback_open,
952 .close = snd_cs4281_playback_close, 952 .close = snd_cs4281_playback_close,
953 .ioctl = snd_pcm_lib_ioctl, 953 .ioctl = snd_pcm_lib_ioctl,
@@ -958,7 +958,7 @@ static snd_pcm_ops_t snd_cs4281_playback_ops = {
958 .pointer = snd_cs4281_pointer, 958 .pointer = snd_cs4281_pointer,
959}; 959};
960 960
961static snd_pcm_ops_t snd_cs4281_capture_ops = { 961static struct snd_pcm_ops snd_cs4281_capture_ops = {
962 .open = snd_cs4281_capture_open, 962 .open = snd_cs4281_capture_open,
963 .close = snd_cs4281_capture_close, 963 .close = snd_cs4281_capture_close,
964 .ioctl = snd_pcm_lib_ioctl, 964 .ioctl = snd_pcm_lib_ioctl,
@@ -969,9 +969,10 @@ static snd_pcm_ops_t snd_cs4281_capture_ops = {
969 .pointer = snd_cs4281_pointer, 969 .pointer = snd_cs4281_pointer,
970}; 970};
971 971
972static int __devinit snd_cs4281_pcm(cs4281_t * chip, int device, snd_pcm_t ** rpcm) 972static int __devinit snd_cs4281_pcm(struct cs4281 * chip, int device,
973 struct snd_pcm ** rpcm)
973{ 974{
974 snd_pcm_t *pcm; 975 struct snd_pcm *pcm;
975 int err; 976 int err;
976 977
977 if (rpcm) 978 if (rpcm)
@@ -1002,7 +1003,8 @@ static int __devinit snd_cs4281_pcm(cs4281_t * chip, int device, snd_pcm_t ** rp
1002 1003
1003#define CS_VOL_MASK 0x1f 1004#define CS_VOL_MASK 0x1f
1004 1005
1005static int snd_cs4281_info_volume(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t * uinfo) 1006static int snd_cs4281_info_volume(struct snd_kcontrol *kcontrol,
1007 struct snd_ctl_elem_info *uinfo)
1006{ 1008{
1007 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; 1009 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
1008 uinfo->count = 2; 1010 uinfo->count = 2;
@@ -1011,9 +1013,10 @@ static int snd_cs4281_info_volume(snd_kcontrol_t * kcontrol, snd_ctl_elem_info_t
1011 return 0; 1013 return 0;
1012} 1014}
1013 1015
1014static int snd_cs4281_get_volume(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1016static int snd_cs4281_get_volume(struct snd_kcontrol *kcontrol,
1017 struct snd_ctl_elem_value *ucontrol)
1015{ 1018{
1016 cs4281_t *chip = snd_kcontrol_chip(kcontrol); 1019 struct cs4281 *chip = snd_kcontrol_chip(kcontrol);
1017 int regL = (kcontrol->private_value >> 16) & 0xffff; 1020 int regL = (kcontrol->private_value >> 16) & 0xffff;
1018 int regR = kcontrol->private_value & 0xffff; 1021 int regR = kcontrol->private_value & 0xffff;
1019 int volL, volR; 1022 int volL, volR;
@@ -1026,9 +1029,10 @@ static int snd_cs4281_get_volume(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
1026 return 0; 1029 return 0;
1027} 1030}
1028 1031
1029static int snd_cs4281_put_volume(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1032static int snd_cs4281_put_volume(struct snd_kcontrol *kcontrol,
1033 struct snd_ctl_elem_value *ucontrol)
1030{ 1034{
1031 cs4281_t *chip = snd_kcontrol_chip(kcontrol); 1035 struct cs4281 *chip = snd_kcontrol_chip(kcontrol);
1032 int change = 0; 1036 int change = 0;
1033 int regL = (kcontrol->private_value >> 16) & 0xffff; 1037 int regL = (kcontrol->private_value >> 16) & 0xffff;
1034 int regR = kcontrol->private_value & 0xffff; 1038 int regR = kcontrol->private_value & 0xffff;
@@ -1050,7 +1054,7 @@ static int snd_cs4281_put_volume(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
1050 return change; 1054 return change;
1051} 1055}
1052 1056
1053static snd_kcontrol_new_t snd_cs4281_fm_vol = 1057static struct snd_kcontrol_new snd_cs4281_fm_vol =
1054{ 1058{
1055 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1059 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1056 .name = "Synth Playback Volume", 1060 .name = "Synth Playback Volume",
@@ -1060,7 +1064,7 @@ static snd_kcontrol_new_t snd_cs4281_fm_vol =
1060 .private_value = ((BA0_FMLVC << 16) | BA0_FMRVC), 1064 .private_value = ((BA0_FMLVC << 16) | BA0_FMRVC),
1061}; 1065};
1062 1066
1063static snd_kcontrol_new_t snd_cs4281_pcm_vol = 1067static struct snd_kcontrol_new snd_cs4281_pcm_vol =
1064{ 1068{
1065 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1069 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
1066 .name = "PCM Stream Playback Volume", 1070 .name = "PCM Stream Playback Volume",
@@ -1070,27 +1074,27 @@ static snd_kcontrol_new_t snd_cs4281_pcm_vol =
1070 .private_value = ((BA0_PPLVC << 16) | BA0_PPRVC), 1074 .private_value = ((BA0_PPLVC << 16) | BA0_PPRVC),
1071}; 1075};
1072 1076
1073static void snd_cs4281_mixer_free_ac97_bus(ac97_bus_t *bus) 1077static void snd_cs4281_mixer_free_ac97_bus(struct snd_ac97_bus *bus)
1074{ 1078{
1075 cs4281_t *chip = bus->private_data; 1079 struct cs4281 *chip = bus->private_data;
1076 chip->ac97_bus = NULL; 1080 chip->ac97_bus = NULL;
1077} 1081}
1078 1082
1079static void snd_cs4281_mixer_free_ac97(ac97_t *ac97) 1083static void snd_cs4281_mixer_free_ac97(struct snd_ac97 *ac97)
1080{ 1084{
1081 cs4281_t *chip = ac97->private_data; 1085 struct cs4281 *chip = ac97->private_data;
1082 if (ac97->num) 1086 if (ac97->num)
1083 chip->ac97_secondary = NULL; 1087 chip->ac97_secondary = NULL;
1084 else 1088 else
1085 chip->ac97 = NULL; 1089 chip->ac97 = NULL;
1086} 1090}
1087 1091
1088static int __devinit snd_cs4281_mixer(cs4281_t * chip) 1092static int __devinit snd_cs4281_mixer(struct cs4281 * chip)
1089{ 1093{
1090 snd_card_t *card = chip->card; 1094 struct snd_card *card = chip->card;
1091 ac97_template_t ac97; 1095 struct snd_ac97_template ac97;
1092 int err; 1096 int err;
1093 static ac97_bus_ops_t ops = { 1097 static struct snd_ac97_bus_ops ops = {
1094 .write = snd_cs4281_ac97_write, 1098 .write = snd_cs4281_ac97_write,
1095 .read = snd_cs4281_ac97_read, 1099 .read = snd_cs4281_ac97_read,
1096 }; 1100 };
@@ -1121,22 +1125,23 @@ static int __devinit snd_cs4281_mixer(cs4281_t * chip)
1121 * proc interface 1125 * proc interface
1122 */ 1126 */
1123 1127
1124static void snd_cs4281_proc_read(snd_info_entry_t *entry, 1128static void snd_cs4281_proc_read(struct snd_info_entry *entry,
1125 snd_info_buffer_t * buffer) 1129 struct snd_info_buffer *buffer)
1126{ 1130{
1127 cs4281_t *chip = entry->private_data; 1131 struct cs4281 *chip = entry->private_data;
1128 1132
1129 snd_iprintf(buffer, "Cirrus Logic CS4281\n\n"); 1133 snd_iprintf(buffer, "Cirrus Logic CS4281\n\n");
1130 snd_iprintf(buffer, "Spurious half IRQs : %u\n", chip->spurious_dhtc_irq); 1134 snd_iprintf(buffer, "Spurious half IRQs : %u\n", chip->spurious_dhtc_irq);
1131 snd_iprintf(buffer, "Spurious end IRQs : %u\n", chip->spurious_dtc_irq); 1135 snd_iprintf(buffer, "Spurious end IRQs : %u\n", chip->spurious_dtc_irq);
1132} 1136}
1133 1137
1134static long snd_cs4281_BA0_read(snd_info_entry_t *entry, void *file_private_data, 1138static long snd_cs4281_BA0_read(struct snd_info_entry *entry,
1139 void *file_private_data,
1135 struct file *file, char __user *buf, 1140 struct file *file, char __user *buf,
1136 unsigned long count, unsigned long pos) 1141 unsigned long count, unsigned long pos)
1137{ 1142{
1138 long size; 1143 long size;
1139 cs4281_t *chip = entry->private_data; 1144 struct cs4281 *chip = entry->private_data;
1140 1145
1141 size = count; 1146 size = count;
1142 if (pos + size > CS4281_BA0_SIZE) 1147 if (pos + size > CS4281_BA0_SIZE)
@@ -1148,12 +1153,13 @@ static long snd_cs4281_BA0_read(snd_info_entry_t *entry, void *file_private_data
1148 return size; 1153 return size;
1149} 1154}
1150 1155
1151static long snd_cs4281_BA1_read(snd_info_entry_t *entry, void *file_private_data, 1156static long snd_cs4281_BA1_read(struct snd_info_entry *entry,
1157 void *file_private_data,
1152 struct file *file, char __user *buf, 1158 struct file *file, char __user *buf,
1153 unsigned long count, unsigned long pos) 1159 unsigned long count, unsigned long pos)
1154{ 1160{
1155 long size; 1161 long size;
1156 cs4281_t *chip = entry->private_data; 1162 struct cs4281 *chip = entry->private_data;
1157 1163
1158 size = count; 1164 size = count;
1159 if (pos + size > CS4281_BA1_SIZE) 1165 if (pos + size > CS4281_BA1_SIZE)
@@ -1173,9 +1179,9 @@ static struct snd_info_entry_ops snd_cs4281_proc_ops_BA1 = {
1173 .read = snd_cs4281_BA1_read, 1179 .read = snd_cs4281_BA1_read,
1174}; 1180};
1175 1181
1176static void __devinit snd_cs4281_proc_init(cs4281_t * chip) 1182static void __devinit snd_cs4281_proc_init(struct cs4281 * chip)
1177{ 1183{
1178 snd_info_entry_t *entry; 1184 struct snd_info_entry *entry;
1179 1185
1180 if (! snd_card_proc_new(chip->card, "cs4281", &entry)) 1186 if (! snd_card_proc_new(chip->card, "cs4281", &entry))
1181 snd_info_set_text_ops(entry, chip, 1024, snd_cs4281_proc_read); 1187 snd_info_set_text_ops(entry, chip, 1024, snd_cs4281_proc_read);
@@ -1201,7 +1207,7 @@ static void __devinit snd_cs4281_proc_init(cs4281_t * chip)
1201 1207
1202static void snd_cs4281_gameport_trigger(struct gameport *gameport) 1208static void snd_cs4281_gameport_trigger(struct gameport *gameport)
1203{ 1209{
1204 cs4281_t *chip = gameport_get_port_data(gameport); 1210 struct cs4281 *chip = gameport_get_port_data(gameport);
1205 1211
1206 snd_assert(chip, return); 1212 snd_assert(chip, return);
1207 snd_cs4281_pokeBA0(chip, BA0_JSPT, 0xff); 1213 snd_cs4281_pokeBA0(chip, BA0_JSPT, 0xff);
@@ -1209,16 +1215,17 @@ static void snd_cs4281_gameport_trigger(struct gameport *gameport)
1209 1215
1210static unsigned char snd_cs4281_gameport_read(struct gameport *gameport) 1216static unsigned char snd_cs4281_gameport_read(struct gameport *gameport)
1211{ 1217{
1212 cs4281_t *chip = gameport_get_port_data(gameport); 1218 struct cs4281 *chip = gameport_get_port_data(gameport);
1213 1219
1214 snd_assert(chip, return 0); 1220 snd_assert(chip, return 0);
1215 return snd_cs4281_peekBA0(chip, BA0_JSPT); 1221 return snd_cs4281_peekBA0(chip, BA0_JSPT);
1216} 1222}
1217 1223
1218#ifdef COOKED_MODE 1224#ifdef COOKED_MODE
1219static int snd_cs4281_gameport_cooked_read(struct gameport *gameport, int *axes, int *buttons) 1225static int snd_cs4281_gameport_cooked_read(struct gameport *gameport,
1226 int *axes, int *buttons)
1220{ 1227{
1221 cs4281_t *chip = gameport_get_port_data(gameport); 1228 struct cs4281 *chip = gameport_get_port_data(gameport);
1222 unsigned js1, js2, jst; 1229 unsigned js1, js2, jst;
1223 1230
1224 snd_assert(chip, return 0); 1231 snd_assert(chip, return 0);
@@ -1257,7 +1264,7 @@ static int snd_cs4281_gameport_open(struct gameport *gameport, int mode)
1257 return 0; 1264 return 0;
1258} 1265}
1259 1266
1260static int __devinit snd_cs4281_create_gameport(cs4281_t *chip) 1267static int __devinit snd_cs4281_create_gameport(struct cs4281 *chip)
1261{ 1268{
1262 struct gameport *gp; 1269 struct gameport *gp;
1263 1270
@@ -1284,7 +1291,7 @@ static int __devinit snd_cs4281_create_gameport(cs4281_t *chip)
1284 return 0; 1291 return 0;
1285} 1292}
1286 1293
1287static void snd_cs4281_free_gameport(cs4281_t *chip) 1294static void snd_cs4281_free_gameport(struct cs4281 *chip)
1288{ 1295{
1289 if (chip->gameport) { 1296 if (chip->gameport) {
1290 gameport_unregister_port(chip->gameport); 1297 gameport_unregister_port(chip->gameport);
@@ -1292,11 +1299,11 @@ static void snd_cs4281_free_gameport(cs4281_t *chip)
1292 } 1299 }
1293} 1300}
1294#else 1301#else
1295static inline int snd_cs4281_create_gameport(cs4281_t *chip) { return -ENOSYS; } 1302static inline int snd_cs4281_create_gameport(struct cs4281 *chip) { return -ENOSYS; }
1296static inline void snd_cs4281_free_gameport(cs4281_t *chip) { } 1303static inline void snd_cs4281_free_gameport(struct cs4281 *chip) { }
1297#endif /* CONFIG_GAMEPORT || (MODULE && CONFIG_GAMEPORT_MODULE) */ 1304#endif /* CONFIG_GAMEPORT || (MODULE && CONFIG_GAMEPORT_MODULE) */
1298 1305
1299static int snd_cs4281_free(cs4281_t *chip) 1306static int snd_cs4281_free(struct cs4281 *chip)
1300{ 1307{
1301 snd_cs4281_free_gameport(chip); 1308 snd_cs4281_free_gameport(chip);
1302 1309
@@ -1313,7 +1320,7 @@ static int snd_cs4281_free(cs4281_t *chip)
1313 pci_set_power_state(chip->pci, 3); 1320 pci_set_power_state(chip->pci, 3);
1314 1321
1315 if (chip->irq >= 0) 1322 if (chip->irq >= 0)
1316 free_irq(chip->irq, (void *)chip); 1323 free_irq(chip->irq, chip);
1317 if (chip->ba0) 1324 if (chip->ba0)
1318 iounmap(chip->ba0); 1325 iounmap(chip->ba0);
1319 if (chip->ba1) 1326 if (chip->ba1)
@@ -1325,27 +1332,27 @@ static int snd_cs4281_free(cs4281_t *chip)
1325 return 0; 1332 return 0;
1326} 1333}
1327 1334
1328static int snd_cs4281_dev_free(snd_device_t *device) 1335static int snd_cs4281_dev_free(struct snd_device *device)
1329{ 1336{
1330 cs4281_t *chip = device->device_data; 1337 struct cs4281 *chip = device->device_data;
1331 return snd_cs4281_free(chip); 1338 return snd_cs4281_free(chip);
1332} 1339}
1333 1340
1334static int snd_cs4281_chip_init(cs4281_t *chip); /* defined below */ 1341static int snd_cs4281_chip_init(struct cs4281 *chip); /* defined below */
1335#ifdef CONFIG_PM 1342#ifdef CONFIG_PM
1336static int cs4281_suspend(snd_card_t *card, pm_message_t state); 1343static int cs4281_suspend(struct snd_card *card, pm_message_t state);
1337static int cs4281_resume(snd_card_t *card); 1344static int cs4281_resume(struct snd_card *card);
1338#endif 1345#endif
1339 1346
1340static int __devinit snd_cs4281_create(snd_card_t * card, 1347static int __devinit snd_cs4281_create(struct snd_card *card,
1341 struct pci_dev *pci, 1348 struct pci_dev *pci,
1342 cs4281_t ** rchip, 1349 struct cs4281 ** rchip,
1343 int dual_codec) 1350 int dual_codec)
1344{ 1351{
1345 cs4281_t *chip; 1352 struct cs4281 *chip;
1346 unsigned int tmp; 1353 unsigned int tmp;
1347 int err; 1354 int err;
1348 static snd_device_ops_t ops = { 1355 static struct snd_device_ops ops = {
1349 .dev_free = snd_cs4281_dev_free, 1356 .dev_free = snd_cs4281_dev_free,
1350 }; 1357 };
1351 1358
@@ -1376,7 +1383,8 @@ static int __devinit snd_cs4281_create(snd_card_t * card,
1376 chip->ba0_addr = pci_resource_start(pci, 0); 1383 chip->ba0_addr = pci_resource_start(pci, 0);
1377 chip->ba1_addr = pci_resource_start(pci, 1); 1384 chip->ba1_addr = pci_resource_start(pci, 1);
1378 1385
1379 if (request_irq(pci->irq, snd_cs4281_interrupt, SA_INTERRUPT|SA_SHIRQ, "CS4281", (void *)chip)) { 1386 if (request_irq(pci->irq, snd_cs4281_interrupt, SA_INTERRUPT|SA_SHIRQ,
1387 "CS4281", chip)) {
1380 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1388 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
1381 snd_cs4281_free(chip); 1389 snd_cs4281_free(chip);
1382 return -ENOMEM; 1390 return -ENOMEM;
@@ -1411,7 +1419,7 @@ static int __devinit snd_cs4281_create(snd_card_t * card,
1411 return 0; 1419 return 0;
1412} 1420}
1413 1421
1414static int snd_cs4281_chip_init(cs4281_t *chip) 1422static int snd_cs4281_chip_init(struct cs4281 *chip)
1415{ 1423{
1416 unsigned int tmp; 1424 unsigned int tmp;
1417 int timeout; 1425 int timeout;
@@ -1587,7 +1595,7 @@ static int snd_cs4281_chip_init(cs4281_t *chip)
1587 * Initialize DMA structures 1595 * Initialize DMA structures
1588 */ 1596 */
1589 for (tmp = 0; tmp < 4; tmp++) { 1597 for (tmp = 0; tmp < 4; tmp++) {
1590 cs4281_dma_t *dma = &chip->dma[tmp]; 1598 struct cs4281_dma *dma = &chip->dma[tmp];
1591 dma->regDBA = BA0_DBA0 + (tmp * 0x10); 1599 dma->regDBA = BA0_DBA0 + (tmp * 0x10);
1592 dma->regDCA = BA0_DCA0 + (tmp * 0x10); 1600 dma->regDCA = BA0_DCA0 + (tmp * 0x10);
1593 dma->regDBC = BA0_DBC0 + (tmp * 0x10); 1601 dma->regDBC = BA0_DBC0 + (tmp * 0x10);
@@ -1644,16 +1652,16 @@ static int snd_cs4281_chip_init(cs4281_t *chip)
1644 * MIDI section 1652 * MIDI section
1645 */ 1653 */
1646 1654
1647static void snd_cs4281_midi_reset(cs4281_t *chip) 1655static void snd_cs4281_midi_reset(struct cs4281 *chip)
1648{ 1656{
1649 snd_cs4281_pokeBA0(chip, BA0_MIDCR, chip->midcr | BA0_MIDCR_MRST); 1657 snd_cs4281_pokeBA0(chip, BA0_MIDCR, chip->midcr | BA0_MIDCR_MRST);
1650 udelay(100); 1658 udelay(100);
1651 snd_cs4281_pokeBA0(chip, BA0_MIDCR, chip->midcr); 1659 snd_cs4281_pokeBA0(chip, BA0_MIDCR, chip->midcr);
1652} 1660}
1653 1661
1654static int snd_cs4281_midi_input_open(snd_rawmidi_substream_t * substream) 1662static int snd_cs4281_midi_input_open(struct snd_rawmidi_substream *substream)
1655{ 1663{
1656 cs4281_t *chip = substream->rmidi->private_data; 1664 struct cs4281 *chip = substream->rmidi->private_data;
1657 1665
1658 spin_lock_irq(&chip->reg_lock); 1666 spin_lock_irq(&chip->reg_lock);
1659 chip->midcr |= BA0_MIDCR_RXE; 1667 chip->midcr |= BA0_MIDCR_RXE;
@@ -1667,9 +1675,9 @@ static int snd_cs4281_midi_input_open(snd_rawmidi_substream_t * substream)
1667 return 0; 1675 return 0;
1668} 1676}
1669 1677
1670static int snd_cs4281_midi_input_close(snd_rawmidi_substream_t * substream) 1678static int snd_cs4281_midi_input_close(struct snd_rawmidi_substream *substream)
1671{ 1679{
1672 cs4281_t *chip = substream->rmidi->private_data; 1680 struct cs4281 *chip = substream->rmidi->private_data;
1673 1681
1674 spin_lock_irq(&chip->reg_lock); 1682 spin_lock_irq(&chip->reg_lock);
1675 chip->midcr &= ~(BA0_MIDCR_RXE | BA0_MIDCR_RIE); 1683 chip->midcr &= ~(BA0_MIDCR_RXE | BA0_MIDCR_RIE);
@@ -1684,9 +1692,9 @@ static int snd_cs4281_midi_input_close(snd_rawmidi_substream_t * substream)
1684 return 0; 1692 return 0;
1685} 1693}
1686 1694
1687static int snd_cs4281_midi_output_open(snd_rawmidi_substream_t * substream) 1695static int snd_cs4281_midi_output_open(struct snd_rawmidi_substream *substream)
1688{ 1696{
1689 cs4281_t *chip = substream->rmidi->private_data; 1697 struct cs4281 *chip = substream->rmidi->private_data;
1690 1698
1691 spin_lock_irq(&chip->reg_lock); 1699 spin_lock_irq(&chip->reg_lock);
1692 chip->uartm |= CS4281_MODE_OUTPUT; 1700 chip->uartm |= CS4281_MODE_OUTPUT;
@@ -1701,9 +1709,9 @@ static int snd_cs4281_midi_output_open(snd_rawmidi_substream_t * substream)
1701 return 0; 1709 return 0;
1702} 1710}
1703 1711
1704static int snd_cs4281_midi_output_close(snd_rawmidi_substream_t * substream) 1712static int snd_cs4281_midi_output_close(struct snd_rawmidi_substream *substream)
1705{ 1713{
1706 cs4281_t *chip = substream->rmidi->private_data; 1714 struct cs4281 *chip = substream->rmidi->private_data;
1707 1715
1708 spin_lock_irq(&chip->reg_lock); 1716 spin_lock_irq(&chip->reg_lock);
1709 chip->midcr &= ~(BA0_MIDCR_TXE | BA0_MIDCR_TIE); 1717 chip->midcr &= ~(BA0_MIDCR_TXE | BA0_MIDCR_TIE);
@@ -1718,10 +1726,10 @@ static int snd_cs4281_midi_output_close(snd_rawmidi_substream_t * substream)
1718 return 0; 1726 return 0;
1719} 1727}
1720 1728
1721static void snd_cs4281_midi_input_trigger(snd_rawmidi_substream_t * substream, int up) 1729static void snd_cs4281_midi_input_trigger(struct snd_rawmidi_substream *substream, int up)
1722{ 1730{
1723 unsigned long flags; 1731 unsigned long flags;
1724 cs4281_t *chip = substream->rmidi->private_data; 1732 struct cs4281 *chip = substream->rmidi->private_data;
1725 1733
1726 spin_lock_irqsave(&chip->reg_lock, flags); 1734 spin_lock_irqsave(&chip->reg_lock, flags);
1727 if (up) { 1735 if (up) {
@@ -1738,10 +1746,10 @@ static void snd_cs4281_midi_input_trigger(snd_rawmidi_substream_t * substream, i
1738 spin_unlock_irqrestore(&chip->reg_lock, flags); 1746 spin_unlock_irqrestore(&chip->reg_lock, flags);
1739} 1747}
1740 1748
1741static void snd_cs4281_midi_output_trigger(snd_rawmidi_substream_t * substream, int up) 1749static void snd_cs4281_midi_output_trigger(struct snd_rawmidi_substream *substream, int up)
1742{ 1750{
1743 unsigned long flags; 1751 unsigned long flags;
1744 cs4281_t *chip = substream->rmidi->private_data; 1752 struct cs4281 *chip = substream->rmidi->private_data;
1745 unsigned char byte; 1753 unsigned char byte;
1746 1754
1747 spin_lock_irqsave(&chip->reg_lock, flags); 1755 spin_lock_irqsave(&chip->reg_lock, flags);
@@ -1768,23 +1776,24 @@ static void snd_cs4281_midi_output_trigger(snd_rawmidi_substream_t * substream,
1768 spin_unlock_irqrestore(&chip->reg_lock, flags); 1776 spin_unlock_irqrestore(&chip->reg_lock, flags);
1769} 1777}
1770 1778
1771static snd_rawmidi_ops_t snd_cs4281_midi_output = 1779static struct snd_rawmidi_ops snd_cs4281_midi_output =
1772{ 1780{
1773 .open = snd_cs4281_midi_output_open, 1781 .open = snd_cs4281_midi_output_open,
1774 .close = snd_cs4281_midi_output_close, 1782 .close = snd_cs4281_midi_output_close,
1775 .trigger = snd_cs4281_midi_output_trigger, 1783 .trigger = snd_cs4281_midi_output_trigger,
1776}; 1784};
1777 1785
1778static snd_rawmidi_ops_t snd_cs4281_midi_input = 1786static struct snd_rawmidi_ops snd_cs4281_midi_input =
1779{ 1787{
1780 .open = snd_cs4281_midi_input_open, 1788 .open = snd_cs4281_midi_input_open,
1781 .close = snd_cs4281_midi_input_close, 1789 .close = snd_cs4281_midi_input_close,
1782 .trigger = snd_cs4281_midi_input_trigger, 1790 .trigger = snd_cs4281_midi_input_trigger,
1783}; 1791};
1784 1792
1785static int __devinit snd_cs4281_midi(cs4281_t * chip, int device, snd_rawmidi_t **rrawmidi) 1793static int __devinit snd_cs4281_midi(struct cs4281 * chip, int device,
1794 struct snd_rawmidi **rrawmidi)
1786{ 1795{
1787 snd_rawmidi_t *rmidi; 1796 struct snd_rawmidi *rmidi;
1788 int err; 1797 int err;
1789 1798
1790 if (rrawmidi) 1799 if (rrawmidi)
@@ -1808,9 +1817,9 @@ static int __devinit snd_cs4281_midi(cs4281_t * chip, int device, snd_rawmidi_t
1808 1817
1809static irqreturn_t snd_cs4281_interrupt(int irq, void *dev_id, struct pt_regs *regs) 1818static irqreturn_t snd_cs4281_interrupt(int irq, void *dev_id, struct pt_regs *regs)
1810{ 1819{
1811 cs4281_t *chip = dev_id; 1820 struct cs4281 *chip = dev_id;
1812 unsigned int status, dma, val; 1821 unsigned int status, dma, val;
1813 cs4281_dma_t *cdma; 1822 struct cs4281_dma *cdma;
1814 1823
1815 if (chip == NULL) 1824 if (chip == NULL)
1816 return IRQ_NONE; 1825 return IRQ_NONE;
@@ -1880,10 +1889,11 @@ static irqreturn_t snd_cs4281_interrupt(int irq, void *dev_id, struct pt_regs *r
1880/* 1889/*
1881 * OPL3 command 1890 * OPL3 command
1882 */ 1891 */
1883static void snd_cs4281_opl3_command(opl3_t * opl3, unsigned short cmd, unsigned char val) 1892static void snd_cs4281_opl3_command(struct snd_opl3 *opl3, unsigned short cmd,
1893 unsigned char val)
1884{ 1894{
1885 unsigned long flags; 1895 unsigned long flags;
1886 cs4281_t *chip = opl3->private_data; 1896 struct cs4281 *chip = opl3->private_data;
1887 void __iomem *port; 1897 void __iomem *port;
1888 1898
1889 if (cmd & OPL3_RIGHT) 1899 if (cmd & OPL3_RIGHT)
@@ -1906,9 +1916,9 @@ static int __devinit snd_cs4281_probe(struct pci_dev *pci,
1906 const struct pci_device_id *pci_id) 1916 const struct pci_device_id *pci_id)
1907{ 1917{
1908 static int dev; 1918 static int dev;
1909 snd_card_t *card; 1919 struct snd_card *card;
1910 cs4281_t *chip; 1920 struct cs4281 *chip;
1911 opl3_t *opl3; 1921 struct snd_opl3 *opl3;
1912 int err; 1922 int err;
1913 1923
1914 if (dev >= SNDRV_CARDS) 1924 if (dev >= SNDRV_CARDS)
@@ -1997,9 +2007,9 @@ static int saved_regs[SUSPEND_REGISTERS] = {
1997 2007
1998#define CLKCR1_CKRA 0x00010000L 2008#define CLKCR1_CKRA 0x00010000L
1999 2009
2000static int cs4281_suspend(snd_card_t *card, pm_message_t state) 2010static int cs4281_suspend(struct snd_card *card, pm_message_t state)
2001{ 2011{
2002 cs4281_t *chip = card->pm_private_data; 2012 struct cs4281 *chip = card->pm_private_data;
2003 u32 ulCLK; 2013 u32 ulCLK;
2004 unsigned int i; 2014 unsigned int i;
2005 2015
@@ -2042,9 +2052,9 @@ static int cs4281_suspend(snd_card_t *card, pm_message_t state)
2042 return 0; 2052 return 0;
2043} 2053}
2044 2054
2045static int cs4281_resume(snd_card_t *card) 2055static int cs4281_resume(struct snd_card *card)
2046{ 2056{
2047 cs4281_t *chip = card->pm_private_data; 2057 struct cs4281 *chip = card->pm_private_data;
2048 unsigned int i; 2058 unsigned int i;
2049 u32 ulCLK; 2059 u32 ulCLK;
2050 2060