Changeset 679 for GPL/trunk/alsa-kernel/isa/gus/interwave.c
- Timestamp:
- Mar 18, 2021, 8:57:36 PM (4 years ago)
- Location:
- GPL/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
- Property svn:mergeinfo changed
/GPL/branches/uniaud32-linux-3.2.102 (added) merged: 611-614 /GPL/branches/uniaud32-next (added) merged: 615-678
- Property svn:mergeinfo changed
-
GPL/trunk/alsa-kernel/isa/gus/interwave.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Driver for AMD InterWave soundcard 3 4 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 4 5 * 5 *6 * This program is free software; you can redistribute it and/or modify7 * it under the terms of the GNU General Public License as published by8 * the Free Software Foundation; either version 2 of the License, or9 * (at your option) any later version.10 *11 * This program is distributed in the hope that it will be useful,12 * but WITHOUT ANY WARRANTY; without even the implied warranty of13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the14 * GNU General Public License for more details.15 *16 * You should have received a copy of the GNU General Public License17 * along with this program; if not, write to the Free Software18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA19 *20 6 * 1999/07/22 Erik Inge Bolso <knan@mo.himolde.no> 21 7 * * mixer group handlers 22 *23 8 */ 24 9 … … 28 13 #include <linux/delay.h> 29 14 #include <linux/pnp.h> 30 #include <linux/module param.h>15 #include <linux/module.h> 31 16 #include <asm/dma.h> 32 17 #include <sound/core.h> … … 56 41 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 57 42 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 58 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */43 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 59 44 #ifdef CONFIG_PNP 60 static intisapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};45 static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 61 46 #endif 62 47 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x210,0x220,0x230,0x240,0x250,0x260 */ … … 93 78 MODULE_PARM_DESC(isapnp, "ISA PnP detection for specified soundcard."); 94 79 #endif 95 module_param_ array(port, long, NULL, 0444);80 module_param_hw_array(port, long, ioport, NULL, 0444); 96 81 MODULE_PARM_DESC(port, "Port # for InterWave driver."); 97 82 #ifdef SNDRV_STB 98 module_param_ array(port_tc, long, NULL, 0444);83 module_param_hw_array(port_tc, long, ioport, NULL, 0444); 99 84 MODULE_PARM_DESC(port_tc, "Tone control (TEA6330T - i2c bus) port # for InterWave driver."); 100 85 #endif 101 module_param_ array(irq, int, NULL, 0444);86 module_param_hw_array(irq, int, irq, NULL, 0444); 102 87 MODULE_PARM_DESC(irq, "IRQ # for InterWave driver."); 103 module_param_ array(dma1, int, NULL, 0444);88 module_param_hw_array(dma1, int, dma, NULL, 0444); 104 89 MODULE_PARM_DESC(dma1, "DMA1 # for InterWave driver."); 105 module_param_ array(dma2, int, NULL, 0444);90 module_param_hw_array(dma2, int, dma, NULL, 0444); 106 91 MODULE_PARM_DESC(dma2, "DMA2 # for InterWave driver."); 107 92 module_param_array(joystick_dac, int, NULL, 0444); … … 137 122 static int pnp_registered; 138 123 139 static struct pnp_card_device_id snd_interwave_pnpids[] = {124 static const struct pnp_card_device_id snd_interwave_pnpids[] = { 140 125 #ifndef SNDRV_STB 141 126 /* Gravis UltraSound Plug & Play */ … … 208 193 }; 209 194 210 static int __devinitsnd_interwave_detect_stb(struct snd_interwave *iwcard,211 struct snd_gus_card *gus, int dev,212 195 static int snd_interwave_detect_stb(struct snd_interwave *iwcard, 196 struct snd_gus_card *gus, int dev, 197 struct snd_i2c_bus **rbus) 213 198 { 214 199 unsigned long port; … … 250 235 #endif 251 236 252 static int __devinitsnd_interwave_detect(struct snd_interwave *iwcard,253 struct snd_gus_card *gus,254 255 #ifdef SNDRV_STB 256 237 static int snd_interwave_detect(struct snd_interwave *iwcard, 238 struct snd_gus_card *gus, 239 int dev 240 #ifdef SNDRV_STB 241 , struct snd_i2c_bus **rbus 257 242 #endif 258 243 ) … … 319 304 } 320 305 321 static void __devinit snd_interwave_reset(struct snd_gus_card *gus)306 static void snd_interwave_reset(struct snd_gus_card *gus) 322 307 { 323 308 snd_gf1_write8(gus, SNDRV_GF1_GB_RESET, 0x00); … … 327 312 } 328 313 329 static void __devinit snd_interwave_bank_sizes(struct snd_gus_card *gus, int *sizes)314 static void snd_interwave_bank_sizes(struct snd_gus_card *gus, int *sizes) 330 315 { 331 316 unsigned int idx; … … 378 363 }; 379 364 380 static void __devinit snd_interwave_detect_memory(struct snd_gus_card *gus)381 { 382 static unsigned int lmc[13] =365 static void snd_interwave_detect_memory(struct snd_gus_card *gus) 366 { 367 static const unsigned int lmc[13] = 383 368 { 384 369 0x00000001, 0x00000101, 0x01010101, 0x00000401, … … 443 428 for (i = 0; i < 8; ++i) 444 429 iwave[i] = snd_gf1_peek(gus, bank_pos + i); 445 #ifdef CONFIG_SND_DEBUG_ROM446 printk(KERN_DEBUG "ROM at 0x%06x = %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n", bank_pos,447 iwave[0], iwave[1], iwave[2], iwave[3],448 iwave[4], iwave[5], iwave[6], iwave[7]);449 #endif450 430 if (strncmp(iwave, "INTRWAVE", 8)) 451 431 continue; /* first check */ … … 453 433 for (i = 0; i < sizeof(struct rom_hdr); i++) 454 434 csum += snd_gf1_peek(gus, bank_pos + i); 455 #ifdef CONFIG_SND_DEBUG_ROM456 printk(KERN_DEBUG "ROM checksum = 0x%x (computed)\n", csum);457 #endif458 435 if (csum != 0) 459 436 continue; /* not valid rom */ … … 477 454 } 478 455 479 static void __devinit snd_interwave_init(int dev, struct snd_gus_card *gus)456 static void snd_interwave_init(int dev, struct snd_gus_card *gus) 480 457 { 481 458 unsigned long flags; … … 499 476 } 500 477 501 static struct snd_kcontrol_new snd_interwave_controls[] = {478 static const struct snd_kcontrol_new snd_interwave_controls[] = { 502 479 WSS_DOUBLE("Master Playback Switch", 0, 503 480 CS4231_LINE_LEFT_OUTPUT, CS4231_LINE_RIGHT_OUTPUT, 7, 7, 1, 1), … … 510 487 }; 511 488 512 static int __devinitsnd_interwave_mixer(struct snd_wss *chip)489 static int snd_interwave_mixer(struct snd_wss *chip) 513 490 { 514 491 struct snd_card *card = chip->card; … … 560 537 #ifdef CONFIG_PNP 561 538 562 static int __devinitsnd_interwave_pnp(int dev, struct snd_interwave *iwcard,563 564 539 static int snd_interwave_pnp(int dev, struct snd_interwave *iwcard, 540 struct pnp_card_link *card, 541 const struct pnp_card_device_id *id) 565 542 { 566 543 struct pnp_dev *pdev; … … 628 605 } 629 606 630 static int snd_interwave_card_new(int dev, struct snd_card **cardp) 607 static int snd_interwave_card_new(struct device *pdev, int dev, 608 struct snd_card **cardp) 631 609 { 632 610 struct snd_card *card; … … 634 612 int err; 635 613 636 err = snd_card_ create(index[dev], id[dev], THIS_MODULE,637 614 err = snd_card_new(pdev, index[dev], id[dev], THIS_MODULE, 615 sizeof(struct snd_interwave), &card); 638 616 if (err < 0) 639 617 return err; … … 646 624 } 647 625 648 static int __devinitsnd_interwave_probe(struct snd_card *card, int dev)626 static int snd_interwave_probe(struct snd_card *card, int dev) 649 627 { 650 628 int xirq, xdma1, xdma2; … … 655 633 struct snd_i2c_bus *i2c_bus; 656 634 #endif 657 struct snd_pcm *pcm;658 635 char *str; 659 636 int err; … … 685 662 return err; 686 663 687 if (request_irq(xirq, snd_interwave_interrupt, IRQF_DISABLED,664 if (request_irq(xirq, snd_interwave_interrupt, 0, 688 665 "InterWave", iwcard)) { 689 666 snd_printk(KERN_ERR PFX "unable to grab IRQ %d\n", xirq); … … 691 668 } 692 669 iwcard->irq = xirq; 670 card->sync_irq = iwcard->irq; 693 671 694 672 err = snd_wss_create(card, … … 703 681 return err; 704 682 705 err = snd_wss_pcm(wss, 0 , &pcm);683 err = snd_wss_pcm(wss, 0); 706 684 if (err < 0) 707 685 return err; 708 686 709 sprintf(pcm->name + strlen(pcm->name), " rev %c", gus->revision + 'A'); 710 strcat(pcm->name, " (codec)"); 711 712 err = snd_wss_timer(wss, 2, NULL); 687 sprintf(wss->pcm->name + strlen(wss->pcm->name), " rev %c", 688 gus->revision + 'A'); 689 strcat(wss->pcm->name, " (codec)"); 690 691 err = snd_wss_timer(wss, 2); 713 692 if (err < 0) 714 693 return err; … … 719 698 720 699 if (pcm_channels[dev] > 0) { 721 err = snd_gf1_pcm_new(gus, 1, 1 , NULL);700 err = snd_gf1_pcm_new(gus, 1, 1); 722 701 if (err < 0) 723 702 return err; … … 748 727 749 728 gus->uart_enable = midi[dev]; 750 if ((err = snd_gf1_rawmidi_new(gus, 0 , NULL)) < 0)729 if ((err = snd_gf1_rawmidi_new(gus, 0)) < 0) 751 730 return err; 752 731 … … 777 756 } 778 757 779 static int __devinitsnd_interwave_isa_probe1(int dev, struct device *devptr)758 static int snd_interwave_isa_probe1(int dev, struct device *devptr) 780 759 { 781 760 struct snd_card *card; 782 761 int err; 783 762 784 err = snd_interwave_card_new(dev , &card);763 err = snd_interwave_card_new(devptr, dev, &card); 785 764 if (err < 0) 786 765 return err; 787 766 788 snd_card_set_dev(card, devptr);789 767 if ((err = snd_interwave_probe(card, dev)) < 0) { 790 768 snd_card_free(card); … … 795 773 } 796 774 797 static int __devinitsnd_interwave_isa_match(struct device *pdev,798 775 static int snd_interwave_isa_match(struct device *pdev, 776 unsigned int dev) 799 777 { 800 778 if (!enable[dev]) … … 807 785 } 808 786 809 static int __devinitsnd_interwave_isa_probe(struct device *pdev,810 787 static int snd_interwave_isa_probe(struct device *pdev, 788 unsigned int dev) 811 789 { 812 790 int err; 813 static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1};814 static int possible_dmas[] = {0, 1, 3, 5, 6, 7, -1};791 static const int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; 792 static const int possible_dmas[] = {0, 1, 3, 5, 6, 7, -1}; 815 793 816 794 if (irq[dev] == SNDRV_AUTO_IRQ) { … … 836 814 return snd_interwave_isa_probe1(dev, pdev); 837 815 else { 838 static long possible_ports[] = {0x210, 0x220, 0x230, 0x240, 0x250, 0x260};816 static const long possible_ports[] = {0x210, 0x220, 0x230, 0x240, 0x250, 0x260}; 839 817 int i; 840 818 for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { … … 848 826 } 849 827 850 static int __devexitsnd_interwave_isa_remove(struct device *devptr, unsigned int dev)828 static int snd_interwave_isa_remove(struct device *devptr, unsigned int dev) 851 829 { 852 830 snd_card_free(dev_get_drvdata(devptr)); 853 dev_set_drvdata(devptr, NULL);854 831 return 0; 855 832 } … … 858 835 .match = snd_interwave_isa_match, 859 836 .probe = snd_interwave_isa_probe, 860 .remove = __devexit_p(snd_interwave_isa_remove),837 .remove = snd_interwave_isa_remove, 861 838 /* FIXME: suspend,resume */ 862 839 .driver = { … … 866 843 867 844 #ifdef CONFIG_PNP 868 static int __devinitsnd_interwave_pnp_detect(struct pnp_card_link *pcard,869 845 static int snd_interwave_pnp_detect(struct pnp_card_link *pcard, 846 const struct pnp_card_device_id *pid) 870 847 { 871 848 static int dev; … … 880 857 return -ENODEV; 881 858 882 res = snd_interwave_card_new( dev, &card);859 res = snd_interwave_card_new(&pcard->card->dev, dev, &card); 883 860 if (res < 0) 884 861 return res; … … 888 865 return res; 889 866 } 890 snd_card_set_dev(card, &pcard->card->dev);891 867 if ((res = snd_interwave_probe(card, dev)) < 0) { 892 868 snd_card_free(card); … … 898 874 } 899 875 900 static void __devexit snd_interwave_pnp_remove(struct pnp_card_link *pcard)876 static void snd_interwave_pnp_remove(struct pnp_card_link *pcard) 901 877 { 902 878 snd_card_free(pnp_get_card_drvdata(pcard)); … … 909 885 .id_table = snd_interwave_pnpids, 910 886 .probe = snd_interwave_pnp_detect, 911 .remove = __devexit_p(snd_interwave_pnp_remove),887 .remove = snd_interwave_pnp_remove, 912 888 /* FIXME: suspend,resume */ 913 889 };
Note:
See TracChangeset
for help on using the changeset viewer.