aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/pci/fm801.c229
1 files changed, 121 insertions, 108 deletions
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index 261061b76c7f..a57aca72e91a 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -147,9 +147,7 @@ MODULE_PARM_DESC(tea575x_tuner, "Enable TEA575x tuner.");
147 147
148 */ 148 */
149 149
150typedef struct _snd_fm801 fm801_t; 150struct fm801 {
151
152struct _snd_fm801 {
153 int irq; 151 int irq;
154 152
155 unsigned long port; /* I/O port number */ 153 unsigned long port; /* I/O port number */
@@ -172,24 +170,24 @@ struct _snd_fm801 {
172 unsigned int cap_size; 170 unsigned int cap_size;
173 unsigned int cap_pos; 171 unsigned int cap_pos;
174 172
175 ac97_bus_t *ac97_bus; 173 struct snd_ac97_bus *ac97_bus;
176 ac97_t *ac97; 174 struct snd_ac97 *ac97;
177 ac97_t *ac97_sec; 175 struct snd_ac97 *ac97_sec;
178 176
179 struct pci_dev *pci; 177 struct pci_dev *pci;
180 snd_card_t *card; 178 struct snd_card *card;
181 snd_pcm_t *pcm; 179 struct snd_pcm *pcm;
182 snd_rawmidi_t *rmidi; 180 struct snd_rawmidi *rmidi;
183 snd_pcm_substream_t *playback_substream; 181 struct snd_pcm_substream *playback_substream;
184 snd_pcm_substream_t *capture_substream; 182 struct snd_pcm_substream *capture_substream;
185 unsigned int p_dma_size; 183 unsigned int p_dma_size;
186 unsigned int c_dma_size; 184 unsigned int c_dma_size;
187 185
188 spinlock_t reg_lock; 186 spinlock_t reg_lock;
189 snd_info_entry_t *proc_entry; 187 struct snd_info_entry *proc_entry;
190 188
191#ifdef TEA575X_RADIO 189#ifdef TEA575X_RADIO
192 tea575x_t tea; 190 struct snd_tea575x tea;
193#endif 191#endif
194}; 192};
195 193
@@ -205,7 +203,7 @@ MODULE_DEVICE_TABLE(pci, snd_fm801_ids);
205 * common I/O routines 203 * common I/O routines
206 */ 204 */
207 205
208static int snd_fm801_update_bits(fm801_t *chip, unsigned short reg, 206static int snd_fm801_update_bits(struct fm801 *chip, unsigned short reg,
209 unsigned short mask, unsigned short value) 207 unsigned short mask, unsigned short value)
210{ 208{
211 int change; 209 int change;
@@ -222,11 +220,11 @@ static int snd_fm801_update_bits(fm801_t *chip, unsigned short reg,
222 return change; 220 return change;
223} 221}
224 222
225static void snd_fm801_codec_write(ac97_t *ac97, 223static void snd_fm801_codec_write(struct snd_ac97 *ac97,
226 unsigned short reg, 224 unsigned short reg,
227 unsigned short val) 225 unsigned short val)
228{ 226{
229 fm801_t *chip = ac97->private_data; 227 struct fm801 *chip = ac97->private_data;
230 int idx; 228 int idx;
231 229
232 /* 230 /*
@@ -255,9 +253,9 @@ static void snd_fm801_codec_write(ac97_t *ac97,
255 snd_printk(KERN_ERR "AC'97 interface #%d is busy (2)\n", ac97->num); 253 snd_printk(KERN_ERR "AC'97 interface #%d is busy (2)\n", ac97->num);
256} 254}
257 255
258static unsigned short snd_fm801_codec_read(ac97_t *ac97, unsigned short reg) 256static unsigned short snd_fm801_codec_read(struct snd_ac97 *ac97, unsigned short reg)
259{ 257{
260 fm801_t *chip = ac97->private_data; 258 struct fm801 *chip = ac97->private_data;
261 int idx; 259 int idx;
262 260
263 /* 261 /*
@@ -301,7 +299,7 @@ static unsigned int rates[] = {
301 38400, 44100, 48000 299 38400, 44100, 48000
302}; 300};
303 301
304static snd_pcm_hw_constraint_list_t hw_constraints_rates = { 302static struct snd_pcm_hw_constraint_list hw_constraints_rates = {
305 .count = ARRAY_SIZE(rates), 303 .count = ARRAY_SIZE(rates),
306 .list = rates, 304 .list = rates,
307 .mask = 0, 305 .mask = 0,
@@ -313,7 +311,7 @@ static unsigned int channels[] = {
313 311
314#define CHANNELS sizeof(channels) / sizeof(channels[0]) 312#define CHANNELS sizeof(channels) / sizeof(channels[0])
315 313
316static snd_pcm_hw_constraint_list_t hw_constraints_channels = { 314static struct snd_pcm_hw_constraint_list hw_constraints_channels = {
317 .count = CHANNELS, 315 .count = CHANNELS,
318 .list = channels, 316 .list = channels,
319 .mask = 0, 317 .mask = 0,
@@ -338,10 +336,10 @@ static unsigned short snd_fm801_rate_bits(unsigned int rate)
338 * PCM part 336 * PCM part
339 */ 337 */
340 338
341static int snd_fm801_playback_trigger(snd_pcm_substream_t * substream, 339static int snd_fm801_playback_trigger(struct snd_pcm_substream *substream,
342 int cmd) 340 int cmd)
343{ 341{
344 fm801_t *chip = snd_pcm_substream_chip(substream); 342 struct fm801 *chip = snd_pcm_substream_chip(substream);
345 343
346 spin_lock(&chip->reg_lock); 344 spin_lock(&chip->reg_lock);
347 switch (cmd) { 345 switch (cmd) {
@@ -371,10 +369,10 @@ static int snd_fm801_playback_trigger(snd_pcm_substream_t * substream,
371 return 0; 369 return 0;
372} 370}
373 371
374static int snd_fm801_capture_trigger(snd_pcm_substream_t * substream, 372static int snd_fm801_capture_trigger(struct snd_pcm_substream *substream,
375 int cmd) 373 int cmd)
376{ 374{
377 fm801_t *chip = snd_pcm_substream_chip(substream); 375 struct fm801 *chip = snd_pcm_substream_chip(substream);
378 376
379 spin_lock(&chip->reg_lock); 377 spin_lock(&chip->reg_lock);
380 switch (cmd) { 378 switch (cmd) {
@@ -404,21 +402,21 @@ static int snd_fm801_capture_trigger(snd_pcm_substream_t * substream,
404 return 0; 402 return 0;
405} 403}
406 404
407static int snd_fm801_hw_params(snd_pcm_substream_t * substream, 405static int snd_fm801_hw_params(struct snd_pcm_substream *substream,
408 snd_pcm_hw_params_t * hw_params) 406 struct snd_pcm_hw_params *hw_params)
409{ 407{
410 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); 408 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));
411} 409}
412 410
413static int snd_fm801_hw_free(snd_pcm_substream_t * substream) 411static int snd_fm801_hw_free(struct snd_pcm_substream *substream)
414{ 412{
415 return snd_pcm_lib_free_pages(substream); 413 return snd_pcm_lib_free_pages(substream);
416} 414}
417 415
418static int snd_fm801_playback_prepare(snd_pcm_substream_t * substream) 416static int snd_fm801_playback_prepare(struct snd_pcm_substream *substream)
419{ 417{
420 fm801_t *chip = snd_pcm_substream_chip(substream); 418 struct fm801 *chip = snd_pcm_substream_chip(substream);
421 snd_pcm_runtime_t *runtime = substream->runtime; 419 struct snd_pcm_runtime *runtime = substream->runtime;
422 420
423 chip->ply_size = snd_pcm_lib_buffer_bytes(substream); 421 chip->ply_size = snd_pcm_lib_buffer_bytes(substream);
424 chip->ply_count = snd_pcm_lib_period_bytes(substream); 422 chip->ply_count = snd_pcm_lib_period_bytes(substream);
@@ -447,10 +445,10 @@ static int snd_fm801_playback_prepare(snd_pcm_substream_t * substream)
447 return 0; 445 return 0;
448} 446}
449 447
450static int snd_fm801_capture_prepare(snd_pcm_substream_t * substream) 448static int snd_fm801_capture_prepare(struct snd_pcm_substream *substream)
451{ 449{
452 fm801_t *chip = snd_pcm_substream_chip(substream); 450 struct fm801 *chip = snd_pcm_substream_chip(substream);
453 snd_pcm_runtime_t *runtime = substream->runtime; 451 struct snd_pcm_runtime *runtime = substream->runtime;
454 452
455 chip->cap_size = snd_pcm_lib_buffer_bytes(substream); 453 chip->cap_size = snd_pcm_lib_buffer_bytes(substream);
456 chip->cap_count = snd_pcm_lib_period_bytes(substream); 454 chip->cap_count = snd_pcm_lib_period_bytes(substream);
@@ -473,9 +471,9 @@ static int snd_fm801_capture_prepare(snd_pcm_substream_t * substream)
473 return 0; 471 return 0;
474} 472}
475 473
476static snd_pcm_uframes_t snd_fm801_playback_pointer(snd_pcm_substream_t * substream) 474static snd_pcm_uframes_t snd_fm801_playback_pointer(struct snd_pcm_substream *substream)
477{ 475{
478 fm801_t *chip = snd_pcm_substream_chip(substream); 476 struct fm801 *chip = snd_pcm_substream_chip(substream);
479 size_t ptr; 477 size_t ptr;
480 478
481 if (!(chip->ply_ctrl & FM801_START)) 479 if (!(chip->ply_ctrl & FM801_START))
@@ -490,9 +488,9 @@ static snd_pcm_uframes_t snd_fm801_playback_pointer(snd_pcm_substream_t * substr
490 return bytes_to_frames(substream->runtime, ptr); 488 return bytes_to_frames(substream->runtime, ptr);
491} 489}
492 490
493static snd_pcm_uframes_t snd_fm801_capture_pointer(snd_pcm_substream_t * substream) 491static snd_pcm_uframes_t snd_fm801_capture_pointer(struct snd_pcm_substream *substream)
494{ 492{
495 fm801_t *chip = snd_pcm_substream_chip(substream); 493 struct fm801 *chip = snd_pcm_substream_chip(substream);
496 size_t ptr; 494 size_t ptr;
497 495
498 if (!(chip->cap_ctrl & FM801_START)) 496 if (!(chip->cap_ctrl & FM801_START))
@@ -509,7 +507,7 @@ static snd_pcm_uframes_t snd_fm801_capture_pointer(snd_pcm_substream_t * substre
509 507
510static irqreturn_t snd_fm801_interrupt(int irq, void *dev_id, struct pt_regs *regs) 508static irqreturn_t snd_fm801_interrupt(int irq, void *dev_id, struct pt_regs *regs)
511{ 509{
512 fm801_t *chip = dev_id; 510 struct fm801 *chip = dev_id;
513 unsigned short status; 511 unsigned short status;
514 unsigned int tmp; 512 unsigned int tmp;
515 513
@@ -555,7 +553,7 @@ static irqreturn_t snd_fm801_interrupt(int irq, void *dev_id, struct pt_regs *re
555 return IRQ_HANDLED; 553 return IRQ_HANDLED;
556} 554}
557 555
558static snd_pcm_hardware_t snd_fm801_playback = 556static struct snd_pcm_hardware snd_fm801_playback =
559{ 557{
560 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 558 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
561 SNDRV_PCM_INFO_BLOCK_TRANSFER | 559 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -575,7 +573,7 @@ static snd_pcm_hardware_t snd_fm801_playback =
575 .fifo_size = 0, 573 .fifo_size = 0,
576}; 574};
577 575
578static snd_pcm_hardware_t snd_fm801_capture = 576static struct snd_pcm_hardware snd_fm801_capture =
579{ 577{
580 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 578 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
581 SNDRV_PCM_INFO_BLOCK_TRANSFER | 579 SNDRV_PCM_INFO_BLOCK_TRANSFER |
@@ -595,55 +593,59 @@ static snd_pcm_hardware_t snd_fm801_capture =
595 .fifo_size = 0, 593 .fifo_size = 0,
596}; 594};
597 595
598static int snd_fm801_playback_open(snd_pcm_substream_t * substream) 596static int snd_fm801_playback_open(struct snd_pcm_substream *substream)
599{ 597{
600 fm801_t *chip = snd_pcm_substream_chip(substream); 598 struct fm801 *chip = snd_pcm_substream_chip(substream);
601 snd_pcm_runtime_t *runtime = substream->runtime; 599 struct snd_pcm_runtime *runtime = substream->runtime;
602 int err; 600 int err;
603 601
604 chip->playback_substream = substream; 602 chip->playback_substream = substream;
605 runtime->hw = snd_fm801_playback; 603 runtime->hw = snd_fm801_playback;
606 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates); 604 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
605 &hw_constraints_rates);
607 if (chip->multichannel) { 606 if (chip->multichannel) {
608 runtime->hw.channels_max = 6; 607 runtime->hw.channels_max = 6;
609 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_CHANNELS, &hw_constraints_channels); 608 snd_pcm_hw_constraint_list(runtime, 0,
609 SNDRV_PCM_HW_PARAM_CHANNELS,
610 &hw_constraints_channels);
610 } 611 }
611 if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) 612 if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
612 return err; 613 return err;
613 return 0; 614 return 0;
614} 615}
615 616
616static int snd_fm801_capture_open(snd_pcm_substream_t * substream) 617static int snd_fm801_capture_open(struct snd_pcm_substream *substream)
617{ 618{
618 fm801_t *chip = snd_pcm_substream_chip(substream); 619 struct fm801 *chip = snd_pcm_substream_chip(substream);
619 snd_pcm_runtime_t *runtime = substream->runtime; 620 struct snd_pcm_runtime *runtime = substream->runtime;
620 int err; 621 int err;
621 622
622 chip->capture_substream = substream; 623 chip->capture_substream = substream;
623 runtime->hw = snd_fm801_capture; 624 runtime->hw = snd_fm801_capture;
624 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE, &hw_constraints_rates); 625 snd_pcm_hw_constraint_list(runtime, 0, SNDRV_PCM_HW_PARAM_RATE,
626 &hw_constraints_rates);
625 if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) 627 if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
626 return err; 628 return err;
627 return 0; 629 return 0;
628} 630}
629 631
630static int snd_fm801_playback_close(snd_pcm_substream_t * substream) 632static int snd_fm801_playback_close(struct snd_pcm_substream *substream)
631{ 633{
632 fm801_t *chip = snd_pcm_substream_chip(substream); 634 struct fm801 *chip = snd_pcm_substream_chip(substream);
633 635
634 chip->playback_substream = NULL; 636 chip->playback_substream = NULL;
635 return 0; 637 return 0;
636} 638}
637 639
638static int snd_fm801_capture_close(snd_pcm_substream_t * substream) 640static int snd_fm801_capture_close(struct snd_pcm_substream *substream)
639{ 641{
640 fm801_t *chip = snd_pcm_substream_chip(substream); 642 struct fm801 *chip = snd_pcm_substream_chip(substream);
641 643
642 chip->capture_substream = NULL; 644 chip->capture_substream = NULL;
643 return 0; 645 return 0;
644} 646}
645 647
646static snd_pcm_ops_t snd_fm801_playback_ops = { 648static struct snd_pcm_ops snd_fm801_playback_ops = {
647 .open = snd_fm801_playback_open, 649 .open = snd_fm801_playback_open,
648 .close = snd_fm801_playback_close, 650 .close = snd_fm801_playback_close,
649 .ioctl = snd_pcm_lib_ioctl, 651 .ioctl = snd_pcm_lib_ioctl,
@@ -654,7 +656,7 @@ static snd_pcm_ops_t snd_fm801_playback_ops = {
654 .pointer = snd_fm801_playback_pointer, 656 .pointer = snd_fm801_playback_pointer,
655}; 657};
656 658
657static snd_pcm_ops_t snd_fm801_capture_ops = { 659static struct snd_pcm_ops snd_fm801_capture_ops = {
658 .open = snd_fm801_capture_open, 660 .open = snd_fm801_capture_open,
659 .close = snd_fm801_capture_close, 661 .close = snd_fm801_capture_close,
660 .ioctl = snd_pcm_lib_ioctl, 662 .ioctl = snd_pcm_lib_ioctl,
@@ -665,9 +667,9 @@ static snd_pcm_ops_t snd_fm801_capture_ops = {
665 .pointer = snd_fm801_capture_pointer, 667 .pointer = snd_fm801_capture_pointer,
666}; 668};
667 669
668static int __devinit snd_fm801_pcm(fm801_t *chip, int device, snd_pcm_t ** rpcm) 670static int __devinit snd_fm801_pcm(struct fm801 *chip, int device, struct snd_pcm ** rpcm)
669{ 671{
670 snd_pcm_t *pcm; 672 struct snd_pcm *pcm;
671 int err; 673 int err;
672 674
673 if (rpcm) 675 if (rpcm)
@@ -703,9 +705,9 @@ static int __devinit snd_fm801_pcm(fm801_t *chip, int device, snd_pcm_t ** rpcm)
703#define TEA_256PCS_WRITE_ENABLE 2 /* inverted */ 705#define TEA_256PCS_WRITE_ENABLE 2 /* inverted */
704#define TEA_256PCS_BUS_CLOCK 3 706#define TEA_256PCS_BUS_CLOCK 3
705 707
706static void snd_fm801_tea575x_256pcs_write(tea575x_t *tea, unsigned int val) 708static void snd_fm801_tea575x_256pcs_write(struct snd_tea575x *tea, unsigned int val)
707{ 709{
708 fm801_t *chip = tea->private_data; 710 struct fm801 *chip = tea->private_data;
709 unsigned short reg; 711 unsigned short reg;
710 int i = 25; 712 int i = 25;
711 713
@@ -747,9 +749,9 @@ static void snd_fm801_tea575x_256pcs_write(tea575x_t *tea, unsigned int val)
747 spin_unlock_irq(&chip->reg_lock); 749 spin_unlock_irq(&chip->reg_lock);
748} 750}
749 751
750static unsigned int snd_fm801_tea575x_256pcs_read(tea575x_t *tea) 752static unsigned int snd_fm801_tea575x_256pcs_read(struct snd_tea575x *tea)
751{ 753{
752 fm801_t *chip = tea->private_data; 754 struct fm801 *chip = tea->private_data;
753 unsigned short reg; 755 unsigned short reg;
754 unsigned int val = 0; 756 unsigned int val = 0;
755 int i; 757 int i;
@@ -791,9 +793,9 @@ static unsigned int snd_fm801_tea575x_256pcs_read(tea575x_t *tea)
791#define TEA_256PCPR_DATA 1 793#define TEA_256PCPR_DATA 1
792#define TEA_256PCPR_WRITE_ENABLE 2 /* inverted */ 794#define TEA_256PCPR_WRITE_ENABLE 2 /* inverted */
793 795
794static void snd_fm801_tea575x_256pcpr_write(tea575x_t *tea, unsigned int val) 796static void snd_fm801_tea575x_256pcpr_write(struct snd_tea575x *tea, unsigned int val)
795{ 797{
796 fm801_t *chip = tea->private_data; 798 struct fm801 *chip = tea->private_data;
797 unsigned short reg; 799 unsigned short reg;
798 int i = 25; 800 int i = 25;
799 801
@@ -835,9 +837,9 @@ static void snd_fm801_tea575x_256pcpr_write(tea575x_t *tea, unsigned int val)
835 spin_unlock_irq(&chip->reg_lock); 837 spin_unlock_irq(&chip->reg_lock);
836} 838}
837 839
838static unsigned int snd_fm801_tea575x_256pcpr_read(tea575x_t *tea) 840static unsigned int snd_fm801_tea575x_256pcpr_read(struct snd_tea575x *tea)
839{ 841{
840 fm801_t *chip = tea->private_data; 842 struct fm801 *chip = tea->private_data;
841 unsigned short reg; 843 unsigned short reg;
842 unsigned int val = 0; 844 unsigned int val = 0;
843 int i; 845 int i;
@@ -879,9 +881,9 @@ static unsigned int snd_fm801_tea575x_256pcpr_read(tea575x_t *tea)
879#define TEA_64PCR_WRITE_ENABLE 1 /* inverted */ 881#define TEA_64PCR_WRITE_ENABLE 1 /* inverted */
880#define TEA_64PCR_DATA 2 882#define TEA_64PCR_DATA 2
881 883
882static void snd_fm801_tea575x_64pcr_write(tea575x_t *tea, unsigned int val) 884static void snd_fm801_tea575x_64pcr_write(struct snd_tea575x *tea, unsigned int val)
883{ 885{
884 fm801_t *chip = tea->private_data; 886 struct fm801 *chip = tea->private_data;
885 unsigned short reg; 887 unsigned short reg;
886 int i = 25; 888 int i = 25;
887 889
@@ -923,9 +925,9 @@ static void snd_fm801_tea575x_64pcr_write(tea575x_t *tea, unsigned int val)
923 spin_unlock_irq(&chip->reg_lock); 925 spin_unlock_irq(&chip->reg_lock);
924} 926}
925 927
926static unsigned int snd_fm801_tea575x_64pcr_read(tea575x_t *tea) 928static unsigned int snd_fm801_tea575x_64pcr_read(struct snd_tea575x *tea)
927{ 929{
928 fm801_t *chip = tea->private_data; 930 struct fm801 *chip = tea->private_data;
929 unsigned short reg; 931 unsigned short reg;
930 unsigned int val = 0; 932 unsigned int val = 0;
931 int i; 933 int i;
@@ -990,7 +992,8 @@ static struct snd_tea575x_ops snd_fm801_tea_ops[3] = {
990 .get = snd_fm801_get_single, .put = snd_fm801_put_single, \ 992 .get = snd_fm801_get_single, .put = snd_fm801_put_single, \
991 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } 993 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) }
992 994
993static int snd_fm801_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 995static int snd_fm801_info_single(struct snd_kcontrol *kcontrol,
996 struct snd_ctl_elem_info *uinfo)
994{ 997{
995 int mask = (kcontrol->private_value >> 16) & 0xff; 998 int mask = (kcontrol->private_value >> 16) & 0xff;
996 999
@@ -1001,9 +1004,10 @@ static int snd_fm801_info_single(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *
1001 return 0; 1004 return 0;
1002} 1005}
1003 1006
1004static int snd_fm801_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1007static int snd_fm801_get_single(struct snd_kcontrol *kcontrol,
1008 struct snd_ctl_elem_value *ucontrol)
1005{ 1009{
1006 fm801_t *chip = snd_kcontrol_chip(kcontrol); 1010 struct fm801 *chip = snd_kcontrol_chip(kcontrol);
1007 int reg = kcontrol->private_value & 0xff; 1011 int reg = kcontrol->private_value & 0xff;
1008 int shift = (kcontrol->private_value >> 8) & 0xff; 1012 int shift = (kcontrol->private_value >> 8) & 0xff;
1009 int mask = (kcontrol->private_value >> 16) & 0xff; 1013 int mask = (kcontrol->private_value >> 16) & 0xff;
@@ -1015,9 +1019,10 @@ static int snd_fm801_get_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
1015 return 0; 1019 return 0;
1016} 1020}
1017 1021
1018static int snd_fm801_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1022static int snd_fm801_put_single(struct snd_kcontrol *kcontrol,
1023 struct snd_ctl_elem_value *ucontrol)
1019{ 1024{
1020 fm801_t *chip = snd_kcontrol_chip(kcontrol); 1025 struct fm801 *chip = snd_kcontrol_chip(kcontrol);
1021 int reg = kcontrol->private_value & 0xff; 1026 int reg = kcontrol->private_value & 0xff;
1022 int shift = (kcontrol->private_value >> 8) & 0xff; 1027 int shift = (kcontrol->private_value >> 8) & 0xff;
1023 int mask = (kcontrol->private_value >> 16) & 0xff; 1028 int mask = (kcontrol->private_value >> 16) & 0xff;
@@ -1035,7 +1040,8 @@ static int snd_fm801_put_single(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
1035 .get = snd_fm801_get_double, .put = snd_fm801_put_double, \ 1040 .get = snd_fm801_get_double, .put = snd_fm801_put_double, \
1036 .private_value = reg | (shift_left << 8) | (shift_right << 12) | (mask << 16) | (invert << 24) } 1041 .private_value = reg | (shift_left << 8) | (shift_right << 12) | (mask << 16) | (invert << 24) }
1037 1042
1038static int snd_fm801_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1043static int snd_fm801_info_double(struct snd_kcontrol *kcontrol,
1044 struct snd_ctl_elem_info *uinfo)
1039{ 1045{
1040 int mask = (kcontrol->private_value >> 16) & 0xff; 1046 int mask = (kcontrol->private_value >> 16) & 0xff;
1041 1047
@@ -1046,9 +1052,10 @@ static int snd_fm801_info_double(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *
1046 return 0; 1052 return 0;
1047} 1053}
1048 1054
1049static int snd_fm801_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1055static int snd_fm801_get_double(struct snd_kcontrol *kcontrol,
1056 struct snd_ctl_elem_value *ucontrol)
1050{ 1057{
1051 fm801_t *chip = snd_kcontrol_chip(kcontrol); 1058 struct fm801 *chip = snd_kcontrol_chip(kcontrol);
1052 int reg = kcontrol->private_value & 0xff; 1059 int reg = kcontrol->private_value & 0xff;
1053 int shift_left = (kcontrol->private_value >> 8) & 0x0f; 1060 int shift_left = (kcontrol->private_value >> 8) & 0x0f;
1054 int shift_right = (kcontrol->private_value >> 12) & 0x0f; 1061 int shift_right = (kcontrol->private_value >> 12) & 0x0f;
@@ -1066,9 +1073,10 @@ static int snd_fm801_get_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
1066 return 0; 1073 return 0;
1067} 1074}
1068 1075
1069static int snd_fm801_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1076static int snd_fm801_put_double(struct snd_kcontrol *kcontrol,
1077 struct snd_ctl_elem_value *ucontrol)
1070{ 1078{
1071 fm801_t *chip = snd_kcontrol_chip(kcontrol); 1079 struct fm801 *chip = snd_kcontrol_chip(kcontrol);
1072 int reg = kcontrol->private_value & 0xff; 1080 int reg = kcontrol->private_value & 0xff;
1073 int shift_left = (kcontrol->private_value >> 8) & 0x0f; 1081 int shift_left = (kcontrol->private_value >> 8) & 0x0f;
1074 int shift_right = (kcontrol->private_value >> 12) & 0x0f; 1082 int shift_right = (kcontrol->private_value >> 12) & 0x0f;
@@ -1087,7 +1095,8 @@ static int snd_fm801_put_double(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t
1087 (val1 << shift_left ) | (val2 << shift_right)); 1095 (val1 << shift_left ) | (val2 << shift_right));
1088} 1096}
1089 1097
1090static int snd_fm801_info_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo) 1098static int snd_fm801_info_mux(struct snd_kcontrol *kcontrol,
1099 struct snd_ctl_elem_info *uinfo)
1091{ 1100{
1092 static char *texts[5] = { 1101 static char *texts[5] = {
1093 "AC97 Primary", "FM", "I2S", "PCM", "AC97 Secondary" 1102 "AC97 Primary", "FM", "I2S", "PCM", "AC97 Secondary"
@@ -1102,9 +1111,10 @@ static int snd_fm801_info_mux(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * ui
1102 return 0; 1111 return 0;
1103} 1112}
1104 1113
1105static int snd_fm801_get_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1114static int snd_fm801_get_mux(struct snd_kcontrol *kcontrol,
1115 struct snd_ctl_elem_value *ucontrol)
1106{ 1116{
1107 fm801_t *chip = snd_kcontrol_chip(kcontrol); 1117 struct fm801 *chip = snd_kcontrol_chip(kcontrol);
1108 unsigned short val; 1118 unsigned short val;
1109 1119
1110 val = inw(FM801_REG(chip, REC_SRC)) & 7; 1120 val = inw(FM801_REG(chip, REC_SRC)) & 7;
@@ -1114,9 +1124,10 @@ static int snd_fm801_get_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * u
1114 return 0; 1124 return 0;
1115} 1125}
1116 1126
1117static int snd_fm801_put_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * ucontrol) 1127static int snd_fm801_put_mux(struct snd_kcontrol *kcontrol,
1128 struct snd_ctl_elem_value *ucontrol)
1118{ 1129{
1119 fm801_t *chip = snd_kcontrol_chip(kcontrol); 1130 struct fm801 *chip = snd_kcontrol_chip(kcontrol);
1120 unsigned short val; 1131 unsigned short val;
1121 1132
1122 if ((val = ucontrol->value.enumerated.item[0]) > 4) 1133 if ((val = ucontrol->value.enumerated.item[0]) > 4)
@@ -1124,9 +1135,9 @@ static int snd_fm801_put_mux(snd_kcontrol_t * kcontrol, snd_ctl_elem_value_t * u
1124 return snd_fm801_update_bits(chip, FM801_REC_SRC, 7, val); 1135 return snd_fm801_update_bits(chip, FM801_REC_SRC, 7, val);
1125} 1136}
1126 1137
1127#define FM801_CONTROLS (sizeof(snd_fm801_controls)/sizeof(snd_kcontrol_new_t)) 1138#define FM801_CONTROLS ARRAY_SIZE(snd_fm801_controls)
1128 1139
1129static snd_kcontrol_new_t snd_fm801_controls[] __devinitdata = { 1140static struct snd_kcontrol_new snd_fm801_controls[] __devinitdata = {
1130FM801_DOUBLE("Wave Playback Volume", FM801_PCM_VOL, 0, 8, 31, 1), 1141FM801_DOUBLE("Wave Playback Volume", FM801_PCM_VOL, 0, 8, 31, 1),
1131FM801_SINGLE("Wave Playback Switch", FM801_PCM_VOL, 15, 1, 1), 1142FM801_SINGLE("Wave Playback Switch", FM801_PCM_VOL, 15, 1, 1),
1132FM801_DOUBLE("I2S Playback Volume", FM801_I2S_VOL, 0, 8, 31, 1), 1143FM801_DOUBLE("I2S Playback Volume", FM801_I2S_VOL, 0, 8, 31, 1),
@@ -1142,9 +1153,9 @@ FM801_SINGLE("FM Playback Switch", FM801_FM_VOL, 15, 1, 1),
1142} 1153}
1143}; 1154};
1144 1155
1145#define FM801_CONTROLS_MULTI (sizeof(snd_fm801_controls_multi)/sizeof(snd_kcontrol_new_t)) 1156#define FM801_CONTROLS_MULTI ARRAY_SIZE(snd_fm801_controls_multi)
1146 1157
1147static snd_kcontrol_new_t snd_fm801_controls_multi[] __devinitdata = { 1158static struct snd_kcontrol_new snd_fm801_controls_multi[] __devinitdata = {
1148FM801_SINGLE("AC97 2ch->4ch Copy Switch", FM801_CODEC_CTRL, 7, 1, 0), 1159FM801_SINGLE("AC97 2ch->4ch Copy Switch", FM801_CODEC_CTRL, 7, 1, 0),
1149FM801_SINGLE("AC97 18-bit Switch", FM801_CODEC_CTRL, 10, 1, 0), 1160FM801_SINGLE("AC97 18-bit Switch", FM801_CODEC_CTRL, 10, 1, 0),
1150FM801_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), FM801_I2S_MODE, 8, 1, 0), 1161FM801_SINGLE(SNDRV_CTL_NAME_IEC958("",CAPTURE,SWITCH), FM801_I2S_MODE, 8, 1, 0),
@@ -1153,15 +1164,15 @@ FM801_SINGLE(SNDRV_CTL_NAME_IEC958("Raw Data ",CAPTURE,SWITCH), FM801_I2S_MODE,
1153FM801_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), FM801_GEN_CTRL, 2, 1, 0), 1164FM801_SINGLE(SNDRV_CTL_NAME_IEC958("",PLAYBACK,SWITCH), FM801_GEN_CTRL, 2, 1, 0),
1154}; 1165};
1155 1166
1156static void snd_fm801_mixer_free_ac97_bus(ac97_bus_t *bus) 1167static void snd_fm801_mixer_free_ac97_bus(struct snd_ac97_bus *bus)
1157{ 1168{
1158 fm801_t *chip = bus->private_data; 1169 struct fm801 *chip = bus->private_data;
1159 chip->ac97_bus = NULL; 1170 chip->ac97_bus = NULL;
1160} 1171}
1161 1172
1162static void snd_fm801_mixer_free_ac97(ac97_t *ac97) 1173static void snd_fm801_mixer_free_ac97(struct snd_ac97 *ac97)
1163{ 1174{
1164 fm801_t *chip = ac97->private_data; 1175 struct fm801 *chip = ac97->private_data;
1165 if (ac97->num == 0) { 1176 if (ac97->num == 0) {
1166 chip->ac97 = NULL; 1177 chip->ac97 = NULL;
1167 } else { 1178 } else {
@@ -1169,12 +1180,12 @@ static void snd_fm801_mixer_free_ac97(ac97_t *ac97)
1169 } 1180 }
1170} 1181}
1171 1182
1172static int __devinit snd_fm801_mixer(fm801_t *chip) 1183static int __devinit snd_fm801_mixer(struct fm801 *chip)
1173{ 1184{
1174 ac97_template_t ac97; 1185 struct snd_ac97_template ac97;
1175 unsigned int i; 1186 unsigned int i;
1176 int err; 1187 int err;
1177 static ac97_bus_ops_t ops = { 1188 static struct snd_ac97_bus_ops ops = {
1178 .write = snd_fm801_codec_write, 1189 .write = snd_fm801_codec_write,
1179 .read = snd_fm801_codec_read, 1190 .read = snd_fm801_codec_read,
1180 }; 1191 };
@@ -1207,7 +1218,7 @@ static int __devinit snd_fm801_mixer(fm801_t *chip)
1207 * initialization routines 1218 * initialization routines
1208 */ 1219 */
1209 1220
1210static int snd_fm801_free(fm801_t *chip) 1221static int snd_fm801_free(struct fm801 *chip)
1211{ 1222{
1212 unsigned short cmdw; 1223 unsigned short cmdw;
1213 1224
@@ -1224,7 +1235,7 @@ static int snd_fm801_free(fm801_t *chip)
1224 snd_tea575x_exit(&chip->tea); 1235 snd_tea575x_exit(&chip->tea);
1225#endif 1236#endif
1226 if (chip->irq >= 0) 1237 if (chip->irq >= 0)
1227 free_irq(chip->irq, (void *)chip); 1238 free_irq(chip->irq, chip);
1228 pci_release_regions(chip->pci); 1239 pci_release_regions(chip->pci);
1229 pci_disable_device(chip->pci); 1240 pci_disable_device(chip->pci);
1230 1241
@@ -1232,23 +1243,23 @@ static int snd_fm801_free(fm801_t *chip)
1232 return 0; 1243 return 0;
1233} 1244}
1234 1245
1235static int snd_fm801_dev_free(snd_device_t *device) 1246static int snd_fm801_dev_free(struct snd_device *device)
1236{ 1247{
1237 fm801_t *chip = device->device_data; 1248 struct fm801 *chip = device->device_data;
1238 return snd_fm801_free(chip); 1249 return snd_fm801_free(chip);
1239} 1250}
1240 1251
1241static int __devinit snd_fm801_create(snd_card_t * card, 1252static int __devinit snd_fm801_create(struct snd_card *card,
1242 struct pci_dev * pci, 1253 struct pci_dev * pci,
1243 int tea575x_tuner, 1254 int tea575x_tuner,
1244 fm801_t ** rchip) 1255 struct fm801 ** rchip)
1245{ 1256{
1246 fm801_t *chip; 1257 struct fm801 *chip;
1247 unsigned char rev, id; 1258 unsigned char rev, id;
1248 unsigned short cmdw; 1259 unsigned short cmdw;
1249 unsigned long timeout; 1260 unsigned long timeout;
1250 int err; 1261 int err;
1251 static snd_device_ops_t ops = { 1262 static struct snd_device_ops ops = {
1252 .dev_free = snd_fm801_dev_free, 1263 .dev_free = snd_fm801_dev_free,
1253 }; 1264 };
1254 1265
@@ -1270,7 +1281,8 @@ static int __devinit snd_fm801_create(snd_card_t * card,
1270 return err; 1281 return err;
1271 } 1282 }
1272 chip->port = pci_resource_start(pci, 0); 1283 chip->port = pci_resource_start(pci, 0);
1273 if (request_irq(pci->irq, snd_fm801_interrupt, SA_INTERRUPT|SA_SHIRQ, "FM801", (void *)chip)) { 1284 if (request_irq(pci->irq, snd_fm801_interrupt, SA_INTERRUPT|SA_SHIRQ,
1285 "FM801", chip)) {
1274 snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->irq); 1286 snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->irq);
1275 snd_fm801_free(chip); 1287 snd_fm801_free(chip);
1276 return -EBUSY; 1288 return -EBUSY;
@@ -1309,7 +1321,8 @@ static int __devinit snd_fm801_create(snd_card_t * card,
1309 1321
1310 timeout = jiffies + HZ / 20; 1322 timeout = jiffies + HZ / 20;
1311 1323
1312 outw((1<<7) | (id << FM801_AC97_ADDR_SHIFT) | AC97_VENDOR_ID1, FM801_REG(chip, AC97_CMD)); 1324 outw((1<<7) | (id << FM801_AC97_ADDR_SHIFT) | AC97_VENDOR_ID1,
1325 FM801_REG(chip, AC97_CMD));
1313 udelay(5); 1326 udelay(5);
1314 do { 1327 do {
1315 if ((inw(FM801_REG(chip, AC97_CMD)) & (3<<8)) == (1<<8)) { 1328 if ((inw(FM801_REG(chip, AC97_CMD)) & (3<<8)) == (1<<8)) {
@@ -1383,9 +1396,9 @@ static int __devinit snd_card_fm801_probe(struct pci_dev *pci,
1383 const struct pci_device_id *pci_id) 1396 const struct pci_device_id *pci_id)
1384{ 1397{
1385 static int dev; 1398 static int dev;
1386 snd_card_t *card; 1399 struct snd_card *card;
1387 fm801_t *chip; 1400 struct fm801 *chip;
1388 opl3_t *opl3; 1401 struct snd_opl3 *opl3;
1389 int err; 1402 int err;
1390 1403
1391 if (dev >= SNDRV_CARDS) 1404 if (dev >= SNDRV_CARDS)