Changeset 679 for GPL/trunk/alsa-kernel/isa/cs423x/cs4231.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/cs423x/cs4231.c
r410 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Generic driver for CS4231 chips … … 4 5 * Originally the CS4232/CS4232A driver, modified for use on CS4231 by 5 6 * Tugrul Galatali <galatalt@stuy.edu> 6 *7 * This program is free software; you can redistribute it and/or modify8 * it under the terms of the GNU General Public License as published by9 * the Free Software Foundation; either version 2 of the License, or10 * (at your option) any later version.11 *12 * This program is distributed in the hope that it will be useful,13 * but WITHOUT ANY WARRANTY; without even the implied warranty of14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the15 * GNU General Public License for more details.16 *17 * You should have received a copy of the GNU General Public License18 * along with this program; if not, write to the Free Software19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA20 *21 7 */ 22 8 … … 26 12 #include <linux/time.h> 27 13 #include <linux/wait.h> 28 #include <linux/module param.h>14 #include <linux/module.h> 29 15 #include <sound/core.h> 30 16 #include <sound/wss.h> … … 42 28 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 43 29 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 44 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */30 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 45 31 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 46 32 static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ … … 56 42 module_param_array(enable, bool, NULL, 0444); 57 43 MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard."); 58 module_param_ array(port, long, NULL, 0444);44 module_param_hw_array(port, long, ioport, NULL, 0444); 59 45 MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver."); 60 module_param_ array(mpu_port, long, NULL, 0444);46 module_param_hw_array(mpu_port, long, ioport, NULL, 0444); 61 47 MODULE_PARM_DESC(mpu_port, "MPU-401 port # for " CRD_NAME " driver."); 62 module_param_ array(irq, int, NULL, 0444);48 module_param_hw_array(irq, int, irq, NULL, 0444); 63 49 MODULE_PARM_DESC(irq, "IRQ # for " CRD_NAME " driver."); 64 module_param_ array(mpu_irq, int, NULL, 0444);50 module_param_hw_array(mpu_irq, int, irq, NULL, 0444); 65 51 MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for " CRD_NAME " driver."); 66 module_param_ array(dma1, int, NULL, 0444);52 module_param_hw_array(dma1, int, dma, NULL, 0444); 67 53 MODULE_PARM_DESC(dma1, "DMA1 # for " CRD_NAME " driver."); 68 module_param_ array(dma2, int, NULL, 0444);54 module_param_hw_array(dma2, int, dma, NULL, 0444); 69 55 MODULE_PARM_DESC(dma2, "DMA2 # for " CRD_NAME " driver."); 70 56 71 static int __devinitsnd_cs4231_match(struct device *dev, unsigned int n)57 static int snd_cs4231_match(struct device *dev, unsigned int n) 72 58 { 73 59 if (!enable[n]) … … 89 75 } 90 76 91 static int __devinitsnd_cs4231_probe(struct device *dev, unsigned int n)77 static int snd_cs4231_probe(struct device *dev, unsigned int n) 92 78 { 93 79 struct snd_card *card; 94 80 struct snd_wss *chip; 95 struct snd_pcm *pcm;96 81 int error; 97 82 98 error = snd_card_ create(index[n], id[n], THIS_MODULE, 0, &card);83 error = snd_card_new(dev, index[n], id[n], THIS_MODULE, 0, &card); 99 84 if (error < 0) 100 85 return error; … … 107 92 card->private_data = chip; 108 93 109 error = snd_wss_pcm(chip, 0 , &pcm);94 error = snd_wss_pcm(chip, 0); 110 95 if (error < 0) 111 96 goto out; 112 97 113 str cpy(card->driver, "CS4231");114 str cpy(card->shortname, pcm->name);98 strlcpy(card->driver, "CS4231", sizeof(card->driver)); 99 strlcpy(card->shortname, chip->pcm->name, sizeof(card->shortname)); 115 100 116 sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d", 117 pcm->name, chip->port, irq[n], dma1[n]); 118 if (dma2[n] >= 0) 119 sprintf(card->longname + strlen(card->longname), "&%d", dma2[n]); 101 if (dma2[n] < 0) 102 snprintf(card->longname, sizeof(card->longname), 103 "%s at 0x%lx, irq %d, dma %d", 104 chip->pcm->name, chip->port, irq[n], dma1[n]); 105 else 106 snprintf(card->longname, sizeof(card->longname), 107 "%s at 0x%lx, irq %d, dma %d&%d", 108 chip->pcm->name, chip->port, irq[n], dma1[n], dma2[n]); 120 109 121 110 error = snd_wss_mixer(chip); … … 123 112 goto out; 124 113 125 error = snd_wss_timer(chip, 0 , NULL);114 error = snd_wss_timer(chip, 0); 126 115 if (error < 0) 127 116 goto out; … … 132 121 if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232, 133 122 mpu_port[n], 0, mpu_irq[n], 134 mpu_irq[n] >= 0 ? IRQF_DISABLED : 0,135 123 NULL) < 0) 136 124 dev_warn(dev, "MPU401 not detected\n"); 137 125 } 138 139 snd_card_set_dev(card, dev);140 126 141 127 error = snd_card_register(card); … … 150 136 } 151 137 152 static int __devexitsnd_cs4231_remove(struct device *dev, unsigned int n)138 static int snd_cs4231_remove(struct device *dev, unsigned int n) 153 139 { 154 140 snd_card_free(dev_get_drvdata(dev)); 155 dev_set_drvdata(dev, NULL);156 141 return 0; 157 142 } … … 182 167 .match = snd_cs4231_match, 183 168 .probe = snd_cs4231_probe, 184 .remove = __devexit_p(snd_cs4231_remove),169 .remove = snd_cs4231_remove, 185 170 #ifdef CONFIG_PM 186 171 .suspend = snd_cs4231_suspend, … … 192 177 }; 193 178 194 static int __init alsa_card_cs4231_init(void) 195 { 196 return isa_register_driver(&snd_cs4231_driver, SNDRV_CARDS); 197 } 198 199 static void __exit alsa_card_cs4231_exit(void) 200 { 201 isa_unregister_driver(&snd_cs4231_driver); 202 } 203 204 module_init(alsa_card_cs4231_init); 205 module_exit(alsa_card_cs4231_exit); 179 module_isa_driver(snd_cs4231_driver, SNDRV_CARDS);
Note:
See TracChangeset
for help on using the changeset viewer.