aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/sonicvibes.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/sonicvibes.c')
-rw-r--r--sound/pci/sonicvibes.c227
1 files changed, 113 insertions, 114 deletions
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index b66459f69c0b..7bbea3738b8a 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -195,9 +195,7 @@ MODULE_PARM_DESC(dmaio, "DDMA i/o base address for S3 SonicVibes soundcard.");
195 195
196 */ 196 */
197 197
198typedef struct _snd_sonicvibes sonicvibes_t; 198struct sonicvibes {
199
200struct _snd_sonicvibes {
201 unsigned long dma1size; 199 unsigned long dma1size;
202 unsigned long dma2size; 200 unsigned long dma2size;
203 int irq; 201 int irq;
@@ -224,20 +222,20 @@ struct _snd_sonicvibes {
224 unsigned int mode; 222 unsigned int mode;
225 223
226 struct pci_dev *pci; 224 struct pci_dev *pci;
227 snd_card_t *card; 225 struct snd_card *card;
228 snd_pcm_t *pcm; 226 struct snd_pcm *pcm;
229 snd_pcm_substream_t *playback_substream; 227 struct snd_pcm_substream *playback_substream;
230 snd_pcm_substream_t *capture_substream; 228 struct snd_pcm_substream *capture_substream;
231 snd_rawmidi_t *rmidi; 229 struct snd_rawmidi *rmidi;
232 snd_hwdep_t *fmsynth; /* S3FM */ 230 struct snd_hwdep *fmsynth; /* S3FM */
233 231
234 spinlock_t reg_lock; 232 spinlock_t reg_lock;
235 233
236 unsigned int p_dma_size; 234 unsigned int p_dma_size;
237 unsigned int c_dma_size; 235 unsigned int c_dma_size;
238 236
239 snd_kcontrol_t *master_mute; 237 struct snd_kcontrol *master_mute;
240 snd_kcontrol_t *master_volume; 238 struct snd_kcontrol *master_volume;
241 239
242#ifdef SUPPORT_JOYSTICK 240#ifdef SUPPORT_JOYSTICK
243 struct gameport *gameport; 241 struct gameport *gameport;
@@ -251,13 +249,13 @@ static struct pci_device_id snd_sonic_ids[] = {
251 249
252MODULE_DEVICE_TABLE(pci, snd_sonic_ids); 250MODULE_DEVICE_TABLE(pci, snd_sonic_ids);
253 251
254static ratden_t sonicvibes_adc_clock = { 252static struct snd_ratden sonicvibes_adc_clock = {
255 .num_min = 4000 * 65536, 253 .num_min = 4000 * 65536,
256 .num_max = 48000UL * 65536, 254 .num_max = 48000UL * 65536,
257 .num_step = 1, 255 .num_step = 1,
258 .den = 65536, 256 .den = 65536,
259}; 257};
260static snd_pcm_hw_constraint_ratdens_t snd_sonicvibes_hw_constraints_adc_clock = { 258static struct snd_pcm_hw_constraint_ratdens snd_sonicvibes_hw_constraints_adc_clock = {
261 .nrats = 1, 259 .nrats = 1,
262 .rats = &sonicvibes_adc_clock, 260 .rats = &sonicvibes_adc_clock,
263}; 261};
@@ -266,7 +264,7 @@ static snd_pcm_hw_constraint_ratdens_t snd_sonicvibes_hw_constraints_adc_clock =
266 * common I/O routines 264 * common I/O routines
267 */ 265 */
268 266
269static inline void snd_sonicvibes_setdmaa(sonicvibes_t * sonic, 267static inline void snd_sonicvibes_setdmaa(struct sonicvibes * sonic,
270 unsigned int addr, 268 unsigned int addr,
271 unsigned int count) 269 unsigned int count)
272{ 270{
@@ -279,7 +277,7 @@ static inline void snd_sonicvibes_setdmaa(sonicvibes_t * sonic,
279#endif 277#endif
280} 278}
281 279
282static inline void snd_sonicvibes_setdmac(sonicvibes_t * sonic, 280static inline void snd_sonicvibes_setdmac(struct sonicvibes * sonic,
283 unsigned int addr, 281 unsigned int addr,
284 unsigned int count) 282 unsigned int count)
285{ 283{
@@ -294,18 +292,18 @@ static inline void snd_sonicvibes_setdmac(sonicvibes_t * sonic,
294#endif 292#endif
295} 293}
296 294
297static inline unsigned int snd_sonicvibes_getdmaa(sonicvibes_t * sonic) 295static inline unsigned int snd_sonicvibes_getdmaa(struct sonicvibes * sonic)
298{ 296{
299 return (inl(sonic->dmaa_port + SV_DMA_COUNT0) & 0xffffff) + 1; 297 return (inl(sonic->dmaa_port + SV_DMA_COUNT0) & 0xffffff) + 1;
300} 298}
301 299
302static inline unsigned int snd_sonicvibes_getdmac(sonicvibes_t * sonic) 300static inline unsigned int snd_sonicvibes_getdmac(struct sonicvibes * sonic)
303{ 301{
304 /* note: dmac is working in word mode!!! */ 302 /* note: dmac is working in word mode!!! */
305 return ((inl(sonic->dmac_port + SV_DMA_COUNT0) & 0xffffff) + 1) << 1; 303 return ((inl(sonic->dmac_port + SV_DMA_COUNT0) & 0xffffff) + 1) << 1;
306} 304}
307 305
308static void snd_sonicvibes_out1(sonicvibes_t * sonic, 306static void snd_sonicvibes_out1(struct sonicvibes * sonic,
309 unsigned char reg, 307 unsigned char reg,
310 unsigned char value) 308 unsigned char value)
311{ 309{
@@ -315,7 +313,7 @@ static void snd_sonicvibes_out1(sonicvibes_t * sonic,
315 udelay(10); 313 udelay(10);
316} 314}
317 315
318static void snd_sonicvibes_out(sonicvibes_t * sonic, 316static void snd_sonicvibes_out(struct sonicvibes * sonic,
319 unsigned char reg, 317 unsigned char reg,
320 unsigned char value) 318 unsigned char value)
321{ 319{
@@ -329,7 +327,7 @@ static void snd_sonicvibes_out(sonicvibes_t * sonic,
329 spin_unlock_irqrestore(&sonic->reg_lock, flags); 327 spin_unlock_irqrestore(&sonic->reg_lock, flags);
330} 328}
331 329
332static unsigned char snd_sonicvibes_in1(sonicvibes_t * sonic, unsigned char reg) 330static unsigned char snd_sonicvibes_in1(struct sonicvibes * sonic, unsigned char reg)
333{ 331{
334 unsigned char value; 332 unsigned char value;
335 333
@@ -340,7 +338,7 @@ static unsigned char snd_sonicvibes_in1(sonicvibes_t * sonic, unsigned char reg)
340 return value; 338 return value;
341} 339}
342 340
343static unsigned char snd_sonicvibes_in(sonicvibes_t * sonic, unsigned char reg) 341static unsigned char snd_sonicvibes_in(struct sonicvibes * sonic, unsigned char reg)
344{ 342{
345 unsigned long flags; 343 unsigned long flags;
346 unsigned char value; 344 unsigned char value;
@@ -355,7 +353,7 @@ static unsigned char snd_sonicvibes_in(sonicvibes_t * sonic, unsigned char reg)
355} 353}
356 354
357#if 0 355#if 0
358static void snd_sonicvibes_debug(sonicvibes_t * sonic) 356static void snd_sonicvibes_debug(struct sonicvibes * sonic)
359{ 357{
360 printk("SV REGS: INDEX = 0x%02x ", inb(SV_REG(sonic, INDEX))); 358 printk("SV REGS: INDEX = 0x%02x ", inb(SV_REG(sonic, INDEX)));
361 printk(" STATUS = 0x%02x\n", inb(SV_REG(sonic, STATUS))); 359 printk(" STATUS = 0x%02x\n", inb(SV_REG(sonic, STATUS)));
@@ -427,7 +425,7 @@ static void snd_sonicvibes_debug(sonicvibes_t * sonic)
427 425
428#endif 426#endif
429 427
430static void snd_sonicvibes_setfmt(sonicvibes_t * sonic, 428static void snd_sonicvibes_setfmt(struct sonicvibes * sonic,
431 unsigned char mask, 429 unsigned char mask,
432 unsigned char value) 430 unsigned char value)
433{ 431{
@@ -483,7 +481,7 @@ static void snd_sonicvibes_pll(unsigned int rate,
483#endif 481#endif
484} 482}
485 483
486static void snd_sonicvibes_setpll(sonicvibes_t * sonic, 484static void snd_sonicvibes_setpll(struct sonicvibes * sonic,
487 unsigned char reg, 485 unsigned char reg,
488 unsigned int rate) 486 unsigned int rate)
489{ 487{
@@ -499,7 +497,7 @@ static void snd_sonicvibes_setpll(sonicvibes_t * sonic,
499 } 497 }
500} 498}
501 499
502static void snd_sonicvibes_set_adc_rate(sonicvibes_t * sonic, unsigned int rate) 500static void snd_sonicvibes_set_adc_rate(struct sonicvibes * sonic, unsigned int rate)
503{ 501{
504 unsigned long flags; 502 unsigned long flags;
505 unsigned int div; 503 unsigned int div;
@@ -520,8 +518,8 @@ static void snd_sonicvibes_set_adc_rate(sonicvibes_t * sonic, unsigned int rate)
520 spin_unlock_irqrestore(&sonic->reg_lock, flags); 518 spin_unlock_irqrestore(&sonic->reg_lock, flags);
521} 519}
522 520
523static int snd_sonicvibes_hw_constraint_dac_rate(snd_pcm_hw_params_t *params, 521static int snd_sonicvibes_hw_constraint_dac_rate(struct snd_pcm_hw_params *params,
524 snd_pcm_hw_rule_t *rule) 522 struct snd_pcm_hw_rule *rule)
525{ 523{
526 unsigned int rate, div, r, m, n; 524 unsigned int rate, div, r, m, n;
527 525
@@ -545,7 +543,7 @@ static int snd_sonicvibes_hw_constraint_dac_rate(snd_pcm_hw_params_t *params,
545 return 0; 543 return 0;
546} 544}
547 545
548static void snd_sonicvibes_set_dac_rate(sonicvibes_t * sonic, unsigned int rate) 546static void snd_sonicvibes_set_dac_rate(struct sonicvibes * sonic, unsigned int rate)
549{ 547{
550 unsigned int div; 548 unsigned int div;
551 unsigned long flags; 549 unsigned long flags;
@@ -559,7 +557,7 @@ static void snd_sonicvibes_set_dac_rate(sonicvibes_t * sonic, unsigned int rate)
559 spin_unlock_irqrestore(&sonic->reg_lock, flags); 557 spin_unlock_irqrestore(&sonic->reg_lock, flags);
560} 558}
561 559
562static int snd_sonicvibes_trigger(sonicvibes_t * sonic, int what, int cmd) 560static int snd_sonicvibes_trigger(struct sonicvibes * sonic, int what, int cmd)
563{ 561{
564 int result = 0; 562 int result = 0;
565 563
@@ -583,7 +581,7 @@ static int snd_sonicvibes_trigger(sonicvibes_t * sonic, int what, int cmd)
583 581
584static irqreturn_t snd_sonicvibes_interrupt(int irq, void *dev_id, struct pt_regs *regs) 582static irqreturn_t snd_sonicvibes_interrupt(int irq, void *dev_id, struct pt_regs *regs)
585{ 583{
586 sonicvibes_t *sonic = dev_id; 584 struct sonicvibes *sonic = dev_id;
587 unsigned char status; 585 unsigned char status;
588 586
589 status = inb(SV_REG(sonic, STATUS)); 587 status = inb(SV_REG(sonic, STATUS));
@@ -646,35 +644,35 @@ static irqreturn_t snd_sonicvibes_interrupt(int irq, void *dev_id, struct pt_reg
646 * PCM part 644 * PCM part
647 */ 645 */
648 646
649static int snd_sonicvibes_playback_trigger(snd_pcm_substream_t * substream, 647static int snd_sonicvibes_playback_trigger(struct snd_pcm_substream *substream,
650 int cmd) 648 int cmd)
651{ 649{
652 sonicvibes_t *sonic = snd_pcm_substream_chip(substream); 650 struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
653 return snd_sonicvibes_trigger(sonic, 1, cmd); 651 return snd_sonicvibes_trigger(sonic, 1, cmd);
654} 652}
655 653
656static int snd_sonicvibes_capture_trigger(snd_pcm_substream_t * substream, 654static int snd_sonicvibes_capture_trigger(struct snd_pcm_substream *substream,
657 int cmd) 655 int cmd)
658{ 656{
659 sonicvibes_t *sonic = snd_pcm_substream_chip(substream); 657 struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
660 return snd_sonicvibes_trigger(sonic, 2, cmd); 658 return snd_sonicvibes_trigger(sonic, 2, cmd);
661} 659}
662 660
663static int snd_sonicvibes_hw_params(snd_pcm_substream_t * substream, 661static int snd_sonicvibes_hw_params(struct snd_pcm_substream *substream,
664 snd_pcm_hw_params_t * hw_params) 662 struct snd_pcm_hw_params *hw_params)
665{ 663{
666 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); 664 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
667} 665}
668 666
669static int snd_sonicvibes_hw_free(snd_pcm_substream_t * substream) 667static int snd_sonicvibes_hw_free(struct snd_pcm_substream *substream)
670{ 668{
671 return snd_pcm_lib_free_pages(substream); 669 return snd_pcm_lib_free_pages(substream);
672} 670}
673 671
674static int snd_sonicvibes_playback_prepare(snd_pcm_substream_t * substream) 672static int snd_sonicvibes_playback_prepare(struct snd_pcm_substream *substream)
675{ 673{
676 sonicvibes_t *sonic = snd_pcm_substream_chip(substream); 674 struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
677 snd_pcm_runtime_t *runtime = substream->runtime; 675 struct snd_pcm_runtime *runtime = substream->runtime;
678 unsigned char fmt = 0; 676 unsigned char fmt = 0;
679 unsigned int size = snd_pcm_lib_buffer_bytes(substream); 677 unsigned int size = snd_pcm_lib_buffer_bytes(substream);
680 unsigned int count = snd_pcm_lib_period_bytes(substream); 678 unsigned int count = snd_pcm_lib_period_bytes(substream);
@@ -695,10 +693,10 @@ static int snd_sonicvibes_playback_prepare(snd_pcm_substream_t * substream)
695 return 0; 693 return 0;
696} 694}
697 695
698static int snd_sonicvibes_capture_prepare(snd_pcm_substream_t * substream) 696static int snd_sonicvibes_capture_prepare(struct snd_pcm_substream *substream)
699{ 697{
700 sonicvibes_t *sonic = snd_pcm_substream_chip(substream); 698 struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
701 snd_pcm_runtime_t *runtime = substream->runtime; 699 struct snd_pcm_runtime *runtime = substream->runtime;
702 unsigned char fmt = 0; 700 unsigned char fmt = 0;
703 unsigned int size = snd_pcm_lib_buffer_bytes(substream); 701 unsigned int size = snd_pcm_lib_buffer_bytes(substream);
704 unsigned int count = snd_pcm_lib_period_bytes(substream); 702 unsigned int count = snd_pcm_lib_period_bytes(substream);
@@ -720,9 +718,9 @@ static int snd_sonicvibes_capture_prepare(snd_pcm_substream_t * substream)
720 return 0; 718 return 0;
721} 719}
722 720
723static snd_pcm_uframes_t snd_sonicvibes_playback_pointer(snd_pcm_substream_t * substream) 721static snd_pcm_uframes_t snd_sonicvibes_playback_pointer(struct snd_pcm_substream *substream)
724{ 722{
725 sonicvibes_t *sonic = snd_pcm_substream_chip(substream); 723 struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
726 size_t ptr; 724 size_t ptr;
727 725
728 if (!(sonic->enable & 1)) 726 if (!(sonic->enable & 1))
@@ -731,9 +729,9 @@ static snd_pcm_uframes_t snd_sonicvibes_playback_pointer(snd_pcm_substream_t * s
731 return bytes_to_frames(substream->runtime, ptr); 729 return bytes_to_frames(substream->runtime, ptr);
732} 730}
733 731
734static snd_pcm_uframes_t snd_sonicvibes_capture_pointer(snd_pcm_substream_t * substream) 732static snd_pcm_uframes_t snd_sonicvibes_capture_pointer(struct snd_pcm_substream *substream)
735{ 733{
736 sonicvibes_t *sonic = snd_pcm_substream_chip(substream); 734 struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
737 size_t ptr; 735 size_t ptr;
738 if (!(sonic->enable & 2)) 736 if (!(sonic->enable & 2))
739 return 0; 737 return 0;
@@ -741,7 +739,7 @@ static snd_pcm_uframes_t snd_sonicvibes_capture_pointer(snd_pcm_substream_t * su
741 return bytes_to_frames(substream->runtime, ptr); 739 return bytes_to_frames(substream->runtime, ptr);
742} 740}
743 741
744static snd_pcm_hardware_t snd_sonicvibes_playback = 742static struct snd_pcm_hardware snd_sonicvibes_playback =
745{ 743{
746 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 744 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
747 SNDRV_PCM_INFO_BLOCK_TRANSFER | 745 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -760,7 +758,7 @@ static snd_pcm_hardware_t snd_sonicvibes_playback =
760 .fifo_size = 0, 758 .fifo_size = 0,
761}; 759};
762 760
763static snd_pcm_hardware_t snd_sonicvibes_capture = 761static struct snd_pcm_hardware snd_sonicvibes_capture =
764{ 762{
765 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 763 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
766 SNDRV_PCM_INFO_BLOCK_TRANSFER | 764 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -779,10 +777,10 @@ static snd_pcm_hardware_t snd_sonicvibes_capture =
779 .fifo_size = 0, 777 .fifo_size = 0,
780}; 778};
781 779
782static int snd_sonicvibes_playback_open(snd_pcm_substream_t * substream) 780static int snd_sonicvibes_playback_open(struct snd_pcm_substream *substream)
783{ 781{
784 sonicvibes_t *sonic = snd_pcm_substream_chip(substream); 782 struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
785 snd_pcm_runtime_t *runtime = substream->runtime; 783 struct snd_pcm_runtime *runtime = substream->runtime;
786 784
787 sonic->mode |= SV_MODE_PLAY; 785 sonic->mode |= SV_MODE_PLAY;
788 sonic->playback_substream = substream; 786 sonic->playback_substream = substream;
@@ -791,10 +789,10 @@ static int snd_sonicvibes_playback_open(snd_pcm_substream_t * substream)
791 return 0; 789 return 0;
792} 790}
793 791
794static int snd_sonicvibes_capture_open(snd_pcm_substream_t * substream) 792static int snd_sonicvibes_capture_open(struct snd_pcm_substream *substream)
795{ 793{
796 sonicvibes_t *sonic = snd_pcm_substream_chip(substream); 794 struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
797 snd_pcm_runtime_t *runtime = substream->runtime; 795 struct snd_pcm_runtime *runtime = substream->runtime;
798 796
799 sonic->mode |= SV_MODE_CAPTURE; 797 sonic->mode |= SV_MODE_CAPTURE;
800 sonic->capture_substream = substream; 798 sonic->capture_substream = substream;
@@ -804,25 +802,25 @@ static int snd_sonicvibes_capture_open(snd_pcm_substream_t * substream)
804 return 0; 802 return 0;
805} 803}
806 804
807static int snd_sonicvibes_playback_close(snd_pcm_substream_t * substream) 805static int snd_sonicvibes_playback_close(struct snd_pcm_substream *substream)
808{ 806{
809 sonicvibes_t *sonic = snd_pcm_substream_chip(substream); 807 struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
810 808
811 sonic->playback_substream = NULL; 809 sonic->playback_substream = NULL;
812 sonic->mode &= ~SV_MODE_PLAY; 810 sonic->mode &= ~SV_MODE_PLAY;
813 return 0; 811 return 0;
814} 812}
815 813
816static int snd_sonicvibes_capture_close(snd_pcm_substream_t * substream) 814static int snd_sonicvibes_capture_close(struct snd_pcm_substream *substream)
817{ 815{
818 sonicvibes_t *sonic = snd_pcm_substream_chip(substream); 816 struct sonicvibes *sonic = snd_pcm_substream_chip(substream);
819 817
820 sonic->capture_substream = NULL; 818 sonic->capture_substream = NULL;
821 sonic->mode &= ~SV_MODE_CAPTURE; 819 sonic->mode &= ~SV_MODE_CAPTURE;
822 return 0; 820 return 0;
823} 821}
824 822
825static snd_pcm_ops_t snd_sonicvibes_playback_ops = { 823static struct snd_pcm_ops snd_sonicvibes_playback_ops = {
826 .open = snd_sonicvibes_playback_open, 824 .open = snd_sonicvibes_playback_open,
827 .close = snd_sonicvibes_playback_close, 825 .close = snd_sonicvibes_playback_close,
828 .ioctl = snd_pcm_lib_ioctl, 826 .ioctl = snd_pcm_lib_ioctl,
@@ -833,7 +831,7 @@ static snd_pcm_ops_t snd_sonicvibes_playback_ops = {
833 .pointer = snd_sonicvibes_playback_pointer, 831 .pointer = snd_sonicvibes_playback_pointer,
834}; 832};
835 833
836static snd_pcm_ops_t snd_sonicvibes_capture_ops = { 834static struct snd_pcm_ops snd_sonicvibes_capture_ops = {
837 .open = snd_sonicvibes_capture_open, 835 .open = snd_sonicvibes_capture_open,
838 .close = snd_sonicvibes_capture_close, 836 .close = snd_sonicvibes_capture_close,
839 .ioctl = snd_pcm_lib_ioctl, 837 .ioctl = snd_pcm_lib_ioctl,
@@ -844,9 +842,9 @@ static snd_pcm_ops_t snd_sonicvibes_capture_ops = {
844 .pointer = snd_sonicvibes_capture_pointer, 842 .pointer = snd_sonicvibes_capture_pointer,
845}; 843};
846 844
847static int __devinit snd_sonicvibes_pcm(sonicvibes_t * sonic, int device, snd_pcm_t ** rpcm) 845static int __devinit snd_sonicvibes_pcm(struct sonicvibes * sonic, int device, struct snd_pcm ** rpcm)
848{ 846{
849 snd_pcm_t *pcm; 847 struct snd_pcm *pcm;
850 int err; 848 int err;
851 849
852 if ((err = snd_pcm_new(sonic->card, "s3_86c617", device, 1, 1, &pcm)) < 0) 850 if ((err = snd_pcm_new(sonic->card, "s3_86c617", device, 1, 1, &pcm)) < 0)
@@ -878,7 +876,7 @@ static int __devinit snd_sonicvibes_pcm(sonicvibes_t * sonic, int device, snd_pc
878 .info = snd_sonicvibes_info_mux, \ 876 .info = snd_sonicvibes_info_mux, \
879 .get = snd_sonicvibes_get_mux, .put = snd_sonicvibes_put_mux } 877 .get = snd_sonicvibes_get_mux, .put = snd_sonicvibes_put_mux }
880 878
881static int snd_sonicvibes_info_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 879static int snd_sonicvibes_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
882{ 880{
883 static char *texts[7] = { 881 static char *texts[7] = {
884 "CD", "PCM", "Aux1", "Line", "Aux0", "Mic", "Mix" 882 "CD", "PCM", "Aux1", "Line", "Aux0", "Mic", "Mix"
@@ -893,9 +891,9 @@ static int snd_sonicvibes_info_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
893 return 0; 891 return 0;
894} 892}
895 893
896static int snd_sonicvibes_get_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 894static int snd_sonicvibes_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
897{ 895{
898 sonicvibes_t *sonic = snd_kcontrol_chip(kcontrol); 896 struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
899 897
900 spin_lock_irq(&sonic->reg_lock); 898 spin_lock_irq(&sonic->reg_lock);
901 ucontrol->value.enumerated.item[0] = ((snd_sonicvibes_in1(sonic, SV_IREG_LEFT_ADC) & SV_RECSRC_OUT) >> 5) - 1; 899 ucontrol->value.enumerated.item[0] = ((snd_sonicvibes_in1(sonic, SV_IREG_LEFT_ADC) & SV_RECSRC_OUT) >> 5) - 1;
@@ -904,9 +902,9 @@ static int snd_sonicvibes_get_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_
904 return 0; 902 return 0;
905} 903}
906 904
907static int snd_sonicvibes_put_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 905static int snd_sonicvibes_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
908{ 906{
909 sonicvibes_t *sonic = snd_kcontrol_chip(kcontrol); 907 struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
910 unsigned short left, right, oval1, oval2; 908 unsigned short left, right, oval1, oval2;
911 int change; 909 int change;
912 910
@@ -933,7 +931,7 @@ static int snd_sonicvibes_put_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_
933 .get = snd_sonicvibes_get_single, .put = snd_sonicvibes_put_single, \ 931 .get = snd_sonicvibes_get_single, .put = snd_sonicvibes_put_single, \
934 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } 932 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) }
935 933
936static int snd_sonicvibes_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 934static int snd_sonicvibes_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
937{ 935{
938 int mask = (kcontrol->private_value >> 16) & 0xff; 936 int mask = (kcontrol->private_value >> 16) & 0xff;
939 937
@@ -944,9 +942,9 @@ static int snd_sonicvibes_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_inf
944 return 0; 942 return 0;
945} 943}
946 944
947static int snd_sonicvibes_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 945static int snd_sonicvibes_get_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
948{ 946{
949 sonicvibes_t *sonic = snd_kcontrol_chip(kcontrol); 947 struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
950 int reg = kcontrol->private_value & 0xff; 948 int reg = kcontrol->private_value & 0xff;
951 int shift = (kcontrol->private_value >> 8) & 0xff; 949 int shift = (kcontrol->private_value >> 8) & 0xff;
952 int mask = (kcontrol->private_value >> 16) & 0xff; 950 int mask = (kcontrol->private_value >> 16) & 0xff;
@@ -960,9 +958,9 @@ static int snd_sonicvibes_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_val
960 return 0; 958 return 0;
961} 959}
962 960
963static int snd_sonicvibes_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 961static int snd_sonicvibes_put_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
964{ 962{
965 sonicvibes_t *sonic = snd_kcontrol_chip(kcontrol); 963 struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
966 int reg = kcontrol->private_value & 0xff; 964 int reg = kcontrol->private_value & 0xff;
967 int shift = (kcontrol->private_value >> 8) & 0xff; 965 int shift = (kcontrol->private_value >> 8) & 0xff;
968 int mask = (kcontrol->private_value >> 16) & 0xff; 966 int mask = (kcontrol->private_value >> 16) & 0xff;
@@ -989,7 +987,7 @@ static int snd_sonicvibes_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_val
989 .get = snd_sonicvibes_get_double, .put = snd_sonicvibes_put_double, \ 987 .get = snd_sonicvibes_get_double, .put = snd_sonicvibes_put_double, \
990 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) } 988 .private_value = left_reg | (right_reg << 8) | (shift_left << 16) | (shift_right << 19) | (mask << 24) | (invert << 22) }
991 989
992static int snd_sonicvibes_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 990static int snd_sonicvibes_info_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
993{ 991{
994 int mask = (kcontrol->private_value >> 24) & 0xff; 992 int mask = (kcontrol->private_value >> 24) & 0xff;
995 993
@@ -1000,9 +998,9 @@ static int snd_sonicvibes_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_inf
1000 return 0; 998 return 0;
1001} 999}
1002 1000
1003static int snd_sonicvibes_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1001static int snd_sonicvibes_get_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1004{ 1002{
1005 sonicvibes_t *sonic = snd_kcontrol_chip(kcontrol); 1003 struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
1006 int left_reg = kcontrol->private_value & 0xff; 1004 int left_reg = kcontrol->private_value & 0xff;
1007 int right_reg = (kcontrol->private_value >> 8) & 0xff; 1005 int right_reg = (kcontrol->private_value >> 8) & 0xff;
1008 int shift_left = (kcontrol->private_value >> 16) & 0x07; 1006 int shift_left = (kcontrol->private_value >> 16) & 0x07;
@@ -1021,9 +1019,9 @@ static int snd_sonicvibes_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_val
1021 return 0; 1019 return 0;
1022} 1020}
1023 1021
1024static int snd_sonicvibes_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1022static int snd_sonicvibes_put_double(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
1025{ 1023{
1026 sonicvibes_t *sonic = snd_kcontrol_chip(kcontrol); 1024 struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
1027 int left_reg = kcontrol->private_value & 0xff; 1025 int left_reg = kcontrol->private_value & 0xff;
1028 int right_reg = (kcontrol->private_value >> 8) & 0xff; 1026 int right_reg = (kcontrol->private_value >> 8) & 0xff;
1029 int shift_left = (kcontrol->private_value >> 16) & 0x07; 1027 int shift_left = (kcontrol->private_value >> 16) & 0x07;
@@ -1053,7 +1051,7 @@ static int snd_sonicvibes_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_val
1053 return change; 1051 return change;
1054} 1052}
1055 1053
1056static snd_kcontrol_new_t snd_sonicvibes_controls[] __devinitdata = { 1054static struct snd_kcontrol_new snd_sonicvibes_controls[] __devinitdata = {
1057SONICVIBES_DOUBLE("Capture Volume", 0, SV_IREG_LEFT_ADC, SV_IREG_RIGHT_ADC, 0, 0, 15, 0), 1055SONICVIBES_DOUBLE("Capture Volume", 0, SV_IREG_LEFT_ADC, SV_IREG_RIGHT_ADC, 0, 0, 15, 0),
1058SONICVIBES_DOUBLE("Aux Playback Switch", 0, SV_IREG_LEFT_AUX1, SV_IREG_RIGHT_AUX1, 7, 7, 1, 1), 1056SONICVIBES_DOUBLE("Aux Playback Switch", 0, SV_IREG_LEFT_AUX1, SV_IREG_RIGHT_AUX1, 7, 7, 1, 1),
1059SONICVIBES_DOUBLE("Aux Playback Volume", 0, SV_IREG_LEFT_AUX1, SV_IREG_RIGHT_AUX1, 0, 0, 31, 1), 1057SONICVIBES_DOUBLE("Aux Playback Volume", 0, SV_IREG_LEFT_AUX1, SV_IREG_RIGHT_AUX1, 0, 0, 31, 1),
@@ -1077,17 +1075,17 @@ SONICVIBES_SINGLE("Loopback Capture Volume", 0, SV_IREG_ADC_OUTPUT_CTRL, 2, 63,
1077SONICVIBES_MUX("Capture Source", 0) 1075SONICVIBES_MUX("Capture Source", 0)
1078}; 1076};
1079 1077
1080static void snd_sonicvibes_master_free(snd_kcontrol_t *kcontrol) 1078static void snd_sonicvibes_master_free(struct snd_kcontrol *kcontrol)
1081{ 1079{
1082 sonicvibes_t *sonic = snd_kcontrol_chip(kcontrol); 1080 struct sonicvibes *sonic = snd_kcontrol_chip(kcontrol);
1083 sonic->master_mute = NULL; 1081 sonic->master_mute = NULL;
1084 sonic->master_volume = NULL; 1082 sonic->master_volume = NULL;
1085} 1083}
1086 1084
1087static int __devinit snd_sonicvibes_mixer(sonicvibes_t * sonic) 1085static int __devinit snd_sonicvibes_mixer(struct sonicvibes * sonic)
1088{ 1086{
1089 snd_card_t *card; 1087 struct snd_card *card;
1090 snd_kcontrol_t *kctl; 1088 struct snd_kcontrol *kctl;
1091 unsigned int idx; 1089 unsigned int idx;
1092 int err; 1090 int err;
1093 1091
@@ -1110,10 +1108,10 @@ static int __devinit snd_sonicvibes_mixer(sonicvibes_t * sonic)
1110 1108
1111 */ 1109 */
1112 1110
1113static void snd_sonicvibes_proc_read(snd_info_entry_t *entry, 1111static void snd_sonicvibes_proc_read(struct snd_info_entry *entry,
1114 snd_info_buffer_t * buffer) 1112 struct snd_info_buffer *buffer)
1115{ 1113{
1116 sonicvibes_t *sonic = entry->private_data; 1114 struct sonicvibes *sonic = entry->private_data;
1117 unsigned char tmp; 1115 unsigned char tmp;
1118 1116
1119 tmp = sonic->srs_space & 0x0f; 1117 tmp = sonic->srs_space & 0x0f;
@@ -1140,9 +1138,9 @@ static void snd_sonicvibes_proc_read(snd_info_entry_t *entry,
1140 snd_iprintf(buffer, "MIDI to ext. Tx : %s\n", tmp & 0x04 ? "on" : "off"); 1138 snd_iprintf(buffer, "MIDI to ext. Tx : %s\n", tmp & 0x04 ? "on" : "off");
1141} 1139}
1142 1140
1143static void __devinit snd_sonicvibes_proc_init(sonicvibes_t * sonic) 1141static void __devinit snd_sonicvibes_proc_init(struct sonicvibes * sonic)
1144{ 1142{
1145 snd_info_entry_t *entry; 1143 struct snd_info_entry *entry;
1146 1144
1147 if (! snd_card_proc_new(sonic->card, "sonicvibes", &entry)) 1145 if (! snd_card_proc_new(sonic->card, "sonicvibes", &entry))
1148 snd_info_set_text_ops(entry, sonic, 1024, snd_sonicvibes_proc_read); 1146 snd_info_set_text_ops(entry, sonic, 1024, snd_sonicvibes_proc_read);
@@ -1153,10 +1151,10 @@ static void __devinit snd_sonicvibes_proc_init(sonicvibes_t * sonic)
1153 */ 1151 */
1154 1152
1155#ifdef SUPPORT_JOYSTICK 1153#ifdef SUPPORT_JOYSTICK
1156static snd_kcontrol_new_t snd_sonicvibes_game_control __devinitdata = 1154static struct snd_kcontrol_new snd_sonicvibes_game_control __devinitdata =
1157SONICVIBES_SINGLE("Joystick Speed", 0, SV_IREG_GAME_PORT, 1, 15, 0); 1155SONICVIBES_SINGLE("Joystick Speed", 0, SV_IREG_GAME_PORT, 1, 15, 0);
1158 1156
1159static int __devinit snd_sonicvibes_create_gameport(sonicvibes_t *sonic) 1157static int __devinit snd_sonicvibes_create_gameport(struct sonicvibes *sonic)
1160{ 1158{
1161 struct gameport *gp; 1159 struct gameport *gp;
1162 1160
@@ -1178,7 +1176,7 @@ static int __devinit snd_sonicvibes_create_gameport(sonicvibes_t *sonic)
1178 return 0; 1176 return 0;
1179} 1177}
1180 1178
1181static void snd_sonicvibes_free_gameport(sonicvibes_t *sonic) 1179static void snd_sonicvibes_free_gameport(struct sonicvibes *sonic)
1182{ 1180{
1183 if (sonic->gameport) { 1181 if (sonic->gameport) {
1184 gameport_unregister_port(sonic->gameport); 1182 gameport_unregister_port(sonic->gameport);
@@ -1186,11 +1184,11 @@ static void snd_sonicvibes_free_gameport(sonicvibes_t *sonic)
1186 } 1184 }
1187} 1185}
1188#else 1186#else
1189static inline int snd_sonicvibes_create_gameport(sonicvibes_t *sonic) { return -ENOSYS; } 1187static inline int snd_sonicvibes_create_gameport(struct sonicvibes *sonic) { return -ENOSYS; }
1190static inline void snd_sonicvibes_free_gameport(sonicvibes_t *sonic) { } 1188static inline void snd_sonicvibes_free_gameport(struct sonicvibes *sonic) { }
1191#endif 1189#endif
1192 1190
1193static int snd_sonicvibes_free(sonicvibes_t *sonic) 1191static int snd_sonicvibes_free(struct sonicvibes *sonic)
1194{ 1192{
1195 snd_sonicvibes_free_gameport(sonic); 1193 snd_sonicvibes_free_gameport(sonic);
1196 pci_write_config_dword(sonic->pci, 0x40, sonic->dmaa_port); 1194 pci_write_config_dword(sonic->pci, 0x40, sonic->dmaa_port);
@@ -1205,22 +1203,22 @@ static int snd_sonicvibes_free(sonicvibes_t *sonic)
1205 return 0; 1203 return 0;
1206} 1204}
1207 1205
1208static int snd_sonicvibes_dev_free(snd_device_t *device) 1206static int snd_sonicvibes_dev_free(struct snd_device *device)
1209{ 1207{
1210 sonicvibes_t *sonic = device->device_data; 1208 struct sonicvibes *sonic = device->device_data;
1211 return snd_sonicvibes_free(sonic); 1209 return snd_sonicvibes_free(sonic);
1212} 1210}
1213 1211
1214static int __devinit snd_sonicvibes_create(snd_card_t * card, 1212static int __devinit snd_sonicvibes_create(struct snd_card *card,
1215 struct pci_dev *pci, 1213 struct pci_dev *pci,
1216 int reverb, 1214 int reverb,
1217 int mge, 1215 int mge,
1218 sonicvibes_t ** rsonic) 1216 struct sonicvibes ** rsonic)
1219{ 1217{
1220 sonicvibes_t *sonic; 1218 struct sonicvibes *sonic;
1221 unsigned int dmaa, dmac; 1219 unsigned int dmaa, dmac;
1222 int err; 1220 int err;
1223 static snd_device_ops_t ops = { 1221 static struct snd_device_ops ops = {
1224 .dev_free = snd_sonicvibes_dev_free, 1222 .dev_free = snd_sonicvibes_dev_free,
1225 }; 1223 };
1226 1224
@@ -1365,7 +1363,7 @@ static int __devinit snd_sonicvibes_create(snd_card_t * card,
1365 * MIDI section 1363 * MIDI section
1366 */ 1364 */
1367 1365
1368static snd_kcontrol_new_t snd_sonicvibes_midi_controls[] __devinitdata = { 1366static struct snd_kcontrol_new snd_sonicvibes_midi_controls[] __devinitdata = {
1369SONICVIBES_SINGLE("SonicVibes Wave Source RAM", 0, SV_IREG_WAVE_SOURCE, 0, 1, 0), 1367SONICVIBES_SINGLE("SonicVibes Wave Source RAM", 0, SV_IREG_WAVE_SOURCE, 0, 1, 0),
1370SONICVIBES_SINGLE("SonicVibes Wave Source RAM+ROM", 0, SV_IREG_WAVE_SOURCE, 1, 1, 0), 1368SONICVIBES_SINGLE("SonicVibes Wave Source RAM+ROM", 0, SV_IREG_WAVE_SOURCE, 1, 1, 0),
1371SONICVIBES_SINGLE("SonicVibes Onboard Synth", 0, SV_IREG_MPU401, 0, 1, 0), 1369SONICVIBES_SINGLE("SonicVibes Onboard Synth", 0, SV_IREG_MPU401, 0, 1, 0),
@@ -1373,24 +1371,25 @@ SONICVIBES_SINGLE("SonicVibes External Rx to Synth", 0, SV_IREG_MPU401, 1, 1, 0)
1373SONICVIBES_SINGLE("SonicVibes External Tx", 0, SV_IREG_MPU401, 2, 1, 0) 1371SONICVIBES_SINGLE("SonicVibes External Tx", 0, SV_IREG_MPU401, 2, 1, 0)
1374}; 1372};
1375 1373
1376static int snd_sonicvibes_midi_input_open(mpu401_t * mpu) 1374static int snd_sonicvibes_midi_input_open(struct snd_mpu401 * mpu)
1377{ 1375{
1378 sonicvibes_t *sonic = mpu->private_data; 1376 struct sonicvibes *sonic = mpu->private_data;
1379 outb(sonic->irqmask &= ~SV_MIDI_MASK, SV_REG(sonic, IRQMASK)); 1377 outb(sonic->irqmask &= ~SV_MIDI_MASK, SV_REG(sonic, IRQMASK));
1380 return 0; 1378 return 0;
1381} 1379}
1382 1380
1383static void snd_sonicvibes_midi_input_close(mpu401_t * mpu) 1381static void snd_sonicvibes_midi_input_close(struct snd_mpu401 * mpu)
1384{ 1382{
1385 sonicvibes_t *sonic = mpu->private_data; 1383 struct sonicvibes *sonic = mpu->private_data;
1386 outb(sonic->irqmask |= SV_MIDI_MASK, SV_REG(sonic, IRQMASK)); 1384 outb(sonic->irqmask |= SV_MIDI_MASK, SV_REG(sonic, IRQMASK));
1387} 1385}
1388 1386
1389static int __devinit snd_sonicvibes_midi(sonicvibes_t * sonic, snd_rawmidi_t * rmidi) 1387static int __devinit snd_sonicvibes_midi(struct sonicvibes * sonic,
1388 struct snd_rawmidi *rmidi)
1390{ 1389{
1391 mpu401_t * mpu = rmidi->private_data; 1390 struct snd_mpu401 * mpu = rmidi->private_data;
1392 snd_card_t *card = sonic->card; 1391 struct snd_card *card = sonic->card;
1393 snd_rawmidi_str_t *dir; 1392 struct snd_rawmidi_str *dir;
1394 unsigned int idx; 1393 unsigned int idx;
1395 int err; 1394 int err;
1396 1395
@@ -1408,10 +1407,10 @@ static int __devinit snd_sonic_probe(struct pci_dev *pci,
1408 const struct pci_device_id *pci_id) 1407 const struct pci_device_id *pci_id)
1409{ 1408{
1410 static int dev; 1409 static int dev;
1411 snd_card_t *card; 1410 struct snd_card *card;
1412 sonicvibes_t *sonic; 1411 struct sonicvibes *sonic;
1413 snd_rawmidi_t *midi_uart; 1412 struct snd_rawmidi *midi_uart;
1414 opl3_t *opl3; 1413 struct snd_opl3 *opl3;
1415 int idx, err; 1414 int idx, err;
1416 1415
1417 if (dev >= SNDRV_CARDS) 1416 if (dev >= SNDRV_CARDS)