Changeset 679 for GPL/trunk/alsa-kernel/isa/cmi8330.c
- Timestamp:
- Mar 18, 2021, 8:57:36 PM (4 years ago)
- Location:
- GPL/trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/trunk
- Property svn:mergeinfo changed
/GPL/branches/uniaud32-linux-3.2.102 (added) merged: 611-614 /GPL/branches/uniaud32-next (added) merged: 615-678
- Property svn:mergeinfo changed
-
GPL/trunk/alsa-kernel/isa/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 334 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 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 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 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 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 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,
Note:
See TracChangeset
for help on using the changeset viewer.