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