Changeset 679 for GPL/trunk/alsa-kernel/isa
- Timestamp:
- Mar 18, 2021, 8:57:36 PM (5 years ago)
- Location:
- GPL/trunk
- Files:
-
- 51 edited
- 7 copied
-
. (modified) (1 prop)
-
alsa-kernel/isa/Makefile (modified) (1 diff)
-
alsa-kernel/isa/ad1816a/Makefile (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/isa/ad1816a/Makefile )
-
alsa-kernel/isa/ad1816a/ad1816a.c (modified) (16 diffs)
-
alsa-kernel/isa/ad1816a/ad1816a_lib.c (modified) (22 diffs)
-
alsa-kernel/isa/ad1848/ad1848.c (modified) (11 diffs)
-
alsa-kernel/isa/adlib.c (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/isa/adlib.c )
-
alsa-kernel/isa/als100.c (modified) (15 diffs)
-
alsa-kernel/isa/azt2320.c (modified) (17 diffs)
-
alsa-kernel/isa/cmi8328.c (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/isa/cmi8328.c )
-
alsa-kernel/isa/cmi8330.c (modified) (28 diffs)
-
alsa-kernel/isa/cs423x/cs4231.c (modified) (12 diffs)
-
alsa-kernel/isa/cs423x/cs4236.c (modified) (31 diffs)
-
alsa-kernel/isa/cs423x/cs4236_lib.c (modified) (14 diffs)
-
alsa-kernel/isa/es1688/es1688.c (modified) (20 diffs)
-
alsa-kernel/isa/es1688/es1688_lib.c (modified) (23 diffs)
-
alsa-kernel/isa/es18xx.c (modified) (77 diffs)
-
alsa-kernel/isa/gus/gus_dma.c (modified) (2 diffs)
-
alsa-kernel/isa/gus/gus_dram.c (modified) (1 diff)
-
alsa-kernel/isa/gus/gus_io.c (modified) (3 diffs)
-
alsa-kernel/isa/gus/gus_irq.c (modified) (2 diffs)
-
alsa-kernel/isa/gus/gus_main.c (modified) (9 diffs)
-
alsa-kernel/isa/gus/gus_mem.c (modified) (4 diffs)
-
alsa-kernel/isa/gus/gus_mem_proc.c (modified) (2 diffs)
-
alsa-kernel/isa/gus/gus_mixer.c (modified) (5 diffs)
-
alsa-kernel/isa/gus/gus_pcm.c (modified) (20 diffs)
-
alsa-kernel/isa/gus/gus_reset.c (modified) (4 diffs)
-
alsa-kernel/isa/gus/gus_tables.h (modified) (1 diff)
-
alsa-kernel/isa/gus/gus_timer.c (modified) (4 diffs)
-
alsa-kernel/isa/gus/gus_uart.c (modified) (6 diffs)
-
alsa-kernel/isa/gus/gus_volume.c (modified) (5 diffs)
-
alsa-kernel/isa/gus/gusclassic.c (modified) (13 diffs)
-
alsa-kernel/isa/gus/gusextreme.c (modified) (17 diffs)
-
alsa-kernel/isa/gus/gusmax.c (modified) (19 diffs)
-
alsa-kernel/isa/gus/interwave.c (modified) (36 diffs)
-
alsa-kernel/isa/opl3sa2.c (modified) (34 diffs)
-
alsa-kernel/isa/opti9xx/opti92x-ad1848.c (modified) (41 diffs)
-
alsa-kernel/isa/sb/emu8000.c (modified) (33 diffs)
-
alsa-kernel/isa/sb/emu8000_callback.c (modified) (7 diffs)
-
alsa-kernel/isa/sb/emu8000_local.h (modified) (2 diffs)
-
alsa-kernel/isa/sb/emu8000_patch.c (modified) (4 diffs)
-
alsa-kernel/isa/sb/emu8000_pcm.c (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/isa/sb/emu8000_pcm.c )
-
alsa-kernel/isa/sb/emu8000_synth.c (modified) (6 diffs)
-
alsa-kernel/isa/sb/jazz16.c (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/isa/sb/jazz16.c )
-
alsa-kernel/isa/sb/sb16.c (modified) (23 diffs)
-
alsa-kernel/isa/sb/sb16_csp.c (modified) (23 diffs)
-
alsa-kernel/isa/sb/sb16_main.c (modified) (17 diffs)
-
alsa-kernel/isa/sb/sb8.c (modified) (16 diffs)
-
alsa-kernel/isa/sb/sb8_main.c (modified) (20 diffs)
-
alsa-kernel/isa/sb/sb8_midi.c (modified) (9 diffs)
-
alsa-kernel/isa/sb/sb_common.c (modified) (9 diffs)
-
alsa-kernel/isa/sb/sb_mixer.c (modified) (24 diffs)
-
alsa-kernel/isa/sc6000.c (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/isa/sc6000.c )
-
alsa-kernel/isa/sscape.c (copied) (copied from GPL/branches/uniaud32-next/alsa-kernel/isa/sscape.c )
-
alsa-kernel/isa/wavefront/wavefront.c (modified) (27 diffs)
-
alsa-kernel/isa/wavefront/wavefront_fx.c (modified) (6 diffs)
-
alsa-kernel/isa/wavefront/wavefront_midi.c (modified) (8 diffs)
-
alsa-kernel/isa/wavefront/wavefront_synth.c (modified) (28 diffs)
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/Makefile
r587 r679 7 7 !include $(ROOT)\tools\header.mif 8 8 9 WMAKEOPTS=-h $(__MAKEOPTS__) KEE=$(KEE)DEBUG=$(DEBUG)9 WMAKEOPTS=-h $(__MAKEOPTS__) DEBUG=$(DEBUG) 10 10 11 11 -
GPL/trunk/alsa-kernel/isa/ad1816a/ad1816a.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 2 3 /* … … 4 5 Copyright (C) 2000 by Massimo Piccioni <dafastidio@libero.it> 5 6 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 7 */ 20 8 … … 23 11 #include <linux/wait.h> 24 12 #include <linux/pnp.h> 25 #include <linux/module param.h>13 #include <linux/module.h> 26 14 #include <sound/core.h> 27 15 #include <sound/initval.h> … … 45 33 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 1-MAX */ 46 34 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 47 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */35 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 48 36 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 49 37 static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ … … 64 52 MODULE_PARM_DESC(clockfreq, "Clock frequency for ad1816a driver (default = 0)."); 65 53 66 struct snd_card_ad1816a { 67 struct pnp_dev *dev; 68 struct pnp_dev *devmpu; 69 }; 70 71 static struct pnp_card_device_id snd_ad1816a_pnpids[] = { 54 static const struct pnp_card_device_id snd_ad1816a_pnpids[] = { 72 55 /* Analog Devices AD1815 */ 73 56 { .id = "ADS7150", .devs = { { .id = "ADS7150" }, { .id = "ADS7151" } } }, 74 /* Analog Device AD1816? */57 /* Analog Devices AD1816? */ 75 58 { .id = "ADS7180", .devs = { { .id = "ADS7180" }, { .id = "ADS7181" } } }, 76 59 /* Analog Devices AD1816A - added by Kenneth Platz <kxp@atl.hp.com> */ … … 100 83 101 84 102 static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acard, 103 struct pnp_card_link *card, 104 const struct pnp_card_device_id *id) 85 static int snd_card_ad1816a_pnp(int dev, struct pnp_card_link *card, 86 const struct pnp_card_device_id *id) 105 87 { 106 88 struct pnp_dev *pdev; 107 89 int err; 108 90 109 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);110 if ( acard->dev == NULL)91 pdev = pnp_request_card_device(card, id->devs[0].id, NULL); 92 if (pdev == NULL) 111 93 return -EBUSY; 112 113 acard->devmpu = pnp_request_card_device(card, id->devs[1].id, NULL);114 if (acard->devmpu == NULL) {115 mpu_port[dev] = -1;116 snd_printk(KERN_WARNING PFX "MPU401 device busy, skipping.\n");117 }118 119 pdev = acard->dev;120 94 121 95 err = pnp_activate_dev(pdev); … … 131 105 irq[dev] = pnp_irq(pdev, 0); 132 106 133 if (acard->devmpu == NULL) 107 pdev = pnp_request_card_device(card, id->devs[1].id, NULL); 108 if (pdev == NULL) { 109 mpu_port[dev] = -1; 110 snd_printk(KERN_WARNING PFX "MPU401 device busy, skipping.\n"); 134 111 return 0; 135 136 pdev = acard->devmpu; 112 } 137 113 138 114 err = pnp_activate_dev(pdev); … … 140 116 printk(KERN_ERR PFX "MPU401 PnP configure failure\n"); 141 117 mpu_port[dev] = -1; 142 acard->devmpu = NULL;143 118 } else { 144 119 mpu_port[dev] = pnp_port_start(pdev, 0); … … 149 124 } 150 125 151 static int __devinitsnd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard,152 const struct pnp_card_device_id *pid)126 static int snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard, 127 const struct pnp_card_device_id *pid) 153 128 { 154 129 int error; 155 130 struct snd_card *card; 156 struct snd_card_ad1816a *acard;157 131 struct snd_ad1816a *chip; 158 132 struct snd_opl3 *opl3; 159 struct snd_timer *timer; 160 161 error = snd_card_create(index[dev], id[dev], THIS_MODULE,162 sizeof(struct snd_card_ad1816a), &card);133 134 error = snd_card_new(&pcard->card->dev, 135 index[dev], id[dev], THIS_MODULE, 136 sizeof(struct snd_ad1816a), &card); 163 137 if (error < 0) 164 138 return error; 165 acard = card->private_data; 166 167 if ((error = snd_card_ad1816a_pnp(dev, acard, pcard, pid))) { 168 snd_card_free(card); 169 return error; 170 } 171 snd_card_set_dev(card, &pcard->card->dev); 139 chip = card->private_data; 140 141 if ((error = snd_card_ad1816a_pnp(dev, pcard, pid))) { 142 snd_card_free(card); 143 return error; 144 } 172 145 173 146 if ((error = snd_ad1816a_create(card, port[dev], … … 175 148 dma1[dev], 176 149 dma2[dev], 177 &chip)) < 0) {150 chip)) < 0) { 178 151 snd_card_free(card); 179 152 return error; … … 187 160 card->shortname, chip->port, irq[dev], dma1[dev], dma2[dev]); 188 161 189 if ((error = snd_ad1816a_pcm(chip, 0 , NULL)) < 0) {162 if ((error = snd_ad1816a_pcm(chip, 0)) < 0) { 190 163 snd_card_free(card); 191 164 return error; … … 197 170 } 198 171 199 error = snd_ad1816a_timer(chip, 0 , &timer);172 error = snd_ad1816a_timer(chip, 0); 200 173 if (error < 0) { 201 174 snd_card_free(card); … … 205 178 if (mpu_port[dev] > 0) { 206 179 if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, 207 mpu_port[dev], 0, mpu_irq[dev], IRQF_DISABLED,180 mpu_port[dev], 0, mpu_irq[dev], 208 181 NULL) < 0) 209 182 printk(KERN_ERR PFX "no MPU-401 device at 0x%lx.\n", mpu_port[dev]); … … 232 205 } 233 206 234 static unsigned int __devinitdataad1816a_devices;235 236 static int __devinitsnd_ad1816a_pnp_detect(struct pnp_card_link *card,237 const struct pnp_card_device_id *id)207 static unsigned int ad1816a_devices; 208 209 static int snd_ad1816a_pnp_detect(struct pnp_card_link *card, 210 const struct pnp_card_device_id *id) 238 211 { 239 212 static int dev; … … 253 226 } 254 227 255 static void __devexit snd_ad1816a_pnp_remove(struct pnp_card_link *pcard)228 static void snd_ad1816a_pnp_remove(struct pnp_card_link *pcard) 256 229 { 257 230 snd_card_free(pnp_get_card_drvdata(pcard)); 258 231 pnp_set_card_drvdata(pcard, NULL); 259 232 } 233 234 #ifdef CONFIG_PM 235 static int snd_ad1816a_pnp_suspend(struct pnp_card_link *pcard, 236 pm_message_t state) 237 { 238 struct snd_card *card = pnp_get_card_drvdata(pcard); 239 240 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 241 snd_ad1816a_suspend(card->private_data); 242 return 0; 243 } 244 245 static int snd_ad1816a_pnp_resume(struct pnp_card_link *pcard) 246 { 247 struct snd_card *card = pnp_get_card_drvdata(pcard); 248 249 snd_ad1816a_resume(card->private_data); 250 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 251 return 0; 252 } 253 #endif 260 254 261 255 static struct pnp_card_driver ad1816a_pnpc_driver = { … … 264 258 .id_table = snd_ad1816a_pnpids, 265 259 .probe = snd_ad1816a_pnp_detect, 266 .remove = __devexit_p(snd_ad1816a_pnp_remove), 267 /* FIXME: suspend/resume */ 260 .remove = snd_ad1816a_pnp_remove, 261 #ifdef CONFIG_PM 262 .suspend = snd_ad1816a_pnp_suspend, 263 .resume = snd_ad1816a_pnp_resume, 264 #endif 268 265 }; 269 266 -
GPL/trunk/alsa-kernel/isa/ad1816a/ad1816a_lib.c
r426 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 ad1816a.c - lowlevel code for Analog Devices AD1816A chip. 3 4 Copyright (C) 1999-2000 by Massimo Piccioni <dafastidio@libero.it> 4 5 5 This program is free software; you can redistribute it and/or modify6 it under the terms of the GNU General Public License as published by7 the Free Software Foundation; either version 2 of the License, or8 (at your option) any later version.9 10 This program is distributed in the hope that it will be useful,11 but WITHOUT ANY WARRANTY; without even the implied warranty of12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 GNU General Public License for more details.14 15 You should have received a copy of the GNU General Public License16 along with this program; if not, write to the Free Software17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA18 6 */ 19 7 … … 23 11 #include <linux/slab.h> 24 12 #include <linux/ioport.h> 13 #include <linux/io.h> 25 14 #include <sound/core.h> 26 15 #include <sound/tlv.h> 27 16 #include <sound/ad1816a.h> 28 17 29 #include <asm/io.h>30 18 #include <asm/dma.h> 31 19 … … 86 74 87 75 static unsigned char snd_ad1816a_get_format(struct snd_ad1816a *chip, 88 unsigned int format, int channels) 76 snd_pcm_format_t format, 77 int channels) 89 78 { 90 79 unsigned char retval = AD1816A_FMT_LINEAR_8; … … 218 207 } 219 208 220 static int snd_ad1816a_hw_params(struct snd_pcm_substream *substream,221 struct snd_pcm_hw_params *hw_params)222 {223 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));224 }225 226 static int snd_ad1816a_hw_free(struct snd_pcm_substream *substream)227 {228 return snd_pcm_lib_free_pages(substream);229 }230 231 209 static int snd_ad1816a_playback_prepare(struct snd_pcm_substream *substream) 232 210 { … … 340 318 341 319 342 static struct snd_pcm_hardware snd_ad1816a_playback = {320 static const struct snd_pcm_hardware snd_ad1816a_playback = { 343 321 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 344 322 SNDRV_PCM_INFO_MMAP_VALID), … … 359 337 }; 360 338 361 static struct snd_pcm_hardware snd_ad1816a_capture = {339 static const struct snd_pcm_hardware snd_ad1816a_capture = { 362 340 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 363 341 SNDRV_PCM_INFO_MMAP_VALID), … … 432 410 } 433 411 434 static struct snd_timer_hardware snd_ad1816a_timer_table = {412 static const struct snd_timer_hardware snd_ad1816a_timer_table = { 435 413 .flags = SNDRV_TIMER_HW_AUTO, 436 414 .resolution = 10000, … … 492 470 493 471 494 static void __devinitsnd_ad1816a_init(struct snd_ad1816a *chip)472 static void snd_ad1816a_init(struct snd_ad1816a *chip) 495 473 { 496 474 unsigned long flags; … … 512 490 } 513 491 514 static int __devinit snd_ad1816a_probe(struct snd_ad1816a *chip) 492 #ifdef CONFIG_PM 493 void snd_ad1816a_suspend(struct snd_ad1816a *chip) 494 { 495 int reg; 496 unsigned long flags; 497 498 spin_lock_irqsave(&chip->lock, flags); 499 for (reg = 0; reg < 48; reg++) 500 chip->image[reg] = snd_ad1816a_read(chip, reg); 501 spin_unlock_irqrestore(&chip->lock, flags); 502 } 503 504 void snd_ad1816a_resume(struct snd_ad1816a *chip) 505 { 506 int reg; 507 unsigned long flags; 508 509 snd_ad1816a_init(chip); 510 spin_lock_irqsave(&chip->lock, flags); 511 for (reg = 0; reg < 48; reg++) 512 snd_ad1816a_write(chip, reg, chip->image[reg]); 513 spin_unlock_irqrestore(&chip->lock, flags); 514 } 515 #endif 516 517 static int snd_ad1816a_probe(struct snd_ad1816a *chip) 515 518 { 516 519 unsigned long flags; … … 549 552 free_dma(chip->dma2); 550 553 } 551 kfree(chip);552 554 return 0; 553 555 } … … 559 561 } 560 562 561 static const char __devinit*snd_ad1816a_chip_id(struct snd_ad1816a *chip)563 static const char *snd_ad1816a_chip_id(struct snd_ad1816a *chip) 562 564 { 563 565 switch (chip->hardware) { … … 572 574 } 573 575 574 int __devinitsnd_ad1816a_create(struct snd_card *card,575 unsigned long port, int irq, int dma1, int dma2,576 struct snd_ad1816a **rchip)577 { 578 staticstruct snd_device_ops ops = {576 int snd_ad1816a_create(struct snd_card *card, 577 unsigned long port, int irq, int dma1, int dma2, 578 struct snd_ad1816a *chip) 579 { 580 static const struct snd_device_ops ops = { 579 581 .dev_free = snd_ad1816a_dev_free, 580 582 }; 581 583 int error; 582 struct snd_ad1816a *chip; 583 584 *rchip = NULL; 585 586 chip = kzalloc(sizeof(*chip), GFP_KERNEL); 587 if (chip == NULL) 588 return -ENOMEM; 584 589 585 chip->irq = -1; 590 586 chip->dma1 = -1; … … 596 592 return -EBUSY; 597 593 } 598 if (request_irq(irq, snd_ad1816a_interrupt, IRQF_DISABLED, "AD1816A", (void *) chip)) {594 if (request_irq(irq, snd_ad1816a_interrupt, 0, "AD1816A", (void *) chip)) { 599 595 snd_printk(KERN_ERR "ad1816a: can't grab IRQ %d\n", irq); 600 596 snd_ad1816a_free(chip); … … 602 598 } 603 599 chip->irq = irq; 600 card->sync_irq = chip->irq; 604 601 if (request_dma(dma1, "AD1816A - 1")) { 605 602 snd_printk(KERN_ERR "ad1816a: can't grab DMA1 %d\n", dma1); … … 632 629 } 633 630 634 *rchip = chip; 635 return 0; 636 } 637 638 static struct snd_pcm_ops snd_ad1816a_playback_ops = { 631 return 0; 632 } 633 634 static const struct snd_pcm_ops snd_ad1816a_playback_ops = { 639 635 .open = snd_ad1816a_playback_open, 640 636 .close = snd_ad1816a_playback_close, 641 .ioctl = snd_pcm_lib_ioctl,642 .hw_params = snd_ad1816a_hw_params,643 .hw_free = snd_ad1816a_hw_free,644 637 .prepare = snd_ad1816a_playback_prepare, 645 638 .trigger = snd_ad1816a_playback_trigger, … … 647 640 }; 648 641 649 static struct snd_pcm_ops snd_ad1816a_capture_ops = {642 static const struct snd_pcm_ops snd_ad1816a_capture_ops = { 650 643 .open = snd_ad1816a_capture_open, 651 644 .close = snd_ad1816a_capture_close, 652 .ioctl = snd_pcm_lib_ioctl,653 .hw_params = snd_ad1816a_hw_params,654 .hw_free = snd_ad1816a_hw_free,655 645 .prepare = snd_ad1816a_capture_prepare, 656 646 .trigger = snd_ad1816a_capture_trigger, … … 658 648 }; 659 649 660 int __devinit snd_ad1816a_pcm(struct snd_ad1816a *chip, int device, struct snd_pcm **rpcm)650 int snd_ad1816a_pcm(struct snd_ad1816a *chip, int device) 661 651 { 662 652 int error; … … 675 665 snd_ad1816a_init(chip); 676 666 677 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 678 snd_dma_isa_data(), 679 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); 667 snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, chip->card->dev, 668 64*1024, chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); 680 669 681 670 chip->pcm = pcm; 682 if (rpcm) 683 *rpcm = pcm; 684 return 0; 685 } 686 687 int __devinit snd_ad1816a_timer(struct snd_ad1816a *chip, int device, struct snd_timer **rtimer) 671 return 0; 672 } 673 674 int snd_ad1816a_timer(struct snd_ad1816a *chip, int device) 688 675 { 689 676 struct snd_timer *timer; … … 702 689 chip->timer = timer; 703 690 timer->hw = snd_ad1816a_timer_table; 704 if (rtimer)705 *rtimer = timer;706 691 return 0; 707 692 } … … 713 698 static int snd_ad1816a_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 714 699 { 715 static c har *texts[8] = {700 static const char * const texts[8] = { 716 701 "Line", "Mix", "CD", "Synth", "Video", 717 702 "Mic", "Phone", 718 703 }; 719 704 720 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 721 uinfo->count = 2; 722 uinfo->value.enumerated.items = 7; 723 if (uinfo->value.enumerated.item > 6) 724 uinfo->value.enumerated.item = 6; 725 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); 726 return 0; 705 return snd_ctl_enum_info(uinfo, 2, 7, texts); 727 706 } 728 707 … … 906 885 static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); 907 886 908 static struct snd_kcontrol_new snd_ad1816a_controls[] __devinitdata= {887 static const struct snd_kcontrol_new snd_ad1816a_controls[] = { 909 888 AD1816A_DOUBLE("Master Playback Switch", AD1816A_MASTER_ATT, 15, 7, 1, 1), 910 889 AD1816A_DOUBLE_TLV("Master Playback Volume", AD1816A_MASTER_ATT, 8, 0, 31, 1, … … 952 931 }; 953 932 954 int __devinitsnd_ad1816a_mixer(struct snd_ad1816a *chip)933 int snd_ad1816a_mixer(struct snd_ad1816a *chip) 955 934 { 956 935 struct snd_card *card; -
GPL/trunk/alsa-kernel/isa/ad1848/ad1848.c
r410 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Generic driver for AD1848/AD1847/CS4248 chips (0.1 Alpha) … … 4 5 * Jaroslav Kysela <perex@perex.cz> 5 6 * Based on card-4232.c by Jaroslav Kysela <perex@perex.cz> 6 *7 *8 * This program is free software; you can redistribute it and/or modify9 * it under the terms of the GNU General Public License as published by10 * the Free Software Foundation; either version 2 of the License, or11 * (at your option) any later version.12 *13 * This program is distributed in the hope that it will be useful,14 * but WITHOUT ANY WARRANTY; without even the implied warranty of15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 * GNU General Public License for more details.17 *18 * You should have received a copy of the GNU General Public License19 * along with this program; if not, write to the Free Software20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA21 *22 7 */ 23 8 … … 27 12 #include <linux/time.h> 28 13 #include <linux/wait.h> 29 #include <linux/module param.h>14 #include <linux/module.h> 30 15 #include <sound/core.h> 31 16 #include <sound/wss.h> … … 44 29 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 45 30 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 46 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */31 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 47 32 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 48 33 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,11,12,15 */ 49 34 static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */ 50 static intthinkpad[SNDRV_CARDS]; /* Thinkpad special case */35 static bool thinkpad[SNDRV_CARDS]; /* Thinkpad special case */ 51 36 52 37 module_param_array(index, int, NULL, 0444); … … 56 41 module_param_array(enable, bool, NULL, 0444); 57 42 MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard."); 58 module_param_ array(port, long, NULL, 0444);43 module_param_hw_array(port, long, ioport, NULL, 0444); 59 44 MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver."); 60 module_param_ array(irq, int, NULL, 0444);45 module_param_hw_array(irq, int, irq, NULL, 0444); 61 46 MODULE_PARM_DESC(irq, "IRQ # for " CRD_NAME " driver."); 62 module_param_ array(dma1, int, NULL, 0444);47 module_param_hw_array(dma1, int, dma, NULL, 0444); 63 48 MODULE_PARM_DESC(dma1, "DMA1 # for " CRD_NAME " driver."); 64 49 module_param_array(thinkpad, bool, NULL, 0444); 65 50 MODULE_PARM_DESC(thinkpad, "Enable only for the onboard CS4248 of IBM Thinkpad 360/750/755 series."); 66 51 67 static int __devinitsnd_ad1848_match(struct device *dev, unsigned int n)52 static int snd_ad1848_match(struct device *dev, unsigned int n) 68 53 { 69 54 if (!enable[n]) … … 85 70 } 86 71 87 static int __devinitsnd_ad1848_probe(struct device *dev, unsigned int n)72 static int snd_ad1848_probe(struct device *dev, unsigned int n) 88 73 { 89 74 struct snd_card *card; 90 75 struct snd_wss *chip; 91 struct snd_pcm *pcm;92 76 int error; 93 77 94 error = snd_card_ create(index[n], id[n], THIS_MODULE, 0, &card);78 error = snd_card_new(dev, index[n], id[n], THIS_MODULE, 0, &card); 95 79 if (error < 0) 96 80 return error; … … 104 88 card->private_data = chip; 105 89 106 error = snd_wss_pcm(chip, 0 , &pcm);90 error = snd_wss_pcm(chip, 0); 107 91 if (error < 0) 108 92 goto out; … … 112 96 goto out; 113 97 114 str cpy(card->driver, "AD1848");115 str cpy(card->shortname, pcm->name);98 strlcpy(card->driver, "AD1848", sizeof(card->driver)); 99 strlcpy(card->shortname, chip->pcm->name, sizeof(card->shortname)); 116 100 117 sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d", 118 pcm->name, chip->port, irq[n], dma1[n]); 119 if (thinkpad[n]) 120 strcat(card->longname, " [Thinkpad]"); 121 122 snd_card_set_dev(card, dev); 101 if (!thinkpad[n]) 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 [Thinkpad]", 108 chip->pcm->name, chip->port, irq[n], dma1[n]); 123 109 124 110 error = snd_card_register(card); … … 133 119 } 134 120 135 static int __devexitsnd_ad1848_remove(struct device *dev, unsigned int n)121 static int snd_ad1848_remove(struct device *dev, unsigned int n) 136 122 { 137 123 snd_card_free(dev_get_drvdata(dev)); 138 dev_set_drvdata(dev, NULL);139 124 return 0; 140 125 } … … 165 150 .match = snd_ad1848_match, 166 151 .probe = snd_ad1848_probe, 167 .remove = __devexit_p(snd_ad1848_remove),152 .remove = snd_ad1848_remove, 168 153 #ifdef CONFIG_PM 169 154 .suspend = snd_ad1848_suspend, … … 175 160 }; 176 161 177 static int __init alsa_card_ad1848_init(void) 178 { 179 return isa_register_driver(&snd_ad1848_driver, SNDRV_CARDS); 180 } 181 182 static void __exit alsa_card_ad1848_exit(void) 183 { 184 isa_unregister_driver(&snd_ad1848_driver); 185 } 186 187 module_init(alsa_card_ad1848_init); 188 module_exit(alsa_card_ad1848_exit); 162 module_isa_driver(snd_ad1848_driver, SNDRV_CARDS); -
GPL/trunk/alsa-kernel/isa/als100.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 2 3 /* … … 8 9 9 10 Generalised for soundcards based on DT-0196 and ALS-007 chips 10 by Jonathan Woithe <jwoithe@physics.adelaide.edu.au>: June 2002. 11 12 This program is free software; you can redistribute it and/or modify 13 it under the terms of the GNU General Public License as published by 14 the Free Software Foundation; either version 2 of the License, or 15 (at your option) any later version. 16 17 This program is distributed in the hope that it will be useful, 18 but WITHOUT ANY WARRANTY; without even the implied warranty of 19 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 20 GNU General Public License for more details. 21 22 You should have received a copy of the GNU General Public License 23 along with this program; if not, write to the Free Software 24 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 11 by Jonathan Woithe <jwoithe@just42.net>: June 2002. 12 25 13 */ 26 14 … … 29 17 #include <linux/time.h> 30 18 #include <linux/pnp.h> 31 #include <linux/module param.h>19 #include <linux/module.h> 32 20 #include <sound/core.h> 33 21 #include <sound/initval.h> … … 55 43 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 56 44 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 57 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */45 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 58 46 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 59 47 static long mpu_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ … … 80 68 }; 81 69 82 static struct pnp_card_device_id snd_als100_pnpids[] = {70 static const struct pnp_card_device_id snd_als100_pnpids[] = { 83 71 /* DT197A30 */ 84 72 { .id = "RWB1688", … … 118 106 MODULE_DEVICE_TABLE(pnp_card, snd_als100_pnpids); 119 107 120 static int __devinitsnd_card_als100_pnp(int dev, struct snd_card_als100 *acard,121 struct pnp_card_link *card,122 const struct pnp_card_device_id *id)108 static int snd_card_als100_pnp(int dev, struct snd_card_als100 *acard, 109 struct pnp_card_link *card, 110 const struct pnp_card_device_id *id) 123 111 { 124 112 struct pnp_dev *pdev; … … 184 172 } 185 173 186 static int __devinitsnd_card_als100_probe(int dev,187 struct pnp_card_link *pcard,188 const struct pnp_card_device_id *pid)174 static int snd_card_als100_probe(int dev, 175 struct pnp_card_link *pcard, 176 const struct pnp_card_device_id *pid) 189 177 { 190 178 int error; … … 194 182 struct snd_opl3 *opl3; 195 183 196 error = snd_card_create(index[dev], id[dev], THIS_MODULE, 197 sizeof(struct snd_card_als100), &card); 184 error = snd_card_new(&pcard->card->dev, 185 index[dev], id[dev], THIS_MODULE, 186 sizeof(struct snd_card_als100), &card); 198 187 if (error < 0) 199 188 return error; … … 204 193 return error; 205 194 } 206 snd_card_set_dev(card, &pcard->card->dev);207 195 208 196 if (pid->driver_data == SB_HW_DT019X) … … 223 211 strcpy(card->driver, "DT-019X"); 224 212 strcpy(card->shortname, "Diamond Tech. DT-019X"); 225 s printf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d",226 card->shortname, chip->name, chip->port,227 irq[dev], dma8[dev]);213 snprintf(card->longname, sizeof(card->longname), 214 "Diamond Tech. DT-019X, %s at 0x%lx, irq %d, dma %d", 215 chip->name, chip->port, irq[dev], dma8[dev]); 228 216 } else { 229 217 strcpy(card->driver, "ALS100"); 230 218 strcpy(card->shortname, "Avance Logic ALS100"); 231 sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", 232 card->shortname, chip->name, chip->port, 233 irq[dev], dma8[dev], dma16[dev]); 234 } 235 236 if ((error = snd_sb16dsp_pcm(chip, 0, NULL)) < 0) { 219 snprintf(card->longname, sizeof(card->longname), 220 "Avance Logic ALS100, %s at 0x%lx, irq %d, dma %d&%d", 221 chip->name, chip->port, irq[dev], dma8[dev], 222 dma16[dev]); 223 } 224 225 if ((error = snd_sb16dsp_pcm(chip, 0)) < 0) { 237 226 snd_card_free(card); 238 227 return error; … … 257 246 mpu_port[dev], 0, 258 247 mpu_irq[dev], 259 mpu_irq[dev] >= 0 ? IRQF_DISABLED : 0,260 248 NULL) < 0) 261 249 snd_printk(KERN_ERR PFX "no MPU-401 device at 0x%lx\n", mpu_port[dev]); … … 288 276 } 289 277 290 static unsigned int __devinitdataals100_devices;291 292 static int __devinitsnd_als100_pnp_detect(struct pnp_card_link *card,293 const struct pnp_card_device_id *id)278 static unsigned int als100_devices; 279 280 static int snd_als100_pnp_detect(struct pnp_card_link *card, 281 const struct pnp_card_device_id *id) 294 282 { 295 283 static int dev; … … 309 297 } 310 298 311 static void __devexit snd_als100_pnp_remove(struct pnp_card_link *pcard)299 static void snd_als100_pnp_remove(struct pnp_card_link *pcard) 312 300 { 313 301 snd_card_free(pnp_get_card_drvdata(pcard)); … … 323 311 324 312 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 325 snd_pcm_suspend_all(chip->pcm);326 313 snd_sbmixer_suspend(chip); 327 314 return 0; … … 346 333 .id_table = snd_als100_pnpids, 347 334 .probe = snd_als100_pnp_detect, 348 .remove = __devexit_p(snd_als100_pnp_remove),335 .remove = snd_als100_pnp_remove, 349 336 #ifdef CONFIG_PM 350 337 .suspend = snd_als100_pnp_suspend, -
GPL/trunk/alsa-kernel/isa/azt2320.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 card-azt2320.c - driver for Aztech Systems AZT2320 based soundcards. 3 4 Copyright (C) 1999-2000 by Massimo Piccioni <dafastidio@libero.it> 4 5 5 This program is free software; you can redistribute it and/or modify6 it under the terms of the GNU General Public License as published by7 the Free Software Foundation; either version 2 of the License, or8 (at your option) any later version.9 10 This program is distributed in the hope that it will be useful,11 but WITHOUT ANY WARRANTY; without even the implied warranty of12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 GNU General Public License for more details.14 15 You should have received a copy of the GNU General Public License16 along with this program; if not, write to the Free Software17 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA18 6 */ 19 7 … … 30 18 */ 31 19 32 #include < asm/io.h>20 #include <linux/io.h> 33 21 #include <linux/delay.h> 34 22 #include <linux/init.h> … … 36 24 #include <linux/wait.h> 37 25 #include <linux/pnp.h> 38 #include <linux/module param.h>26 #include <linux/module.h> 39 27 #include <sound/core.h> 40 28 #include <sound/initval.h> … … 56 44 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 57 45 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 58 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */46 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 59 47 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ 60 48 static long wss_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ … … 80 68 }; 81 69 82 static struct pnp_card_device_id snd_azt2320_pnpids[] = {70 static const struct pnp_card_device_id snd_azt2320_pnpids[] = { 83 71 /* PRO16V */ 84 72 { .id = "AZT1008", .devs = { { "AZT1008" }, { "AZT2001" }, } }, … … 100 88 #define DRIVER_NAME "snd-card-azt2320" 101 89 102 static int __devinitsnd_card_azt2320_pnp(int dev, struct snd_card_azt2320 *acard,103 struct pnp_card_link *card,104 const struct pnp_card_device_id *id)90 static int snd_card_azt2320_pnp(int dev, struct snd_card_azt2320 *acard, 91 struct pnp_card_link *card, 92 const struct pnp_card_device_id *id) 105 93 { 106 94 struct pnp_dev *pdev; … … 148 136 149 137 /* same of snd_sbdsp_command by Jaroslav Kysela */ 150 static int __devinitsnd_card_azt2320_command(unsigned long port, unsigned char val)138 static int snd_card_azt2320_command(unsigned long port, unsigned char val) 151 139 { 152 140 int i; … … 162 150 } 163 151 164 static int __devinitsnd_card_azt2320_enable_wss(unsigned long port)152 static int snd_card_azt2320_enable_wss(unsigned long port) 165 153 { 166 154 int error; … … 175 163 } 176 164 177 static int __devinitsnd_card_azt2320_probe(int dev,178 struct pnp_card_link *pcard,179 const struct pnp_card_device_id *pid)165 static int snd_card_azt2320_probe(int dev, 166 struct pnp_card_link *pcard, 167 const struct pnp_card_device_id *pid) 180 168 { 181 169 int error; … … 185 173 struct snd_opl3 *opl3; 186 174 187 error = snd_card_create(index[dev], id[dev], THIS_MODULE, 188 sizeof(struct snd_card_azt2320), &card); 175 error = snd_card_new(&pcard->card->dev, 176 index[dev], id[dev], THIS_MODULE, 177 sizeof(struct snd_card_azt2320), &card); 189 178 if (error < 0) 190 179 return error; … … 195 184 return error; 196 185 } 197 snd_card_set_dev(card, &pcard->card->dev);198 186 199 187 if ((error = snd_card_azt2320_enable_wss(port[dev]))) { … … 216 204 card->shortname, chip->port, irq[dev], dma1[dev], dma2[dev]); 217 205 218 error = snd_wss_pcm(chip, 0 , NULL);206 error = snd_wss_pcm(chip, 0); 219 207 if (error < 0) { 220 208 snd_card_free(card); … … 226 214 return error; 227 215 } 228 error = snd_wss_timer(chip, 0 , NULL);216 error = snd_wss_timer(chip, 0); 229 217 if (error < 0) { 230 218 snd_card_free(card); … … 235 223 if (snd_mpu401_uart_new(card, 0, MPU401_HW_AZT2320, 236 224 mpu_port[dev], 0, 237 mpu_irq[dev], IRQF_DISABLED, 238 NULL) < 0) 225 mpu_irq[dev], NULL) < 0) 239 226 snd_printk(KERN_ERR PFX "no MPU-401 device at 0x%lx\n", mpu_port[dev]); 240 227 } … … 266 253 } 267 254 268 static unsigned int __devinitdataazt2320_devices;269 270 static int __devinitsnd_azt2320_pnp_detect(struct pnp_card_link *card,271 const struct pnp_card_device_id *id)255 static unsigned int azt2320_devices; 256 257 static int snd_azt2320_pnp_detect(struct pnp_card_link *card, 258 const struct pnp_card_device_id *id) 272 259 { 273 260 static int dev; … … 287 274 } 288 275 289 static void __devexit snd_azt2320_pnp_remove(struct pnp_card_link *pcard)276 static void snd_azt2320_pnp_remove(struct pnp_card_link *pcard) 290 277 { 291 278 snd_card_free(pnp_get_card_drvdata(pcard)); … … 322 309 .id_table = snd_azt2320_pnpids, 323 310 .probe = snd_azt2320_pnp_detect, 324 .remove = __devexit_p(snd_azt2320_pnp_remove),311 .remove = snd_azt2320_pnp_remove, 325 312 #ifdef CONFIG_PM 326 313 .suspend = snd_azt2320_pnp_suspend, -
GPL/trunk/alsa-kernel/isa/cmi8330.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Driver for C-Media's CMI8330 and CMI8329 soundcards. 3 4 * Copyright (c) by George Talusan <gstalusan@uwaterloo.ca> 4 5 * http://www.undergrad.math.uwaterloo.ca/~gstalusa 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 */ 21 7 … … 48 34 #include <linux/isa.h> 49 35 #include <linux/pnp.h> 50 #include <linux/module param.h>36 #include <linux/module.h> 51 37 #include <sound/core.h> 52 38 #include <sound/wss.h> … … 70 56 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 71 57 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 72 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP;73 #ifdef CONFIG_PNP 74 static intisapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};58 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; 59 #ifdef CONFIG_PNP 60 static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 75 61 #endif 76 62 static long sbport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; … … 96 82 #endif 97 83 98 module_param_ array(sbport, long, NULL, 0444);84 module_param_hw_array(sbport, long, ioport, NULL, 0444); 99 85 MODULE_PARM_DESC(sbport, "Port # for CMI8330/CMI8329 SB driver."); 100 module_param_ array(sbirq, int, NULL, 0444);86 module_param_hw_array(sbirq, int, irq, NULL, 0444); 101 87 MODULE_PARM_DESC(sbirq, "IRQ # for CMI8330/CMI8329 SB driver."); 102 module_param_ array(sbdma8, int, NULL, 0444);88 module_param_hw_array(sbdma8, int, dma, NULL, 0444); 103 89 MODULE_PARM_DESC(sbdma8, "DMA8 for CMI8330/CMI8329 SB driver."); 104 module_param_ array(sbdma16, int, NULL, 0444);90 module_param_hw_array(sbdma16, int, dma, NULL, 0444); 105 91 MODULE_PARM_DESC(sbdma16, "DMA16 for CMI8330/CMI8329 SB driver."); 106 92 107 module_param_ array(wssport, long, NULL, 0444);93 module_param_hw_array(wssport, long, ioport, NULL, 0444); 108 94 MODULE_PARM_DESC(wssport, "Port # for CMI8330/CMI8329 WSS driver."); 109 module_param_ array(wssirq, int, NULL, 0444);95 module_param_hw_array(wssirq, int, irq, NULL, 0444); 110 96 MODULE_PARM_DESC(wssirq, "IRQ # for CMI8330/CMI8329 WSS driver."); 111 module_param_ array(wssdma, int, NULL, 0444);97 module_param_hw_array(wssdma, int, dma, NULL, 0444); 112 98 MODULE_PARM_DESC(wssdma, "DMA for CMI8330/CMI8329 WSS driver."); 113 99 114 module_param_ array(fmport, long, NULL, 0444);100 module_param_hw_array(fmport, long, ioport, NULL, 0444); 115 101 MODULE_PARM_DESC(fmport, "FM port # for CMI8330/CMI8329 driver."); 116 module_param_ array(mpuport, long, NULL, 0444);102 module_param_hw_array(mpuport, long, ioport, NULL, 0444); 117 103 MODULE_PARM_DESC(mpuport, "MPU-401 port # for CMI8330/CMI8329 driver."); 118 module_param_ array(mpuirq, int, NULL, 0444);104 module_param_hw_array(mpuirq, int, irq, NULL, 0444); 119 105 MODULE_PARM_DESC(mpuirq, "IRQ # for CMI8330/CMI8329 MPU-401 port."); 120 106 #ifdef CONFIG_PNP … … 135 121 #define CMI8330_CDINGAIN 26 136 122 137 static unsigned char snd_cmi8330_image[((CMI8330_CDINGAIN)-16) + 1] =123 static const unsigned char snd_cmi8330_image[((CMI8330_CDINGAIN)-16) + 1] = 138 124 { 139 125 0x40, /* 16 - recording mux (SB-mixer-enabled) */ … … 183 169 #ifdef CONFIG_PNP 184 170 185 static struct pnp_card_device_id snd_cmi8330_pnpids[] = {171 static const struct pnp_card_device_id snd_cmi8330_pnpids[] = { 186 172 { .id = "CMI0001", .devs = { { "@X@0001" }, { "@@@0001" }, { "@H@0001" }, { "A@@0001" } } }, 187 173 { .id = "CMI0001", .devs = { { "@@@0001" }, { "@X@0001" }, { "@H@0001" } } }, … … 194 180 195 181 196 static struct snd_kcontrol_new snd_cmi8330_controls[] __devinitdata= {182 static const struct snd_kcontrol_new snd_cmi8330_controls[] = { 197 183 WSS_DOUBLE("Master Playback Volume", 0, 198 184 CMI8330_MASTVOL, CMI8330_MASTVOL, 4, 0, 15, 0), … … 250 236 251 237 #ifdef ENABLE_SB_MIXER 252 static struct sbmix_elem cmi8330_sb_mixers[] __devinitdata= {238 static const struct sbmix_elem cmi8330_sb_mixers[] = { 253 239 SB_DOUBLE("SB Master Playback Volume", SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31), 254 240 SB_DOUBLE("Tone Control - Bass", SB_DSP4_BASS_DEV, (SB_DSP4_BASS_DEV + 1), 4, 4, 15), … … 268 254 }; 269 255 270 static unsigned char cmi8330_sb_init_values[][2] __devinitdata= {256 static const unsigned char cmi8330_sb_init_values[][2] = { 271 257 { SB_DSP4_MASTER_DEV + 0, 0 }, 272 258 { SB_DSP4_MASTER_DEV + 1, 0 }, … … 282 268 283 269 284 static int __devinitcmi8330_add_sb_mixers(struct snd_sb *chip)270 static int cmi8330_add_sb_mixers(struct snd_sb *chip) 285 271 { 286 272 int idx, err; … … 307 293 #endif 308 294 309 static int __devinitsnd_cmi8330_mixer(struct snd_card *card, struct snd_cmi8330 *acard)295 static int snd_cmi8330_mixer(struct snd_card *card, struct snd_cmi8330 *acard) 310 296 { 311 297 unsigned int idx; … … 330 316 331 317 #ifdef CONFIG_PNP 332 static int __devinitsnd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard,333 struct pnp_card_link *card,334 const struct pnp_card_device_id *id)318 static int snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard, 319 struct pnp_card_link *card, 320 const struct pnp_card_device_id *id) 335 321 { 336 322 struct pnp_dev *pdev; … … 438 424 } 439 425 440 static int __devinitsnd_cmi8330_pcm(struct snd_card *card, struct snd_cmi8330 *chip)426 static int snd_cmi8330_pcm(struct snd_card *card, struct snd_cmi8330 *chip) 441 427 { 442 428 struct snd_pcm *pcm; 443 429 const struct snd_pcm_ops *ops; 444 430 int err; 445 static snd_pcm_open_callback_t cmi_open_callbacks[2] = {431 static const snd_pcm_open_callback_t cmi_open_callbacks[2] = { 446 432 snd_cmi8330_playback_open, 447 433 snd_cmi8330_capture_open … … 470 456 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &chip->streams[SNDRV_PCM_STREAM_CAPTURE].ops); 471 457 472 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 473 snd_dma_isa_data(), 474 64*1024, 128*1024); 458 snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, 459 card->dev, 64*1024, 128*1024); 475 460 chip->pcm = pcm; 476 461 … … 485 470 486 471 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 487 snd_pcm_suspend_all(acard->pcm);488 472 acard->wss->suspend(acard->wss); 489 473 snd_sbmixer_suspend(acard->sb); … … 515 499 #define PFX "cmi8330: " 516 500 517 static int snd_cmi8330_card_new(int dev, struct snd_card **cardp) 501 static int snd_cmi8330_card_new(struct device *pdev, int dev, 502 struct snd_card **cardp) 518 503 { 519 504 struct snd_card *card; … … 521 506 int err; 522 507 523 err = snd_card_ create(index[dev], id[dev], THIS_MODULE,524 sizeof(struct snd_cmi8330), &card);508 err = snd_card_new(pdev, index[dev], id[dev], THIS_MODULE, 509 sizeof(struct snd_cmi8330), &card); 525 510 if (err < 0) { 526 511 snd_printk(KERN_ERR PFX "could not get a new card\n"); … … 533 518 } 534 519 535 static int __devinitsnd_cmi8330_probe(struct snd_card *card, int dev)520 static int snd_cmi8330_probe(struct snd_card *card, int dev) 536 521 { 537 522 struct snd_cmi8330 *acard; … … 598 583 if (snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, 599 584 mpuport[dev], 0, mpuirq[dev], 600 IRQF_DISABLED,NULL) < 0)585 NULL) < 0) 601 586 printk(KERN_ERR PFX "no MPU-401 device at 0x%lx.\n", 602 587 mpuport[dev]); … … 614 599 } 615 600 616 static int __devinitsnd_cmi8330_isa_match(struct device *pdev,617 unsigned int dev)601 static int snd_cmi8330_isa_match(struct device *pdev, 602 unsigned int dev) 618 603 { 619 604 if (!enable[dev] || is_isapnp_selected(dev)) … … 630 615 } 631 616 632 static int __devinitsnd_cmi8330_isa_probe(struct device *pdev,633 unsigned int dev)617 static int snd_cmi8330_isa_probe(struct device *pdev, 618 unsigned int dev) 634 619 { 635 620 struct snd_card *card; 636 621 int err; 637 622 638 err = snd_cmi8330_card_new( dev, &card);623 err = snd_cmi8330_card_new(pdev, dev, &card); 639 624 if (err < 0) 640 625 return err; 641 snd_card_set_dev(card, pdev);642 626 if ((err = snd_cmi8330_probe(card, dev)) < 0) { 643 627 snd_card_free(card); … … 648 632 } 649 633 650 static int __devexitsnd_cmi8330_isa_remove(struct device *devptr,651 unsigned int dev)634 static int snd_cmi8330_isa_remove(struct device *devptr, 635 unsigned int dev) 652 636 { 653 637 snd_card_free(dev_get_drvdata(devptr)); 654 dev_set_drvdata(devptr, NULL);655 638 return 0; 656 639 } … … 674 657 .match = snd_cmi8330_isa_match, 675 658 .probe = snd_cmi8330_isa_probe, 676 .remove = __devexit_p(snd_cmi8330_isa_remove),659 .remove = snd_cmi8330_isa_remove, 677 660 #ifdef CONFIG_PM 678 661 .suspend = snd_cmi8330_isa_suspend, … … 686 669 687 670 #ifdef CONFIG_PNP 688 static int __devinitsnd_cmi8330_pnp_detect(struct pnp_card_link *pcard,689 const struct pnp_card_device_id *pid)671 static int snd_cmi8330_pnp_detect(struct pnp_card_link *pcard, 672 const struct pnp_card_device_id *pid) 690 673 { 691 674 static int dev; … … 700 683 return -ENODEV; 701 684 702 res = snd_cmi8330_card_new( dev, &card);685 res = snd_cmi8330_card_new(&pcard->card->dev, dev, &card); 703 686 if (res < 0) 704 687 return res; … … 708 691 return res; 709 692 } 710 snd_card_set_dev(card, &pcard->card->dev);711 693 if ((res = snd_cmi8330_probe(card, dev)) < 0) { 712 694 snd_card_free(card); … … 718 700 } 719 701 720 static void __devexit snd_cmi8330_pnp_remove(struct pnp_card_link *pcard)702 static void snd_cmi8330_pnp_remove(struct pnp_card_link *pcard) 721 703 { 722 704 snd_card_free(pnp_get_card_drvdata(pcard)); … … 741 723 .id_table = snd_cmi8330_pnpids, 742 724 .probe = snd_cmi8330_pnp_detect, 743 .remove = __devexit_p(snd_cmi8330_pnp_remove),725 .remove = snd_cmi8330_pnp_remove, 744 726 #ifdef CONFIG_PM 745 727 .suspend = snd_cmi8330_pnp_suspend, -
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); -
GPL/trunk/alsa-kernel/isa/cs423x/cs4236.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Driver for generic CS4232/CS4235/CS4236/CS4236B/CS4237B/CS4238B/CS4239 chips 3 4 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 4 *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 5 */ 21 6 … … 24 9 #include <linux/isa.h> 25 10 #include <linux/pnp.h> 26 #include <linux/module param.h>11 #include <linux/module.h> 27 12 #include <sound/core.h> 28 13 #include <sound/wss.h> … … 75 60 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 76 61 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 77 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */78 #ifdef CONFIG_PNP 79 static intisapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};62 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 63 #ifdef CONFIG_PNP 64 static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 80 65 #endif 81 66 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ … … 99 84 MODULE_PARM_DESC(isapnp, "ISA PnP detection for specified soundcard."); 100 85 #endif 101 module_param_ array(port, long, NULL, 0444);86 module_param_hw_array(port, long, ioport, NULL, 0444); 102 87 MODULE_PARM_DESC(port, "Port # for " IDENT " driver."); 103 module_param_ array(cport, long, NULL, 0444);88 module_param_hw_array(cport, long, ioport, NULL, 0444); 104 89 MODULE_PARM_DESC(cport, "Control port # for " IDENT " driver."); 105 module_param_ array(mpu_port, long, NULL, 0444);90 module_param_hw_array(mpu_port, long, ioport, NULL, 0444); 106 91 MODULE_PARM_DESC(mpu_port, "MPU-401 port # for " IDENT " driver."); 107 module_param_ array(fm_port, long, NULL, 0444);92 module_param_hw_array(fm_port, long, ioport, NULL, 0444); 108 93 MODULE_PARM_DESC(fm_port, "FM port # for " IDENT " driver."); 109 module_param_ array(sb_port, long, NULL, 0444);94 module_param_hw_array(sb_port, long, ioport, NULL, 0444); 110 95 MODULE_PARM_DESC(sb_port, "SB port # for " IDENT " driver (optional)."); 111 module_param_ array(irq, int, NULL, 0444);96 module_param_hw_array(irq, int, irq, NULL, 0444); 112 97 MODULE_PARM_DESC(irq, "IRQ # for " IDENT " driver."); 113 module_param_ array(mpu_irq, int, NULL, 0444);98 module_param_hw_array(mpu_irq, int, irq, NULL, 0444); 114 99 MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for " IDENT " driver."); 115 module_param_ array(dma1, int, NULL, 0444);100 module_param_hw_array(dma1, int, dma, NULL, 0444); 116 101 MODULE_PARM_DESC(dma1, "DMA1 # for " IDENT " driver."); 117 module_param_ array(dma2, int, NULL, 0444);102 module_param_hw_array(dma2, int, dma, NULL, 0444); 118 103 MODULE_PARM_DESC(dma2, "DMA2 # for " IDENT " driver."); 119 104 … … 150 135 151 136 #define CS423X_ISAPNP_DRIVER "cs4232_isapnp" 152 static struct pnp_card_device_id snd_cs423x_pnpids[] = {137 static const struct pnp_card_device_id snd_cs423x_pnpids[] = { 153 138 /* Philips PCA70PS */ 154 139 { .id = "CSC0d32", .devs = { { "CSC0000" }, { "CSC0010" }, { "PNPb006" } } }, … … 252 237 253 238 /* WSS initialization */ 254 static int __devinitsnd_cs423x_pnp_init_wss(int dev, struct pnp_dev *pdev)239 static int snd_cs423x_pnp_init_wss(int dev, struct pnp_dev *pdev) 255 240 { 256 241 if (pnp_activate_dev(pdev) < 0) { … … 273 258 274 259 /* CTRL initialization */ 275 static int __devinitsnd_cs423x_pnp_init_ctrl(int dev, struct pnp_dev *pdev)260 static int snd_cs423x_pnp_init_ctrl(int dev, struct pnp_dev *pdev) 276 261 { 277 262 if (pnp_activate_dev(pdev) < 0) { … … 285 270 286 271 /* MPU initialization */ 287 static int __devinitsnd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev)272 static int snd_cs423x_pnp_init_mpu(int dev, struct pnp_dev *pdev) 288 273 { 289 274 if (pnp_activate_dev(pdev) < 0) { … … 294 279 mpu_port[dev] = pnp_port_start(pdev, 0); 295 280 if (mpu_irq[dev] >= 0 && 296 pnp_irq_valid(pdev, 0) && pnp_irq(pdev, 0) >= 0) { 281 pnp_irq_valid(pdev, 0) && 282 pnp_irq(pdev, 0) != (resource_size_t)-1) { 297 283 mpu_irq[dev] = pnp_irq(pdev, 0); 298 284 } else { … … 304 290 } 305 291 306 static int __devinitsnd_card_cs423x_pnp(int dev, struct snd_card_cs4236 *acard,307 struct pnp_dev *pdev,308 struct pnp_dev *cdev)292 static int snd_card_cs423x_pnp(int dev, struct snd_card_cs4236 *acard, 293 struct pnp_dev *pdev, 294 struct pnp_dev *cdev) 309 295 { 310 296 acard->wss = pdev; … … 318 304 } 319 305 320 static int __devinitsnd_card_cs423x_pnpc(int dev, struct snd_card_cs4236 *acard,321 struct pnp_card_link *card,322 const struct pnp_card_device_id *id)306 static int snd_card_cs423x_pnpc(int dev, struct snd_card_cs4236 *acard, 307 struct pnp_card_link *card, 308 const struct pnp_card_device_id *id) 323 309 { 324 310 acard->wss = pnp_request_card_device(card, id->devs[0].id, NULL); … … 365 351 } 366 352 367 static int snd_cs423x_card_new(int dev, struct snd_card **cardp) 353 static int snd_cs423x_card_new(struct device *pdev, int dev, 354 struct snd_card **cardp) 368 355 { 369 356 struct snd_card *card; 370 357 int err; 371 358 372 err = snd_card_ create(index[dev], id[dev], THIS_MODULE,373 sizeof(struct snd_card_cs4236), &card);359 err = snd_card_new(pdev, index[dev], id[dev], THIS_MODULE, 360 sizeof(struct snd_card_cs4236), &card); 374 361 if (err < 0) 375 362 return err; … … 379 366 } 380 367 381 static int __devinitsnd_cs423x_probe(struct snd_card *card, int dev)368 static int snd_cs423x_probe(struct snd_card *card, int dev) 382 369 { 383 370 struct snd_card_cs4236 *acard; 384 struct snd_pcm *pcm;385 371 struct snd_wss *chip; 386 372 struct snd_opl3 *opl3; … … 404 390 if (chip->hardware & WSS_HW_CS4236B_MASK) { 405 391 406 err = snd_cs4236_pcm(chip, 0 , &pcm);392 err = snd_cs4236_pcm(chip, 0); 407 393 if (err < 0) 408 394 return err; … … 412 398 return err; 413 399 } else { 414 err = snd_wss_pcm(chip, 0 , &pcm);400 err = snd_wss_pcm(chip, 0); 415 401 if (err < 0) 416 402 return err; … … 420 406 return err; 421 407 } 422 strcpy(card->driver, pcm->name); 423 strcpy(card->shortname, pcm->name); 424 sprintf(card->longname, "%s at 0x%lx, irq %i, dma %i", 425 pcm->name, 426 chip->port, 427 irq[dev], 428 dma1[dev]); 429 if (dma2[dev] >= 0) 430 sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]); 431 432 err = snd_wss_timer(chip, 0, NULL); 408 strlcpy(card->driver, chip->pcm->name, sizeof(card->driver)); 409 strlcpy(card->shortname, chip->pcm->name, sizeof(card->shortname)); 410 if (dma2[dev] < 0) 411 snprintf(card->longname, sizeof(card->longname), 412 "%s at 0x%lx, irq %i, dma %i", 413 chip->pcm->name, chip->port, irq[dev], dma1[dev]); 414 else 415 snprintf(card->longname, sizeof(card->longname), 416 "%s at 0x%lx, irq %i, dma %i&%d", 417 chip->pcm->name, chip->port, irq[dev], dma1[dev], 418 dma2[dev]); 419 420 err = snd_wss_timer(chip, 0); 433 421 if (err < 0) 434 422 return err; … … 450 438 if (snd_mpu401_uart_new(card, 0, MPU401_HW_CS4232, 451 439 mpu_port[dev], 0, 452 mpu_irq[dev], 453 mpu_irq[dev] >= 0 ? IRQF_DISABLED : 0, NULL) < 0) 440 mpu_irq[dev], NULL) < 0) 454 441 printk(KERN_WARNING IDENT ": MPU401 not detected\n"); 455 442 } … … 458 445 } 459 446 460 static int __devinitsnd_cs423x_isa_match(struct device *pdev,461 unsigned int dev)447 static int snd_cs423x_isa_match(struct device *pdev, 448 unsigned int dev) 462 449 { 463 450 if (!enable[dev] || is_isapnp_selected(dev)) … … 483 470 } 484 471 485 static int __devinitsnd_cs423x_isa_probe(struct device *pdev,486 unsigned int dev)472 static int snd_cs423x_isa_probe(struct device *pdev, 473 unsigned int dev) 487 474 { 488 475 struct snd_card *card; 489 476 int err; 490 477 491 err = snd_cs423x_card_new( dev, &card);478 err = snd_cs423x_card_new(pdev, dev, &card); 492 479 if (err < 0) 493 480 return err; 494 snd_card_set_dev(card, pdev);495 481 if ((err = snd_cs423x_probe(card, dev)) < 0) { 496 482 snd_card_free(card); … … 502 488 } 503 489 504 static int __devexitsnd_cs423x_isa_remove(struct device *pdev,505 unsigned int dev)490 static int snd_cs423x_isa_remove(struct device *pdev, 491 unsigned int dev) 506 492 { 507 493 snd_card_free(dev_get_drvdata(pdev)); 508 dev_set_drvdata(pdev, NULL);509 494 return 0; 510 495 } … … 542 527 .match = snd_cs423x_isa_match, 543 528 .probe = snd_cs423x_isa_probe, 544 .remove = __devexit_p(snd_cs423x_isa_remove),529 .remove = snd_cs423x_isa_remove, 545 530 #ifdef CONFIG_PM 546 531 .suspend = snd_cs423x_isa_suspend, … … 554 539 555 540 #ifdef CONFIG_PNP 556 static int __devinitsnd_cs423x_pnpbios_detect(struct pnp_dev *pdev,557 const struct pnp_device_id *id)541 static int snd_cs423x_pnpbios_detect(struct pnp_dev *pdev, 542 const struct pnp_device_id *id) 558 543 { 559 544 static int dev; … … 580 565 break; 581 566 } 582 err = snd_cs423x_card_new( dev, &card);567 err = snd_cs423x_card_new(&pdev->dev, dev, &card); 583 568 if (err < 0) 584 569 return err; … … 589 574 return err; 590 575 } 591 snd_card_set_dev(card, &pdev->dev);592 576 if ((err = snd_cs423x_probe(card, dev)) < 0) { 593 577 snd_card_free(card); … … 599 583 } 600 584 601 static void __devexitsnd_cs423x_pnp_remove(struct pnp_dev *pdev)585 static void snd_cs423x_pnp_remove(struct pnp_dev *pdev) 602 586 { 603 587 snd_card_free(pnp_get_drvdata(pdev)); 604 pnp_set_drvdata(pdev, NULL);605 588 } 606 589 … … 621 604 .id_table = snd_cs423x_pnpbiosids, 622 605 .probe = snd_cs423x_pnpbios_detect, 623 .remove = __devexit_p(snd_cs423x_pnp_remove),606 .remove = snd_cs423x_pnp_remove, 624 607 #ifdef CONFIG_PM 625 608 .suspend = snd_cs423x_pnp_suspend, … … 628 611 }; 629 612 630 static int __devinitsnd_cs423x_pnpc_detect(struct pnp_card_link *pcard,631 const struct pnp_card_device_id *pid)613 static int snd_cs423x_pnpc_detect(struct pnp_card_link *pcard, 614 const struct pnp_card_device_id *pid) 632 615 { 633 616 static int dev; … … 642 625 return -ENODEV; 643 626 644 res = snd_cs423x_card_new( dev, &card);627 res = snd_cs423x_card_new(&pcard->card->dev, dev, &card); 645 628 if (res < 0) 646 629 return res; … … 651 634 return res; 652 635 } 653 snd_card_set_dev(card, &pcard->card->dev);654 636 if ((res = snd_cs423x_probe(card, dev)) < 0) { 655 637 snd_card_free(card); … … 661 643 } 662 644 663 static void __devexit snd_cs423x_pnpc_remove(struct pnp_card_link *pcard)645 static void snd_cs423x_pnpc_remove(struct pnp_card_link *pcard) 664 646 { 665 647 snd_card_free(pnp_get_card_drvdata(pcard)); … … 684 666 .id_table = snd_cs423x_pnpids, 685 667 .probe = snd_cs423x_pnpc_detect, 686 .remove = __devexit_p(snd_cs423x_pnpc_remove),668 .remove = snd_cs423x_pnpc_remove, 687 669 #ifdef CONFIG_PM 688 670 .suspend = snd_cs423x_pnpc_suspend, -
GPL/trunk/alsa-kernel/isa/cs423x/cs4236_lib.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> … … 8 9 * Bugs: 9 10 * ----- 10 *11 * This program is free software; you can redistribute it and/or modify12 * it under the terms of the GNU General Public License as published by13 * the Free Software Foundation; either version 2 of the License, or14 * (at your option) any later version.15 *16 * This program is distributed in the hope that it will be useful,17 * but WITHOUT ANY WARRANTY; without even the implied warranty of18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the19 * GNU General Public License for more details.20 *21 * You should have received a copy of the GNU General Public License22 * along with this program; if not, write to the Free Software23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA24 *25 11 */ 26 12 … … 54 40 * D6: channels status block reset (CS4237B,CS4238B) 55 41 * D5: user bit in sub-frame of digital audio data (CS4237B,CS4238B) 56 * D4: validity bit bitin sub-frame of digital audio data (CS4237B,CS4238B)42 * D4: validity bit in sub-frame of digital audio data (CS4237B,CS4238B) 57 43 * 58 44 * C5 lower channel status (digital serial data description) (CS4237B,CS4238B) … … 80 66 */ 81 67 82 #include < asm/io.h>68 #include <linux/io.h> 83 69 #include <linux/delay.h> 84 70 #include <linux/init.h> … … 95 81 */ 96 82 97 static unsigned char snd_cs4236_ext_map[18] = {83 static const unsigned char snd_cs4236_ext_map[18] = { 98 84 /* CS4236_LEFT_LINE */ 0xff, 99 85 /* CS4236_RIGHT_LINE */ 0xff, … … 139 125 #define CLOCKS 8 140 126 141 static struct snd_ratnum clocks[CLOCKS] = {127 static const struct snd_ratnum clocks[CLOCKS] = { 142 128 { .num = 16934400, .den_min = 353, .den_max = 353, .den_step = 1 }, 143 129 { .num = 16934400, .den_min = 529, .den_max = 529, .den_step = 1 }, … … 150 136 }; 151 137 152 static struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = {138 static const struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = { 153 139 .nrats = CLOCKS, 154 140 .rats = clocks, … … 377 363 } 378 364 379 int snd_cs4236_pcm(struct snd_wss *chip, int device, struct snd_pcm **rpcm) 380 { 381 struct snd_pcm *pcm; 365 int snd_cs4236_pcm(struct snd_wss *chip, int device) 366 { 382 367 int err; 383 368 384 err = snd_wss_pcm(chip, device , &pcm);369 err = snd_wss_pcm(chip, device); 385 370 if (err < 0) 386 371 return err; 387 pcm->info_flags &= ~SNDRV_PCM_INFO_JOINT_DUPLEX; 388 if (rpcm) 389 *rpcm = pcm; 372 chip->pcm->info_flags &= ~SNDRV_PCM_INFO_JOINT_DUPLEX; 390 373 return 0; 391 374 } … … 776 759 static const DECLARE_TLV_DB_SCALE(db_scale_rec_gain, 0, 150, 0); 777 760 778 static struct snd_kcontrol_new snd_cs4236_controls[] = {761 static const struct snd_kcontrol_new snd_cs4236_controls[] = { 779 762 780 763 CS4236_DOUBLE("Master Digital Playback Switch", 0, … … 871 854 static const DECLARE_TLV_DB_SCALE(db_scale_2bit_16db_max, -2400, 800, 0); 872 855 873 static struct snd_kcontrol_new snd_cs4235_controls[] = {856 static const struct snd_kcontrol_new snd_cs4235_controls[] = { 874 857 875 858 WSS_DOUBLE("Master Playback Switch", 0, … … 1004 987 } 1005 988 1006 static struct snd_kcontrol_new snd_cs4236_iec958_controls[] = {989 static const struct snd_kcontrol_new snd_cs4236_iec958_controls[] = { 1007 990 CS4236_IEC958_ENABLE("IEC958 Output Enable", 0), 1008 991 CS4236_SINGLEC("IEC958 Output Validity", 0, 4, 4, 1, 0), … … 1013 996 }; 1014 997 1015 static struct snd_kcontrol_new snd_cs4236_3d_controls_cs4235[] = {998 static const struct snd_kcontrol_new snd_cs4236_3d_controls_cs4235[] = { 1016 999 CS4236_SINGLEC("3D Control - Switch", 0, 3, 4, 1, 0), 1017 1000 CS4236_SINGLEC("3D Control - Space", 0, 2, 4, 15, 1) 1018 1001 }; 1019 1002 1020 static struct snd_kcontrol_new snd_cs4236_3d_controls_cs4237[] = {1003 static const struct snd_kcontrol_new snd_cs4236_3d_controls_cs4237[] = { 1021 1004 CS4236_SINGLEC("3D Control - Switch", 0, 3, 7, 1, 0), 1022 1005 CS4236_SINGLEC("3D Control - Space", 0, 2, 4, 15, 1), … … 1026 1009 }; 1027 1010 1028 static struct snd_kcontrol_new snd_cs4236_3d_controls_cs4238[] = {1011 static const struct snd_kcontrol_new snd_cs4236_3d_controls_cs4238[] = { 1029 1012 CS4236_SINGLEC("3D Control - Switch", 0, 3, 4, 1, 0), 1030 1013 CS4236_SINGLEC("3D Control - Space", 0, 2, 4, 15, 1), … … 1038 1021 unsigned int idx, count; 1039 1022 int err; 1040 struct snd_kcontrol_new *kcontrol;1023 const struct snd_kcontrol_new *kcontrol; 1041 1024 1042 1025 if (snd_BUG_ON(!chip || !chip->card)) -
GPL/trunk/alsa-kernel/isa/es1688/es1688.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Driver for generic ESS AudioDrive ESx688 soundcards 3 4 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 4 *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 5 */ 21 6 … … 26 11 #include <linux/time.h> 27 12 #include <linux/wait.h> 28 #include <linux/module param.h>13 #include <linux/module.h> 29 14 #include <asm/dma.h> 30 15 #include <sound/core.h> … … 52 37 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 53 38 #ifdef CONFIG_PNP 54 static intisapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP;55 #endif 56 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */39 static bool isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; 40 #endif 41 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 57 42 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */ 58 43 static long fm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* Usually 0x388 */ … … 72 57 #endif 73 58 MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard."); 74 module_param_ array(port, long, NULL, 0444);59 module_param_hw_array(port, long, ioport, NULL, 0444); 75 60 MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver."); 76 module_param_ array(mpu_port, long, NULL, 0444);61 module_param_hw_array(mpu_port, long, ioport, NULL, 0444); 77 62 MODULE_PARM_DESC(mpu_port, "MPU-401 port # for " CRD_NAME " driver."); 78 module_param_ array(irq, int, NULL, 0444);79 module_param_ array(fm_port, long, NULL, 0444);63 module_param_hw_array(irq, int, irq, NULL, 0444); 64 module_param_hw_array(fm_port, long, ioport, NULL, 0444); 80 65 MODULE_PARM_DESC(fm_port, "FM port # for ES1688 driver."); 81 66 MODULE_PARM_DESC(irq, "IRQ # for " CRD_NAME " driver."); 82 module_param_ array(mpu_irq, int, NULL, 0444);67 module_param_hw_array(mpu_irq, int, irq, NULL, 0444); 83 68 MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for " CRD_NAME " driver."); 84 module_param_ array(dma8, int, NULL, 0444);69 module_param_hw_array(dma8, int, dma, NULL, 0444); 85 70 MODULE_PARM_DESC(dma8, "8-bit DMA # for " CRD_NAME " driver."); 86 71 … … 91 76 #endif 92 77 93 static int __devinitsnd_es1688_match(struct device *dev, unsigned int n)78 static int snd_es1688_match(struct device *dev, unsigned int n) 94 79 { 95 80 return enable[n] && !is_isapnp_selected(n); 96 81 } 97 82 98 static int __devinitsnd_es1688_legacy_create(struct snd_card *card,99 struct device *dev, unsigned int n)83 static int snd_es1688_legacy_create(struct snd_card *card, 84 struct device *dev, unsigned int n) 100 85 { 101 86 struct snd_es1688 *chip = card->private_data; 102 static long possible_ports[] = {0x220, 0x240, 0x260};103 static int possible_irqs[] = {5, 9, 10, 7, -1};104 static int possible_dmas[] = {1, 3, 0, -1};87 static const long possible_ports[] = {0x220, 0x240, 0x260}; 88 static const int possible_irqs[] = {5, 9, 10, 7, -1}; 89 static const int possible_dmas[] = {1, 3, 0, -1}; 105 90 106 91 int i, error; … … 135 120 } 136 121 137 static int __devinitsnd_es1688_probe(struct snd_card *card, unsigned int n)122 static int snd_es1688_probe(struct snd_card *card, unsigned int n) 138 123 { 139 124 struct snd_es1688 *chip = card->private_data; 140 125 struct snd_opl3 *opl3; 141 struct snd_pcm *pcm;142 126 int error; 143 127 144 error = snd_es1688_pcm(card, chip, 0 , &pcm);128 error = snd_es1688_pcm(card, chip, 0); 145 129 if (error < 0) 146 130 return error; … … 151 135 152 136 strlcpy(card->driver, "ES1688", sizeof(card->driver)); 153 strlcpy(card->shortname, pcm->name, sizeof(card->shortname));137 strlcpy(card->shortname, chip->pcm->name, sizeof(card->shortname)); 154 138 snprintf(card->longname, sizeof(card->longname), 155 "%s at 0x%lx, irq %i, dma %i", pcm->name, chip->port,139 "%s at 0x%lx, irq %i, dma %i", chip->pcm->name, chip->port, 156 140 chip->irq, chip->dma8); 157 141 … … 175 159 error = snd_mpu401_uart_new(card, 0, MPU401_HW_ES1688, 176 160 chip->mpu_port, 0, 177 mpu_irq[n], IRQF_DISABLED,NULL);161 mpu_irq[n], NULL); 178 162 if (error < 0) 179 163 return error; … … 183 167 } 184 168 185 static int __devinitsnd_es1688_isa_probe(struct device *dev, unsigned int n)169 static int snd_es1688_isa_probe(struct device *dev, unsigned int n) 186 170 { 187 171 struct snd_card *card; 188 172 int error; 189 173 190 error = snd_card_ create(index[n], id[n], THIS_MODULE,191 sizeof(struct snd_es1688), &card);174 error = snd_card_new(dev, index[n], id[n], THIS_MODULE, 175 sizeof(struct snd_es1688), &card); 192 176 if (error < 0) 193 177 return error; … … 196 180 if (error < 0) 197 181 goto out; 198 199 snd_card_set_dev(card, dev);200 182 201 183 error = snd_es1688_probe(card, n); … … 211 193 } 212 194 213 static int __devexitsnd_es1688_isa_remove(struct device *dev, unsigned int n)195 static int snd_es1688_isa_remove(struct device *dev, unsigned int n) 214 196 { 215 197 snd_card_free(dev_get_drvdata(dev)); 216 dev_set_drvdata(dev, NULL);217 198 return 0; 218 199 } … … 221 202 .match = snd_es1688_match, 222 203 .probe = snd_es1688_isa_probe, 223 .remove = __devexit_p(snd_es1688_isa_remove),204 .remove = snd_es1688_isa_remove, 224 205 #if 0 /* FIXME */ 225 206 .suspend = snd_es1688_suspend, … … 234 215 235 216 #ifdef CONFIG_PNP 236 static int __devinitsnd_card_es968_pnp(struct snd_card *card, unsigned int n,237 struct pnp_card_link *pcard,238 const struct pnp_card_device_id *pid)217 static int snd_card_es968_pnp(struct snd_card *card, unsigned int n, 218 struct pnp_card_link *pcard, 219 const struct pnp_card_device_id *pid) 239 220 { 240 221 struct snd_es1688 *chip = card->private_data; … … 259 240 } 260 241 261 static int __devinitsnd_es968_pnp_detect(struct pnp_card_link *pcard,262 const struct pnp_card_device_id *pid)242 static int snd_es968_pnp_detect(struct pnp_card_link *pcard, 243 const struct pnp_card_device_id *pid) 263 244 { 264 245 struct snd_card *card; 265 246 static unsigned int dev; 266 247 int error; 267 struct snd_es1688 *chip;268 248 269 249 if (snd_es968_pnp_is_probed) … … 276 256 return -ENODEV; 277 257 278 error = snd_card_ create(index[dev], id[dev], THIS_MODULE,279 sizeof(struct snd_es1688), &card);280 if (error < 0)281 return error;282 chip = card->private_data;258 error = snd_card_new(&pcard->card->dev, 259 index[dev], id[dev], THIS_MODULE, 260 sizeof(struct snd_es1688), &card); 261 if (error < 0) 262 return error; 283 263 284 264 error = snd_card_es968_pnp(card, dev, pcard, pid); … … 287 267 return error; 288 268 } 289 snd_card_set_dev(card, &pcard->card->dev);290 269 error = snd_es1688_probe(card, dev); 291 if (error < 0) 292 return error; 270 if (error < 0) { 271 snd_card_free(card); 272 return error; 273 } 293 274 pnp_set_card_drvdata(pcard, card); 294 275 snd_es968_pnp_is_probed = 1; … … 296 277 } 297 278 298 static void __devexit snd_es968_pnp_remove(struct pnp_card_link *pcard)279 static void snd_es968_pnp_remove(struct pnp_card_link *pcard) 299 280 { 300 281 snd_card_free(pnp_get_card_drvdata(pcard)); … … 308 289 { 309 290 struct snd_card *card = pnp_get_card_drvdata(pcard); 310 struct snd_es1688 *chip = card->private_data;311 291 312 292 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 313 snd_pcm_suspend_all(chip->pcm);314 293 return 0; 315 294 } … … 326 305 #endif 327 306 328 static struct pnp_card_device_id snd_es968_pnpids[] = {307 static const struct pnp_card_device_id snd_es968_pnpids[] = { 329 308 { .id = "ESS0968", .devs = { { "@@@0968" }, } }, 330 309 { .id = "ESS0968", .devs = { { "ESS0968" }, } }, … … 339 318 .id_table = snd_es968_pnpids, 340 319 .probe = snd_es968_pnp_detect, 341 .remove = __devexit_p(snd_es968_pnp_remove),320 .remove = snd_es968_pnp_remove, 342 321 #ifdef CONFIG_PM 343 322 .suspend = snd_es968_pnp_suspend, -
GPL/trunk/alsa-kernel/isa/es1688/es1688_lib.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 3 4 * Routines for control of ESS ES1688/688/488 chip 4 *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 5 */ 21 6 … … 25 10 #include <linux/slab.h> 26 11 #include <linux/ioport.h> 12 #include <linux/module.h> 13 #include <linux/io.h> 27 14 #include <sound/core.h> 28 15 #include <sound/es1688.h> 29 16 #include <sound/initval.h> 30 17 31 #include <asm/io.h>32 18 #include <asm/dma.h> 33 19 … … 121 107 { 122 108 unsigned long flags; 123 unsigned short major, minor , hw;109 unsigned short major, minor; 124 110 int i; 125 111 … … 166 152 return -ENODEV; /* probably SB */ 167 153 168 hw = ES1688_HW_AUTO;169 154 switch (chip->version & 0xfff0) { 170 155 case 0x4880: … … 173 158 return -ENODEV; 174 159 case 0x6880: 175 hw = (chip->version & 0x0f) >= 8 ? ES1688_HW_1688 : ES1688_HW_688;176 160 break; 177 161 default: … … 197 181 static int snd_es1688_init(struct snd_es1688 * chip, int enable) 198 182 { 199 static int irqs[16] = {-1, -1, 0, -1, -1, 1, -1, 2, -1, 0, 3, -1, -1, -1, -1, -1};183 static const int irqs[16] = {-1, -1, 0, -1, -1, 1, -1, 2, -1, 0, 3, -1, -1, -1, -1, -1}; 200 184 unsigned long flags; 201 185 int cfg, irq_bits, dma, dma_bits, tmp, tmp1; … … 290 274 */ 291 275 292 static struct snd_ratnum clocks[2] = {276 static const struct snd_ratnum clocks[2] = { 293 277 { 294 278 .num = 795444, … … 305 289 }; 306 290 307 static struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = {291 static const struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = { 308 292 .nrats = 2, 309 293 .rats = clocks, … … 326 310 } 327 311 328 static int snd_es1688_ioctl(struct snd_pcm_substream *substream,329 unsigned int cmd, void *arg)330 {331 return snd_pcm_lib_ioctl(substream, cmd, arg);332 }333 334 312 static int snd_es1688_trigger(struct snd_es1688 *chip, int cmd, unsigned char value) 335 313 { … … 356 334 spin_unlock(&chip->reg_lock); 357 335 return 0; 358 }359 360 static int snd_es1688_hw_params(struct snd_pcm_substream *substream,361 struct snd_pcm_hw_params *hw_params)362 {363 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));364 }365 366 static int snd_es1688_hw_free(struct snd_pcm_substream *substream)367 {368 return snd_pcm_lib_free_pages(substream);369 336 } 370 337 … … 526 493 */ 527 494 528 static struct snd_pcm_hardware snd_es1688_playback =495 static const struct snd_pcm_hardware snd_es1688_playback = 529 496 { 530 497 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | … … 544 511 }; 545 512 546 static struct snd_pcm_hardware snd_es1688_capture =513 static const struct snd_pcm_hardware snd_es1688_capture = 547 514 { 548 515 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | … … 612 579 static int snd_es1688_free(struct snd_es1688 *chip) 613 580 { 614 if (chip-> res_port) {581 if (chip->hardware != ES1688_HW_UNDEF) 615 582 snd_es1688_init(chip, 0); 616 release_and_free_resource(chip->res_port); 617 } 583 release_and_free_resource(chip->res_port); 618 584 if (chip->irq >= 0) 619 585 free_irq(chip->irq, (void *) chip); … … 647 613 unsigned short hardware) 648 614 { 649 static struct snd_device_ops ops = {615 static const struct snd_device_ops ops = { 650 616 .dev_free = snd_es1688_dev_free, 651 617 }; … … 657 623 chip->irq = -1; 658 624 chip->dma8 = -1; 625 chip->hardware = ES1688_HW_UNDEF; 659 626 660 if ((chip->res_port = request_region(port + 4, 12, "ES1688")) == NULL) { 627 chip->res_port = request_region(port + 4, 12, "ES1688"); 628 if (chip->res_port == NULL) { 661 629 snd_printk(KERN_ERR "es1688: can't grab port 0x%lx\n", port + 4); 662 return -EBUSY; 663 } 664 if (request_irq(irq, snd_es1688_interrupt, IRQF_DISABLED, "ES1688", (void *) chip)) { 630 err = -EBUSY; 631 goto exit; 632 } 633 634 err = request_irq(irq, snd_es1688_interrupt, 0, "ES1688", (void *) chip); 635 if (err < 0) { 665 636 snd_printk(KERN_ERR "es1688: can't grab IRQ %d\n", irq); 666 return -EBUSY; 667 } 637 goto exit; 638 } 639 668 640 chip->irq = irq; 669 if (request_dma(dma8, "ES1688")) { 641 card->sync_irq = chip->irq; 642 err = request_dma(dma8, "ES1688"); 643 644 if (err < 0) { 670 645 snd_printk(KERN_ERR "es1688: can't grab DMA8 %d\n", dma8); 671 return -EBUSY;646 goto exit; 672 647 } 673 648 chip->dma8 = dma8; … … 685 660 err = snd_es1688_probe(chip); 686 661 if (err < 0) 687 return err;662 goto exit; 688 663 689 664 err = snd_es1688_init(chip, 1); 690 665 if (err < 0) 691 return err;666 goto exit; 692 667 693 668 /* Register device */ 694 return snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); 695 } 696 697 static struct snd_pcm_ops snd_es1688_playback_ops = { 669 err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops); 670 exit: 671 if (err) 672 snd_es1688_free(chip); 673 return err; 674 } 675 676 static const struct snd_pcm_ops snd_es1688_playback_ops = { 698 677 .open = snd_es1688_playback_open, 699 678 .close = snd_es1688_playback_close, 700 .ioctl = snd_es1688_ioctl,701 .hw_params = snd_es1688_hw_params,702 .hw_free = snd_es1688_hw_free,703 679 .prepare = snd_es1688_playback_prepare, 704 680 .trigger = snd_es1688_playback_trigger, … … 706 682 }; 707 683 708 static struct snd_pcm_ops snd_es1688_capture_ops = {684 static const struct snd_pcm_ops snd_es1688_capture_ops = { 709 685 .open = snd_es1688_capture_open, 710 686 .close = snd_es1688_capture_close, 711 .ioctl = snd_es1688_ioctl,712 .hw_params = snd_es1688_hw_params,713 .hw_free = snd_es1688_hw_free,714 687 .prepare = snd_es1688_capture_prepare, 715 688 .trigger = snd_es1688_capture_trigger, … … 717 690 }; 718 691 719 int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip, 720 int device, struct snd_pcm **rpcm) 692 int snd_es1688_pcm(struct snd_card *card, struct snd_es1688 *chip, int device) 721 693 { 722 694 struct snd_pcm *pcm; … … 732 704 pcm->private_data = chip; 733 705 pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX; 734 s printf(pcm->name, snd_es1688_chip_id(chip));706 strcpy(pcm->name, snd_es1688_chip_id(chip)); 735 707 chip->pcm = pcm; 736 708 737 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 738 snd_dma_isa_data(), 739 64*1024, 64*1024); 740 741 if (rpcm) 742 *rpcm = pcm; 709 snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, card->dev, 710 64*1024, 64*1024); 743 711 return 0; 744 712 } … … 750 718 static int snd_es1688_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 751 719 { 752 static c har *texts[9] = {720 static const char * const texts[8] = { 753 721 "Mic", "Mic Master", "CD", "AOUT", 754 722 "Mic1", "Mix", "Line", "Master" 755 723 }; 756 724 757 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 758 uinfo->count = 1; 759 uinfo->value.enumerated.items = 8; 760 if (uinfo->value.enumerated.item > 7) 761 uinfo->value.enumerated.item = 7; 762 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); 763 return 0; 725 return snd_ctl_enum_info(uinfo, 1, 8, texts); 764 726 } 765 727 … … 963 925 } 964 926 965 static struct snd_kcontrol_new snd_es1688_controls[] = {927 static const struct snd_kcontrol_new snd_es1688_controls[] = { 966 928 ES1688_DOUBLE("Master Playback Volume", 0, ES1688_MASTER_DEV, ES1688_MASTER_DEV, 4, 0, 15, 0), 967 929 ES1688_DOUBLE("PCM Playback Volume", 0, ES1688_PCM_DEV, ES1688_PCM_DEV, 4, 0, 15, 0), … … 985 947 #define ES1688_INIT_TABLE_SIZE (sizeof(snd_es1688_init_table)/2) 986 948 987 static unsigned char snd_es1688_init_table[][2] = {949 static const unsigned char snd_es1688_init_table[][2] = { 988 950 { ES1688_MASTER_DEV, 0 }, 989 951 { ES1688_PCM_DEV, 0 }, … … 1028 990 EXPORT_SYMBOL(snd_es1688_pcm); 1029 991 EXPORT_SYMBOL(snd_es1688_mixer); 1030 1031 /*1032 * INIT part1033 */1034 1035 static int __init alsa_es1688_init(void)1036 {1037 return 0;1038 }1039 1040 static void __exit alsa_es1688_exit(void)1041 {1042 }1043 1044 module_init(alsa_es1688_init)1045 module_exit(alsa_es1688_exit) -
GPL/trunk/alsa-kernel/isa/es18xx.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Driver for generic ESS AudioDrive ES18xx soundcards 3 4 * Copyright (c) by Christian Fischbach <fishbach@pool.informatik.rwth-aachen.de> 4 5 * Copyright (c) by Abramo Bagnara <abramo@alsa-project.org> 5 *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 6 */ 22 7 /* GENERAL NOTES: … … 83 68 #include <linux/pnp.h> 84 69 #include <linux/isapnp.h> 85 #include <linux/module param.h>70 #include <linux/module.h> 86 71 #include <linux/delay.h> 87 88 #include <asm/io.h> 72 #include <linux/io.h> 73 89 74 #include <asm/dma.h> 90 75 #include <sound/core.h> … … 157 142 #define ES18XX_MUTEREC 0x0400 /* Record source can be muted */ 158 143 #define ES18XX_CONTROL 0x0800 /* Has control ports */ 144 #define ES18XX_GPO_2BIT 0x1000 /* GPO0,1 controlled by PM port */ 159 145 160 146 /* Power Management */ … … 349 335 350 336 351 static int __devinitsnd_es18xx_reset(struct snd_es18xx *chip)337 static int snd_es18xx_reset(struct snd_es18xx *chip) 352 338 { 353 339 int i; … … 369 355 } 370 356 371 static struct snd_ratnum new_clocks[2] = {357 static const struct snd_ratnum new_clocks[2] = { 372 358 { 373 359 .num = 793800, … … 384 370 }; 385 371 386 static struct snd_pcm_hw_constraint_ratnums new_hw_constraints_clocks = {372 static const struct snd_pcm_hw_constraint_ratnums new_hw_constraints_clocks = { 387 373 .nrats = 2, 388 374 .rats = new_clocks, 389 375 }; 390 376 391 static struct snd_ratnum old_clocks[2] = {377 static const struct snd_ratnum old_clocks[2] = { 392 378 { 393 379 .num = 795444, … … 404 390 }; 405 391 406 static struct snd_pcm_hw_constraint_ratnums old_hw_constraints_clocks = {392 static const struct snd_pcm_hw_constraint_ratnums old_hw_constraints_clocks = { 407 393 .nrats = 2, 408 394 .rats = old_clocks, … … 449 435 { 450 436 struct snd_es18xx *chip = snd_pcm_substream_chip(substream); 451 int shift , err;437 int shift; 452 438 453 439 shift = 0; … … 468 454 chip->dma1_shift = shift; 469 455 } 470 if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) 471 return err; 472 return 0; 473 } 474 475 static int snd_es18xx_pcm_hw_free(struct snd_pcm_substream *substream) 476 { 477 return snd_pcm_lib_free_pages(substream); 456 return 0; 478 457 } 479 458 … … 521 500 #ifdef AVOID_POPS 522 501 /* Avoid pops */ 523 udelay(100000);502 mdelay(100); 524 503 if (chip->caps & ES18XX_PCM2) 525 504 /* Restore Audio 2 volume */ … … 538 517 snd_es18xx_mixer_write(chip, 0x78, 0x00); 539 518 #ifdef AVOID_POPS 540 udelay(25000);519 mdelay(25); 541 520 if (chip->caps & ES18XX_PCM2) 542 521 /* Set Audio 2 volume to 0 */ … … 558 537 { 559 538 struct snd_es18xx *chip = snd_pcm_substream_chip(substream); 560 int shift , err;539 int shift; 561 540 562 541 shift = 0; … … 572 551 shift++; 573 552 chip->dma1_shift = shift; 574 if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0)575 return err;576 553 return 0; 577 554 } … … 597 574 598 575 #ifdef AVOID_POPS 599 udelay(100000);576 mdelay(100); 600 577 #endif 601 578 … … 692 669 #ifdef AVOID_POPS 693 670 /* Avoid pops */ 694 udelay(100000);671 mdelay(100); 695 672 /* Enable Audio 1 */ 696 673 snd_es18xx_dsp_command(chip, 0xD1); … … 706 683 #ifdef AVOID_POPS 707 684 /* Avoid pops */ 708 udelay(25000);685 mdelay(25); 709 686 /* Disable Audio 1 */ 710 687 snd_es18xx_dsp_command(chip, 0xD3); … … 838 815 } 839 816 840 static struct snd_pcm_hardware snd_es18xx_playback =817 static const struct snd_pcm_hardware snd_es18xx_playback = 841 818 { 842 819 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | … … 858 835 }; 859 836 860 static struct snd_pcm_hardware snd_es18xx_capture =837 static const struct snd_pcm_hardware snd_es18xx_capture = 861 838 { 862 839 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | … … 930 907 chip->playback_b_substream = NULL; 931 908 932 snd_pcm_lib_free_pages(substream);933 909 return 0; 934 910 } … … 939 915 940 916 chip->capture_a_substream = NULL; 941 snd_pcm_lib_free_pages(substream);942 917 return 0; 943 918 } … … 965 940 static int snd_es18xx_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 966 941 { 967 static c har *texts5Source[5] = {942 static const char * const texts5Source[5] = { 968 943 "Mic", "CD", "Line", "Master", "Mix" 969 944 }; 970 static c har *texts8Source[8] = {945 static const char * const texts8Source[8] = { 971 946 "Mic", "Mic Master", "CD", "AOUT", 972 947 "Mic1", "Mix", "Line", "Master" … … 974 949 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol); 975 950 976 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;977 uinfo->count = 1;978 951 switch (chip->version) { 979 952 case 0x1868: 980 953 case 0x1878: 981 uinfo->value.enumerated.items = 4; 982 if (uinfo->value.enumerated.item > 3) 983 uinfo->value.enumerated.item = 3; 984 strcpy(uinfo->value.enumerated.name, 985 texts5Source[uinfo->value.enumerated.item]); 986 break; 954 return snd_ctl_enum_info(uinfo, 1, 4, texts5Source); 987 955 case 0x1887: 988 956 case 0x1888: 989 uinfo->value.enumerated.items = 5; 990 if (uinfo->value.enumerated.item > 4) 991 uinfo->value.enumerated.item = 4; 992 strcpy(uinfo->value.enumerated.name, texts5Source[uinfo->value.enumerated.item]); 993 break; 994 case 0x1869: /* DS somewhat contradictory for 1869: could be be 5 or 8 */ 957 return snd_ctl_enum_info(uinfo, 1, 5, texts5Source); 958 case 0x1869: /* DS somewhat contradictory for 1869: could be 5 or 8 */ 995 959 case 0x1879: 996 uinfo->value.enumerated.items = 8; 997 if (uinfo->value.enumerated.item > 7) 998 uinfo->value.enumerated.item = 7; 999 strcpy(uinfo->value.enumerated.name, texts8Source[uinfo->value.enumerated.item]); 1000 break; 960 return snd_ctl_enum_info(uinfo, 1, 8, texts8Source); 1001 961 default: 1002 962 return -EINVAL; 1003 963 } 1004 return 0;1005 964 } 1006 965 1007 966 static int snd_es18xx_get_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1008 967 { 1009 static unsigned char invMap4Source[8] = {0, 0, 1, 1, 0, 0, 2, 3};968 static const unsigned char invMap4Source[8] = {0, 0, 1, 1, 0, 0, 2, 3}; 1010 969 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol); 1011 970 int muxSource = snd_es18xx_mixer_read(chip, 0x1c) & 0x07; … … 1024 983 static int snd_es18xx_put_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) 1025 984 { 1026 static unsigned char map4Source[4] = {0, 2, 6, 7};985 static const unsigned char map4Source[4] = {0, 2, 6, 7}; 1027 986 struct snd_es18xx *chip = snd_kcontrol_chip(kcontrol); 1028 987 unsigned char val = ucontrol->value.enumerated.item[0]; … … 1040 999 } else 1041 1000 retVal = snd_es18xx_mixer_bits(chip, 0x7a, 0x08, 0x00) != 0x00; 1001 fallthrough; 1042 1002 /* 4 source chips */ 1043 1003 case 0x1868: … … 1137 1097 } 1138 1098 1139 #define ES18XX_SINGLE(xname, xindex, reg, shift, mask, invert) \1099 #define ES18XX_SINGLE(xname, xindex, reg, shift, mask, flags) \ 1140 1100 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xindex, \ 1141 1101 .info = snd_es18xx_info_single, \ 1142 1102 .get = snd_es18xx_get_single, .put = snd_es18xx_put_single, \ 1143 .private_value = reg | (shift << 8) | (mask << 16) | (invert << 24) } 1103 .private_value = reg | (shift << 8) | (mask << 16) | (flags << 24) } 1104 1105 #define ES18XX_FL_INVERT (1 << 0) 1106 #define ES18XX_FL_PMPORT (1 << 1) 1144 1107 1145 1108 static int snd_es18xx_info_single(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) … … 1160 1123 int shift = (kcontrol->private_value >> 8) & 0xff; 1161 1124 int mask = (kcontrol->private_value >> 16) & 0xff; 1162 int invert = (kcontrol->private_value >> 24) & 0xff; 1125 int invert = (kcontrol->private_value >> 24) & ES18XX_FL_INVERT; 1126 int pm_port = (kcontrol->private_value >> 24) & ES18XX_FL_PMPORT; 1163 1127 int val; 1164 1165 val = snd_es18xx_reg_read(chip, reg); 1128 1129 if (pm_port) 1130 val = inb(chip->port + ES18XX_PM); 1131 else 1132 val = snd_es18xx_reg_read(chip, reg); 1166 1133 ucontrol->value.integer.value[0] = (val >> shift) & mask; 1167 1134 if (invert) … … 1176 1143 int shift = (kcontrol->private_value >> 8) & 0xff; 1177 1144 int mask = (kcontrol->private_value >> 16) & 0xff; 1178 int invert = (kcontrol->private_value >> 24) & 0xff; 1145 int invert = (kcontrol->private_value >> 24) & ES18XX_FL_INVERT; 1146 int pm_port = (kcontrol->private_value >> 24) & ES18XX_FL_PMPORT; 1179 1147 unsigned char val; 1180 1148 … … 1184 1152 mask <<= shift; 1185 1153 val <<= shift; 1154 if (pm_port) { 1155 unsigned char cur = inb(chip->port + ES18XX_PM); 1156 1157 if ((cur & mask) == val) 1158 return 0; 1159 outb((cur & ~mask) | val, chip->port + ES18XX_PM); 1160 return 1; 1161 } 1162 1186 1163 return snd_es18xx_reg_bits(chip, reg, mask, val) != val; 1187 1164 } … … 1270 1247 * here. 1271 1248 */ 1272 static struct snd_kcontrol_new snd_es18xx_base_controls[] = {1249 static const struct snd_kcontrol_new snd_es18xx_base_controls[] = { 1273 1250 ES18XX_DOUBLE("Master Playback Volume", 0, 0x60, 0x62, 0, 0, 63, 0), 1274 1251 ES18XX_DOUBLE("Master Playback Switch", 0, 0x60, 0x62, 6, 6, 1, 1), … … 1289 1266 }; 1290 1267 1291 static struct snd_kcontrol_new snd_es18xx_recmix_controls[] = {1268 static const struct snd_kcontrol_new snd_es18xx_recmix_controls[] = { 1292 1269 ES18XX_DOUBLE("PCM Capture Volume", 0, 0x69, 0x69, 4, 0, 15, 0), 1293 1270 ES18XX_DOUBLE("Mic Capture Volume", 0, 0x68, 0x68, 4, 0, 15, 0), … … 1301 1278 * The chipset specific mixer controls 1302 1279 */ 1303 static struct snd_kcontrol_new snd_es18xx_opt_speaker =1280 static const struct snd_kcontrol_new snd_es18xx_opt_speaker = 1304 1281 ES18XX_SINGLE("Beep Playback Volume", 0, 0x3c, 0, 7, 0); 1305 1282 1306 static struct snd_kcontrol_new snd_es18xx_opt_1869[] = {1307 ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, 1),1283 static const struct snd_kcontrol_new snd_es18xx_opt_1869[] = { 1284 ES18XX_SINGLE("Capture Switch", 0, 0x1c, 4, 1, ES18XX_FL_INVERT), 1308 1285 ES18XX_SINGLE("Video Playback Switch", 0, 0x7f, 0, 1, 0), 1309 1286 ES18XX_DOUBLE("Mono Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0), … … 1311 1288 }; 1312 1289 1313 static struct snd_kcontrol_new snd_es18xx_opt_1878 =1290 static const struct snd_kcontrol_new snd_es18xx_opt_1878 = 1314 1291 ES18XX_DOUBLE("Video Playback Volume", 0, 0x68, 0x68, 4, 0, 15, 0); 1315 1292 1316 static struct snd_kcontrol_new snd_es18xx_opt_1879[] = {1293 static const struct snd_kcontrol_new snd_es18xx_opt_1879[] = { 1317 1294 ES18XX_SINGLE("Video Playback Switch", 0, 0x71, 6, 1, 0), 1318 1295 ES18XX_DOUBLE("Video Playback Volume", 0, 0x6d, 0x6d, 4, 0, 15, 0), … … 1320 1297 }; 1321 1298 1322 static struct snd_kcontrol_new snd_es18xx_pcm1_controls[] = {1299 static const struct snd_kcontrol_new snd_es18xx_pcm1_controls[] = { 1323 1300 ES18XX_DOUBLE("PCM Playback Volume", 0, 0x14, 0x14, 4, 0, 15, 0), 1324 1301 }; 1325 1302 1326 static struct snd_kcontrol_new snd_es18xx_pcm2_controls[] = {1303 static const struct snd_kcontrol_new snd_es18xx_pcm2_controls[] = { 1327 1304 ES18XX_DOUBLE("PCM Playback Volume", 0, 0x7c, 0x7c, 4, 0, 15, 0), 1328 1305 ES18XX_DOUBLE("PCM Playback Volume", 1, 0x14, 0x14, 4, 0, 15, 0) 1329 1306 }; 1330 1307 1331 static struct snd_kcontrol_new snd_es18xx_spatializer_controls[] = {1308 static const struct snd_kcontrol_new snd_es18xx_spatializer_controls[] = { 1332 1309 ES18XX_SINGLE("3D Control - Level", 0, 0x52, 0, 63, 0), 1333 1310 { … … 1340 1317 }; 1341 1318 1342 static struct snd_kcontrol_new snd_es18xx_micpre1_control =1319 static const struct snd_kcontrol_new snd_es18xx_micpre1_control = 1343 1320 ES18XX_SINGLE("Mic Boost (+26dB)", 0, 0xa9, 2, 1, 0); 1344 1321 1345 static struct snd_kcontrol_new snd_es18xx_micpre2_control =1322 static const struct snd_kcontrol_new snd_es18xx_micpre2_control = 1346 1323 ES18XX_SINGLE("Mic Boost (+26dB)", 0, 0x7d, 3, 1, 0); 1347 1324 1348 static struct snd_kcontrol_new snd_es18xx_hw_volume_controls[] = {1325 static const struct snd_kcontrol_new snd_es18xx_hw_volume_controls[] = { 1349 1326 { 1350 1327 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 1364 1341 }; 1365 1342 1366 static int __devinit snd_es18xx_config_read(struct snd_es18xx *chip, unsigned char reg) 1343 static const struct snd_kcontrol_new snd_es18xx_opt_gpo_2bit[] = { 1344 ES18XX_SINGLE("GPO0 Switch", 0, ES18XX_PM, 0, 1, ES18XX_FL_PMPORT), 1345 ES18XX_SINGLE("GPO1 Switch", 0, ES18XX_PM, 1, 1, ES18XX_FL_PMPORT), 1346 }; 1347 1348 static int snd_es18xx_config_read(struct snd_es18xx *chip, unsigned char reg) 1367 1349 { 1368 1350 int data; … … 1373 1355 } 1374 1356 1375 static void __devinit snd_es18xx_config_write(struct snd_es18xx *chip,1376 unsigned char reg, unsigned char data)1357 static void snd_es18xx_config_write(struct snd_es18xx *chip, 1358 unsigned char reg, unsigned char data) 1377 1359 { 1378 1360 /* No need for spinlocks, this function is used only in … … 1385 1367 } 1386 1368 1387 static int __devinitsnd_es18xx_initialize(struct snd_es18xx *chip,1388 unsigned long mpu_port,1389 unsigned long fm_port)1369 static int snd_es18xx_initialize(struct snd_es18xx *chip, 1370 unsigned long mpu_port, 1371 unsigned long fm_port) 1390 1372 { 1391 1373 int mask = 0; … … 1550 1532 } 1551 1533 1552 static int __devinitsnd_es18xx_identify(struct snd_es18xx *chip)1534 static int snd_es18xx_identify(struct snd_es18xx *chip) 1553 1535 { 1554 1536 int hi,lo; … … 1619 1601 } 1620 1602 1621 static int __devinitsnd_es18xx_probe(struct snd_es18xx *chip,1622 unsigned long mpu_port,1623 unsigned long fm_port)1603 static int snd_es18xx_probe(struct snd_es18xx *chip, 1604 unsigned long mpu_port, 1605 unsigned long fm_port) 1624 1606 { 1625 1607 if (snd_es18xx_identify(chip) < 0) { … … 1630 1612 switch (chip->version) { 1631 1613 case 0x1868: 1632 chip->caps = ES18XX_DUPLEX_MONO | ES18XX_DUPLEX_SAME | ES18XX_CONTROL ;1614 chip->caps = ES18XX_DUPLEX_MONO | ES18XX_DUPLEX_SAME | ES18XX_CONTROL | ES18XX_GPO_2BIT; 1633 1615 break; 1634 1616 case 0x1869: 1635 chip->caps = ES18XX_PCM2 | ES18XX_SPATIALIZER | ES18XX_RECMIX | ES18XX_NEW_RATE | ES18XX_AUXB | ES18XX_MONO | ES18XX_MUTEREC | ES18XX_CONTROL | ES18XX_HWV ;1617 chip->caps = ES18XX_PCM2 | ES18XX_SPATIALIZER | ES18XX_RECMIX | ES18XX_NEW_RATE | ES18XX_AUXB | ES18XX_MONO | ES18XX_MUTEREC | ES18XX_CONTROL | ES18XX_HWV | ES18XX_GPO_2BIT; 1636 1618 break; 1637 1619 case 0x1878: … … 1643 1625 case 0x1887: 1644 1626 case 0x1888: 1645 chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME ;1627 chip->caps = ES18XX_PCM2 | ES18XX_RECMIX | ES18XX_AUXB | ES18XX_DUPLEX_SAME | ES18XX_GPO_2BIT; 1646 1628 break; 1647 1629 default: … … 1659 1641 } 1660 1642 1661 static struct snd_pcm_ops snd_es18xx_playback_ops = {1643 static const struct snd_pcm_ops snd_es18xx_playback_ops = { 1662 1644 .open = snd_es18xx_playback_open, 1663 1645 .close = snd_es18xx_playback_close, 1664 .ioctl = snd_pcm_lib_ioctl,1665 1646 .hw_params = snd_es18xx_playback_hw_params, 1666 .hw_free = snd_es18xx_pcm_hw_free,1667 1647 .prepare = snd_es18xx_playback_prepare, 1668 1648 .trigger = snd_es18xx_playback_trigger, … … 1670 1650 }; 1671 1651 1672 static struct snd_pcm_ops snd_es18xx_capture_ops = {1652 static const struct snd_pcm_ops snd_es18xx_capture_ops = { 1673 1653 .open = snd_es18xx_capture_open, 1674 1654 .close = snd_es18xx_capture_close, 1675 .ioctl = snd_pcm_lib_ioctl,1676 1655 .hw_params = snd_es18xx_capture_hw_params, 1677 .hw_free = snd_es18xx_pcm_hw_free,1678 1656 .prepare = snd_es18xx_capture_prepare, 1679 1657 .trigger = snd_es18xx_capture_trigger, … … 1681 1659 }; 1682 1660 1683 static int __devinit snd_es18xx_pcm(struct snd_card *card, int device, 1684 struct snd_pcm **rpcm) 1661 static int snd_es18xx_pcm(struct snd_card *card, int device) 1685 1662 { 1686 1663 struct snd_es18xx *chip = card->private_data; … … 1689 1666 int err; 1690 1667 1691 if (rpcm)1692 *rpcm = NULL;1693 1668 sprintf(str, "ES%x", chip->version); 1694 1669 if (chip->caps & ES18XX_PCM2) … … 1712 1687 chip->pcm = pcm; 1713 1688 1714 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 1715 snd_dma_isa_data(), 1716 64*1024, 1717 chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); 1718 1719 if (rpcm) 1720 *rpcm = pcm; 1689 snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, card->dev, 1690 64*1024, 1691 chip->dma1 > 3 || chip->dma2 > 3 ? 128*1024 : 64*1024); 1721 1692 return 0; 1722 1693 } … … 1729 1700 1730 1701 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 1731 1732 snd_pcm_suspend_all(chip->pcm);1733 1702 1734 1703 /* power down */ … … 1778 1747 } 1779 1748 1780 static int __devinitsnd_es18xx_new_device(struct snd_card *card,1781 unsigned long port,1782 unsigned long mpu_port,1783 unsigned long fm_port,1784 int irq, int dma1, int dma2)1749 static int snd_es18xx_new_device(struct snd_card *card, 1750 unsigned long port, 1751 unsigned long mpu_port, 1752 unsigned long fm_port, 1753 int irq, int dma1, int dma2) 1785 1754 { 1786 1755 struct snd_es18xx *chip = card->private_data; 1787 static struct snd_device_ops ops = {1756 static const struct snd_device_ops ops = { 1788 1757 .dev_free = snd_es18xx_dev_free, 1789 1758 }; … … 1806 1775 } 1807 1776 1808 if (request_irq(irq, snd_es18xx_interrupt, IRQF_DISABLED, "ES18xx",1777 if (request_irq(irq, snd_es18xx_interrupt, 0, "ES18xx", 1809 1778 (void *) card)) { 1810 1779 snd_es18xx_free(card); … … 1813 1782 } 1814 1783 chip->irq = irq; 1784 card->sync_irq = chip->irq; 1815 1785 1816 1786 if (request_dma(dma1, "ES18xx DMA 1")) { … … 1840 1810 } 1841 1811 1842 static int __devinitsnd_es18xx_mixer(struct snd_card *card)1812 static int snd_es18xx_mixer(struct snd_card *card) 1843 1813 { 1844 1814 struct snd_es18xx *chip = card->private_data; … … 1945 1915 } 1946 1916 } 1917 if (chip->caps & ES18XX_GPO_2BIT) { 1918 for (idx = 0; idx < ARRAY_SIZE(snd_es18xx_opt_gpo_2bit); idx++) { 1919 err = snd_ctl_add(card, 1920 snd_ctl_new1(&snd_es18xx_opt_gpo_2bit[idx], 1921 chip)); 1922 if (err < 0) 1923 return err; 1924 } 1925 } 1947 1926 return 0; 1948 1927 } … … 1965 1944 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 1966 1945 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 1967 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */1946 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 1968 1947 #ifdef CONFIG_PNP 1969 static intisapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP;1948 static bool isapnp[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; 1970 1949 #endif 1971 1950 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260,0x280 */ … … 1990 1969 MODULE_PARM_DESC(isapnp, "PnP detection for specified soundcard."); 1991 1970 #endif 1992 module_param_ array(port, long, NULL, 0444);1971 module_param_hw_array(port, long, ioport, NULL, 0444); 1993 1972 MODULE_PARM_DESC(port, "Port # for ES18xx driver."); 1994 module_param_ array(mpu_port, long, NULL, 0444);1973 module_param_hw_array(mpu_port, long, ioport, NULL, 0444); 1995 1974 MODULE_PARM_DESC(mpu_port, "MPU-401 port # for ES18xx driver."); 1996 module_param_ array(fm_port, long, NULL, 0444);1975 module_param_hw_array(fm_port, long, ioport, NULL, 0444); 1997 1976 MODULE_PARM_DESC(fm_port, "FM port # for ES18xx driver."); 1998 module_param_ array(irq, int, NULL, 0444);1977 module_param_hw_array(irq, int, irq, NULL, 0444); 1999 1978 MODULE_PARM_DESC(irq, "IRQ # for ES18xx driver."); 2000 module_param_ array(dma1, int, NULL, 0444);1979 module_param_hw_array(dma1, int, dma, NULL, 0444); 2001 1980 MODULE_PARM_DESC(dma1, "DMA 1 # for ES18xx driver."); 2002 module_param_ array(dma2, int, NULL, 0444);1981 module_param_hw_array(dma2, int, dma, NULL, 0444); 2003 1982 MODULE_PARM_DESC(dma2, "DMA 2 # for ES18xx driver."); 2004 1983 … … 2008 1987 static int pnpc_registered; 2009 1988 2010 static struct pnp_device_id snd_audiodrive_pnpbiosids[] = {1989 static const struct pnp_device_id snd_audiodrive_pnpbiosids[] = { 2011 1990 { .id = "ESS1869" }, 2012 1991 { .id = "ESS1879" }, … … 2017 1996 2018 1997 /* PnP main device initialization */ 2019 static int __devinitsnd_audiodrive_pnp_init_main(int dev, struct pnp_dev *pdev)1998 static int snd_audiodrive_pnp_init_main(int dev, struct pnp_dev *pdev) 2020 1999 { 2021 2000 if (pnp_activate_dev(pdev) < 0) { … … 2044 2023 } 2045 2024 2046 static int __devinitsnd_audiodrive_pnp(int dev, struct snd_es18xx *chip,2047 struct pnp_dev *pdev)2025 static int snd_audiodrive_pnp(int dev, struct snd_es18xx *chip, 2026 struct pnp_dev *pdev) 2048 2027 { 2049 2028 chip->dev = pdev; … … 2053 2032 } 2054 2033 2055 static struct pnp_card_device_id snd_audiodrive_pnpids[] = {2034 static const struct pnp_card_device_id snd_audiodrive_pnpids[] = { 2056 2035 /* ESS 1868 (integrated on Compaq dual P-Pro motherboard and Genius 18PnP 3D) */ 2057 2036 { .id = "ESS1868", .devs = { { "ESS1868" }, { "ESS0000" } } }, … … 2074 2053 MODULE_DEVICE_TABLE(pnp_card, snd_audiodrive_pnpids); 2075 2054 2076 static int __devinitsnd_audiodrive_pnpc(int dev, struct snd_es18xx *chip,2077 struct pnp_card_link *card,2078 const struct pnp_card_device_id *id)2055 static int snd_audiodrive_pnpc(int dev, struct snd_es18xx *chip, 2056 struct pnp_card_link *card, 2057 const struct pnp_card_device_id *id) 2079 2058 { 2080 2059 chip->dev = pnp_request_card_device(card, id->devs[0].id, NULL); … … 2106 2085 #endif 2107 2086 2108 static int snd_es18xx_card_new(int dev, struct snd_card **cardp) 2109 { 2110 return snd_card_create(index[dev], id[dev], THIS_MODULE, 2111 sizeof(struct snd_es18xx), cardp); 2112 } 2113 2114 static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) 2087 static int snd_es18xx_card_new(struct device *pdev, int dev, 2088 struct snd_card **cardp) 2089 { 2090 return snd_card_new(pdev, index[dev], id[dev], THIS_MODULE, 2091 sizeof(struct snd_es18xx), cardp); 2092 } 2093 2094 static int snd_audiodrive_probe(struct snd_card *card, int dev) 2115 2095 { 2116 2096 struct snd_es18xx *chip = card->private_data; … … 2138 2118 irq[dev], dma1[dev]); 2139 2119 2140 err = snd_es18xx_pcm(card, 0 , NULL);2120 err = snd_es18xx_pcm(card, 0); 2141 2121 if (err < 0) 2142 2122 return err; … … 2161 2141 if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) { 2162 2142 err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX, 2163 mpu_port[dev], 0,2164 irq[dev], 0, &chip->rmidi);2143 mpu_port[dev], MPU401_INFO_IRQ_HOOK, 2144 -1, &chip->rmidi); 2165 2145 if (err < 0) 2166 2146 return err; … … 2170 2150 } 2171 2151 2172 static int __devinitsnd_es18xx_isa_match(struct device *pdev, unsigned int dev)2152 static int snd_es18xx_isa_match(struct device *pdev, unsigned int dev) 2173 2153 { 2174 2154 return enable[dev] && !is_isapnp_selected(dev); 2175 2155 } 2176 2156 2177 static int __devinitsnd_es18xx_isa_probe1(int dev, struct device *devptr)2157 static int snd_es18xx_isa_probe1(int dev, struct device *devptr) 2178 2158 { 2179 2159 struct snd_card *card; 2180 2160 int err; 2181 2161 2182 err = snd_es18xx_card_new(dev , &card);2162 err = snd_es18xx_card_new(devptr, dev, &card); 2183 2163 if (err < 0) 2184 2164 return err; 2185 snd_card_set_dev(card, devptr);2186 2165 if ((err = snd_audiodrive_probe(card, dev)) < 0) { 2187 2166 snd_card_free(card); … … 2192 2171 } 2193 2172 2194 static int __devinitsnd_es18xx_isa_probe(struct device *pdev, unsigned int dev)2173 static int snd_es18xx_isa_probe(struct device *pdev, unsigned int dev) 2195 2174 { 2196 2175 int err; 2197 static int possible_irqs[] = {5, 9, 10, 7, 11, 12, -1};2198 static int possible_dmas[] = {1, 0, 3, 5, -1};2176 static const int possible_irqs[] = {5, 9, 10, 7, 11, 12, -1}; 2177 static const int possible_dmas[] = {1, 0, 3, 5, -1}; 2199 2178 2200 2179 if (irq[dev] == SNDRV_AUTO_IRQ) { … … 2220 2199 return snd_es18xx_isa_probe1(dev, pdev); 2221 2200 } else { 2222 static unsigned long possible_ports[] = {0x220, 0x240, 0x260, 0x280};2201 static const unsigned long possible_ports[] = {0x220, 0x240, 0x260, 0x280}; 2223 2202 int i; 2224 2203 for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { … … 2232 2211 } 2233 2212 2234 static int __devexitsnd_es18xx_isa_remove(struct device *devptr,2235 unsigned int dev)2213 static int snd_es18xx_isa_remove(struct device *devptr, 2214 unsigned int dev) 2236 2215 { 2237 2216 snd_card_free(dev_get_drvdata(devptr)); 2238 dev_set_drvdata(devptr, NULL);2239 2217 return 0; 2240 2218 } … … 2258 2236 .match = snd_es18xx_isa_match, 2259 2237 .probe = snd_es18xx_isa_probe, 2260 .remove = __devexit_p(snd_es18xx_isa_remove),2238 .remove = snd_es18xx_isa_remove, 2261 2239 #ifdef CONFIG_PM 2262 2240 .suspend = snd_es18xx_isa_suspend, … … 2270 2248 2271 2249 #ifdef CONFIG_PNP 2272 static int __devinitsnd_audiodrive_pnp_detect(struct pnp_dev *pdev,2273 const struct pnp_device_id *id)2250 static int snd_audiodrive_pnp_detect(struct pnp_dev *pdev, 2251 const struct pnp_device_id *id) 2274 2252 { 2275 2253 static int dev; … … 2286 2264 return -ENODEV; 2287 2265 2288 err = snd_es18xx_card_new( dev, &card);2266 err = snd_es18xx_card_new(&pdev->dev, dev, &card); 2289 2267 if (err < 0) 2290 2268 return err; … … 2293 2271 return err; 2294 2272 } 2295 snd_card_set_dev(card, &pdev->dev);2296 2273 if ((err = snd_audiodrive_probe(card, dev)) < 0) { 2297 2274 snd_card_free(card); … … 2303 2280 } 2304 2281 2305 static void __devexit snd_audiodrive_pnp_remove(struct pnp_dev *pdev)2282 static void snd_audiodrive_pnp_remove(struct pnp_dev *pdev) 2306 2283 { 2307 2284 snd_card_free(pnp_get_drvdata(pdev)); 2308 pnp_set_drvdata(pdev, NULL);2309 2285 } 2310 2286 … … 2324 2300 .id_table = snd_audiodrive_pnpbiosids, 2325 2301 .probe = snd_audiodrive_pnp_detect, 2326 .remove = __devexit_p(snd_audiodrive_pnp_remove),2302 .remove = snd_audiodrive_pnp_remove, 2327 2303 #ifdef CONFIG_PM 2328 2304 .suspend = snd_audiodrive_pnp_suspend, … … 2331 2307 }; 2332 2308 2333 static int __devinitsnd_audiodrive_pnpc_detect(struct pnp_card_link *pcard,2334 const struct pnp_card_device_id *pid)2309 static int snd_audiodrive_pnpc_detect(struct pnp_card_link *pcard, 2310 const struct pnp_card_device_id *pid) 2335 2311 { 2336 2312 static int dev; … … 2345 2321 return -ENODEV; 2346 2322 2347 res = snd_es18xx_card_new( dev, &card);2323 res = snd_es18xx_card_new(&pcard->card->dev, dev, &card); 2348 2324 if (res < 0) 2349 2325 return res; … … 2353 2329 return res; 2354 2330 } 2355 snd_card_set_dev(card, &pcard->card->dev);2356 2331 if ((res = snd_audiodrive_probe(card, dev)) < 0) { 2357 2332 snd_card_free(card); … … 2364 2339 } 2365 2340 2366 static void __devexit snd_audiodrive_pnpc_remove(struct pnp_card_link *pcard)2341 static void snd_audiodrive_pnpc_remove(struct pnp_card_link *pcard) 2367 2342 { 2368 2343 snd_card_free(pnp_get_card_drvdata(pcard)); … … 2388 2363 .id_table = snd_audiodrive_pnpids, 2389 2364 .probe = snd_audiodrive_pnpc_detect, 2390 .remove = __devexit_p(snd_audiodrive_pnpc_remove),2365 .remove = snd_audiodrive_pnpc_remove, 2391 2366 #ifdef CONFIG_PM 2392 2367 .suspend = snd_audiodrive_pnpc_suspend, -
GPL/trunk/alsa-kernel/isa/gus/gus_dma.c
r426 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Routines for GF1 DMA control 3 4 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 4 *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 5 */ 21 6 … … 202 187 203 188 block = kmalloc(sizeof(*block), atomic ? GFP_ATOMIC : GFP_KERNEL); 204 if (block == NULL) { 205 snd_printk(KERN_ERR "gf1: DMA transfer failure; not enough memory\n"); 189 if (!block) 206 190 return -ENOMEM; 207 } 191 208 192 *block = *__block; 209 193 block->next = NULL; -
GPL/trunk/alsa-kernel/isa/gus/gus_dram.c
r305 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 3 4 * DRAM access routines 4 *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 5 */ 21 6 -
GPL/trunk/alsa-kernel/isa/gus/gus_io.c
r305 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 3 4 * I/O routines for GF1/InterWave synthesizer chips 4 *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 5 */ 21 6 … … 419 404 unsigned short voices; 420 405 421 static unsigned short voices_tbl[32 - 14 + 1] =406 static const unsigned short voices_tbl[32 - 14 + 1] = 422 407 { 423 408 44100, 41160, 38587, 36317, 34300, 32494, 30870, 29400, 28063, 26843, … … 462 447 printk(KERN_INFO " -%i- GFA1 effect volume = 0x%x\n", voice, snd_gf1_i_read16(gus, 0x16)); 463 448 printk(KERN_INFO " -%i- GFA1 effect volume final = 0x%x\n", voice, snd_gf1_i_read16(gus, 0x1d)); 464 printk(KERN_INFO " -%i- GFA1 effect ac umulator= 0x%x\n", voice, snd_gf1_i_read8(gus, 0x14));449 printk(KERN_INFO " -%i- GFA1 effect accumulator = 0x%x\n", voice, snd_gf1_i_read8(gus, 0x14)); 465 450 } 466 451 if (mode & 0x20) { -
GPL/trunk/alsa-kernel/isa/gus/gus_irq.c
r426 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Routine for IRQ handling from GF1/InterWave chip 3 4 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 4 *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 5 */ 21 6 … … 141 126 void snd_gus_irq_profile_init(struct snd_gus_card *gus) 142 127 { 143 struct snd_info_entry *entry; 144 145 if (! snd_card_proc_new(gus->card, "gusirq", &entry)) 146 snd_info_set_text_ops(entry, gus, snd_gus_irq_info_read); 128 snd_card_ro_proc_new(gus->card, "gusirq", gus, snd_gus_irq_info_read); 147 129 } 148 130 -
GPL/trunk/alsa-kernel/isa/gus/gus_main.c
r399 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Routines for Gravis UltraSound soundcards 3 4 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 4 *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 5 */ 21 6 … … 25 10 #include <linux/slab.h> 26 11 #include <linux/ioport.h> 12 #include <linux/module.h> 27 13 #include <sound/core.h> 28 14 #include <sound/gus.h> … … 82 68 } 83 69 84 static struct snd_kcontrol_new snd_gus_joystick_control = {70 static const struct snd_kcontrol_new snd_gus_joystick_control = { 85 71 .iface = SNDRV_CTL_ELEM_IFACE_CARD, 86 72 .name = "Joystick Speed", … … 92 78 static void snd_gus_init_control(struct snd_gus_card *gus) 93 79 { 94 if (!gus->ace_flag) 95 snd_ctl_add(gus->card, snd_ctl_new1(&snd_gus_joystick_control, gus)); 80 int ret; 81 82 if (!gus->ace_flag) { 83 ret = 84 snd_ctl_add(gus->card, 85 snd_ctl_new1(&snd_gus_joystick_control, 86 gus)); 87 if (ret) 88 snd_printk(KERN_ERR "gus: snd_ctl_add failed: %d\n", 89 ret); 90 } 96 91 } 97 92 … … 140 135 struct snd_gus_card *gus; 141 136 int err; 142 static struct snd_device_ops ops = {137 static const struct snd_device_ops ops = { 143 138 .dev_free = snd_gus_dev_free, 144 139 }; … … 181 176 return -EBUSY; 182 177 } 183 if (irq >= 0 && request_irq(irq, snd_gus_interrupt, IRQF_DISABLED, "GUS GF1", (void *) gus)) {178 if (irq >= 0 && request_irq(irq, snd_gus_interrupt, 0, "GUS GF1", (void *) gus)) { 184 179 snd_printk(KERN_ERR "gus: can't grab irq %d\n", irq); 185 180 snd_gus_free(gus); … … 187 182 } 188 183 gus->gf1.irq = irq; 184 card->sync_irq = irq; 189 185 if (request_dma(dma1, "GUS - 1")) { 190 186 snd_printk(KERN_ERR "gus: can't grab DMA1 %d\n", dma1); … … 272 268 unsigned long flags; 273 269 int irq, dma1, dma2; 274 static unsigned char irqs[16] =270 static const unsigned char irqs[16] = 275 271 {0, 0, 1, 3, 0, 2, 0, 4, 0, 1, 0, 5, 6, 0, 0, 7}; 276 static unsigned char dmas[8] =272 static const unsigned char dmas[8] = 277 273 {6, 1, 0, 2, 0, 3, 4, 5}; 278 274 … … 465 461 EXPORT_SYMBOL(snd_gf1_mem_free); 466 462 EXPORT_SYMBOL(snd_gf1_mem_lock); 467 468 /*469 * INIT part470 */471 472 static int __init alsa_gus_init(void)473 {474 return 0;475 }476 477 static void __exit alsa_gus_exit(void)478 {479 }480 481 module_init(alsa_gus_init)482 module_exit(alsa_gus_exit) -
GPL/trunk/alsa-kernel/isa/gus/gus_mem.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 3 4 * GUS's memory allocation routines / bottom layer 4 *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 5 */ 21 6 … … 239 224 struct snd_gf1_mem *alloc; 240 225 struct snd_gf1_mem_block block; 241 #ifdef CONFIG_SND_DEBUG242 struct snd_info_entry *entry;243 #endif244 226 245 227 alloc = &gus->gf1.mem_alloc; … … 264 246 return -ENOMEM; 265 247 #ifdef CONFIG_SND_DEBUG 266 if (! snd_card_proc_new(gus->card, "gusmem", &entry)) 267 snd_info_set_text_ops(entry, gus, snd_gf1_mem_info_read); 248 snd_card_ro_proc_new(gus->card, "gusmem", gus, snd_gf1_mem_info_read); 268 249 #endif 269 250 return 0; … … 311 292 for (block = alloc->first, i = 0; block; block = block->next, i++) { 312 293 used += block->size; 313 snd_iprintf(buffer, "Block %i at 0x%lx onboard 0x%x size %i (0x%x):\n", i, (long) block, block->ptr, block->size, block->size);294 snd_iprintf(buffer, "Block %i onboard 0x%x size %i (0x%x):\n", i, block->ptr, block->size, block->size); 314 295 if (block->share || 315 296 block->share_id[0] || block->share_id[1] || -
GPL/trunk/alsa-kernel/isa/gus/gus_mem_proc.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 3 4 * GUS's memory access via proc filesystem 4 *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 5 */ 21 6 … … 53 38 } 54 39 55 static struct snd_info_entry_ops snd_gf1_mem_proc_ops = {40 static const struct snd_info_entry_ops snd_gf1_mem_proc_ops = { 56 41 .read = snd_gf1_mem_proc_dump, 57 42 }; -
GPL/trunk/alsa-kernel/isa/gus/gus_mixer.c
r399 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 3 4 * Routines for control of ICS 2101 chip and "mixer" in GF1 chip 4 *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 5 */ 21 6 … … 110 95 int addr = kcontrol->private_value & 0xff; 111 96 int change; 112 unsigned char val1, val2, oval1, oval2 , tmp;97 unsigned char val1, val2, oval1, oval2; 113 98 114 99 val1 = ucontrol->value.integer.value[0] & 127; … … 121 106 gus->gf1.ics_regs[addr][1] = val2; 122 107 if (gus->ics_flag && gus->ics_flipped && 123 (addr == SNDRV_ICS_GF1_DEV || addr == SNDRV_ICS_MASTER_DEV)) { 124 tmp = val1; 125 val1 = val2; 126 val2 = tmp; 127 } 108 (addr == SNDRV_ICS_GF1_DEV || addr == SNDRV_ICS_MASTER_DEV)) 109 swap(val1, val2); 128 110 addr <<= 3; 129 111 outb(addr | 0, GUSP(gus, MIXCNTRLPORT)); … … 139 121 } 140 122 141 static struct snd_kcontrol_new snd_gf1_controls[] = {123 static const struct snd_kcontrol_new snd_gf1_controls[] = { 142 124 GF1_SINGLE("Master Playback Switch", 0, 1, 1), 143 125 GF1_SINGLE("Line Switch", 0, 0, 1), … … 145 127 }; 146 128 147 static struct snd_kcontrol_new snd_ics_controls[] = {129 static const struct snd_kcontrol_new snd_ics_controls[] = { 148 130 GF1_SINGLE("Master Playback Switch", 0, 1, 1), 149 131 ICS_DOUBLE("Master Playback Volume", 0, SNDRV_ICS_MASTER_DEV), -
GPL/trunk/alsa-kernel/isa/gus/gus_pcm.c
r464 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> … … 8 9 * This code emulates autoinit DMA transfer for playback, recording by GF1 9 10 * chip doesn't support autoinit DMA. 10 *11 *12 * This program is free software; you can redistribute it and/or modify13 * it under the terms of the GNU General Public License as published by14 * the Free Software Foundation; either version 2 of the License, or15 * (at your option) any later version.16 *17 * This program is distributed in the hope that it will be useful,18 * but WITHOUT ANY WARRANTY; without even the implied warranty of19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the20 * GNU General Public License for more details.21 *22 * You should have received a copy of the GNU General Public License23 * along with this program; if not, write to the Free Software24 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA25 *26 11 */ 27 12 28 13 #include <asm/dma.h> 29 14 #include <linux/slab.h> 15 #include <linux/sched/signal.h> 16 30 17 #include <sound/core.h> 31 18 #include <sound/control.h> … … 59 46 int final_volume; 60 47 }; 61 62 static int snd_gf1_pcm_use_dma = 1;63 48 64 49 static void snd_gf1_pcm_block_change_ack(struct snd_gus_card * gus, void *private_data) … … 354 339 } 355 340 356 static int snd_gf1_pcm_playback_copy(struct snd_pcm_substream *substream, 357 int voice, 358 snd_pcm_uframes_t pos, 359 void __user *src, 360 snd_pcm_uframes_t count) 361 { 362 struct snd_pcm_runtime *runtime = substream->runtime; 363 struct gus_pcm_private *pcmp = runtime->private_data; 364 unsigned int bpos, len; 365 366 bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2)); 367 len = samples_to_bytes(runtime, count); 341 static int get_bpos(struct gus_pcm_private *pcmp, int voice, unsigned int pos, 342 unsigned int len) 343 { 344 unsigned int bpos = pos + (voice * (pcmp->dma_size / 2)); 368 345 if (snd_BUG_ON(bpos > pcmp->dma_size)) 369 346 return -EIO; 370 347 if (snd_BUG_ON(bpos + len > pcmp->dma_size)) 371 348 return -EIO; 349 return bpos; 350 } 351 352 static int playback_copy_ack(struct snd_pcm_substream *substream, 353 unsigned int bpos, unsigned int len) 354 { 355 struct snd_pcm_runtime *runtime = substream->runtime; 356 struct gus_pcm_private *pcmp = runtime->private_data; 357 struct snd_gus_card *gus = pcmp->gus; 358 int w16, invert; 359 360 if (len > 32) 361 return snd_gf1_pcm_block_change(substream, bpos, 362 pcmp->memory + bpos, len); 363 364 w16 = (snd_pcm_format_width(runtime->format) == 16); 365 invert = snd_pcm_format_unsigned(runtime->format); 366 return snd_gf1_pcm_poke_block(gus, runtime->dma_area + bpos, 367 pcmp->memory + bpos, len, w16, invert); 368 } 369 370 static int snd_gf1_pcm_playback_copy(struct snd_pcm_substream *substream, 371 int voice, unsigned long pos, 372 void __user *src, unsigned long count) 373 { 374 struct snd_pcm_runtime *runtime = substream->runtime; 375 struct gus_pcm_private *pcmp = runtime->private_data; 376 unsigned int len = count; 377 int bpos; 378 379 bpos = get_bpos(pcmp, voice, pos, len); 380 if (bpos < 0) 381 return pos; 372 382 if (copy_from_user(runtime->dma_area + bpos, src, len)) 373 383 return -EFAULT; 374 if (snd_gf1_pcm_use_dma && len > 32) { 375 return snd_gf1_pcm_block_change(substream, bpos, pcmp->memory + bpos, len); 376 } else { 377 struct snd_gus_card *gus = pcmp->gus; 378 int err, w16, invert; 379 380 w16 = (snd_pcm_format_width(runtime->format) == 16); 381 invert = snd_pcm_format_unsigned(runtime->format); 382 if ((err = snd_gf1_pcm_poke_block(gus, runtime->dma_area + bpos, pcmp->memory + bpos, len, w16, invert)) < 0) 383 return err; 384 } 385 return 0; 384 return playback_copy_ack(substream, bpos, len); 385 } 386 387 static int snd_gf1_pcm_playback_copy_kernel(struct snd_pcm_substream *substream, 388 int voice, unsigned long pos, 389 void *src, unsigned long count) 390 { 391 struct snd_pcm_runtime *runtime = substream->runtime; 392 struct gus_pcm_private *pcmp = runtime->private_data; 393 unsigned int len = count; 394 int bpos; 395 396 bpos = get_bpos(pcmp, voice, pos, len); 397 if (bpos < 0) 398 return pos; 399 memcpy(runtime->dma_area + bpos, src, len); 400 return playback_copy_ack(substream, bpos, len); 386 401 } 387 402 388 403 static int snd_gf1_pcm_playback_silence(struct snd_pcm_substream *substream, 389 int voice, 390 snd_pcm_uframes_t pos,391 snd_pcm_uframes_t count) 392 { 393 struct snd_pcm_runtime *runtime = substream->runtime;394 struct gus_pcm_private *pcmp = runtime->private_data;395 unsigned int bpos, len;404 int voice, unsigned long pos, 405 unsigned long count) 406 { 407 struct snd_pcm_runtime *runtime = substream->runtime; 408 struct gus_pcm_private *pcmp = runtime->private_data; 409 unsigned int len = count; 410 int bpos; 396 411 397 bpos = samples_to_bytes(runtime, pos) + (voice * (pcmp->dma_size / 2)); 398 len = samples_to_bytes(runtime, count); 399 if (snd_BUG_ON(bpos > pcmp->dma_size)) 400 return -EIO; 401 if (snd_BUG_ON(bpos + len > pcmp->dma_size)) 402 return -EIO; 403 snd_pcm_format_set_silence(runtime->format, runtime->dma_area + bpos, count); 404 if (snd_gf1_pcm_use_dma && len > 32) { 405 return snd_gf1_pcm_block_change(substream, bpos, pcmp->memory + bpos, len); 406 } else { 407 struct snd_gus_card *gus = pcmp->gus; 408 int err, w16, invert; 409 410 w16 = (snd_pcm_format_width(runtime->format) == 16); 411 invert = snd_pcm_format_unsigned(runtime->format); 412 if ((err = snd_gf1_pcm_poke_block(gus, runtime->dma_area + bpos, pcmp->memory + bpos, len, w16, invert)) < 0) 413 return err; 414 } 415 return 0; 412 bpos = get_bpos(pcmp, voice, pos, len); 413 if (bpos < 0) 414 return pos; 415 snd_pcm_format_set_silence(runtime->format, runtime->dma_area + bpos, 416 bytes_to_samples(runtime, count)); 417 return playback_copy_ack(substream, bpos, len); 416 418 } 417 419 … … 422 424 struct snd_pcm_runtime *runtime = substream->runtime; 423 425 struct gus_pcm_private *pcmp = runtime->private_data; 424 int err; 425 426 if ((err = snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params))) < 0) 427 return err; 428 if (err > 0) { /* change */ 426 427 if (runtime->buffer_changed) { 429 428 struct snd_gf1_mem_block *block; 430 429 if (pcmp->memory > 0) { … … 470 469 struct gus_pcm_private *pcmp = runtime->private_data; 471 470 472 snd_pcm_lib_free_pages(substream);473 471 if (pcmp->pvoices[0]) { 474 472 snd_gf1_free_voice(pcmp->gus, pcmp->pvoices[0]); … … 546 544 } 547 545 548 static struct snd_ratnum clock = {546 static const struct snd_ratnum clock = { 549 547 .num = 9878400/16, 550 548 .den_min = 2, … … 553 551 }; 554 552 555 static struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = {553 static const struct snd_pcm_hw_constraint_ratnums hw_constraints_clocks = { 556 554 .nrats = 1, 557 555 .rats = &clock, … … 573 571 if (snd_pcm_format_unsigned(params_format(hw_params))) 574 572 gus->gf1.pcm_rcntrl_reg |= 0x80; 575 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params)); 576 } 577 578 static int snd_gf1_pcm_capture_hw_free(struct snd_pcm_substream *substream) 579 { 580 return snd_pcm_lib_free_pages(substream); 573 return 0; 581 574 } 582 575 … … 634 627 } 635 628 636 static struct snd_pcm_hardware snd_gf1_pcm_playback =629 static const struct snd_pcm_hardware snd_gf1_pcm_playback = 637 630 { 638 631 .info = SNDRV_PCM_INFO_NONINTERLEAVED, … … 652 645 }; 653 646 654 static struct snd_pcm_hardware snd_gf1_pcm_capture =647 static const struct snd_pcm_hardware snd_gf1_pcm_capture = 655 648 { 656 649 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | … … 808 801 } 809 802 810 static struct snd_kcontrol_new snd_gf1_pcm_volume_control =803 static const struct snd_kcontrol_new snd_gf1_pcm_volume_control = 811 804 { 812 805 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 817 810 }; 818 811 819 static struct snd_kcontrol_new snd_gf1_pcm_volume_control1 =812 static const struct snd_kcontrol_new snd_gf1_pcm_volume_control1 = 820 813 { 821 814 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 826 819 }; 827 820 828 static struct snd_pcm_ops snd_gf1_pcm_playback_ops = {821 static const struct snd_pcm_ops snd_gf1_pcm_playback_ops = { 829 822 .open = snd_gf1_pcm_playback_open, 830 823 .close = snd_gf1_pcm_playback_close, 831 .ioctl = snd_pcm_lib_ioctl,832 824 .hw_params = snd_gf1_pcm_playback_hw_params, 833 825 .hw_free = snd_gf1_pcm_playback_hw_free, … … 835 827 .trigger = snd_gf1_pcm_playback_trigger, 836 828 .pointer = snd_gf1_pcm_playback_pointer, 837 .copy = snd_gf1_pcm_playback_copy, 838 .silence = snd_gf1_pcm_playback_silence, 829 .copy_user = snd_gf1_pcm_playback_copy, 830 .copy_kernel = snd_gf1_pcm_playback_copy_kernel, 831 .fill_silence = snd_gf1_pcm_playback_silence, 839 832 }; 840 833 841 static struct snd_pcm_ops snd_gf1_pcm_capture_ops = {834 static const struct snd_pcm_ops snd_gf1_pcm_capture_ops = { 842 835 .open = snd_gf1_pcm_capture_open, 843 836 .close = snd_gf1_pcm_capture_close, 844 .ioctl = snd_pcm_lib_ioctl,845 837 .hw_params = snd_gf1_pcm_capture_hw_params, 846 .hw_free = snd_gf1_pcm_capture_hw_free,847 838 .prepare = snd_gf1_pcm_capture_prepare, 848 839 .trigger = snd_gf1_pcm_capture_trigger, … … 850 841 }; 851 842 852 int snd_gf1_pcm_new(struct snd_gus_card * gus, int pcm_dev, int control_index, struct snd_pcm ** rpcm)843 int snd_gf1_pcm_new(struct snd_gus_card *gus, int pcm_dev, int control_index) 853 844 { 854 845 struct snd_card *card; … … 858 849 int capture, err; 859 850 860 if (rpcm)861 *rpcm = NULL;862 851 card = gus->card; 863 852 capture = !gus->interwave && !gus->ess_flag && !gus->ace_flag ? 1 : 0; … … 875 864 876 865 for (substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; substream; substream = substream->next) 877 snd_pcm_ lib_preallocate_pages(substream, SNDRV_DMA_TYPE_DEV,878 snd_dma_isa_data(),879 64*1024, gus->gf1.dma1 > 3 ? 128*1024 : 64*1024);866 snd_pcm_set_managed_buffer(substream, SNDRV_DMA_TYPE_DEV, 867 card->dev, 868 64*1024, gus->gf1.dma1 > 3 ? 128*1024 : 64*1024); 880 869 881 870 pcm->info_flags = 0; … … 885 874 if (gus->gf1.dma2 == gus->gf1.dma1) 886 875 pcm->info_flags |= SNDRV_PCM_INFO_HALF_DUPLEX; 887 snd_pcm_ lib_preallocate_pages(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream,888 SNDRV_DMA_TYPE_DEV, snd_dma_isa_data(),889 64*1024, gus->gf1.dma2 > 3 ? 128*1024 : 64*1024);876 snd_pcm_set_managed_buffer(pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream, 877 SNDRV_DMA_TYPE_DEV, card->dev, 878 64*1024, gus->gf1.dma2 > 3 ? 128*1024 : 64*1024); 890 879 } 891 880 strcpy(pcm->name, pcm->id); … … 904 893 kctl->id.index = control_index; 905 894 906 if (rpcm) 907 *rpcm = pcm; 908 return 0; 909 } 910 895 return 0; 896 } 897 -
GPL/trunk/alsa-kernel/isa/gus/gus_reset.c
r305 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 3 *4 *5 * This program is free software; you can redistribute it and/or modify6 * it under the terms of the GNU General Public License as published by7 * the Free Software Foundation; either version 2 of the License, or8 * (at your option) any later version.9 *10 * This program is distributed in the hope that it will be useful,11 * but WITHOUT ANY WARRANTY; without even the implied warranty of12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * GNU General Public License for more details.14 *15 * You should have received a copy of the GNU General Public License16 * along with this program; if not, write to the Free Software17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA18 *19 4 */ 20 5 … … 25 10 #include <sound/gus.h> 26 11 27 extern void snd_gf1_timers_init(struct snd_gus_card * gus);28 extern void snd_gf1_timers_done(struct snd_gus_card * gus);29 12 extern int snd_gf1_synth_init(struct snd_gus_card * gus); 30 13 extern void snd_gf1_synth_done(struct snd_gus_card * gus); … … 293 276 unsigned long flags; 294 277 void (*private_free)(struct snd_gus_voice *voice); 295 void *private_data;296 278 297 279 if (voice == NULL || !voice->use) … … 301 283 spin_lock_irqsave(&gus->voice_alloc, flags); 302 284 private_free = voice->private_free; 303 private_data = voice->private_data;304 285 voice->private_free = NULL; 305 286 voice->private_data = NULL; -
GPL/trunk/alsa-kernel/isa/gus/gus_tables.h
r305 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 3 *4 *5 * This program is free software; you can redistribute it and/or modify6 * it under the terms of the GNU General Public License as published by7 * the Free Software Foundation; either version 2 of the License, or8 * (at your option) any later version.9 *10 * This program is distributed in the hope that it will be useful,11 * but WITHOUT ANY WARRANTY; without even the implied warranty of12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * GNU General Public License for more details.14 *15 * You should have received a copy of the GNU General Public License16 * along with this program; if not, write to the Free Software17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA18 *19 4 */ 20 5 -
GPL/trunk/alsa-kernel/isa/gus/gus_timer.c
r305 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Routines for Gravis UltraSound soundcards - Timers … … 4 5 * 5 6 * GUS have similar timers as AdLib (OPL2/OPL3 chips). 6 *7 *8 * This program is free software; you can redistribute it and/or modify9 * it under the terms of the GNU General Public License as published by10 * the Free Software Foundation; either version 2 of the License, or11 * (at your option) any later version.12 *13 * This program is distributed in the hope that it will be useful,14 * but WITHOUT ANY WARRANTY; without even the implied warranty of15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 * GNU General Public License for more details.17 *18 * You should have received a copy of the GNU General Public License19 * along with this program; if not, write to the Free Software20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA21 *22 7 */ 23 8 … … 124 109 */ 125 110 126 static struct snd_timer_hardware snd_gf1_timer1 =111 static const struct snd_timer_hardware snd_gf1_timer1 = 127 112 { 128 113 .flags = SNDRV_TIMER_HW_STOP, … … 133 118 }; 134 119 135 static struct snd_timer_hardware snd_gf1_timer2 =120 static const struct snd_timer_hardware snd_gf1_timer2 = 136 121 { 137 122 .flags = SNDRV_TIMER_HW_STOP, -
GPL/trunk/alsa-kernel/isa/gus/gus_uart.c
r426 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 3 4 * Routines for the GF1 MIDI interface - like UART 6850 4 *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 5 */ 21 6 … … 29 14 { 30 15 int count; 31 unsigned char stat, data, byte; 16 unsigned char stat, byte; 17 __always_unused unsigned char data; 32 18 unsigned long flags; 33 19 … … 228 214 } 229 215 230 static struct snd_rawmidi_ops snd_gf1_uart_output =216 static const struct snd_rawmidi_ops snd_gf1_uart_output = 231 217 { 232 218 .open = snd_gf1_uart_output_open, … … 235 221 }; 236 222 237 static struct snd_rawmidi_ops snd_gf1_uart_input =223 static const struct snd_rawmidi_ops snd_gf1_uart_input = 238 224 { 239 225 .open = snd_gf1_uart_input_open, … … 242 228 }; 243 229 244 int snd_gf1_rawmidi_new(struct snd_gus_card * gus, int device, struct snd_rawmidi ** rrawmidi)230 int snd_gf1_rawmidi_new(struct snd_gus_card *gus, int device) 245 231 { 246 232 struct snd_rawmidi *rmidi; 247 233 int err; 248 234 249 if (rrawmidi)250 *rrawmidi = NULL;251 235 if ((err = snd_rawmidi_new(gus->card, "GF1", device, 1, 1, &rmidi)) < 0) 252 236 return err; … … 257 241 rmidi->private_data = gus; 258 242 gus->midi_uart = rmidi; 259 if (rrawmidi)260 *rrawmidi = rmidi;261 243 return err; 262 244 } -
GPL/trunk/alsa-kernel/isa/gus/gus_volume.c
r305 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 3 *4 *5 * This program is free software; you can redistribute it and/or modify6 * it under the terms of the GNU General Public License as published by7 * the Free Software Foundation; either version 2 of the License, or8 * (at your option) any later version.9 *10 * This program is distributed in the hope that it will be useful,11 * but WITHOUT ANY WARRANTY; without even the implied warranty of12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * GNU General Public License for more details.14 *15 * You should have received a copy of the GNU General Public License16 * along with this program; if not, write to the Free Software17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA18 *19 4 */ 20 5 21 6 #include <linux/time.h> 7 #include <linux/export.h> 22 8 #include <sound/core.h> 23 9 #include <sound/gus.h> … … 77 63 unsigned int us) 78 64 { 79 static unsigned char vol_rates[19] =65 static const unsigned char vol_rates[19] = 80 66 { 81 67 23, 24, 26, 28, 29, 31, 32, 34, … … 128 114 short snd_gf1_compute_vibrato(short cents, unsigned short fc_register) 129 115 { 130 static short vibrato_table[] =116 static const short vibrato_table[] = 131 117 { 132 118 0, 0, 32, 592, 61, 1175, 93, 1808, … … 136 122 137 123 long depth; 138 short *vi1, *vi2, pcents, v1; 124 const short *vi1, *vi2; 125 short pcents, v1; 139 126 140 127 pcents = cents < 0 ? -cents : cents; … … 160 147 unsigned short snd_gf1_compute_pitchbend(unsigned short pitchbend, unsigned short sens) 161 148 { 162 static long log_table[] = {1024, 1085, 1149, 1218, 1290, 1367, 1448, 1534, 1625, 1722, 1825, 1933};149 static const long log_table[] = {1024, 1085, 1149, 1218, 1290, 1367, 1448, 1534, 1625, 1722, 1825, 1933}; 163 150 int wheel, sensitivity; 164 151 unsigned int mantissa, f1, f2; -
GPL/trunk/alsa-kernel/isa/gus/gusclassic.c
r410 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Driver for Gravis UltraSound Classic soundcard 3 4 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 4 *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 5 */ 21 6 … … 25 10 #include <linux/delay.h> 26 11 #include <linux/time.h> 27 #include <linux/module param.h>12 #include <linux/module.h> 28 13 #include <asm/dma.h> 29 14 #include <sound/core.h> … … 43 28 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 44 29 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 45 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */30 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 46 31 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x230,0x240,0x250,0x260 */ 47 32 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 3,5,9,11,12,15 */ … … 59 44 module_param_array(enable, bool, NULL, 0444); 60 45 MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard."); 61 module_param_ array(port, long, NULL, 0444);46 module_param_hw_array(port, long, ioport, NULL, 0444); 62 47 MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver."); 63 module_param_ array(irq, int, NULL, 0444);48 module_param_hw_array(irq, int, irq, NULL, 0444); 64 49 MODULE_PARM_DESC(irq, "IRQ # for " CRD_NAME " driver."); 65 module_param_ array(dma1, int, NULL, 0444);50 module_param_hw_array(dma1, int, dma, NULL, 0444); 66 51 MODULE_PARM_DESC(dma1, "DMA1 # for " CRD_NAME " driver."); 67 module_param_ array(dma2, int, NULL, 0444);52 module_param_hw_array(dma2, int, dma, NULL, 0444); 68 53 MODULE_PARM_DESC(dma2, "DMA2 # for " CRD_NAME " driver."); 69 54 module_param_array(joystick_dac, int, NULL, 0444); … … 74 59 MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for " CRD_NAME " driver."); 75 60 76 static int __devinitsnd_gusclassic_match(struct device *dev, unsigned int n)61 static int snd_gusclassic_match(struct device *dev, unsigned int n) 77 62 { 78 63 return enable[n]; 79 64 } 80 65 81 static int __devinit snd_gusclassic_create(struct snd_card *card, 82 struct device *dev, unsigned int n, struct snd_gus_card **rgus) 83 { 84 static long possible_ports[] = {0x220, 0x230, 0x240, 0x250, 0x260}; 85 static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, 4, -1}; 86 static int possible_dmas[] = {5, 6, 7, 1, 3, -1}; 66 static int snd_gusclassic_create(struct snd_card *card, 67 struct device *dev, unsigned int n, 68 struct snd_gus_card **rgus) 69 { 70 static const long possible_ports[] = {0x220, 0x230, 0x240, 0x250, 0x260}; 71 static const int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, 4, -1}; 72 static const int possible_dmas[] = {5, 6, 7, 1, 3, -1}; 87 73 88 74 int i, error; … … 124 110 } 125 111 126 static int __devinitsnd_gusclassic_detect(struct snd_gus_card *gus)112 static int snd_gusclassic_detect(struct snd_gus_card *gus) 127 113 { 128 114 unsigned char d; … … 143 129 } 144 130 145 static int __devinitsnd_gusclassic_probe(struct device *dev, unsigned int n)131 static int snd_gusclassic_probe(struct device *dev, unsigned int n) 146 132 { 147 133 struct snd_card *card; … … 149 135 int error; 150 136 151 error = snd_card_ create(index[n], id[n], THIS_MODULE, 0, &card);137 error = snd_card_new(dev, index[n], id[n], THIS_MODULE, 0, &card); 152 138 if (error < 0) 153 139 return error; … … 181 167 goto out; 182 168 183 error = snd_gf1_pcm_new(gus, 0, 0 , NULL);169 error = snd_gf1_pcm_new(gus, 0, 0); 184 170 if (error < 0) 185 171 goto out; 186 172 187 173 if (!gus->ace_flag) { 188 error = snd_gf1_rawmidi_new(gus, 0 , NULL);174 error = snd_gf1_rawmidi_new(gus, 0); 189 175 if (error < 0) 190 176 goto out; … … 199 185 "&%d", gus->gf1.dma2); 200 186 201 snd_card_set_dev(card, dev);202 203 187 error = snd_card_register(card); 204 188 if (error < 0) … … 212 196 } 213 197 214 static int __devexitsnd_gusclassic_remove(struct device *dev, unsigned int n)198 static int snd_gusclassic_remove(struct device *dev, unsigned int n) 215 199 { 216 200 snd_card_free(dev_get_drvdata(dev)); 217 dev_set_drvdata(dev, NULL);218 201 return 0; 219 202 } … … 222 205 .match = snd_gusclassic_match, 223 206 .probe = snd_gusclassic_probe, 224 .remove = __devexit_p(snd_gusclassic_remove),207 .remove = snd_gusclassic_remove, 225 208 #if 0 /* FIXME */ 226 209 .suspend = snd_gusclassic_suspend, … … 232 215 }; 233 216 234 static int __init alsa_card_gusclassic_init(void) 235 { 236 return isa_register_driver(&snd_gusclassic_driver, SNDRV_CARDS); 237 } 238 239 static void __exit alsa_card_gusclassic_exit(void) 240 { 241 isa_unregister_driver(&snd_gusclassic_driver); 242 } 243 244 module_init(alsa_card_gusclassic_init); 245 module_exit(alsa_card_gusclassic_exit); 217 module_isa_driver(snd_gusclassic_driver, SNDRV_CARDS); -
GPL/trunk/alsa-kernel/isa/gus/gusextreme.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Driver for Gravis UltraSound Extreme soundcards 3 4 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 4 *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 5 */ 21 6 … … 25 10 #include <linux/delay.h> 26 11 #include <linux/time.h> 27 #include <linux/module param.h>12 #include <linux/module.h> 28 13 #include <asm/dma.h> 29 14 #include <sound/core.h> … … 47 32 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 48 33 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 49 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */34 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 50 35 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */ 51 36 static long gf1_port[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS) - 1] = -1}; /* 0x210,0x220,0x230,0x240,0x250,0x260,0x270 */ … … 67 52 module_param_array(enable, bool, NULL, 0444); 68 53 MODULE_PARM_DESC(enable, "Enable " CRD_NAME " soundcard."); 69 module_param_ array(port, long, NULL, 0444);54 module_param_hw_array(port, long, ioport, NULL, 0444); 70 55 MODULE_PARM_DESC(port, "Port # for " CRD_NAME " driver."); 71 module_param_ array(gf1_port, long, NULL, 0444);56 module_param_hw_array(gf1_port, long, ioport, NULL, 0444); 72 57 MODULE_PARM_DESC(gf1_port, "GF1 port # for " CRD_NAME " driver (optional)."); 73 module_param_ array(mpu_port, long, NULL, 0444);58 module_param_hw_array(mpu_port, long, ioport, NULL, 0444); 74 59 MODULE_PARM_DESC(mpu_port, "MPU-401 port # for " CRD_NAME " driver."); 75 module_param_ array(irq, int, NULL, 0444);60 module_param_hw_array(irq, int, irq, NULL, 0444); 76 61 MODULE_PARM_DESC(irq, "IRQ # for " CRD_NAME " driver."); 77 module_param_ array(mpu_irq, int, NULL, 0444);62 module_param_hw_array(mpu_irq, int, irq, NULL, 0444); 78 63 MODULE_PARM_DESC(mpu_irq, "MPU-401 IRQ # for " CRD_NAME " driver."); 79 module_param_ array(gf1_irq, int, NULL, 0444);64 module_param_hw_array(gf1_irq, int, irq, NULL, 0444); 80 65 MODULE_PARM_DESC(gf1_irq, "GF1 IRQ # for " CRD_NAME " driver."); 81 module_param_ array(dma8, int, NULL, 0444);66 module_param_hw_array(dma8, int, dma, NULL, 0444); 82 67 MODULE_PARM_DESC(dma8, "8-bit DMA # for " CRD_NAME " driver."); 83 module_param_ array(dma1, int, NULL, 0444);68 module_param_hw_array(dma1, int, dma, NULL, 0444); 84 69 MODULE_PARM_DESC(dma1, "GF1 DMA # for " CRD_NAME " driver."); 85 70 module_param_array(joystick_dac, int, NULL, 0444); … … 90 75 MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for " CRD_NAME " driver."); 91 76 92 static int __devinitsnd_gusextreme_match(struct device *dev, unsigned int n)77 static int snd_gusextreme_match(struct device *dev, unsigned int n) 93 78 { 94 79 return enable[n]; 95 80 } 96 81 97 static int __devinit snd_gusextreme_es1688_create(struct snd_card *card, 98 struct snd_es1688 *chip, struct device *dev, unsigned int n) 99 { 100 static long possible_ports[] = {0x220, 0x240, 0x260}; 101 static int possible_irqs[] = {5, 9, 10, 7, -1}; 102 static int possible_dmas[] = {1, 3, 0, -1}; 82 static int snd_gusextreme_es1688_create(struct snd_card *card, 83 struct snd_es1688 *chip, 84 struct device *dev, unsigned int n) 85 { 86 static const long possible_ports[] = {0x220, 0x240, 0x260}; 87 static const int possible_irqs[] = {5, 9, 10, 7, -1}; 88 static const int possible_dmas[] = {1, 3, 0, -1}; 103 89 104 90 int i, error; … … 133 119 } 134 120 135 static int __devinit snd_gusextreme_gus_card_create(struct snd_card *card, 136 struct device *dev, unsigned int n, struct snd_gus_card **rgus) 137 { 138 static int possible_irqs[] = {11, 12, 15, 9, 5, 7, 3, -1}; 139 static int possible_dmas[] = {5, 6, 7, 3, 1, -1}; 121 static int snd_gusextreme_gus_card_create(struct snd_card *card, 122 struct device *dev, unsigned int n, 123 struct snd_gus_card **rgus) 124 { 125 static const int possible_irqs[] = {11, 12, 15, 9, 5, 7, 3, -1}; 126 static const int possible_dmas[] = {5, 6, 7, 3, 1, -1}; 140 127 141 128 if (gf1_irq[n] == SNDRV_AUTO_IRQ) { … … 157 144 } 158 145 159 static int __devinitsnd_gusextreme_detect(struct snd_gus_card *gus,160 struct snd_es1688 *es1688)146 static int snd_gusextreme_detect(struct snd_gus_card *gus, 147 struct snd_es1688 *es1688) 161 148 { 162 149 unsigned long flags; … … 207 194 } 208 195 209 static int __devinitsnd_gusextreme_mixer(struct snd_card *card)196 static int snd_gusextreme_mixer(struct snd_card *card) 210 197 { 211 198 struct snd_ctl_elem_id id1, id2; … … 233 220 } 234 221 235 static int __devinitsnd_gusextreme_probe(struct device *dev, unsigned int n)222 static int snd_gusextreme_probe(struct device *dev, unsigned int n) 236 223 { 237 224 struct snd_card *card; … … 241 228 int error; 242 229 243 error = snd_card_ create(index[n], id[n], THIS_MODULE,244 sizeof(struct snd_es1688), &card);230 error = snd_card_new(dev, index[n], id[n], THIS_MODULE, 231 sizeof(struct snd_es1688), &card); 245 232 if (error < 0) 246 233 return error; … … 283 270 gus->codec_flag = 1; 284 271 285 error = snd_es1688_pcm(card, es1688, 0 , NULL);272 error = snd_es1688_pcm(card, es1688, 0); 286 273 if (error < 0) 287 274 goto out; … … 294 281 295 282 if (pcm_channels[n] > 0) { 296 error = snd_gf1_pcm_new(gus, 1, 1 , NULL);283 error = snd_gf1_pcm_new(gus, 1, 1); 297 284 if (error < 0) 298 285 goto out; … … 318 305 if (es1688->mpu_port >= 0x300) { 319 306 error = snd_mpu401_uart_new(card, 0, MPU401_HW_ES1688, 320 es1688->mpu_port, 0, 321 mpu_irq[n], IRQF_DISABLED, NULL); 307 es1688->mpu_port, 0, mpu_irq[n], NULL); 322 308 if (error < 0) 323 309 goto out; … … 328 314 gus->gf1.irq, es1688->irq, gus->gf1.dma1, es1688->dma8); 329 315 330 snd_card_set_dev(card, dev);331 332 316 error = snd_card_register(card); 333 317 if (error < 0) … … 341 325 } 342 326 343 static int __devexitsnd_gusextreme_remove(struct device *dev, unsigned int n)327 static int snd_gusextreme_remove(struct device *dev, unsigned int n) 344 328 { 345 329 snd_card_free(dev_get_drvdata(dev)); 346 dev_set_drvdata(dev, NULL);347 330 return 0; 348 331 } … … 351 334 .match = snd_gusextreme_match, 352 335 .probe = snd_gusextreme_probe, 353 .remove = __devexit_p(snd_gusextreme_remove),336 .remove = snd_gusextreme_remove, 354 337 #if 0 /* FIXME */ 355 338 .suspend = snd_gusextreme_suspend, … … 361 344 }; 362 345 363 static int __init alsa_card_gusextreme_init(void) 364 { 365 return isa_register_driver(&snd_gusextreme_driver, SNDRV_CARDS); 366 } 367 368 static void __exit alsa_card_gusextreme_exit(void) 369 { 370 isa_unregister_driver(&snd_gusextreme_driver); 371 } 372 373 module_init(alsa_card_gusextreme_init); 374 module_exit(alsa_card_gusextreme_exit); 346 module_isa_driver(snd_gusextreme_driver, SNDRV_CARDS); -
GPL/trunk/alsa-kernel/isa/gus/gusmax.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Driver for Gravis UltraSound MAX soundcard 3 4 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 4 *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 5 */ 21 6 … … 25 10 #include <linux/delay.h> 26 11 #include <linux/time.h> 27 #include <linux/module param.h>12 #include <linux/module.h> 28 13 #include <asm/dma.h> 29 14 #include <sound/core.h> … … 41 26 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 42 27 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 43 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */28 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 44 29 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x230,0x240,0x250,0x260 */ 45 30 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 2,3,5,9,11,12,15 */ … … 57 42 module_param_array(enable, bool, NULL, 0444); 58 43 MODULE_PARM_DESC(enable, "Enable GUS MAX soundcard."); 59 module_param_ array(port, long, NULL, 0444);44 module_param_hw_array(port, long, ioport, NULL, 0444); 60 45 MODULE_PARM_DESC(port, "Port # for GUS MAX driver."); 61 module_param_ array(irq, int, NULL, 0444);46 module_param_hw_array(irq, int, irq, NULL, 0444); 62 47 MODULE_PARM_DESC(irq, "IRQ # for GUS MAX driver."); 63 module_param_ array(dma1, int, NULL, 0444);48 module_param_hw_array(dma1, int, dma, NULL, 0444); 64 49 MODULE_PARM_DESC(dma1, "DMA1 # for GUS MAX driver."); 65 module_param_ array(dma2, int, NULL, 0444);50 module_param_hw_array(dma2, int, dma, NULL, 0444); 66 51 MODULE_PARM_DESC(dma2, "DMA2 # for GUS MAX driver."); 67 52 module_param_array(joystick_dac, int, NULL, 0444); … … 83 68 #define PFX "gusmax: " 84 69 85 static int __devinit snd_gusmax_detect(struct snd_gus_card *gus)70 static int snd_gusmax_detect(struct snd_gus_card *gus) 86 71 { 87 72 unsigned char d; … … 125 110 } 126 111 127 static void __devinitsnd_gusmax_init(int dev, struct snd_card *card,128 struct snd_gus_card *gus)112 static void snd_gusmax_init(int dev, struct snd_card *card, 113 struct snd_gus_card *gus) 129 114 { 130 115 gus->equal_irq = 1; … … 141 126 } 142 127 143 static int __devinitsnd_gusmax_mixer(struct snd_wss *chip)128 static int snd_gusmax_mixer(struct snd_wss *chip) 144 129 { 145 130 struct snd_card *card = chip->card; … … 200 185 } 201 186 202 static int __devinitsnd_gusmax_match(struct device *pdev, unsigned int dev)187 static int snd_gusmax_match(struct device *pdev, unsigned int dev) 203 188 { 204 189 return enable[dev]; 205 190 } 206 191 207 static int __devinitsnd_gusmax_probe(struct device *pdev, unsigned int dev)208 { 209 static int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1};210 static int possible_dmas[] = {5, 6, 7, 1, 3, -1};192 static int snd_gusmax_probe(struct device *pdev, unsigned int dev) 193 { 194 static const int possible_irqs[] = {5, 11, 12, 9, 7, 15, 3, -1}; 195 static const int possible_dmas[] = {5, 6, 7, 1, 3, -1}; 211 196 int xirq, xdma1, xdma2, err; 212 197 struct snd_card *card; … … 215 200 struct snd_gusmax *maxcard; 216 201 217 err = snd_card_ create(index[dev], id[dev], THIS_MODULE,218 sizeof(struct snd_gusmax), &card);202 err = snd_card_new(pdev, index[dev], id[dev], THIS_MODULE, 203 sizeof(struct snd_gusmax), &card); 219 204 if (err < 0) 220 205 return err; … … 257 242 0, &gus); 258 243 } else { 259 static unsigned long possible_ports[] = {244 static const unsigned long possible_ports[] = { 260 245 0x220, 0x230, 0x240, 0x250, 0x260 261 246 }; … … 292 277 } 293 278 294 if (request_irq(xirq, snd_gusmax_interrupt, IRQF_DISABLED, "GUS MAX", (void *)maxcard)) {279 if (request_irq(xirq, snd_gusmax_interrupt, 0, "GUS MAX", (void *)maxcard)) { 295 280 snd_printk(KERN_ERR PFX "unable to grab IRQ %d\n", xirq); 296 281 err = -EBUSY; … … 298 283 } 299 284 maxcard->irq = xirq; 300 285 card->sync_irq = maxcard->irq; 286 301 287 err = snd_wss_create(card, 302 288 gus->gf1.port + 0x10c, -1, xirq, … … 310 296 goto _err; 311 297 312 err = snd_wss_pcm(wss, 0 , NULL);298 err = snd_wss_pcm(wss, 0); 313 299 if (err < 0) 314 300 goto _err; … … 318 304 goto _err; 319 305 320 err = snd_wss_timer(wss, 2 , NULL);306 err = snd_wss_timer(wss, 2); 321 307 if (err < 0) 322 308 goto _err; 323 309 324 310 if (pcm_channels[dev] > 0) { 325 if ((err = snd_gf1_pcm_new(gus, 1, 1 , NULL)) < 0)311 if ((err = snd_gf1_pcm_new(gus, 1, 1)) < 0) 326 312 goto _err; 327 313 } … … 330 316 goto _err; 331 317 332 err = snd_gf1_rawmidi_new(gus, 0 , NULL);318 err = snd_gf1_rawmidi_new(gus, 0); 333 319 if (err < 0) 334 320 goto _err; … … 338 324 sprintf(card->longname + strlen(card->longname), "&%i", xdma2); 339 325 340 snd_card_set_dev(card, pdev);341 342 326 err = snd_card_register(card); 343 327 if (err < 0) … … 355 339 } 356 340 357 static int __devexitsnd_gusmax_remove(struct device *devptr, unsigned int dev)341 static int snd_gusmax_remove(struct device *devptr, unsigned int dev) 358 342 { 359 343 snd_card_free(dev_get_drvdata(devptr)); 360 dev_set_drvdata(devptr, NULL);361 344 return 0; 362 345 } … … 367 350 .match = snd_gusmax_match, 368 351 .probe = snd_gusmax_probe, 369 .remove = __devexit_p(snd_gusmax_remove),352 .remove = snd_gusmax_remove, 370 353 /* FIXME: suspend/resume */ 371 354 .driver = { … … 374 357 }; 375 358 376 static int __init alsa_card_gusmax_init(void) 377 { 378 return isa_register_driver(&snd_gusmax_driver, SNDRV_CARDS); 379 } 380 381 static void __exit alsa_card_gusmax_exit(void) 382 { 383 isa_unregister_driver(&snd_gusmax_driver); 384 } 385 386 module_init(alsa_card_gusmax_init) 387 module_exit(alsa_card_gusmax_exit) 359 module_isa_driver(snd_gusmax_driver, SNDRV_CARDS); -
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 struct snd_i2c_bus **rbus)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 int dev255 #ifdef SNDRV_STB 256 , struct snd_i2c_bus **rbus237 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 struct pnp_card_link *card,564 const struct pnp_card_device_id *id)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 sizeof(struct snd_interwave), &card);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 unsigned int dev)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 unsigned int dev)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 const struct pnp_card_device_id *pid)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 }; -
GPL/trunk/alsa-kernel/isa/opl3sa2.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Driver for Yamaha OPL3-SA[2,3] soundcards 3 4 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 4 *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 5 */ 21 6 … … 26 11 #include <linux/pm.h> 27 12 #include <linux/pnp.h> 28 #include <linux/moduleparam.h> 13 #include <linux/module.h> 14 #include <linux/io.h> 29 15 #include <sound/core.h> 30 16 #include <sound/wss.h> … … 33 19 #include <sound/initval.h> 34 20 #include <sound/tlv.h> 35 36 #include <asm/io.h>37 21 38 22 MODULE_AUTHOR("Jaroslav Kysela <perex@perex.cz>"); … … 47 31 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 48 32 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 49 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */33 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 50 34 #ifdef CONFIG_PNP 51 35 #ifndef TARGET_OS2 52 static intisapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};36 static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 53 37 #else 54 38 static int isapnp[SNDRV_CARDS] = {1,1,1,1,1,1,1,1}; … … 75 59 MODULE_PARM_DESC(isapnp, "PnP detection for specified soundcard."); 76 60 #endif 77 module_param_ array(port, long, NULL, 0444);61 module_param_hw_array(port, long, ioport, NULL, 0444); 78 62 MODULE_PARM_DESC(port, "Port # for OPL3-SA driver."); 79 module_param_ array(sb_port, long, NULL, 0444);63 module_param_hw_array(sb_port, long, ioport, NULL, 0444); 80 64 MODULE_PARM_DESC(sb_port, "SB port # for OPL3-SA driver."); 81 module_param_ array(wss_port, long, NULL, 0444);65 module_param_hw_array(wss_port, long, ioport, NULL, 0444); 82 66 MODULE_PARM_DESC(wss_port, "WSS port # for OPL3-SA driver."); 83 module_param_ array(fm_port, long, NULL, 0444);67 module_param_hw_array(fm_port, long, ioport, NULL, 0444); 84 68 MODULE_PARM_DESC(fm_port, "FM port # for OPL3-SA driver."); 85 module_param_ array(midi_port, long, NULL, 0444);69 module_param_hw_array(midi_port, long, ioport, NULL, 0444); 86 70 MODULE_PARM_DESC(midi_port, "MIDI port # for OPL3-SA driver."); 87 module_param_ array(irq, int, NULL, 0444);71 module_param_hw_array(irq, int, irq, NULL, 0444); 88 72 MODULE_PARM_DESC(irq, "IRQ # for OPL3-SA driver."); 89 module_param_ array(dma1, int, NULL, 0444);73 module_param_hw_array(dma1, int, dma, NULL, 0444); 90 74 MODULE_PARM_DESC(dma1, "DMA1 # for OPL3-SA driver."); 91 module_param_ array(dma2, int, NULL, 0444);75 module_param_hw_array(dma2, int, dma, NULL, 0444); 92 76 MODULE_PARM_DESC(dma2, "DMA2 # for OPL3-SA driver."); 93 77 module_param_array(opl3sa3_ymode, int, NULL, 0444); … … 147 131 #ifdef CONFIG_PNP 148 132 149 static struct pnp_device_id snd_opl3sa2_pnpbiosids[] = {133 static const struct pnp_device_id snd_opl3sa2_pnpbiosids[] = { 150 134 { .id = "YMH0021" }, 151 135 { .id = "NMX2210" }, /* Gateway Solo 2500 */ … … 155 139 MODULE_DEVICE_TABLE(pnp, snd_opl3sa2_pnpbiosids); 156 140 157 static struct pnp_card_device_id snd_opl3sa2_pnpids[] = {141 static const struct pnp_card_device_id snd_opl3sa2_pnpids[] = { 158 142 /* Yamaha YMF719E-S (Genius Sound Maker 3DX) */ 159 143 { .id = "YMH0020", .devs = { { "YMH0021" } } }, … … 226 210 } 227 211 228 static int __devinitsnd_opl3sa2_detect(struct snd_card *card)212 static int snd_opl3sa2_detect(struct snd_card *card) 229 213 { 230 214 struct snd_opl3sa2 *chip = card->private_data; … … 478 462 static const DECLARE_TLV_DB_SCALE(db_scale_5bit_12db_max, -3450, 150, 0); 479 463 480 static struct snd_kcontrol_new snd_opl3sa2_controls[] = {464 static const struct snd_kcontrol_new snd_opl3sa2_controls[] = { 481 465 OPL3SA2_DOUBLE("Master Playback Switch", 0, 0x07, 0x08, 7, 7, 1, 1), 482 466 OPL3SA2_DOUBLE_TLV("Master Playback Volume", 0, 0x07, 0x08, 0, 0, 15, 1, … … 488 472 }; 489 473 490 static struct snd_kcontrol_new snd_opl3sa2_tone_controls[] = {474 static const struct snd_kcontrol_new snd_opl3sa2_tone_controls[] = { 491 475 OPL3SA2_DOUBLE("3D Control - Wide", 0, 0x14, 0x14, 4, 0, 7, 0), 492 476 OPL3SA2_DOUBLE("Tone Control - Bass", 0, 0x15, 0x15, 4, 0, 7, 0), … … 501 485 } 502 486 503 static int __devinitsnd_opl3sa2_mixer(struct snd_card *card)487 static int snd_opl3sa2_mixer(struct snd_card *card) 504 488 { 505 489 struct snd_opl3sa2 *chip = card->private_data; … … 601 585 602 586 #ifdef CONFIG_PNP 603 static int __devinitsnd_opl3sa2_pnp(int dev, struct snd_opl3sa2 *chip,604 struct pnp_dev *pdev)587 static int snd_opl3sa2_pnp(int dev, struct snd_opl3sa2 *chip, 588 struct pnp_dev *pdev) 605 589 { 606 590 if (pnp_activate_dev(pdev) < 0) { … … 632 616 } 633 617 634 static int snd_opl3sa2_card_new(int dev, struct snd_card **cardp) 618 static int snd_opl3sa2_card_new(struct device *pdev, int dev, 619 struct snd_card **cardp) 635 620 { 636 621 struct snd_card *card; … … 638 623 int err; 639 624 640 err = snd_card_ create(index[dev], id[dev], THIS_MODULE,641 sizeof(struct snd_opl3sa2), &card);625 err = snd_card_new(pdev, index[dev], id[dev], THIS_MODULE, 626 sizeof(struct snd_opl3sa2), &card); 642 627 if (err < 0) 643 628 return err; … … 652 637 } 653 638 654 static int __devinitsnd_opl3sa2_probe(struct snd_card *card, int dev)639 static int snd_opl3sa2_probe(struct snd_card *card, int dev) 655 640 { 656 641 int xirq, xdma1, xdma2; … … 672 657 if (err < 0) 673 658 return err; 674 err = request_irq(xirq, snd_opl3sa2_interrupt, IRQF_DISABLED,659 err = request_irq(xirq, snd_opl3sa2_interrupt, 0, 675 660 "OPL3-SA2", card); 676 661 if (err) { … … 679 664 } 680 665 chip->irq = xirq; 666 card->sync_irq = chip->irq; 681 667 err = snd_wss_create(card, 682 668 wss_port[dev] + 4, -1, … … 688 674 } 689 675 chip->wss = wss; 690 err = snd_wss_pcm(wss, 0 , NULL);676 err = snd_wss_pcm(wss, 0); 691 677 if (err < 0) 692 678 return err; … … 697 683 if (err < 0) 698 684 return err; 699 err = snd_wss_timer(wss, 0 , NULL);685 err = snd_wss_timer(wss, 0); 700 686 if (err < 0) 701 687 return err; … … 712 698 if (midi_port[dev] >= 0x300 && midi_port[dev] < 0x340) { 713 699 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_OPL3SA2, 714 midi_port[dev], 0, 715 xirq, 0, &chip->rmidi)) < 0) 700 midi_port[dev], 701 MPU401_INFO_IRQ_HOOK, -1, 702 &chip->rmidi)) < 0) 716 703 return err; 717 704 } … … 725 712 726 713 #ifdef CONFIG_PNP 727 static int __devinitsnd_opl3sa2_pnp_detect(struct pnp_dev *pdev,728 const struct pnp_device_id *id)714 static int snd_opl3sa2_pnp_detect(struct pnp_dev *pdev, 715 const struct pnp_device_id *id) 729 716 { 730 717 static int dev; … … 741 728 return -ENODEV; 742 729 743 err = snd_opl3sa2_card_new( dev, &card);730 err = snd_opl3sa2_card_new(&pdev->dev, dev, &card); 744 731 if (err < 0) 745 732 return err; … … 748 735 return err; 749 736 } 750 snd_card_set_dev(card, &pdev->dev);751 737 if ((err = snd_opl3sa2_probe(card, dev)) < 0) { 752 738 snd_card_free(card); … … 758 744 } 759 745 760 static void __devexit snd_opl3sa2_pnp_remove(struct pnp_dev *pdev)746 static void snd_opl3sa2_pnp_remove(struct pnp_dev *pdev) 761 747 { 762 748 snd_card_free(pnp_get_drvdata(pdev)); 763 pnp_set_drvdata(pdev, NULL);764 749 } 765 750 … … 779 764 .id_table = snd_opl3sa2_pnpbiosids, 780 765 .probe = snd_opl3sa2_pnp_detect, 781 .remove = __devexit_p(snd_opl3sa2_pnp_remove),766 .remove = snd_opl3sa2_pnp_remove, 782 767 #ifdef CONFIG_PM 783 768 .suspend = snd_opl3sa2_pnp_suspend, … … 786 771 }; 787 772 788 static int __devinitsnd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard,789 const struct pnp_card_device_id *id)773 static int snd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard, 774 const struct pnp_card_device_id *id) 790 775 { 791 776 static int dev; … … 807 792 return -ENODEV; 808 793 809 err = snd_opl3sa2_card_new( dev, &card);794 err = snd_opl3sa2_card_new(&pdev->dev, dev, &card); 810 795 if (err < 0) 811 796 return err; … … 814 799 return err; 815 800 } 816 snd_card_set_dev(card, &pdev->dev);817 801 if ((err = snd_opl3sa2_probe(card, dev)) < 0) { 818 802 snd_card_free(card); … … 824 808 } 825 809 826 static void __devexit snd_opl3sa2_pnp_cremove(struct pnp_card_link *pcard)810 static void snd_opl3sa2_pnp_cremove(struct pnp_card_link *pcard) 827 811 { 828 812 snd_card_free(pnp_get_card_drvdata(pcard)); … … 846 830 .id_table = snd_opl3sa2_pnpids, 847 831 .probe = snd_opl3sa2_pnp_cdetect, 848 .remove = __devexit_p(snd_opl3sa2_pnp_cremove),832 .remove = snd_opl3sa2_pnp_cremove, 849 833 #ifdef CONFIG_PM 850 834 .suspend = snd_opl3sa2_pnp_csuspend, … … 854 838 #endif /* CONFIG_PNP */ 855 839 856 static int __devinitsnd_opl3sa2_isa_match(struct device *pdev,857 unsigned int dev)840 static int snd_opl3sa2_isa_match(struct device *pdev, 841 unsigned int dev) 858 842 { 859 843 if (!enable[dev]) … … 882 866 } 883 867 884 static int __devinitsnd_opl3sa2_isa_probe(struct device *pdev,885 unsigned int dev)868 static int snd_opl3sa2_isa_probe(struct device *pdev, 869 unsigned int dev) 886 870 { 887 871 struct snd_card *card; 888 872 int err; 889 873 890 err = snd_opl3sa2_card_new( dev, &card);874 err = snd_opl3sa2_card_new(pdev, dev, &card); 891 875 if (err < 0) 892 876 return err; 893 snd_card_set_dev(card, pdev);894 877 if ((err = snd_opl3sa2_probe(card, dev)) < 0) { 895 878 snd_card_free(card); … … 900 883 } 901 884 902 static int __devexitsnd_opl3sa2_isa_remove(struct device *devptr,903 unsigned int dev)885 static int snd_opl3sa2_isa_remove(struct device *devptr, 886 unsigned int dev) 904 887 { 905 888 snd_card_free(dev_get_drvdata(devptr)); 906 dev_set_drvdata(devptr, NULL);907 889 return 0; 908 890 } … … 926 908 .match = snd_opl3sa2_isa_match, 927 909 .probe = snd_opl3sa2_isa_probe, 928 .remove = __devexit_p(snd_opl3sa2_isa_remove),910 .remove = snd_opl3sa2_isa_remove, 929 911 #ifdef CONFIG_PM 930 912 .suspend = snd_opl3sa2_isa_suspend, -
GPL/trunk/alsa-kernel/isa/opti9xx/opti92x-ad1848.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 card-opti92x-ad1848.c - driver for OPTi 82c92x based soundcards. … … 8 9 Thanks to Maria Grazia Pollarini, Salvatore Vassallo. 9 10 10 This program is free software; you can redistribute it and/or modify11 it under the terms of the GNU General Public License as published by12 the Free Software Foundation; either version 2 of the License, or13 (at your option) any later version.14 15 This program is distributed in the hope that it will be useful,16 but WITHOUT ANY WARRANTY; without even the implied warranty of17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the18 GNU General Public License for more details.19 20 You should have received a copy of the GNU General Public License21 along with this program; if not, write to the Free Software22 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA23 11 */ 24 12 … … 29 17 #include <linux/delay.h> 30 18 #include <linux/pnp.h> 31 #include <linux/module param.h>32 #include < asm/io.h>19 #include <linux/module.h> 20 #include <linux/io.h> 33 21 #include <asm/dma.h> 34 22 #include <sound/core.h> … … 40 28 #include <sound/opl4.h> 41 29 #endif 30 #define SNDRV_LEGACY_FIND_FREE_IOPORT 42 31 #define SNDRV_LEGACY_FIND_FREE_IRQ 43 32 #define SNDRV_LEGACY_FIND_FREE_DMA … … 64 53 static int index = SNDRV_DEFAULT_IDX1; /* Index 0-MAX */ 65 54 static char *id = SNDRV_DEFAULT_STR1; /* ID for this card */ 66 //static intenable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */55 //static bool enable = SNDRV_DEFAULT_ENABLE1; /* Enable this card */ 67 56 #ifdef CONFIG_PNP 68 static int isapnp = 1; /* Enable ISA PnP detection */57 static bool isapnp = true; /* Enable ISA PnP detection */ 69 58 #endif 70 59 static long port = SNDRV_DEFAULT_PORT1; /* 0x530,0xe80,0xf40,0x604 */ … … 88 77 MODULE_PARM_DESC(isapnp, "Enable ISA PnP detection for specified soundcard."); 89 78 #endif 90 module_param (port, long, 0444);79 module_param_hw(port, long, ioport, 0444); 91 80 MODULE_PARM_DESC(port, "WSS port # for opti9xx driver."); 92 module_param (mpu_port, long, 0444);81 module_param_hw(mpu_port, long, ioport, 0444); 93 82 MODULE_PARM_DESC(mpu_port, "MPU-401 port # for opti9xx driver."); 94 module_param (fm_port, long, 0444);83 module_param_hw(fm_port, long, ioport, 0444); 95 84 MODULE_PARM_DESC(fm_port, "FM port # for opti9xx driver."); 96 module_param (irq, int, 0444);85 module_param_hw(irq, int, irq, 0444); 97 86 MODULE_PARM_DESC(irq, "WSS irq # for opti9xx driver."); 98 module_param (mpu_irq, int, 0444);87 module_param_hw(mpu_irq, int, irq, 0444); 99 88 MODULE_PARM_DESC(mpu_irq, "MPU-401 irq # for opti9xx driver."); 100 module_param (dma1, int, 0444);89 module_param_hw(dma1, int, dma, 0444); 101 90 MODULE_PARM_DESC(dma1, "1st dma # for opti9xx driver."); 102 91 #if defined(CS4231) || defined(OPTi93X) 103 module_param (dma2, int, 0444);92 module_param_hw(dma2, int, dma, 0444); 104 93 MODULE_PARM_DESC(dma2, "2nd dma # for opti9xx driver."); 105 94 #endif /* CS4231 || OPTi93X */ … … 136 125 #ifdef OPTi93X 137 126 unsigned long mc_indir_index; 138 unsigned long mc_indir_size;139 127 struct resource *res_mc_indir; 128 #endif /* OPTi93X */ 140 129 struct snd_wss *codec; 141 #endif /* OPTi93X */142 130 unsigned long pwd_reg; 143 131 … … 152 140 #ifdef CONFIG_PNP 153 141 154 static struct pnp_card_device_id snd_opti9xx_pnpids[] = {142 static const struct pnp_card_device_id snd_opti9xx_pnpids[] = { 155 143 #ifndef OPTi93X 156 144 /* OPTi 82C924 */ … … 174 162 #endif /* CONFIG_PNP */ 175 163 176 #ifdef OPTi93X 177 #define DEV_NAME "opti93x" 178 #else 179 #define DEV_NAME "opti92x" 180 #endif 181 182 static char * snd_opti9xx_names[] = { 164 #define DEV_NAME KBUILD_MODNAME 165 166 static const char * const snd_opti9xx_names[] = { 183 167 "unknown", 184 168 "82C928", "82C929", … … 187 171 }; 188 172 189 190 static long __devinit snd_legacy_find_free_ioport(long *port_table, long size) 191 { 192 while (*port_table != -1) { 193 if (request_region(*port_table, size, "ALSA test")) { 194 release_region(*port_table, size); 195 return *port_table; 196 } 197 port_table++; 198 } 199 return -1; 200 } 201 202 static int __devinit snd_opti9xx_init(struct snd_opti9xx *chip, 203 unsigned short hardware) 204 { 205 static int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; 173 static int snd_opti9xx_init(struct snd_opti9xx *chip, 174 unsigned short hardware) 175 { 176 static const int opti9xx_mc_size[] = {7, 7, 10, 10, 2, 2, 2}; 206 177 207 178 chip->hardware = hardware; … … 246 217 case OPTi9XX_HW_82C933: 247 218 chip->mc_base = (hardware == OPTi9XX_HW_82C930) ? 0xf8f : 0xf8d; 248 if (!chip->mc_indir_index) {219 if (!chip->mc_indir_index) 249 220 chip->mc_indir_index = 0xe0e; 250 chip->mc_indir_size = 2;251 }252 221 chip->password = 0xe4; 253 222 chip->pwd_reg = 0; … … 281 250 break; 282 251 } 252 fallthrough; 283 253 284 254 case OPTi9XX_HW_82C928: … … 323 293 break; 324 294 } 295 fallthrough; 325 296 326 297 case OPTi9XX_HW_82C928: … … 347 318 348 319 349 #define snd_opti9xx_write_mask(chip, reg, value, mask) \ 350 snd_opti9xx_write(chip, reg, \ 351 (snd_opti9xx_read(chip, reg) & ~(mask)) | ((value) & (mask))) 352 353 354 static int __devinit snd_opti9xx_configure(struct snd_opti9xx *chip, 320 static inline void snd_opti9xx_write_mask(struct snd_opti9xx *chip, 321 unsigned char reg, unsigned char value, unsigned char mask) 322 { 323 unsigned char oldval = snd_opti9xx_read(chip, reg); 324 325 snd_opti9xx_write(chip, reg, (oldval & ~mask) | (value & mask)); 326 } 327 328 static int snd_opti9xx_configure(struct snd_opti9xx *chip, 355 329 long port, 356 330 int irq, int dma1, int dma2, … … 370 344 /* enable wave audio */ 371 345 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x02); 346 fallthrough; 372 347 373 348 case OPTi9XX_HW_82C925: … … 404 379 #else /* OPTi93X */ 405 380 case OPTi9XX_HW_82C931: 381 /* disable 3D sound (set GPIO1 as output, low) */ 382 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(20), 0x04, 0x0c); 383 fallthrough; 384 406 385 case OPTi9XX_HW_82C933: 407 386 /* … … 415 394 */ 416 395 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(26), 0x01, 0x01); 417 case OPTi9XX_HW_82C930: /* FALL THROUGH */ 396 fallthrough; 397 398 case OPTi9XX_HW_82C930: 418 399 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(6), 0x02, 0x03); 419 400 snd_opti9xx_write_mask(chip, OPTi9XX_MC_REG(3), 0x00, 0xff); … … 575 556 static const DECLARE_TLV_DB_SCALE(db_scale_4bit_12db_max, -3300, 300, 0); 576 557 577 static struct snd_kcontrol_new snd_opti93x_controls[] = {558 static const struct snd_kcontrol_new snd_opti93x_controls[] = { 578 559 WSS_DOUBLE("Master Playback Switch", 0, 579 560 OPTi93X_OUT_LEFT, OPTi93X_OUT_RIGHT, 7, 7, 1, 1), … … 607 588 }; 608 589 609 static int __devinitsnd_opti93x_mixer(struct snd_wss *chip)590 static int snd_opti93x_mixer(struct snd_wss *chip) 610 591 { 611 592 struct snd_card *card; … … 680 661 #endif /* OPTi93X */ 681 662 682 static int __devinitsnd_opti9xx_read_check(struct snd_opti9xx *chip)663 static int snd_opti9xx_read_check(struct snd_opti9xx *chip) 683 664 { 684 665 unsigned char value; … … 697 678 return 0; 698 679 #else /* OPTi93X */ 699 chip->res_mc_indir = request_region(chip->mc_indir_index, 700 chip->mc_indir_size, 680 chip->res_mc_indir = request_region(chip->mc_indir_index, 2, 701 681 "OPTi93x MC"); 702 682 if (chip->res_mc_indir == NULL) … … 722 702 } 723 703 724 static int __devinitsnd_card_opti9xx_detect(struct snd_card *card,725 struct snd_opti9xx *chip)704 static int snd_card_opti9xx_detect(struct snd_card *card, 705 struct snd_opti9xx *chip) 726 706 { 727 707 int i, err; … … 747 727 748 728 #ifdef CONFIG_PNP 749 static int __devinitsnd_card_opti9xx_pnp(struct snd_opti9xx *chip,750 struct pnp_card_link *card,751 const struct pnp_card_device_id *pid)729 static int snd_card_opti9xx_pnp(struct snd_opti9xx *chip, 730 struct pnp_card_link *card, 731 const struct pnp_card_device_id *pid) 752 732 { 753 733 struct pnp_dev *pdev; … … 771 751 port = pnp_port_start(pdev, 0) - 4; 772 752 fm_port = pnp_port_start(pdev, 1) + 8; 773 chip->mc_indir_index = pnp_port_start(pdev, 3) + 2; 774 chip->mc_indir_size = pnp_port_len(pdev, 3) - 2; 753 /* adjust mc_indir_index - some cards report it at 0xe?d, 754 other at 0xe?c but it really is always at 0xe?e */ 755 chip->mc_indir_index = (pnp_port_start(pdev, 3) & ~0xf) | 0xe; 775 756 #else 776 757 devmc = pnp_request_card_device(card, pid->devs[2].id, NULL); … … 831 812 } 832 813 833 static int __devinitsnd_opti9xx_probe(struct snd_card *card)834 { 835 static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1};814 static int snd_opti9xx_probe(struct snd_card *card) 815 { 816 static const long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; 836 817 int error; 837 818 int xdma2; 838 819 struct snd_opti9xx *chip = card->private_data; 839 820 struct snd_wss *codec; 840 #ifdef CS4231841 struct snd_timer *timer;842 #endif843 struct snd_pcm *pcm;844 821 struct snd_rawmidi *rmidi; 845 822 struct snd_hwdep *synth; … … 872 849 if (error < 0) 873 850 return error; 874 #ifdef OPTi93X875 851 chip->codec = codec; 876 #endif 877 error = snd_wss_pcm(codec, 0, &pcm); 852 error = snd_wss_pcm(codec, 0); 878 853 if (error < 0) 879 854 return error; … … 887 862 #endif 888 863 #ifdef CS4231 889 error = snd_wss_timer(codec, 0 , &timer);864 error = snd_wss_timer(codec, 0); 890 865 if (error < 0) 891 866 return error; … … 893 868 #ifdef OPTi93X 894 869 error = request_irq(irq, snd_opti93x_interrupt, 895 IRQF_DISABLED, DEV_NAME" - WSS", chip);870 0, DEV_NAME" - WSS", chip); 896 871 if (error < 0) { 897 872 snd_printk(KERN_ERR "opti9xx: can't grab IRQ %d\n", irq); … … 900 875 #endif 901 876 chip->irq = irq; 877 card->sync_irq = chip->irq; 902 878 strcpy(card->driver, chip->name); 903 879 sprintf(card->shortname, "OPTi %s", card->driver); 904 880 #if defined(CS4231) || defined(OPTi93X) 905 sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d&%d", 906 card->shortname, pcm->name, 907 chip->wss_base + 4, irq, dma1, xdma2); 881 snprintf(card->longname, sizeof(card->longname), 882 "%s, %s at 0x%lx, irq %d, dma %d&%d", 883 card->shortname, codec->pcm->name, 884 chip->wss_base + 4, irq, dma1, xdma2); 908 885 #else 909 sprintf(card->longname, "%s, %s at 0x%lx, irq %d, dma %d", 910 card->shortname, pcm->name, chip->wss_base + 4, irq, dma1); 886 snprintf(card->longname, sizeof(card->longname), 887 "%s, %s at 0x%lx, irq %d, dma %d", 888 card->shortname, codec->pcm->name, chip->wss_base + 4, irq, 889 dma1); 911 890 #endif /* CS4231 || OPTi93X */ 912 891 … … 915 894 else { 916 895 error = snd_mpu401_uart_new(card, 0, MPU401_HW_MPU401, 917 mpu_port, 0, mpu_irq, IRQF_DISABLED,&rmidi);896 mpu_port, 0, mpu_irq, &rmidi); 918 897 if (error) 919 898 snd_printk(KERN_WARNING "no MPU-401 device at 0x%lx?\n", … … 954 933 } 955 934 956 static int snd_opti9xx_card_new(struct snd_card **cardp)935 static int snd_opti9xx_card_new(struct device *pdev, struct snd_card **cardp) 957 936 { 958 937 struct snd_card *card; 959 938 int err; 960 939 961 err = snd_card_ create(index, id, THIS_MODULE,962 sizeof(struct snd_opti9xx), &card);940 err = snd_card_new(pdev, index, id, THIS_MODULE, 941 sizeof(struct snd_opti9xx), &card); 963 942 if (err < 0) 964 943 return err; … … 968 947 } 969 948 970 static int __devinitsnd_opti9xx_isa_match(struct device *devptr,971 unsigned int dev)949 static int snd_opti9xx_isa_match(struct device *devptr, 950 unsigned int dev) 972 951 { 973 952 #ifdef CONFIG_PNP … … 980 959 } 981 960 982 static int __devinitsnd_opti9xx_isa_probe(struct device *devptr,983 unsigned int dev)961 static int snd_opti9xx_isa_probe(struct device *devptr, 962 unsigned int dev) 984 963 { 985 964 struct snd_card *card; 986 965 int error; 987 static long possible_mpu_ports[] = {0x300, 0x310, 0x320, 0x330, -1};966 static const long possible_mpu_ports[] = {0x300, 0x310, 0x320, 0x330, -1}; 988 967 #ifdef OPTi93X 989 static int possible_irqs[] = {5, 9, 10, 11, 7, -1};968 static const int possible_irqs[] = {5, 9, 10, 11, 7, -1}; 990 969 #else 991 static int possible_irqs[] = {9, 10, 11, 7, -1};970 static const int possible_irqs[] = {9, 10, 11, 7, -1}; 992 971 #endif /* OPTi93X */ 993 static int possible_mpu_irqs[] = {5, 9, 10, 7, -1};994 static int possible_dma1s[] = {3, 1, 0, -1};972 static const int possible_mpu_irqs[] = {5, 9, 10, 7, -1}; 973 static const int possible_dma1s[] = {3, 1, 0, -1}; 995 974 #if defined(CS4231) || defined(OPTi93X) 996 static int possible_dma2s[][2] = {{1,-1}, {0,-1}, {-1,-1}, {0,-1}};975 static const int possible_dma2s[][2] = {{1,-1}, {0,-1}, {-1,-1}, {0,-1}}; 997 976 #endif /* CS4231 || OPTi93X */ 998 977 … … 1030 1009 #endif 1031 1010 1032 error = snd_opti9xx_card_new( &card);1011 error = snd_opti9xx_card_new(devptr, &card); 1033 1012 if (error < 0) 1034 1013 return error; … … 1038 1017 return error; 1039 1018 } 1040 snd_card_set_dev(card, devptr);1041 1019 if ((error = snd_opti9xx_probe(card)) < 0) { 1042 1020 snd_card_free(card); … … 1047 1025 } 1048 1026 1049 static int __devexitsnd_opti9xx_isa_remove(struct device *devptr,1050 unsigned int dev)1027 static int snd_opti9xx_isa_remove(struct device *devptr, 1028 unsigned int dev) 1051 1029 { 1052 1030 snd_card_free(dev_get_drvdata(devptr)); 1053 dev_set_drvdata(devptr, NULL);1054 1031 return 0; 1055 1032 } 1033 1034 #ifdef CONFIG_PM 1035 static int snd_opti9xx_suspend(struct snd_card *card) 1036 { 1037 struct snd_opti9xx *chip = card->private_data; 1038 1039 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 1040 chip->codec->suspend(chip->codec); 1041 return 0; 1042 } 1043 1044 static int snd_opti9xx_resume(struct snd_card *card) 1045 { 1046 struct snd_opti9xx *chip = card->private_data; 1047 int error, xdma2; 1048 #if defined(CS4231) || defined(OPTi93X) 1049 xdma2 = dma2; 1050 #else 1051 xdma2 = -1; 1052 #endif 1053 1054 error = snd_opti9xx_configure(chip, port, irq, dma1, xdma2, 1055 mpu_port, mpu_irq); 1056 if (error) 1057 return error; 1058 chip->codec->resume(chip->codec); 1059 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 1060 return 0; 1061 } 1062 1063 static int snd_opti9xx_isa_suspend(struct device *dev, unsigned int n, 1064 pm_message_t state) 1065 { 1066 return snd_opti9xx_suspend(dev_get_drvdata(dev)); 1067 } 1068 1069 static int snd_opti9xx_isa_resume(struct device *dev, unsigned int n) 1070 { 1071 return snd_opti9xx_resume(dev_get_drvdata(dev)); 1072 } 1073 #endif 1056 1074 1057 1075 static struct isa_driver snd_opti9xx_driver = { 1058 1076 .match = snd_opti9xx_isa_match, 1059 1077 .probe = snd_opti9xx_isa_probe, 1060 .remove = __devexit_p(snd_opti9xx_isa_remove), 1061 /* FIXME: suspend/resume */ 1078 .remove = snd_opti9xx_isa_remove, 1079 #ifdef CONFIG_PM 1080 .suspend = snd_opti9xx_isa_suspend, 1081 .resume = snd_opti9xx_isa_resume, 1082 #endif 1062 1083 .driver = { 1063 1084 .name = DEV_NAME … … 1066 1087 1067 1088 #ifdef CONFIG_PNP 1068 static int __devinitsnd_opti9xx_pnp_probe(struct pnp_card_link *pcard,1069 const struct pnp_card_device_id *pid)1089 static int snd_opti9xx_pnp_probe(struct pnp_card_link *pcard, 1090 const struct pnp_card_device_id *pid) 1070 1091 { 1071 1092 struct snd_card *card; … … 1077 1098 if (! isapnp) 1078 1099 return -ENODEV; 1079 error = snd_opti9xx_card_new(& card);1100 error = snd_opti9xx_card_new(&pcard->card->dev, &card); 1080 1101 if (error < 0) 1081 1102 return error; … … 1108 1129 return error; 1109 1130 } 1110 snd_card_set_dev(card, &pcard->card->dev);1111 1131 if ((error = snd_opti9xx_probe(card)) < 0) { 1112 1132 snd_card_free(card); … … 1118 1138 } 1119 1139 1120 static void __devexit snd_opti9xx_pnp_remove(struct pnp_card_link *pcard)1140 static void snd_opti9xx_pnp_remove(struct pnp_card_link *pcard) 1121 1141 { 1122 1142 snd_card_free(pnp_get_card_drvdata(pcard)); … … 1125 1145 } 1126 1146 1147 #ifdef CONFIG_PM 1148 static int snd_opti9xx_pnp_suspend(struct pnp_card_link *pcard, 1149 pm_message_t state) 1150 { 1151 return snd_opti9xx_suspend(pnp_get_card_drvdata(pcard)); 1152 } 1153 1154 static int snd_opti9xx_pnp_resume(struct pnp_card_link *pcard) 1155 { 1156 return snd_opti9xx_resume(pnp_get_card_drvdata(pcard)); 1157 } 1158 #endif 1159 1127 1160 static struct pnp_card_driver opti9xx_pnpc_driver = { 1128 1161 .flags = PNP_DRIVER_RES_DISABLE, 1129 .name = "opti9xx",1162 .name = DEV_NAME, 1130 1163 .id_table = snd_opti9xx_pnpids, 1131 1164 .probe = snd_opti9xx_pnp_probe, 1132 .remove = __devexit_p(snd_opti9xx_pnp_remove), 1165 .remove = snd_opti9xx_pnp_remove, 1166 #ifdef CONFIG_PM 1167 .suspend = snd_opti9xx_pnp_suspend, 1168 .resume = snd_opti9xx_pnp_resume, 1169 #endif 1133 1170 }; 1134 1171 #endif -
GPL/trunk/alsa-kernel/isa/sb/emu8000.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> … … 5 6 * 6 7 * Routines for control of EMU8000 chip 7 *8 * This program is free software; you can redistribute it and/or modify9 * it under the terms of the GNU General Public License as published by10 * the Free Software Foundation; either version 2 of the License, or11 * (at your option) any later version.12 *13 * This program is distributed in the hope that it will be useful,14 * but WITHOUT ANY WARRANTY; without even the implied warranty of15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 * GNU General Public License for more details.17 *18 * You should have received a copy of the GNU General Public License19 * along with this program; if not, write to the Free Software20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA21 8 */ 22 9 23 10 #include <linux/wait.h> 24 #include <linux/sched .h>11 #include <linux/sched/signal.h> 25 12 #include <linux/slab.h> 26 13 #include <linux/ioport.h> 14 #include <linux/export.h> 27 15 #include <linux/delay.h> 16 #include <linux/io.h> 28 17 #include <sound/core.h> 29 18 #include <sound/emu8000.h> 30 19 #include <sound/emu8000_reg.h> 31 #include <asm/io.h> 32 #include <asm/uaccess.h> 20 #include <linux/uaccess.h> 33 21 #include <linux/init.h> 34 22 #include <sound/control.h> … … 131 119 /* 132 120 */ 133 static void __devinit121 static void 134 122 snd_emu8000_read_wait(struct snd_emu8000 *emu) 135 123 { … … 143 131 /* 144 132 */ 145 static void __devinit133 static void 146 134 snd_emu8000_write_wait(struct snd_emu8000 *emu) 147 135 { … … 156 144 * detect a card at the given port 157 145 */ 158 static int __devinit146 static int 159 147 snd_emu8000_detect(struct snd_emu8000 *emu) 160 148 { … … 182 170 * intiailize audio channels 183 171 */ 184 static void __devinit172 static void 185 173 init_audio(struct snd_emu8000 *emu) 186 174 { … … 223 211 * initialize DMA address 224 212 */ 225 static void __devinit213 static void 226 214 init_dma(struct snd_emu8000 *emu) 227 215 { … … 235 223 * initialization arrays; from ADIP 236 224 */ 237 static unsigned short init1[128] /*__devinitdata*/= {225 static const unsigned short init1[128] = { 238 226 0x03ff, 0x0030, 0x07ff, 0x0130, 0x0bff, 0x0230, 0x0fff, 0x0330, 239 227 0x13ff, 0x0430, 0x17ff, 0x0530, 0x1bff, 0x0630, 0x1fff, 0x0730, … … 257 245 }; 258 246 259 static unsigned short init2[128] /*__devinitdata*/= {247 static const unsigned short init2[128] = { 260 248 0x03ff, 0x8030, 0x07ff, 0x8130, 0x0bff, 0x8230, 0x0fff, 0x8330, 261 249 0x13ff, 0x8430, 0x17ff, 0x8530, 0x1bff, 0x8630, 0x1fff, 0x8730, … … 279 267 }; 280 268 281 static unsigned short init3[128] /*__devinitdata*/= {269 static const unsigned short init3[128] = { 282 270 0x0C10, 0x8470, 0x14FE, 0xB488, 0x167F, 0xA470, 0x18E7, 0x84B5, 283 271 0x1B6E, 0x842A, 0x1F1D, 0x852A, 0x0DA3, 0x8F7C, 0x167E, 0xF254, … … 301 289 }; 302 290 303 static unsigned short init4[128] /*__devinitdata*/= {291 static const unsigned short init4[128] = { 304 292 0x0C10, 0x8470, 0x14FE, 0xB488, 0x167F, 0xA470, 0x18E7, 0x84B5, 305 293 0x1B6E, 0x842A, 0x1F1D, 0x852A, 0x0DA3, 0x0F7C, 0x167E, 0x7254, … … 327 315 * is meant to work 328 316 */ 329 static void __devinit330 send_array(struct snd_emu8000 *emu, unsigned short *data, int size)317 static void 318 send_array(struct snd_emu8000 *emu, const unsigned short *data, int size) 331 319 { 332 320 int i; 333 unsigned short *p;321 const unsigned short *p; 334 322 335 323 p = data; … … 349 337 * initialisation sequence in the adip. 350 338 */ 351 static void __devinit339 static void 352 340 init_arrays(struct snd_emu8000 *emu) 353 341 { … … 371 359 /* 372 360 * Size the onboard memory. 373 * This is written so as not to need arbit ary delays after the write. It361 * This is written so as not to need arbitrary delays after the write. It 374 362 * seems that the only way to do this is to use the one channel and keep 375 363 * reallocating between read and write. 376 364 */ 377 static void __devinit365 static void 378 366 size_dram(struct snd_emu8000 *emu) 379 367 { 380 int i, size , detected_size;368 int i, size; 381 369 382 370 if (emu->dram_checked) … … 384 372 385 373 size = 0; 386 detected_size = 0;387 374 388 375 /* write out a magic number */ … … 392 379 EMU8000_SMLD_WRITE(emu, UNIQUE_ID1); 393 380 snd_emu8000_init_fm(emu); /* This must really be here and not 2 lines back even */ 394 395 while (size < EMU8000_MAX_DRAM) { 396 397 size += 512 * 1024; /* increment 512kbytes */ 381 snd_emu8000_write_wait(emu); 382 383 /* 384 * Detect first 512 KiB. If a write succeeds at the beginning of a 385 * 512 KiB page we assume that the whole page is there. 386 */ 387 EMU8000_SMALR_WRITE(emu, EMU8000_DRAM_OFFSET); 388 EMU8000_SMLD_READ(emu); /* discard stale data */ 389 if (EMU8000_SMLD_READ(emu) != UNIQUE_ID1) 390 goto skip_detect; /* No RAM */ 391 snd_emu8000_read_wait(emu); 392 393 for (size = 512 * 1024; size < EMU8000_MAX_DRAM; size += 512 * 1024) { 398 394 399 395 /* Write a unique data on the test address. … … 417 413 if (EMU8000_SMLD_READ(emu) != UNIQUE_ID2) 418 414 break; /* no memory at this address */ 419 420 detected_size = size;421 422 415 snd_emu8000_read_wait(emu); 423 416 … … 432 425 break; /* we must have wrapped around */ 433 426 snd_emu8000_read_wait(emu); 434 } 435 427 428 /* Otherwise, it's valid memory. */ 429 } 430 431 skip_detect: 436 432 /* wait until FULL bit in SMAxW register is false */ 437 433 for (i = 0; i < 10000; i++) { … … 445 441 snd_emu8000_dma_chan(emu, 1, EMU8000_RAM_CLOSE); 446 442 447 snd_printdd("EMU8000 [0x%lx]: %d Kb on-board memorydetected\n",448 emu->port1, detected_size/1024);449 450 emu->mem_size = detected_size;443 pr_info("EMU8000 [0x%lx]: %d KiB on-board DRAM detected\n", 444 emu->port1, size/1024); 445 446 emu->mem_size = size; 451 447 emu->dram_checked = 1; 452 448 } … … 503 499 * The main initialization routine. 504 500 */ 505 static void __devinit501 static void 506 502 snd_emu8000_init_hw(struct snd_emu8000 *emu) 507 503 { … … 553 549 *----------------------------------------------------------------*/ 554 550 555 static unsigned short bass_parm[12][3] = {551 static const unsigned short bass_parm[12][3] = { 556 552 {0xD26A, 0xD36A, 0x0000}, /* -12 dB */ 557 553 {0xD25B, 0xD35B, 0x0000}, /* -8 */ … … 568 564 }; 569 565 570 static unsigned short treble_parm[12][9] = {566 static const unsigned short treble_parm[12][9] = { 571 567 {0x821E, 0xC26A, 0x031E, 0xC36A, 0x021E, 0xD208, 0x831E, 0xD308, 0x0001}, /* -12 dB */ 572 568 {0x821E, 0xC25B, 0x031E, 0xC35B, 0x021E, 0xD208, 0x831E, 0xD308, 0x0001}, … … 860 856 } 861 857 862 static struct snd_kcontrol_new mixer_bass_control =858 static const struct snd_kcontrol_new mixer_bass_control = 863 859 { 864 860 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 870 866 }; 871 867 872 static struct snd_kcontrol_new mixer_treble_control =868 static const struct snd_kcontrol_new mixer_treble_control = 873 869 { 874 870 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 927 923 } 928 924 929 static struct snd_kcontrol_new mixer_chorus_mode_control =925 static const struct snd_kcontrol_new mixer_chorus_mode_control = 930 926 { 931 927 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 937 933 }; 938 934 939 static struct snd_kcontrol_new mixer_reverb_mode_control =935 static const struct snd_kcontrol_new mixer_reverb_mode_control = 940 936 { 941 937 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 989 985 } 990 986 991 static struct snd_kcontrol_new mixer_fm_chorus_depth_control =987 static const struct snd_kcontrol_new mixer_fm_chorus_depth_control = 992 988 { 993 989 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 999 995 }; 1000 996 1001 static struct snd_kcontrol_new mixer_fm_reverb_depth_control =997 static const struct snd_kcontrol_new mixer_fm_reverb_depth_control = 1002 998 { 1003 999 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 1010 1006 1011 1007 1012 static struct snd_kcontrol_new *mixer_defs[EMU8000_NUM_CONTROLS] = {1008 static const struct snd_kcontrol_new *mixer_defs[EMU8000_NUM_CONTROLS] = { 1013 1009 &mixer_bass_control, 1014 1010 &mixer_treble_control, … … 1022 1018 * create and attach mixer elements for WaveTable treble/bass controls 1023 1019 */ 1024 static int __devinit1020 static int 1025 1021 snd_emu8000_create_mixer(struct snd_card *card, struct snd_emu8000 *emu) 1026 1022 { … … 1073 1069 * initialize and register emu8000 synth device. 1074 1070 */ 1075 int __devinit1071 int 1076 1072 snd_emu8000_new(struct snd_card *card, int index, long port, int seq_ports, 1077 1073 struct snd_seq_device **awe_ret) … … 1080 1076 struct snd_emu8000 *hw; 1081 1077 int err; 1082 static struct snd_device_ops ops = {1078 static const struct snd_device_ops ops = { 1083 1079 .dev_free = snd_emu8000_dev_free, 1084 1080 }; … … 1130 1126 return err; 1131 1127 } 1132 #if defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE))1128 #if IS_ENABLED(CONFIG_SND_SEQUENCER) 1133 1129 if (snd_seq_device_new(card, index, SNDRV_SEQ_DEV_ID_EMU8000, 1134 1130 sizeof(struct snd_emu8000*), &awe) >= 0) { -
GPL/trunk/alsa-kernel/isa/sb/emu8000_callback.c
r305 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * synth callback routines for the emu8000 (AWE32/64) … … 4 5 * Copyright (C) 1999 Steve Ratcliffe 5 6 * Copyright (C) 1999-2000 Takashi Iwai <tiwai@suse.de> 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 7 */ 21 8 22 9 #include "emu8000_local.h" 10 #include <linux/export.h> 23 11 #include <sound/asoundef.h> 24 12 … … 36 24 static void sysex(struct snd_emux *emu, char *buf, int len, int parsed, 37 25 struct snd_midi_channel_set *chset); 38 #if def CONFIG_SND_SEQUENCER_OSS26 #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 39 27 static int oss_ioctl(struct snd_emux *emu, int cmd, int p1, int p2); 40 28 #endif … … 62 50 * set up operators 63 51 */ 64 static struct snd_emux_operators emu8000_ops = {52 static const struct snd_emux_operators emu8000_ops = { 65 53 .owner = THIS_MODULE, 66 54 .get_voice = get_voice, … … 76 64 .load_fx = load_fx, 77 65 .sysex = sysex, 78 #if def CONFIG_SND_SEQUENCER_OSS66 #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 79 67 .oss_ioctl = oss_ioctl, 80 68 #endif … … 175 163 176 164 for (i = 0; i < END; i++) { 177 best[i].time = (unsigned int)(-1); /* XXX MAX_?INT really */ ;165 best[i].time = (unsigned int)(-1); /* XXX MAX_?INT really */ 178 166 best[i].voice = -1; 179 167 } … … 477 465 478 466 479 #if def CONFIG_SND_SEQUENCER_OSS467 #if IS_ENABLED(CONFIG_SND_SEQUENCER_OSS) 480 468 /* 481 469 * OSS ioctl callback -
GPL/trunk/alsa-kernel/isa/sb/emu8000_local.h
r305 r679 1 /* SPDX-License-Identifier: GPL-2.0-or-later */ 1 2 #ifndef __EMU8000_LOCAL_H 2 3 #define __EMU8000_LOCAL_H … … 6 7 * Copyright (C) 1999 Steve Ratcliffe 7 8 * Copyright (C) 1999-2000 Takashi Iwai <tiwai@suse.de> 8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 9 */ 23 10 -
GPL/trunk/alsa-kernel/isa/sb/emu8000_patch.c
r399 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Patch routines for the emu8000 (AWE32/64) … … 4 5 * Copyright (C) 1999 Steve Ratcliffe 5 6 * Copyright (C) 1999-2000 Takashi Iwai <tiwai@suse.de> 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 7 */ 21 8 22 9 #include "emu8000_local.h" 23 #include <asm/uaccess.h> 10 11 #include <linux/sched/signal.h> 12 #include <linux/uaccess.h> 24 13 #include <linux/moduleparam.h> 25 14 … … 164 153 165 154 /* be sure loop points start < end */ 166 if (sp->v.loopstart > sp->v.loopend) { 167 int tmp = sp->v.loopstart; 168 sp->v.loopstart = sp->v.loopend; 169 sp->v.loopend = tmp; 170 } 155 if (sp->v.loopstart > sp->v.loopend) 156 swap(sp->v.loopstart, sp->v.loopend); 171 157 172 158 /* compute true data size to be loaded */ … … 185 171 186 172 if (sp->v.mode_flags & SNDRV_SFNT_SAMPLE_8BITS) { 187 if (!access_ok( VERIFY_READ,data, sp->v.size))173 if (!access_ok(data, sp->v.size)) 188 174 return -EFAULT; 189 175 } else { 190 if (!access_ok( VERIFY_READ,data, sp->v.size * 2))176 if (!access_ok(data, sp->v.size * 2)) 191 177 return -EFAULT; 192 178 } -
GPL/trunk/alsa-kernel/isa/sb/emu8000_synth.c
r305 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> … … 5 6 * 6 7 * Emu8000 synth plug-in routine 7 *8 * This program is free software; you can redistribute it and/or modify9 * it under the terms of the GNU General Public License as published by10 * the Free Software Foundation; either version 2 of the License, or11 * (at your option) any later version.12 *13 * This program is distributed in the hope that it will be useful,14 * but WITHOUT ANY WARRANTY; without even the implied warranty of15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the16 * GNU General Public License for more details.17 *18 * You should have received a copy of the GNU General Public License19 * along with this program; if not, write to the Free Software20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA21 8 */ 22 9 23 10 #include "emu8000_local.h" 24 11 #include <linux/init.h> 12 #include <linux/module.h> 25 13 #include <sound/initval.h> 26 14 … … 34 22 * create a new hardware dependent device for Emu8000 35 23 */ 36 static int snd_emu8000_ new_device(struct snd_seq_device *dev)24 static int snd_emu8000_probe(struct device *_dev) 37 25 { 26 struct snd_seq_device *dev = to_seq_dev(_dev); 38 27 struct snd_emu8000 *hw; 39 28 struct snd_emux *emu; … … 93 82 * free all resources 94 83 */ 95 static int snd_emu8000_ delete_device(struct snd_seq_device *dev)84 static int snd_emu8000_remove(struct device *_dev) 96 85 { 86 struct snd_seq_device *dev = to_seq_dev(_dev); 97 87 struct snd_emu8000 *hw; 98 88 … … 103 93 if (hw->pcm) 104 94 snd_device_free(dev->card, hw->pcm); 105 if (hw->emu) 106 snd_emux_free(hw->emu); 107 if (hw->memhdr) 108 snd_util_memhdr_free(hw->memhdr); 95 snd_emux_free(hw->emu); 96 snd_util_memhdr_free(hw->memhdr); 109 97 hw->emu = NULL; 110 98 hw->memhdr = NULL; … … 116 104 */ 117 105 118 static int __init alsa_emu8000_init(void) 119 { 120 121 static struct snd_seq_dev_ops ops = { 122 snd_emu8000_new_device, 123 snd_emu8000_delete_device, 124 }; 125 return snd_seq_device_register_driver(SNDRV_SEQ_DEV_ID_EMU8000, &ops, 126 sizeof(struct snd_emu8000*)); 127 } 106 static struct snd_seq_driver emu8000_driver = { 107 .driver = { 108 .name = KBUILD_MODNAME, 109 .probe = snd_emu8000_probe, 110 .remove = snd_emu8000_remove, 111 }, 112 .id = SNDRV_SEQ_DEV_ID_EMU8000, 113 .argsize = sizeof(struct snd_emu8000 *), 114 }; 128 115 129 static void __exit alsa_emu8000_exit(void) 130 { 131 snd_seq_device_unregister_driver(SNDRV_SEQ_DEV_ID_EMU8000); 132 } 133 134 module_init(alsa_emu8000_init) 135 module_exit(alsa_emu8000_exit) 116 module_snd_seq_driver(emu8000_driver); -
GPL/trunk/alsa-kernel/isa/sb/sb16.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Driver for SoundBlaster 16/AWE32/AWE64 soundcards 3 4 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 4 *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 5 */ 21 6 … … 25 10 #include <linux/err.h> 26 11 #include <linux/isa.h> 27 #include <linux/module param.h>12 #include <linux/module.h> 28 13 #include <sound/core.h> 29 14 #include <sound/sb.h> … … 63 48 #endif 64 49 65 #if defined(SNDRV_SBAWE) && (defined(CONFIG_SND_SEQUENCER) || (defined(MODULE) && defined(CONFIG_SND_SEQUENCER_MODULE)))50 #if defined(SNDRV_SBAWE) && IS_ENABLED(CONFIG_SND_SEQUENCER) 66 51 #define SNDRV_SBAWE_EMU8000 67 52 #endif … … 69 54 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 70 55 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 71 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */72 #ifdef CONFIG_PNP 73 static intisapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};56 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; /* Enable this card */ 57 #ifdef CONFIG_PNP 58 static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 74 59 #endif 75 60 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260,0x280 */ … … 100 85 MODULE_PARM_DESC(isapnp, "PnP detection for specified soundcard."); 101 86 #endif 102 module_param_ array(port, long, NULL, 0444);87 module_param_hw_array(port, long, ioport, NULL, 0444); 103 88 MODULE_PARM_DESC(port, "Port # for SB16 driver."); 104 module_param_ array(mpu_port, long, NULL, 0444);89 module_param_hw_array(mpu_port, long, ioport, NULL, 0444); 105 90 MODULE_PARM_DESC(mpu_port, "MPU-401 port # for SB16 driver."); 106 module_param_ array(fm_port, long, NULL, 0444);91 module_param_hw_array(fm_port, long, ioport, NULL, 0444); 107 92 MODULE_PARM_DESC(fm_port, "FM port # for SB16 PnP driver."); 108 93 #ifdef SNDRV_SBAWE_EMU8000 109 module_param_ array(awe_port, long, NULL, 0444);94 module_param_hw_array(awe_port, long, ioport, NULL, 0444); 110 95 MODULE_PARM_DESC(awe_port, "AWE port # for SB16 PnP driver."); 111 96 #endif 112 module_param_ array(irq, int, NULL, 0444);97 module_param_hw_array(irq, int, irq, NULL, 0444); 113 98 MODULE_PARM_DESC(irq, "IRQ # for SB16 driver."); 114 module_param_ array(dma8, int, NULL, 0444);99 module_param_hw_array(dma8, int, dma, NULL, 0444); 115 100 MODULE_PARM_DESC(dma8, "8-bit DMA # for SB16 driver."); 116 module_param_ array(dma16, int, NULL, 0444);101 module_param_hw_array(dma16, int, dma, NULL, 0444); 117 102 MODULE_PARM_DESC(dma16, "16-bit DMA # for SB16 driver."); 118 103 module_param_array(mic_agc, int, NULL, 0444); … … 146 131 #ifdef CONFIG_PNP 147 132 148 static struct pnp_card_device_id snd_sb16_pnpids[] = {133 static const struct pnp_card_device_id snd_sb16_pnpids[] = { 149 134 #ifndef SNDRV_SBAWE 150 135 /* Sound Blaster 16 PnP */ … … 251 236 #ifdef CONFIG_PNP 252 237 253 static int __devinitsnd_card_sb16_pnp(int dev, struct snd_card_sb16 *acard,254 struct pnp_card_link *card,255 const struct pnp_card_device_id *id)238 static int snd_card_sb16_pnp(int dev, struct snd_card_sb16 *acard, 239 struct pnp_card_link *card, 240 const struct pnp_card_device_id *id) 256 241 { 257 242 struct pnp_dev *pdev; … … 324 309 #endif 325 310 326 static int snd_sb16_card_new(int dev, struct snd_card **cardp) 311 static int snd_sb16_card_new(struct device *devptr, int dev, 312 struct snd_card **cardp) 327 313 { 328 314 struct snd_card *card; 329 315 int err; 330 316 331 err = snd_card_ create(index[dev], id[dev], THIS_MODULE,332 sizeof(struct snd_card_sb16), &card);317 err = snd_card_new(devptr, index[dev], id[dev], THIS_MODULE, 318 sizeof(struct snd_card_sb16), &card); 333 319 if (err < 0) 334 320 return err; … … 338 324 } 339 325 340 static int __devinitsnd_sb16_probe(struct snd_card *card, int dev)326 static int snd_sb16_probe(struct snd_card *card, int dev) 341 327 { 342 328 int xirq, xdma8, xdma16; … … 374 360 return err; 375 361 376 if ((err = snd_sb16dsp_pcm(chip, 0 , &chip->pcm)) < 0)362 if ((err = snd_sb16dsp_pcm(chip, 0)) < 0) 377 363 return err; 378 364 … … 395 381 if (chip->mpu_port > 0 && chip->mpu_port != SNDRV_AUTO_PORT) { 396 382 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_SB, 397 chip->mpu_port, 0, 398 xirq, 0, &chip->rmidi)) < 0) 383 chip->mpu_port, 384 MPU401_INFO_IRQ_HOOK, -1, 385 &chip->rmidi)) < 0) 399 386 return err; 400 387 chip->rmidi_callback = snd_mpu401_uart_interrupt; … … 470 457 471 458 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 472 snd_pcm_suspend_all(chip->pcm);473 459 snd_sbmixer_suspend(chip); 474 460 return 0; … … 487 473 #endif 488 474 489 static int __devinitsnd_sb16_isa_probe1(int dev, struct device *pdev)475 static int snd_sb16_isa_probe1(int dev, struct device *pdev) 490 476 { 491 477 struct snd_card_sb16 *acard; … … 493 479 int err; 494 480 495 err = snd_sb16_card_new( dev, &card);481 err = snd_sb16_card_new(pdev, dev, &card); 496 482 if (err < 0) 497 483 return err; … … 507 493 #endif 508 494 509 snd_card_set_dev(card, pdev);510 495 if ((err = snd_sb16_probe(card, dev)) < 0) { 511 496 snd_card_free(card); … … 517 502 518 503 519 static int __devinitsnd_sb16_isa_match(struct device *pdev, unsigned int dev)504 static int snd_sb16_isa_match(struct device *pdev, unsigned int dev) 520 505 { 521 506 return enable[dev] && !is_isapnp_selected(dev); 522 507 } 523 508 524 static int __devinitsnd_sb16_isa_probe(struct device *pdev, unsigned int dev)509 static int snd_sb16_isa_probe(struct device *pdev, unsigned int dev) 525 510 { 526 511 int err; 527 static int possible_irqs[] = {5, 9, 10, 7, -1};528 static int possible_dmas8[] = {1, 3, 0, -1};529 static int possible_dmas16[] = {5, 6, 7, -1};512 static const int possible_irqs[] = {5, 9, 10, 7, -1}; 513 static const int possible_dmas8[] = {1, 3, 0, -1}; 514 static const int possible_dmas16[] = {5, 6, 7, -1}; 530 515 531 516 if (irq[dev] == SNDRV_AUTO_IRQ) { … … 551 536 return snd_sb16_isa_probe1(dev, pdev); 552 537 else { 553 static int possible_ports[] = {0x220, 0x240, 0x260, 0x280};538 static const int possible_ports[] = {0x220, 0x240, 0x260, 0x280}; 554 539 int i; 555 540 for (i = 0; i < ARRAY_SIZE(possible_ports); i++) { … … 563 548 } 564 549 565 static int __devexitsnd_sb16_isa_remove(struct device *pdev, unsigned int dev)550 static int snd_sb16_isa_remove(struct device *pdev, unsigned int dev) 566 551 { 567 552 snd_card_free(dev_get_drvdata(pdev)); 568 dev_set_drvdata(pdev, NULL);569 553 return 0; 570 554 } … … 592 576 .match = snd_sb16_isa_match, 593 577 .probe = snd_sb16_isa_probe, 594 .remove = __devexit_p(snd_sb16_isa_remove),578 .remove = snd_sb16_isa_remove, 595 579 #ifdef CONFIG_PM 596 580 .suspend = snd_sb16_isa_suspend, … … 604 588 605 589 #ifdef CONFIG_PNP 606 static int __devinitsnd_sb16_pnp_detect(struct pnp_card_link *pcard,607 const struct pnp_card_device_id *pid)590 static int snd_sb16_pnp_detect(struct pnp_card_link *pcard, 591 const struct pnp_card_device_id *pid) 608 592 { 609 593 static int dev; … … 614 598 if (!enable[dev] || !isapnp[dev]) 615 599 continue; 616 res = snd_sb16_card_new( dev, &card);600 res = snd_sb16_card_new(&pcard->card->dev, dev, &card); 617 601 if (res < 0) 618 602 return res; 619 snd_card_set_dev(card, &pcard->card->dev);620 603 if ((res = snd_card_sb16_pnp(dev, card->private_data, pcard, pid)) < 0 || 621 604 (res = snd_sb16_probe(card, dev)) < 0) { … … 631 614 } 632 615 633 static void __devexit snd_sb16_pnp_remove(struct pnp_card_link *pcard)616 static void snd_sb16_pnp_remove(struct pnp_card_link *pcard) 634 617 { 635 618 snd_card_free(pnp_get_card_drvdata(pcard)); … … 657 640 .id_table = snd_sb16_pnpids, 658 641 .probe = snd_sb16_pnp_detect, 659 .remove = __devexit_p(snd_sb16_pnp_remove),642 .remove = snd_sb16_pnp_remove, 660 643 #ifdef CONFIG_PM 661 644 .suspend = snd_sb16_pnp_suspend, -
GPL/trunk/alsa-kernel/isa/sb/sb16_csp.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) 1999 by Uros Bizjak <uros@kss-loka.si> … … 6 7 * 7 8 * CSP microcode loader: 8 * alsa-tools/sb16_csp/ 9 * 10 * This program is free software; you can redistribute it and/or modify 11 * it under the terms of the GNU General Public License as published by 12 * the Free Software Foundation; either version 2 of the License, or 13 * (at your option) any later version. 14 * 15 * This program is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU General Public License for more details. 19 * 20 * You should have received a copy of the GNU General Public License 21 * along with this program; if not, write to the Free Software 22 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 23 * 9 * alsa-tools/sb16_csp/ 24 10 */ 25 11 … … 27 13 #include <linux/init.h> 28 14 #include <linux/slab.h> 15 #include <linux/module.h> 29 16 #include <sound/core.h> 30 17 #include <sound/control.h> … … 61 48 */ 62 49 struct riff_header { 63 __ u32 name;64 __ u32 len;50 __le32 name; 51 __le32 len; 65 52 }; 66 53 67 54 struct desc_header { 68 55 struct riff_header info; 69 __ u16 func_nr;70 __ u16 VOC_type;71 __ u16 flags_play_rec;72 __ u16 flags_16bit_8bit;73 __ u16 flags_stereo_mono;74 __ u16 flags_rates;56 __le16 func_nr; 57 __le16 VOC_type; 58 __le16 flags_play_rec; 59 __le16 flags_16bit_8bit; 60 __le16 flags_stereo_mono; 61 __le16 flags_rates; 75 62 }; 76 63 … … 94 81 static int snd_sb_csp_unload(struct snd_sb_csp * p); 95 82 static int snd_sb_csp_load_user(struct snd_sb_csp * p, const unsigned char __user *buf, int size, int load_flags); 96 static int snd_sb_csp_autoload(struct snd_sb_csp * p, int pcm_sfmt, int play_rec_mode);83 static int snd_sb_csp_autoload(struct snd_sb_csp * p, snd_pcm_format_t pcm_sfmt, int play_rec_mode); 97 84 static int snd_sb_csp_check_version(struct snd_sb_csp * p); 98 85 … … 117 104 { 118 105 struct snd_sb_csp *p; 119 int uninitialized_var(version);106 int version; 120 107 int err; 121 108 struct snd_hwdep *hw; … … 209 196 /* get information */ 210 197 case SNDRV_SB_CSP_IOCTL_INFO: 198 memset(&info, 0, sizeof(info)); 211 199 *info.codec_name = *p->codec_name; 212 200 info.func_nr = p->func_nr; … … 301 289 302 290 /* 303 * load microcode via ioctl: 291 * load microcode via ioctl: 304 292 * code is user-space pointer 305 293 */ … … 314 302 315 303 struct riff_header file_h, item_h, code_h; 316 __ u32 item_type;304 __le32 item_type; 317 305 struct desc_header funcdesc_h; 318 306 … … 326 314 if (copy_from_user(&file_h, data_ptr, sizeof(file_h))) 327 315 return -EFAULT; 328 if (( file_h.name!= RIFF_HEADER) ||316 if ((le32_to_cpu(file_h.name) != RIFF_HEADER) || 329 317 (le32_to_cpu(file_h.len) >= SNDRV_SB_CSP_MAX_MICROCODE_FILE_SIZE - sizeof(file_h))) { 330 318 snd_printd("%s: Invalid RIFF header\n", __func__); … … 336 324 if (copy_from_user(&item_type, data_ptr, sizeof(item_type))) 337 325 return -EFAULT; 338 if ( item_type!= CSP__HEADER) {326 if (le32_to_cpu(item_type) != CSP__HEADER) { 339 327 snd_printd("%s: Invalid RIFF file type\n", __func__); 340 328 return -EINVAL; … … 346 334 return -EFAULT; 347 335 data_ptr += sizeof(item_h); 348 if ( item_h.name!= LIST_HEADER)336 if (le32_to_cpu(item_h.name) != LIST_HEADER) 349 337 continue; 350 338 351 339 if (copy_from_user(&item_type, data_ptr, sizeof(item_type))) 352 340 return -EFAULT; 353 switch ( item_type) {341 switch (le32_to_cpu(item_type)) { 354 342 case FUNC_HEADER: 355 343 if (copy_from_user(&funcdesc_h, data_ptr + sizeof(item_type), sizeof(funcdesc_h))) … … 378 366 379 367 /* init microcode blocks */ 380 if ( code_h.name!= INIT_HEADER)368 if (le32_to_cpu(code_h.name) != INIT_HEADER) 381 369 break; 382 370 data_ptr += sizeof(code_h); … … 391 379 return -EFAULT; 392 380 393 if ( code_h.name!= MAIN_HEADER) {381 if (le32_to_cpu(code_h.name) != MAIN_HEADER) { 394 382 snd_printd("%s: Missing 'main' microcode\n", __func__); 395 383 return -EINVAL; … … 683 671 return result; 684 672 } 685 673 686 674 static int snd_sb_csp_load_user(struct snd_sb_csp * p, const unsigned char __user *buf, int size, int load_flags) 687 675 { … … 726 714 * return 0 if CSP is loaded and ready to run (p->running != 0) 727 715 */ 728 static int snd_sb_csp_autoload(struct snd_sb_csp * p, int pcm_sfmt, int play_rec_mode)716 static int snd_sb_csp_autoload(struct snd_sb_csp * p, snd_pcm_format_t pcm_sfmt, int play_rec_mode) 729 717 { 730 718 unsigned long flags; … … 732 720 733 721 /* if CSP is running or manually loaded then exit */ 734 if (p->running & (SNDRV_SB_CSP_ST_RUNNING | SNDRV_SB_CSP_ST_LOADED)) 722 if (p->running & (SNDRV_SB_CSP_ST_RUNNING | SNDRV_SB_CSP_ST_LOADED)) 735 723 return -EBUSY; 736 724 737 725 /* autoload microcode only if requested hardware codec is not already loaded */ 738 if (((1 <<pcm_sfmt) & p->acc_format) && (play_rec_mode & p->mode)) {726 if (((1U << (__force int)pcm_sfmt) & p->acc_format) && (play_rec_mode & p->mode)) { 739 727 p->running = SNDRV_SB_CSP_ST_AUTO; 740 728 } else { … … 765 753 } 766 754 p->acc_format = SNDRV_PCM_FMTBIT_IMA_ADPCM; 767 break; 755 break; 768 756 default: 769 757 /* Decouple CSP from IRQ and DMAREQ lines */ … … 789 777 p->acc_channels = SNDRV_SB_CSP_MONO | SNDRV_SB_CSP_STEREO; 790 778 p->acc_rates = SNDRV_SB_CSP_RATE_ALL; /* HW codecs accept all rates */ 791 } 779 } 792 780 793 781 } … … 1029 1017 } 1030 1018 1031 static struct snd_kcontrol_new snd_sb_qsound_switch = {1019 static const struct snd_kcontrol_new snd_sb_qsound_switch = { 1032 1020 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1033 1021 .name = "3D Control - Switch", … … 1037 1025 }; 1038 1026 1039 static struct snd_kcontrol_new snd_sb_qsound_space = {1027 static const struct snd_kcontrol_new snd_sb_qsound_space = { 1040 1028 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 1041 1029 .name = "3D Control - Space", … … 1126 1114 { 1127 1115 char name[16]; 1128 struct snd_info_entry *entry; 1116 1129 1117 sprintf(name, "cspD%d", device); 1130 if (! snd_card_proc_new(p->chip->card, name, &entry)) 1131 snd_info_set_text_ops(entry, p, info_read); 1118 snd_card_ro_proc_new(p->chip->card, name, p, info_read); 1132 1119 return 0; 1133 1120 } … … 1185 1172 1186 1173 EXPORT_SYMBOL(snd_sb_csp_new); 1187 1188 /*1189 * INIT part1190 */1191 1192 static int __init alsa_sb_csp_init(void)1193 {1194 return 0;1195 }1196 1197 static void __exit alsa_sb_csp_exit(void)1198 {1199 }1200 1201 module_init(alsa_sb_csp_init)1202 module_exit(alsa_sb_csp_exit) -
GPL/trunk/alsa-kernel/isa/sb/sb16_main.c
r399 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> … … 16 17 * to DSP chip (playback) starts. This bug can be avoided with 17 18 * "16bit DMA Allocation" setting set to Playback or Capture. 18 *19 *20 * This program is free software; you can redistribute it and/or modify21 * it under the terms of the GNU General Public License as published by22 * the Free Software Foundation; either version 2 of the License, or23 * (at your option) any later version.24 *25 * This program is distributed in the hope that it will be useful,26 * but WITHOUT ANY WARRANTY; without even the implied warranty of27 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the28 * GNU General Public License for more details.29 *30 * You should have received a copy of the GNU General Public License31 * along with this program; if not, write to the Free Software32 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA33 *34 19 */ 35 20 36 #include < asm/io.h>21 #include <linux/io.h> 37 22 #include <asm/dma.h> 38 23 #include <linux/init.h> 39 24 #include <linux/time.h> 25 #include <linux/module.h> 40 26 #include <sound/core.h> 41 27 #include <sound/sb.h> … … 49 35 MODULE_LICENSE("GPL"); 50 36 37 #define runtime_format_bits(runtime) \ 38 ((unsigned int)pcm_format_to_bits((runtime)->format)) 39 51 40 #ifdef CONFIG_SND_SB16_CSP 52 41 static void snd_sb16_csp_playback_prepare(struct snd_sb *chip, struct snd_pcm_runtime *runtime) … … 58 47 /* manually loaded codec */ 59 48 if ((csp->mode & SNDRV_SB_CSP_MODE_DSP_WRITE) && 60 ( (1U << runtime->format) == csp->acc_format)) {49 (runtime_format_bits(runtime) == csp->acc_format)) { 61 50 /* Supported runtime PCM format for playback */ 62 51 if (csp->ops.csp_use(csp) == 0) { … … 66 55 } else if ((csp->mode & SNDRV_SB_CSP_MODE_QSOUND) && (csp->q_enabled)) { 67 56 /* QSound decoder is loaded and enabled */ 68 if ( (1 << runtime->format) & (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 |57 if (runtime_format_bits(runtime) & (SNDRV_PCM_FMTBIT_S8 | SNDRV_PCM_FMTBIT_U8 | 69 58 SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_U16_LE)) { 70 59 /* Only for simple PCM formats */ … … 106 95 /* manually loaded codec */ 107 96 if ((csp->mode & SNDRV_SB_CSP_MODE_DSP_READ) && 108 ( (1U << runtime->format) == csp->acc_format)) {97 (runtime_format_bits(runtime) == csp->acc_format)) { 109 98 /* Supported runtime PCM format for capture */ 110 99 if (csp->ops.csp_use(csp) == 0) { … … 244 233 } 245 234 246 static int snd_sb16_hw_params(struct snd_pcm_substream *substream,247 struct snd_pcm_hw_params *hw_params)248 {249 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));250 }251 252 static int snd_sb16_hw_free(struct snd_pcm_substream *substream)253 {254 snd_pcm_lib_free_pages(substream);255 return 0;256 }257 258 235 static int snd_sb16_playback_prepare(struct snd_pcm_substream *substream) 259 236 { … … 473 450 */ 474 451 475 static struct snd_pcm_hardware snd_sb16_playback =452 static const struct snd_pcm_hardware snd_sb16_playback = 476 453 { 477 454 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | … … 491 468 }; 492 469 493 static struct snd_pcm_hardware snd_sb16_capture =470 static const struct snd_pcm_hardware snd_sb16_capture = 494 471 { 495 472 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | … … 702 679 static int snd_sb16_dma_control_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 703 680 { 704 static c har *texts[3] = {681 static const char * const texts[3] = { 705 682 "Auto", "Playback", "Capture" 706 683 }; 707 684 708 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 709 uinfo->count = 1; 710 uinfo->value.enumerated.items = 3; 711 if (uinfo->value.enumerated.item > 2) 712 uinfo->value.enumerated.item = 2; 713 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); 714 return 0; 685 return snd_ctl_enum_info(uinfo, 1, 3, texts); 715 686 } 716 687 … … 743 714 } 744 715 745 static struct snd_kcontrol_new snd_sb16_dma_control = {716 static const struct snd_kcontrol_new snd_sb16_dma_control = { 746 717 .iface = SNDRV_CTL_ELEM_IFACE_CARD, 747 718 .name = "16-bit DMA Allocation", … … 844 815 } 845 816 846 static struct snd_pcm_ops snd_sb16_playback_ops = {817 static const struct snd_pcm_ops snd_sb16_playback_ops = { 847 818 .open = snd_sb16_playback_open, 848 819 .close = snd_sb16_playback_close, 849 .ioctl = snd_pcm_lib_ioctl,850 .hw_params = snd_sb16_hw_params,851 .hw_free = snd_sb16_hw_free,852 820 .prepare = snd_sb16_playback_prepare, 853 821 .trigger = snd_sb16_playback_trigger, … … 855 823 }; 856 824 857 static struct snd_pcm_ops snd_sb16_capture_ops = {825 static const struct snd_pcm_ops snd_sb16_capture_ops = { 858 826 .open = snd_sb16_capture_open, 859 827 .close = snd_sb16_capture_close, 860 .ioctl = snd_pcm_lib_ioctl,861 .hw_params = snd_sb16_hw_params,862 .hw_free = snd_sb16_hw_free,863 828 .prepare = snd_sb16_capture_prepare, 864 829 .trigger = snd_sb16_capture_trigger, … … 866 831 }; 867 832 868 int snd_sb16dsp_pcm(struct snd_sb * chip, int device, struct snd_pcm ** rpcm)833 int snd_sb16dsp_pcm(struct snd_sb *chip, int device) 869 834 { 870 835 struct snd_card *card = chip->card; … … 872 837 int err; 873 838 874 if (rpcm)875 *rpcm = NULL;876 839 if ((err = snd_pcm_new(card, "SB16 DSP", device, 1, 1, &pcm)) < 0) 877 840 return err; … … 879 842 pcm->info_flags = SNDRV_PCM_INFO_JOINT_DUPLEX; 880 843 pcm->private_data = chip; 844 chip->pcm = pcm; 881 845 882 846 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_sb16_playback_ops); 883 847 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_sb16_capture_ops); 884 848 885 if (chip->dma16 >= 0 && chip->dma8 != chip->dma16) 886 snd_ctl_add(card, snd_ctl_new1(&snd_sb16_dma_control, chip)); 887 else 849 if (chip->dma16 >= 0 && chip->dma8 != chip->dma16) { 850 err = snd_ctl_add(card, snd_ctl_new1( 851 &snd_sb16_dma_control, chip)); 852 if (err) 853 return err; 854 } else { 888 855 pcm->info_flags = SNDRV_PCM_INFO_HALF_DUPLEX; 889 890 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 891 snd_dma_isa_data(), 892 64*1024, 128*1024); 893 894 if (rpcm) 895 *rpcm = pcm; 856 } 857 858 snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, 859 card->dev, 64*1024, 128*1024); 896 860 return 0; 897 861 } … … 907 871 EXPORT_SYMBOL(snd_sb16dsp_configure); 908 872 EXPORT_SYMBOL(snd_sb16dsp_interrupt); 909 910 /*911 * INIT part912 */913 914 static int __init alsa_sb16_init(void)915 {916 return 0;917 }918 919 static void __exit alsa_sb16_exit(void)920 {921 }922 923 module_init(alsa_sb16_init)924 module_exit(alsa_sb16_exit) -
GPL/trunk/alsa-kernel/isa/sb/sb8.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Driver for SoundBlaster 1.0/2.0/Pro soundcards and compatible 3 4 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 4 *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 5 */ 21 6 … … 24 9 #include <linux/isa.h> 25 10 #include <linux/ioport.h> 26 #include <linux/module param.h>11 #include <linux/module.h> 27 12 #include <sound/core.h> 28 13 #include <sound/sb.h> … … 37 22 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 38 23 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 39 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */24 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 40 25 static long port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240,0x260 */ 41 26 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 5,7,9,10 */ … … 48 33 module_param_array(enable, bool, NULL, 0444); 49 34 MODULE_PARM_DESC(enable, "Enable Sound Blaster soundcard."); 50 module_param_ array(port, long, NULL, 0444);35 module_param_hw_array(port, long, ioport, NULL, 0444); 51 36 MODULE_PARM_DESC(port, "Port # for SB8 driver."); 52 module_param_ array(irq, int, NULL, 0444);37 module_param_hw_array(irq, int, irq, NULL, 0444); 53 38 MODULE_PARM_DESC(irq, "IRQ # for SB8 driver."); 54 module_param_ array(dma8, int, NULL, 0444);39 module_param_hw_array(dma8, int, dma, NULL, 0444); 55 40 MODULE_PARM_DESC(dma8, "8-bit DMA # for SB8 driver."); 56 41 … … 80 65 } 81 66 82 static int __devinitsnd_sb8_match(struct device *pdev, unsigned int dev)67 static int snd_sb8_match(struct device *pdev, unsigned int dev) 83 68 { 84 69 if (!enable[dev]) … … 95 80 } 96 81 97 static int __devinitsnd_sb8_probe(struct device *pdev, unsigned int dev)82 static int snd_sb8_probe(struct device *pdev, unsigned int dev) 98 83 { 99 84 struct snd_sb *chip; … … 103 88 int err; 104 89 105 err = snd_card_ create(index[dev], id[dev], THIS_MODULE,106 sizeof(struct snd_sb8), &card);90 err = snd_card_new(pdev, index[dev], id[dev], THIS_MODULE, 91 sizeof(struct snd_sb8), &card); 107 92 if (err < 0) 108 93 return err; … … 112 97 /* block the 0x388 port to avoid PnP conflicts */ 113 98 acard->fm_res = request_region(0x388, 4, "SoundBlaster FM"); 99 if (!acard->fm_res) { 100 err = -EBUSY; 101 goto _err; 102 } 114 103 115 104 if (port[dev] != SNDRV_AUTO_PORT) { … … 123 112 } else { 124 113 /* auto-probe legacy ports */ 125 static unsigned long possible_ports[] = {114 static const unsigned long possible_ports[] = { 126 115 0x220, 0x240, 0x260, 127 116 }; … … 158 147 } 159 148 160 if ((err = snd_sb8dsp_pcm(chip, 0 , NULL)) < 0)149 if ((err = snd_sb8dsp_pcm(chip, 0)) < 0) 161 150 goto _err; 162 151 … … 183 172 } 184 173 185 if ((err = snd_sb8dsp_midi(chip, 0 , NULL)) < 0)174 if ((err = snd_sb8dsp_midi(chip, 0)) < 0) 186 175 goto _err; 187 176 … … 193 182 irq[dev], dma8[dev]); 194 183 195 snd_card_set_dev(card, pdev);196 197 184 if ((err = snd_card_register(card)) < 0) 198 185 goto _err; … … 206 193 } 207 194 208 static int __devexitsnd_sb8_remove(struct device *pdev, unsigned int dev)195 static int snd_sb8_remove(struct device *pdev, unsigned int dev) 209 196 { 210 197 snd_card_free(dev_get_drvdata(pdev)); 211 dev_set_drvdata(pdev, NULL);212 198 return 0; 213 199 } … … 222 208 223 209 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 224 snd_pcm_suspend_all(chip->pcm);225 210 snd_sbmixer_suspend(chip); 226 211 return 0; … … 245 230 .match = snd_sb8_match, 246 231 .probe = snd_sb8_probe, 247 .remove = __devexit_p(snd_sb8_remove),232 .remove = snd_sb8_remove, 248 233 #ifdef CONFIG_PM 249 234 .suspend = snd_sb8_suspend, … … 255 240 }; 256 241 257 static int __init alsa_card_sb8_init(void) 258 { 259 return isa_register_driver(&snd_sb8_driver, SNDRV_CARDS); 260 } 261 262 static void __exit alsa_card_sb8_exit(void) 263 { 264 isa_unregister_driver(&snd_sb8_driver); 265 } 266 267 module_init(alsa_card_sb8_init) 268 module_exit(alsa_card_sb8_exit) 242 module_isa_driver(snd_sb8_driver, SNDRV_CARDS); -
GPL/trunk/alsa-kernel/isa/sb/sb8_main.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> … … 5 6 * Routines for control of 8-bit SoundBlaster cards and clones 6 7 * Please note: I don't have access to old SB8 soundcards. 7 *8 *9 * This program is free software; you can redistribute it and/or modify10 * it under the terms of the GNU General Public License as published by11 * the Free Software Foundation; either version 2 of the License, or12 * (at your option) any later version.13 *14 * This program is distributed in the hope that it will be useful,15 * but WITHOUT ANY WARRANTY; without even the implied warranty of16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the17 * GNU General Public License for more details.18 *19 * You should have received a copy of the GNU General Public License20 * along with this program; if not, write to the Free Software21 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA22 8 * 23 9 * -- … … 31 17 */ 32 18 33 #include < asm/io.h>19 #include <linux/io.h> 34 20 #include <asm/dma.h> 35 21 #include <linux/init.h> 36 22 #include <linux/time.h> 23 #include <linux/module.h> 37 24 #include <sound/core.h> 38 25 #include <sound/sb.h> … … 46 33 #define SB8_RATE(v) (SB8_CLOCK / SB8_DEN(v)) 47 34 48 static struct snd_ratnum clock = {35 static const struct snd_ratnum clock = { 49 36 .num = SB8_CLOCK, 50 37 .den_min = 1, … … 53 40 }; 54 41 55 static struct snd_pcm_hw_constraint_ratnums hw_constraints_clock = {42 static const struct snd_pcm_hw_constraint_ratnums hw_constraints_clock = { 56 43 .nrats = 1, 57 44 .rats = &clock, 58 45 }; 59 46 60 static struct snd_ratnum stereo_clocks[] = {47 static const struct snd_ratnum stereo_clocks[] = { 61 48 { 62 49 .num = SB8_CLOCK, … … 130 117 break; 131 118 } 132 /* fallthru */119 fallthrough; 133 120 case SB_HW_201: 134 121 if (rate > 23000) { … … 136 123 break; 137 124 } 138 /* fallthru */125 fallthrough; 139 126 case SB_HW_20: 140 127 chip->playback_format = SB_DSP_LO_OUTPUT_AUTO; … … 239 226 } 240 227 241 static int snd_sb8_hw_params(struct snd_pcm_substream *substream,242 struct snd_pcm_hw_params *hw_params)243 {244 return snd_pcm_lib_malloc_pages(substream, params_buffer_bytes(hw_params));245 }246 247 static int snd_sb8_hw_free(struct snd_pcm_substream *substream)248 {249 snd_pcm_lib_free_pages(substream);250 return 0;251 }252 253 228 static int snd_sb8_capture_prepare(struct snd_pcm_substream *substream) 254 229 { … … 287 262 break; 288 263 } 289 /* fallthru */264 fallthrough; 290 265 case SB_HW_20: 291 266 chip->capture_format = SB_DSP_LO_INPUT_AUTO; … … 381 356 { 382 357 struct snd_pcm_substream *substream; 383 struct snd_pcm_runtime *runtime;384 358 385 359 snd_sb_ack_8bit(chip); … … 388 362 if (chip->hardware != SB_HW_JAZZ16) 389 363 break; 390 /* fallthru */364 fallthrough; 391 365 case SB_MODE_PLAYBACK_8: 392 366 substream = chip->playback_substream; 393 runtime = substream->runtime;394 367 if (chip->playback_format == SB_DSP_OUTPUT) 395 368 snd_sb8_playback_trigger(substream, SNDRV_PCM_TRIGGER_START); … … 399 372 if (chip->hardware != SB_HW_JAZZ16) 400 373 break; 401 /* fallthru */374 fallthrough; 402 375 case SB_MODE_CAPTURE_8: 403 376 substream = chip->capture_substream; 404 runtime = substream->runtime;405 377 if (chip->capture_format == SB_DSP_INPUT) 406 378 snd_sb8_capture_trigger(substream, SNDRV_PCM_TRIGGER_START); … … 447 419 */ 448 420 449 static struct snd_pcm_hardware snd_sb8_playback =421 static const struct snd_pcm_hardware snd_sb8_playback = 450 422 { 451 423 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | … … 466 438 }; 467 439 468 static struct snd_pcm_hardware snd_sb8_capture =440 static const struct snd_pcm_hardware snd_sb8_capture = 469 441 { 470 442 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | … … 572 544 */ 573 545 574 static struct snd_pcm_ops snd_sb8_playback_ops = {546 static const struct snd_pcm_ops snd_sb8_playback_ops = { 575 547 .open = snd_sb8_open, 576 548 .close = snd_sb8_close, 577 .ioctl = snd_pcm_lib_ioctl,578 .hw_params = snd_sb8_hw_params,579 .hw_free = snd_sb8_hw_free,580 549 .prepare = snd_sb8_playback_prepare, 581 550 .trigger = snd_sb8_playback_trigger, … … 583 552 }; 584 553 585 static struct snd_pcm_ops snd_sb8_capture_ops = {554 static const struct snd_pcm_ops snd_sb8_capture_ops = { 586 555 .open = snd_sb8_open, 587 556 .close = snd_sb8_close, 588 .ioctl = snd_pcm_lib_ioctl,589 .hw_params = snd_sb8_hw_params,590 .hw_free = snd_sb8_hw_free,591 557 .prepare = snd_sb8_capture_prepare, 592 558 .trigger = snd_sb8_capture_trigger, … … 594 560 }; 595 561 596 int snd_sb8dsp_pcm(struct snd_sb *chip, int device , struct snd_pcm ** rpcm)562 int snd_sb8dsp_pcm(struct snd_sb *chip, int device) 597 563 { 598 564 struct snd_card *card = chip->card; … … 601 567 size_t max_prealloc = 64 * 1024; 602 568 603 if (rpcm)604 *rpcm = NULL;605 569 if ((err = snd_pcm_new(card, "SB8 DSP", device, 1, 1, &pcm)) < 0) 606 570 return err; … … 614 578 if (chip->dma8 > 3 || chip->dma16 >= 0) 615 579 max_prealloc = 128 * 1024; 616 snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, 617 snd_dma_isa_data(), 618 64*1024, max_prealloc); 619 620 if (rpcm) 621 *rpcm = pcm; 580 snd_pcm_set_managed_buffer_all(pcm, SNDRV_DMA_TYPE_DEV, 581 card->dev, 64*1024, max_prealloc); 582 622 583 return 0; 623 584 } … … 628 589 EXPORT_SYMBOL(snd_sb8dsp_midi_interrupt); 629 590 EXPORT_SYMBOL(snd_sb8dsp_midi); 630 631 /*632 * INIT part633 */634 635 static int __init alsa_sb8_init(void)636 {637 return 0;638 }639 640 static void __exit alsa_sb8_exit(void)641 {642 }643 644 module_init(alsa_sb8_init)645 module_exit(alsa_sb8_exit) -
GPL/trunk/alsa-kernel/isa/sb/sb8_midi.c
r305 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 3 4 * Routines for control of SoundBlaster cards - MIDI interface 4 *5 * This program is free software; you can redistribute it and/or modify6 * it under the terms of the GNU General Public License as published by7 * the Free Software Foundation; either version 2 of the License, or8 * (at your option) any later version.9 *10 * This program is distributed in the hope that it will be useful,11 * but WITHOUT ANY WARRANTY; without even the implied warranty of12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * GNU General Public License for more details.14 *15 * You should have received a copy of the GNU General Public License16 * along with this program; if not, write to the Free Software17 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA18 5 * 19 6 * -- … … 27 14 */ 28 15 29 #include < asm/io.h>16 #include <linux/io.h> 30 17 #include <linux/time.h> 31 18 #include <sound/core.h> … … 139 126 140 127 chip = substream->rmidi->private_data; 128 del_timer_sync(&chip->midi_timer); 141 129 spin_lock_irqsave(&chip->open_lock, flags); 142 130 chip->open &= ~(SB_OPEN_MIDI_OUTPUT | SB_OPEN_MIDI_OUTPUT_TRIGGER); … … 210 198 } 211 199 212 static void snd_sb8dsp_midi_output_timer(unsigned long data) 213 { 214 struct snd_rawmidi_substream *substream = (struct snd_rawmidi_substream *) data; 215 struct snd_sb * chip = substream->rmidi->private_data; 216 unsigned long flags; 217 218 spin_lock_irqsave(&chip->open_lock, flags); 219 chip->midi_timer.expires = 1 + jiffies; 220 add_timer(&chip->midi_timer); 200 static void snd_sb8dsp_midi_output_timer(struct timer_list *t) 201 { 202 struct snd_sb *chip = from_timer(chip, t, midi_timer); 203 struct snd_rawmidi_substream *substream = chip->midi_substream_output; 204 unsigned long flags; 205 206 spin_lock_irqsave(&chip->open_lock, flags); 207 mod_timer(&chip->midi_timer, 1 + jiffies); 221 208 spin_unlock_irqrestore(&chip->open_lock, flags); 222 209 snd_sb8dsp_midi_output_write(substream); … … 232 219 if (up) { 233 220 if (!(chip->open & SB_OPEN_MIDI_OUTPUT_TRIGGER)) { 234 init_timer(&chip->midi_timer); 235 chip->midi_timer.function = snd_sb8dsp_midi_output_timer; 236 chip->midi_timer.data = (unsigned long) substream; 237 chip->midi_timer.expires = 1 + jiffies; 238 add_timer(&chip->midi_timer); 221 mod_timer(&chip->midi_timer, 1 + jiffies); 239 222 chip->open |= SB_OPEN_MIDI_OUTPUT_TRIGGER; 240 223 } … … 250 233 } 251 234 252 static struct snd_rawmidi_ops snd_sb8dsp_midi_output =235 static const struct snd_rawmidi_ops snd_sb8dsp_midi_output = 253 236 { 254 237 .open = snd_sb8dsp_midi_output_open, … … 257 240 }; 258 241 259 static struct snd_rawmidi_ops snd_sb8dsp_midi_input =242 static const struct snd_rawmidi_ops snd_sb8dsp_midi_input = 260 243 { 261 244 .open = snd_sb8dsp_midi_input_open, … … 264 247 }; 265 248 266 int snd_sb8dsp_midi(struct snd_sb *chip, int device , struct snd_rawmidi ** rrawmidi)249 int snd_sb8dsp_midi(struct snd_sb *chip, int device) 267 250 { 268 251 struct snd_rawmidi *rmidi; 269 252 int err; 270 253 271 if (rrawmidi)272 *rrawmidi = NULL;273 254 if ((err = snd_rawmidi_new(chip->card, "SB8 MIDI", device, 1, 1, &rmidi)) < 0) 274 255 return err; … … 280 261 rmidi->info_flags |= SNDRV_RAWMIDI_INFO_DUPLEX; 281 262 rmidi->private_data = chip; 263 timer_setup(&chip->midi_timer, snd_sb8dsp_midi_output_timer, 0); 282 264 chip->rmidi = rmidi; 283 if (rrawmidi) 284 *rrawmidi = rmidi; 285 return 0; 286 } 265 return 0; 266 } -
GPL/trunk/alsa-kernel/isa/sb/sb_common.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> … … 4 5 * 5 6 * Lowlevel routines for control of Sound Blaster cards 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/slab.h> 27 13 #include <linux/ioport.h> 14 #include <linux/module.h> 15 #include <linux/io.h> 28 16 #include <sound/core.h> 29 17 #include <sound/sb.h> 30 18 #include <sound/initval.h> 31 19 32 #include <asm/io.h>33 20 #include <asm/dma.h> 34 21 … … 94 81 static int snd_sbdsp_version(struct snd_sb * chip) 95 82 { 96 unsigned int result = -ENODEV;83 unsigned int result; 97 84 98 85 snd_sbdsp_command(chip, SB_DSP_GET_VERSION); … … 184 171 static int snd_sbdsp_free(struct snd_sb *chip) 185 172 { 186 if (chip->res_port) 187 release_and_free_resource(chip->res_port); 173 release_and_free_resource(chip->res_port); 188 174 if (chip->irq >= 0) 189 175 free_irq(chip->irq, (void *) chip); … … 219 205 struct snd_sb *chip; 220 206 int err; 221 static struct snd_device_ops ops = {207 static const struct snd_device_ops ops = { 222 208 .dev_free = snd_sbdsp_dev_free, 223 209 }; … … 241 227 (hardware == SB_HW_ALS4000 || 242 228 hardware == SB_HW_CS5530) ? 243 IRQF_SHARED : IRQF_DISABLED,229 IRQF_SHARED : 0, 244 230 "SoundBlaster", (void *) chip)) { 245 231 snd_printk(KERN_ERR "sb: can't grab irq %d\n", irq); … … 248 234 } 249 235 chip->irq = irq; 236 card->sync_irq = chip->irq; 250 237 251 238 if (hardware == SB_HW_ALS4000) … … 306 293 EXPORT_SYMBOL(snd_sbmixer_resume); 307 294 #endif 308 309 /*310 * INIT part311 */312 313 static int __init alsa_sb_common_init(void)314 {315 return 0;316 }317 318 static void __exit alsa_sb_common_exit(void)319 {320 }321 322 module_init(alsa_sb_common_init)323 module_exit(alsa_sb_common_exit) -
GPL/trunk/alsa-kernel/isa/sb/sb_mixer.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) by Jaroslav Kysela <perex@perex.cz> 3 4 * Routines for Sound Blaster mixer control 4 * 5 * 6 * This program is free software; you can redistribute it and/or modify 7 * it under the terms of the GNU General Public License as published by 8 * the Free Software Foundation; either version 2 of the License, or 9 * (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 of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 * GNU General Public License for more details. 15 * 16 * You should have received a copy of the GNU General Public License 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 * 20 */ 21 22 #include <asm/io.h> 5 */ 6 7 #include <linux/io.h> 23 8 #include <linux/delay.h> 24 9 #include <linux/time.h> … … 183 168 static int snd_dt019x_input_sw_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 184 169 { 185 static const char * texts[5] = {170 static const char * const texts[5] = { 186 171 "CD", "Mic", "Line", "Synth", "Master" 187 172 }; 188 173 189 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 190 uinfo->count = 1; 191 uinfo->value.enumerated.items = 5; 192 if (uinfo->value.enumerated.item > 4) 193 uinfo->value.enumerated.item = 4; 194 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); 195 return 0; 174 return snd_ctl_enum_info(uinfo, 1, 5, texts); 196 175 } 197 176 … … 276 255 struct snd_ctl_elem_info *uinfo) 277 256 { 278 static const char * texts[3] = {257 static const char * const texts[3] = { 279 258 "L chan only", "R chan only", "L ch/2 + R ch/2" 280 259 }; 281 260 282 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 283 uinfo->count = 1; 284 uinfo->value.enumerated.items = 3; 285 if (uinfo->value.enumerated.item > 2) 286 uinfo->value.enumerated.item = 2; 287 strcpy(uinfo->value.enumerated.name, 288 texts[uinfo->value.enumerated.item]); 289 return 0; 261 return snd_ctl_enum_info(uinfo, 1, 3, texts); 290 262 } 291 263 … … 336 308 static int snd_sb8mixer_info_mux(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) 337 309 { 338 static const char * texts[3] = {310 static const char * const texts[3] = { 339 311 "Mic", "CD", "Line" 340 312 }; 341 313 342 uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED; 343 uinfo->count = 1; 344 uinfo->value.enumerated.items = 3; 345 if (uinfo->value.enumerated.item > 2) 346 uinfo->value.enumerated.item = 2; 347 strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]); 348 return 0; 314 return snd_ctl_enum_info(uinfo, 1, 3, texts); 349 315 } 350 316 … … 473 439 int snd_sbmixer_add_ctl(struct snd_sb *chip, const char *name, int index, int type, unsigned long value) 474 440 { 475 static struct snd_kcontrol_new newctls[] = {441 static const struct snd_kcontrol_new newctls[] = { 476 442 [SB_MIX_SINGLE] = { 477 443 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, … … 529 495 */ 530 496 531 static struct sbmix_elem snd_sb20_controls[] = {497 static const struct sbmix_elem snd_sb20_controls[] = { 532 498 SB_SINGLE("Master Playback Volume", SB_DSP20_MASTER_DEV, 1, 7), 533 499 SB_SINGLE("PCM Playback Volume", SB_DSP20_PCM_DEV, 1, 3), … … 536 502 }; 537 503 538 static unsigned char snd_sb20_init_values[][2] = {504 static const unsigned char snd_sb20_init_values[][2] = { 539 505 { SB_DSP20_MASTER_DEV, 0 }, 540 506 { SB_DSP20_FM_DEV, 0 }, … … 544 510 * SB Pro specific mixer elements 545 511 */ 546 static struct sbmix_elem snd_sbpro_controls[] = {512 static const struct sbmix_elem snd_sbpro_controls[] = { 547 513 SB_DOUBLE("Master Playback Volume", 548 514 SB_DSP_MASTER_DEV, SB_DSP_MASTER_DEV, 5, 1, 7), … … 564 530 }; 565 531 566 static unsigned char snd_sbpro_init_values[][2] = {532 static const unsigned char snd_sbpro_init_values[][2] = { 567 533 { SB_DSP_MASTER_DEV, 0 }, 568 534 { SB_DSP_PCM_DEV, 0 }, … … 573 539 * SB16 specific mixer elements 574 540 */ 575 static struct sbmix_elem snd_sb16_controls[] = {541 static const struct sbmix_elem snd_sb16_controls[] = { 576 542 SB_DOUBLE("Master Playback Volume", 577 543 SB_DSP4_MASTER_DEV, (SB_DSP4_MASTER_DEV + 1), 3, 3, 31), … … 611 577 }; 612 578 613 static unsigned char snd_sb16_init_values[][2] = {579 static const unsigned char snd_sb16_init_values[][2] = { 614 580 { SB_DSP4_MASTER_DEV + 0, 0 }, 615 581 { SB_DSP4_MASTER_DEV + 1, 0 }, … … 627 593 * DT019x specific mixer elements 628 594 */ 629 static struct sbmix_elem snd_dt019x_controls[] = {595 static const struct sbmix_elem snd_dt019x_controls[] = { 630 596 /* ALS4000 below has some parts which we might be lacking, 631 597 * e.g. snd_als4000_ctl_mono_playback_switch - check it! */ … … 657 623 }; 658 624 659 static unsigned char snd_dt019x_init_values[][2] = {625 static const unsigned char snd_dt019x_init_values[][2] = { 660 626 { SB_DT019X_MASTER_DEV, 0 }, 661 627 { SB_DT019X_PCM_DEV, 0 }, … … 672 638 * ALS4000 specific mixer elements 673 639 */ 674 static struct sbmix_elem snd_als4000_controls[] = {640 static const struct sbmix_elem snd_als4000_controls[] = { 675 641 SB_DOUBLE("PCM Playback Switch", 676 642 SB_DT019X_OUTPUT_SW2, SB_DT019X_OUTPUT_SW2, 2, 1, 1), … … 706 672 }; 707 673 708 static unsigned char snd_als4000_init_values[][2] = {674 static const unsigned char snd_als4000_init_values[][2] = { 709 675 { SB_DSP4_MASTER_DEV + 0, 0 }, 710 676 { SB_DSP4_MASTER_DEV + 1, 0 }, … … 724 690 */ 725 691 static int snd_sbmixer_init(struct snd_sb *chip, 726 struct sbmix_elem *controls,692 const struct sbmix_elem *controls, 727 693 int controls_count, 728 unsigned char map[][2],694 const unsigned char map[][2], 729 695 int map_count, 730 696 char *name) … … 819 785 break; 820 786 case SB_HW_DT019X: 821 if ((err = snd_sbmixer_init(chip, 822 snd_dt019x_controls, 823 ARRAY_SIZE(snd_dt019x_controls), 824 snd_dt019x_init_values, 825 ARRAY_SIZE(snd_dt019x_init_values), 826 "DT019X")) < 0) 787 err = snd_sbmixer_init(chip, 788 snd_dt019x_controls, 789 ARRAY_SIZE(snd_dt019x_controls), 790 snd_dt019x_init_values, 791 ARRAY_SIZE(snd_dt019x_init_values), 792 "DT019X"); 793 if (err < 0) 794 return err; 827 795 break; 828 796 default: … … 833 801 834 802 #ifdef CONFIG_PM 835 static unsigned char sb20_saved_regs[] = {803 static const unsigned char sb20_saved_regs[] = { 836 804 SB_DSP20_MASTER_DEV, 837 805 SB_DSP20_PCM_DEV, … … 840 808 }; 841 809 842 static unsigned char sbpro_saved_regs[] = {810 static const unsigned char sbpro_saved_regs[] = { 843 811 SB_DSP_MASTER_DEV, 844 812 SB_DSP_PCM_DEV, … … 852 820 }; 853 821 854 static unsigned char sb16_saved_regs[] = {822 static const unsigned char sb16_saved_regs[] = { 855 823 SB_DSP4_MASTER_DEV, SB_DSP4_MASTER_DEV + 1, 856 824 SB_DSP4_3DSE, … … 870 838 }; 871 839 872 static unsigned char dt019x_saved_regs[] = {840 static const unsigned char dt019x_saved_regs[] = { 873 841 SB_DT019X_MASTER_DEV, 874 842 SB_DT019X_PCM_DEV, … … 883 851 }; 884 852 885 static unsigned char als4000_saved_regs[] = {853 static const unsigned char als4000_saved_regs[] = { 886 854 /* please verify in dsheet whether regs to be added 887 855 are actually real H/W or just dummy */ … … 905 873 }; 906 874 907 static void save_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs)875 static void save_mixer(struct snd_sb *chip, const unsigned char *regs, int num_regs) 908 876 { 909 877 unsigned char *val = chip->saved_regs; … … 914 882 } 915 883 916 static void restore_mixer(struct snd_sb *chip, unsigned char *regs, int num_regs)884 static void restore_mixer(struct snd_sb *chip, const unsigned char *regs, int num_regs) 917 885 { 918 886 unsigned char *val = chip->saved_regs; -
GPL/trunk/alsa-kernel/isa/wavefront/wavefront.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * ALSA card-level driver for Turtle Beach Wavefront cards … … 4 5 * 5 6 * Copyright (c) 1997-1999 by Paul Barton-Davis <pbd@op.net> 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 7 */ 21 8 … … 25 12 #include <linux/isa.h> 26 13 #include <linux/pnp.h> 27 #include <linux/module param.h>14 #include <linux/module.h> 28 15 #include <sound/core.h> 29 16 #include <sound/initval.h> … … 39 26 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 40 27 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 41 static intenable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */28 static bool enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 42 29 #ifdef CONFIG_PNP 43 static intisapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};30 static bool isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 44 31 #endif 45 32 static long cs4232_pcm_port[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* PnP setup */ … … 52 39 static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */ 53 40 static int dma2[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3,5,6,7 */ 54 static intuse_cs4232_midi[SNDRV_CARDS];41 static bool use_cs4232_midi[SNDRV_CARDS]; 55 42 56 43 module_param_array(index, int, NULL, 0444); … … 64 51 MODULE_PARM_DESC(isapnp, "ISA PnP detection for WaveFront soundcards."); 65 52 #endif 66 module_param_ array(cs4232_pcm_port, long, NULL, 0444);53 module_param_hw_array(cs4232_pcm_port, long, ioport, NULL, 0444); 67 54 MODULE_PARM_DESC(cs4232_pcm_port, "Port # for CS4232 PCM interface."); 68 module_param_ array(cs4232_pcm_irq, int, NULL, 0444);55 module_param_hw_array(cs4232_pcm_irq, int, irq, NULL, 0444); 69 56 MODULE_PARM_DESC(cs4232_pcm_irq, "IRQ # for CS4232 PCM interface."); 70 module_param_ array(dma1, int, NULL, 0444);57 module_param_hw_array(dma1, int, dma, NULL, 0444); 71 58 MODULE_PARM_DESC(dma1, "DMA1 # for CS4232 PCM interface."); 72 module_param_ array(dma2, int, NULL, 0444);59 module_param_hw_array(dma2, int, dma, NULL, 0444); 73 60 MODULE_PARM_DESC(dma2, "DMA2 # for CS4232 PCM interface."); 74 module_param_ array(cs4232_mpu_port, long, NULL, 0444);61 module_param_hw_array(cs4232_mpu_port, long, ioport, NULL, 0444); 75 62 MODULE_PARM_DESC(cs4232_mpu_port, "port # for CS4232 MPU-401 interface."); 76 module_param_ array(cs4232_mpu_irq, int, NULL, 0444);63 module_param_hw_array(cs4232_mpu_irq, int, irq, NULL, 0444); 77 64 MODULE_PARM_DESC(cs4232_mpu_irq, "IRQ # for CS4232 MPU-401 interface."); 78 module_param_ array(ics2115_irq, int, NULL, 0444);65 module_param_hw_array(ics2115_irq, int, irq, NULL, 0444); 79 66 MODULE_PARM_DESC(ics2115_irq, "IRQ # for ICS2115."); 80 module_param_ array(ics2115_port, long, NULL, 0444);67 module_param_hw_array(ics2115_port, long, ioport, NULL, 0444); 81 68 MODULE_PARM_DESC(ics2115_port, "Port # for ICS2115."); 82 module_param_ array(fm_port, long, NULL, 0444);69 module_param_hw_array(fm_port, long, ioport, NULL, 0444); 83 70 MODULE_PARM_DESC(fm_port, "FM port #."); 84 71 module_param_array(use_cs4232_midi, bool, NULL, 0444); … … 89 76 static int pnp_registered; 90 77 91 static struct pnp_card_device_id snd_wavefront_pnpids[] = {78 static const struct pnp_card_device_id snd_wavefront_pnpids[] = { 92 79 /* Tropez */ 93 80 { .id = "CSC7532", .devs = { { "CSC0000" }, { "CSC0010" }, { "PnPb006" }, { "CSC0004" } } }, … … 99 86 MODULE_DEVICE_TABLE(pnp_card, snd_wavefront_pnpids); 100 87 101 static int __devinit88 static int 102 89 snd_wavefront_pnp (int dev, snd_wavefront_card_t *acard, struct pnp_card_link *card, 103 90 const struct pnp_card_device_id *id) … … 232 219 } 233 220 234 static struct snd_hwdep * __devinit 235 snd_wavefront_new_synth (struct snd_card *card, 236 int hw_dev, 237 snd_wavefront_card_t *acard) 221 static struct snd_hwdep *snd_wavefront_new_synth(struct snd_card *card, 222 int hw_dev, 223 snd_wavefront_card_t *acard) 238 224 { 239 225 struct snd_hwdep *wavefront_synth; … … 258 244 } 259 245 260 static struct snd_hwdep * __devinit 261 snd_wavefront_new_fx (struct snd_card *card, 262 int hw_dev, 263 snd_wavefront_card_t *acard, 264 unsigned long port) 246 static struct snd_hwdep *snd_wavefront_new_fx(struct snd_card *card, 247 int hw_dev, 248 snd_wavefront_card_t *acard, 249 unsigned long port) 265 250 266 251 { … … 285 270 static snd_wavefront_mpu_id external_id = external_mpu; 286 271 287 static struct snd_rawmidi *__devinit 288 snd_wavefront_new_midi (struct snd_card *card, 289 int midi_dev, 290 snd_wavefront_card_t *acard, 291 unsigned long port, 292 snd_wavefront_mpu_id mpu) 272 static struct snd_rawmidi *snd_wavefront_new_midi(struct snd_card *card, 273 int midi_dev, 274 snd_wavefront_card_t *acard, 275 unsigned long port, 276 snd_wavefront_mpu_id mpu) 293 277 294 278 { … … 338 322 } 339 323 340 static int snd_wavefront_card_new(int dev, struct snd_card **cardp) 324 static int snd_wavefront_card_new(struct device *pdev, int dev, 325 struct snd_card **cardp) 341 326 { 342 327 struct snd_card *card; … … 344 329 int err; 345 330 346 err = snd_card_ create(index[dev], id[dev], THIS_MODULE,347 sizeof(snd_wavefront_card_t), &card);331 err = snd_card_new(pdev, index[dev], id[dev], THIS_MODULE, 332 sizeof(snd_wavefront_card_t), &card); 348 333 if (err < 0) 349 334 return err; … … 362 347 } 363 348 364 static int __devinit349 static int 365 350 snd_wavefront_probe (struct snd_card *card, int dev) 366 351 { … … 383 368 } 384 369 385 err = snd_wss_pcm(chip, 0 , NULL);370 err = snd_wss_pcm(chip, 0); 386 371 if (err < 0) 387 372 return err; 388 373 389 err = snd_wss_timer(chip, 0 , NULL);374 err = snd_wss_timer(chip, 0); 390 375 if (err < 0) 391 376 return err; … … 419 404 } 420 405 if (request_irq(ics2115_irq[dev], snd_wavefront_ics2115_interrupt, 421 IRQF_DISABLED, "ICS2115", acard)) {406 0, "ICS2115", acard)) { 422 407 snd_printk(KERN_ERR "unable to use ICS2115 IRQ %d\n", ics2115_irq[dev]); 423 408 return -EBUSY; … … 425 410 426 411 acard->wavefront.irq = ics2115_irq[dev]; 412 card->sync_irq = acard->wavefront.irq; 427 413 acard->wavefront.base = ics2115_port[dev]; 428 414 … … 450 436 err = snd_mpu401_uart_new(card, midi_dev, MPU401_HW_CS4232, 451 437 cs4232_mpu_port[dev], 0, 452 cs4232_mpu_irq[dev], IRQF_DISABLED, 453 NULL); 438 cs4232_mpu_irq[dev], NULL); 454 439 if (err < 0) { 455 440 snd_printk (KERN_ERR "can't allocate CS4232 MPU-401 device\n"); … … 543 528 } 544 529 545 static int __devinitsnd_wavefront_isa_match(struct device *pdev,546 unsigned int dev)530 static int snd_wavefront_isa_match(struct device *pdev, 531 unsigned int dev) 547 532 { 548 533 if (!enable[dev]) … … 563 548 } 564 549 565 static int __devinitsnd_wavefront_isa_probe(struct device *pdev,566 unsigned int dev)550 static int snd_wavefront_isa_probe(struct device *pdev, 551 unsigned int dev) 567 552 { 568 553 struct snd_card *card; 569 554 int err; 570 555 571 err = snd_wavefront_card_new( dev, &card);556 err = snd_wavefront_card_new(pdev, dev, &card); 572 557 if (err < 0) 573 558 return err; 574 snd_card_set_dev(card, pdev);575 559 if ((err = snd_wavefront_probe(card, dev)) < 0) { 576 560 snd_card_free(card); … … 582 566 } 583 567 584 static int __devexitsnd_wavefront_isa_remove(struct device *devptr,585 unsigned int dev)568 static int snd_wavefront_isa_remove(struct device *devptr, 569 unsigned int dev) 586 570 { 587 571 snd_card_free(dev_get_drvdata(devptr)); 588 dev_set_drvdata(devptr, NULL);589 572 return 0; 590 573 } … … 595 578 .match = snd_wavefront_isa_match, 596 579 .probe = snd_wavefront_isa_probe, 597 .remove = __devexit_p(snd_wavefront_isa_remove),580 .remove = snd_wavefront_isa_remove, 598 581 /* FIXME: suspend, resume */ 599 582 .driver = { … … 604 587 605 588 #ifdef CONFIG_PNP 606 static int __devinitsnd_wavefront_pnp_detect(struct pnp_card_link *pcard,607 const struct pnp_card_device_id *pid)589 static int snd_wavefront_pnp_detect(struct pnp_card_link *pcard, 590 const struct pnp_card_device_id *pid) 608 591 { 609 592 static int dev; … … 618 601 return -ENODEV; 619 602 620 res = snd_wavefront_card_new( dev, &card);603 res = snd_wavefront_card_new(&pcard->card->dev, dev, &card); 621 604 if (res < 0) 622 605 return res; … … 629 612 } 630 613 } 631 snd_card_set_dev(card, &pcard->card->dev);632 614 633 615 if ((res = snd_wavefront_probe(card, dev)) < 0) … … 639 621 } 640 622 641 static void __devexit snd_wavefront_pnp_remove(struct pnp_card_link *pcard)623 static void snd_wavefront_pnp_remove(struct pnp_card_link *pcard) 642 624 { 643 625 snd_card_free(pnp_get_card_drvdata(pcard)); … … 650 632 .id_table = snd_wavefront_pnpids, 651 633 .probe = snd_wavefront_pnp_detect, 652 .remove = __devexit_p(snd_wavefront_pnp_remove),634 .remove = snd_wavefront_pnp_remove, 653 635 /* FIXME: suspend,resume */ 654 636 }; -
GPL/trunk/alsa-kernel/isa/wavefront/wavefront_fx.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-or-later 1 2 /* 2 3 * Copyright (c) 1998-2002 by Paul Davis <pbd@op.net> 3 *4 * This program is free software; you can redistribute it and/or modify5 * it under the terms of the GNU General Public License as published by6 * the Free Software Foundation; either version 2 of the License, or7 * (at your option) any later version.8 *9 * This program is distributed in the hope that it will be useful,10 * but WITHOUT ANY WARRANTY; without even the implied warranty of11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the12 * GNU General Public License for more details.13 *14 * You should have received a copy of the GNU General Public License15 * along with this program; if not, write to the Free Software16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA17 4 */ 18 5 19 #include < asm/io.h>6 #include <linux/io.h> 20 7 #include <linux/init.h> 21 8 #include <linux/time.h> 22 9 #include <linux/wait.h> 23 10 #include <linux/slab.h> 11 #include <linux/module.h> 24 12 #include <linux/firmware.h> 25 13 #include <sound/core.h> 26 14 #include <sound/snd_wavefront.h> 27 15 #include <sound/initval.h> 28 #include <proto.h>29 16 30 17 /* Control bits for the Load Control Register … … 80 67 snd_printk ("FX memset: " 81 68 "page must be >= 0 and <= 7\n"); 82 return - (EINVAL);69 return -EINVAL; 83 70 } 84 71 … … 86 73 snd_printk ("FX memset: " 87 74 "addr must be >= 0 and <= 7f\n"); 88 return - (EINVAL);75 return -EINVAL; 89 76 } 90 77 … … 119 106 "(0x%x, 0x%x, 0x%lx, %d) incomplete\n", 120 107 page, addr, (unsigned long) data, cnt); 121 return - (EIO);108 return -EIO; 122 109 } 123 110 } … … 154 141 } 155 142 156 int 143 int 157 144 snd_wavefront_fx_release (struct snd_hwdep *hw, struct file *file) 158 145 … … 241 228 */ 242 229 243 int __devinit230 int 244 231 snd_wavefront_fx_start (snd_wavefront_t *dev) 245 232 { -
GPL/trunk/alsa-kernel/isa/wavefront/wavefront_midi.c
r399 r679 1 // SPDX-License-Identifier: GPL-2.0-only 1 2 /* 2 3 * Copyright (C) by Paul Barton-Davis 1998-1999 3 *4 * This file is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)5 * Version 2 (June 1991). See the "COPYING" file distributed with this6 * software for more info.7 4 */ 8 5 … … 48 45 */ 49 46 50 #include < asm/io.h>47 #include <linux/io.h> 51 48 #include <linux/init.h> 52 49 #include <linux/time.h> … … 350 347 } 351 348 352 static void snd_wavefront_midi_output_timer( unsigned long data)353 { 354 snd_wavefront_ card_t *card = (snd_wavefront_card_t *)data;355 snd_wavefront_ midi_t *midi = &card->wavefront.midi;349 static void snd_wavefront_midi_output_timer(struct timer_list *t) 350 { 351 snd_wavefront_midi_t *midi = from_timer(midi, t, timer); 352 snd_wavefront_card_t *card = midi->timer_card; 356 353 unsigned long flags; 357 354 358 355 spin_lock_irqsave (&midi->virtual, flags); 359 midi->timer.expires = 1 + jiffies; 360 add_timer(&midi->timer); 356 mod_timer(&midi->timer, 1 + jiffies); 361 357 spin_unlock_irqrestore (&midi->virtual, flags); 362 358 snd_wavefront_midi_output_write(card); … … 385 381 if ((midi->mode[mpu] & MPU401_MODE_OUTPUT_TRIGGER) == 0) { 386 382 if (!midi->istimer) { 387 init_timer(&midi->timer); 388 midi->timer.function = snd_wavefront_midi_output_timer; 389 midi->timer.data = (unsigned long) substream->rmidi->card->private_data; 390 midi->timer.expires = 1 + jiffies; 391 add_timer(&midi->timer); 383 timer_setup(&midi->timer, 384 snd_wavefront_midi_output_timer, 385 0); 386 mod_timer(&midi->timer, 1 + jiffies); 392 387 } 393 388 midi->istimer++; … … 482 477 } 483 478 484 int __devinit479 int 485 480 snd_wavefront_midi_start (snd_wavefront_card_t *card) 486 481 … … 538 533 539 534 /* Turn on Virtual MIDI, but first *always* turn it off, 540 since otherwise consec tutive reloads of the driver will535 since otherwise consecutive reloads of the driver will 541 536 never cause the hardware to generate the initial "internal" or 542 537 "external" source bytes in the MIDI data stream. This … … 562 557 } 563 558 564 struct snd_rawmidi_ops snd_wavefront_midi_output =559 const struct snd_rawmidi_ops snd_wavefront_midi_output = 565 560 { 566 561 .open = snd_wavefront_midi_output_open, … … 569 564 }; 570 565 571 struct snd_rawmidi_ops snd_wavefront_midi_input =566 const struct snd_rawmidi_ops snd_wavefront_midi_input = 572 567 { 573 568 .open = snd_wavefront_midi_input_open, -
GPL/trunk/alsa-kernel/isa/wavefront/wavefront_synth.c
r598 r679 1 // SPDX-License-Identifier: GPL-2.0-only 1 2 /* Copyright (C) by Paul Barton-Davis 1998-1999 2 3 * 3 4 * Some portions of this file are taken from work that is 4 5 * copyright (C) by Hannu Savolainen 1993-1996 5 *6 * This program is distributed under the GNU GENERAL PUBLIC LICENSE (GPL)7 * Version 2 (June 1991). See the "COPYING" file distributed with this software8 * for more info.9 6 */ 10 7 … … 21 18 */ 22 19 23 #include < asm/io.h>20 #include <linux/io.h> 24 21 #include <linux/interrupt.h> 25 22 #include <linux/init.h> … … 27 24 #include <linux/time.h> 28 25 #include <linux/wait.h> 26 #include <linux/sched/signal.h> 29 27 #include <linux/firmware.h> 30 28 #include <linux/moduleparam.h> 31 29 #include <linux/slab.h> 30 #include <linux/module.h> 32 31 #include <sound/core.h> 33 32 #include <sound/snd_wavefront.h> … … 539 538 540 539 dst++; 541 }; 540 } 542 541 return dst; 543 542 }; … … 787 786 header->number); 788 787 788 if (header->number >= ARRAY_SIZE(dev->patch_status)) 789 return -EINVAL; 790 789 791 dev->patch_status[header->number] |= WF_SLOT_FILLED; 790 792 791 bptr = buf;792 793 bptr = munge_int32 (header->number, buf, 2); 793 794 munge_buf ((unsigned char *)&header->hdr.p, bptr, WF_PATCH_BYTES); … … 795 796 if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_PATCH, NULL, buf)) { 796 797 snd_printk ("download patch failed\n"); 797 return - (EIO);798 return -EIO; 798 799 } 799 800 … … 810 811 DPRINT (WF_DEBUG_LOAD_PATCH, "downloading program %d\n", 811 812 header->number); 813 814 if (header->number >= ARRAY_SIZE(dev->prog_status)) 815 return -EINVAL; 812 816 813 817 dev->prog_status[header->number] = WF_SLOT_USED; … … 833 837 if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_PROGRAM, NULL, buf)) { 834 838 snd_printk ("download patch failed\n"); 835 return - (EIO);839 return -EIO; 836 840 } 837 841 … … 900 904 } 901 905 906 if (header->number >= WF_MAX_SAMPLE) 907 return -EINVAL; 908 902 909 if (header->size) { 903 910 … … 954 961 snd_printk ("channel selection only " 955 962 "possible on 16-bit samples"); 956 return - (EINVAL);963 return -EINVAL; 957 964 } 958 965 … … 1051 1058 snd_printk ("sample %sdownload refused.\n", 1052 1059 header->size ? "" : "header "); 1053 return - (EIO);1060 return -EIO; 1054 1061 } 1055 1062 … … 1077 1084 snd_printk ("download block " 1078 1085 "request refused.\n"); 1079 return - (EIO);1086 return -EIO; 1080 1087 } 1081 1088 … … 1137 1144 snd_printk ("upload sample " 1138 1145 "DMA ack timeout\n"); 1139 return - (EIO);1146 return -EIO; 1140 1147 } else { 1141 1148 snd_printk ("upload sample " 1142 1149 "DMA ack error 0x%x\n", 1143 1150 dma_ack); 1144 return - (EIO);1151 return -EIO; 1145 1152 } 1146 1153 } … … 1167 1174 header->number, 1168 1175 header->hdr.a.OriginalSample); 1169 1176 1177 if (header->number >= WF_MAX_SAMPLE) 1178 return -EINVAL; 1179 1170 1180 munge_int32 (header->number, &alias_hdr[0], 2); 1171 1181 munge_int32 (header->hdr.a.OriginalSample, &alias_hdr[2], 2); … … 1183 1193 if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_SAMPLE_ALIAS, NULL, alias_hdr)) { 1184 1194 snd_printk ("download alias failed.\n"); 1185 return - (EIO);1195 return -EIO; 1186 1196 } 1187 1197 … … 1198 1208 unsigned char *msample_hdr; 1199 1209 1200 msample_hdr = kmalloc(sizeof(WF_MSAMPLE_BYTES), GFP_KERNEL); 1210 if (header->number >= WF_MAX_SAMPLE) 1211 return -EINVAL; 1212 1213 msample_hdr = kmalloc(WF_MSAMPLE_BYTES, GFP_KERNEL); 1201 1214 if (! msample_hdr) 1202 1215 return -ENOMEM; … … 1234 1247 snd_printk ("download of multisample failed.\n"); 1235 1248 kfree(msample_hdr); 1236 return - (EIO);1249 return -EIO; 1237 1250 } 1238 1251 … … 1256 1269 if (snd_wavefront_cmd (dev, WFC_UPLOAD_MULTISAMPLE, log_ns, number)) { 1257 1270 snd_printk ("upload multisample failed.\n"); 1258 return - (EIO);1271 return -EIO; 1259 1272 } 1260 1273 … … 1275 1288 snd_printk ("upload multisample failed " 1276 1289 "during sample loop.\n"); 1277 return - (EIO);1290 return -EIO; 1278 1291 } 1279 1292 d[0] = val; … … 1282 1295 snd_printk ("upload multisample failed " 1283 1296 "during sample loop.\n"); 1284 return - (EIO);1297 return -EIO; 1285 1298 } 1286 1299 d[1] = val; … … 1317 1330 if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_EDRUM_PROGRAM, NULL, drumbuf)) { 1318 1331 snd_printk ("download drum failed.\n"); 1319 return - (EIO);1332 return -EIO; 1320 1333 } 1321 1334 … … 1743 1756 */ 1744 1757 1745 static int __devinit1758 static int 1746 1759 snd_wavefront_interrupt_bits (int irq) 1747 1760 … … 1771 1784 } 1772 1785 1773 static void __devinit1786 static void 1774 1787 wavefront_should_cause_interrupt (snd_wavefront_t *dev, 1775 1788 int val, int port, unsigned long timeout) 1776 1789 1777 1790 { 1778 wait_queue_ t wait;1791 wait_queue_entry_t wait; 1779 1792 1780 1793 init_waitqueue_entry(&wait, current); … … 1790 1803 } 1791 1804 1792 static int __devinit1805 static int 1793 1806 wavefront_reset_to_cleanliness (snd_wavefront_t *dev) 1794 1807 … … 1941 1954 } 1942 1955 1943 static int __devinit1956 static int 1944 1957 wavefront_download_firmware (snd_wavefront_t *dev, char *path) 1945 1958 … … 2014 2027 2015 2028 2016 static int __devinit2029 static int 2017 2030 wavefront_do_reset (snd_wavefront_t *dev) 2018 2031 … … 2103 2116 } 2104 2117 2105 int __devinit2118 int 2106 2119 snd_wavefront_start (snd_wavefront_t *dev) 2107 2120 … … 2145 2158 } 2146 2159 2147 int __devinit2160 int 2148 2161 snd_wavefront_detect (snd_wavefront_card_t *card) 2149 2162
Note:
See TracChangeset
for help on using the changeset viewer.
