Changeset 212 for GPL/branches/alsa-resync1/alsa-kernel/isa/cmi8330.c
- Timestamp:
- Jul 14, 2007, 7:13:46 AM (18 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/alsa-resync1/alsa-kernel/isa/cmi8330.c
r207 r212 31 31 * To quickly load the module, 32 32 * 33 * modprobe -a snd-card-cmi8330 s nd_sbport=0x220 snd_sbirq=5 snd_sbdma8=134 * s nd_sbdma16=5 snd_wssport=0x530 snd_wssirq=11 snd_wssdma=033 * modprobe -a snd-card-cmi8330 sbport=0x220 sbirq=5 sbdma8=1 34 * sbdma16=5 wssport=0x530 wssirq=11 wssdma=0 35 35 * 36 36 * This card has two mixers and two PCM devices. I've cheesed it such … … 47 47 #include <linux/init.h> 48 48 #include <linux/slab.h> 49 #ifndef LINUX_ISAPNP_H 50 #include <linux/isapnp.h> 51 #define isapnp_card pci_bus 52 #define isapnp_dev pci_dev 53 #endif 49 54 #include <sound/core.h> 50 55 #include <sound/ad1848.h> … … 59 64 MODULE_DEVICES("{{C-Media,CMI8330,isapnp:{CMI0001,@@@0001,@X@0001}}}"); 60 65 61 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;62 static char * snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;63 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE;66 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 67 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 68 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_ISAPNP; 64 69 #ifdef __ISAPNP__ 65 70 #ifdef TARGET_OS2 66 static int snd_isapnp[SNDRV_CARDS] = {REPEAT_SNDRV(1)};71 static int isapnp[SNDRV_CARDS] = {REPEAT_SNDRV(1)}; 67 72 #else 68 static int snd_isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1};69 #endif 70 #endif 71 static long s nd_sbport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;72 static int s nd_sbirq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;73 static int s nd_sbdma8[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;74 static int s nd_sbdma16[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;75 static long snd_wssport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT;76 static int snd_wssirq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ;77 static int snd_wssdma[SNDRV_CARDS] = SNDRV_DEFAULT_DMA;78 79 MODULE_PARM( snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");80 MODULE_PARM_DESC( snd_index, "Index value for CMI8330 soundcard.");81 MODULE_PARM_SYNTAX( snd_index, SNDRV_INDEX_DESC);82 MODULE_PARM( snd_id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");83 MODULE_PARM_DESC( snd_id, "ID string for CMI8330 soundcard.");84 MODULE_PARM_SYNTAX( snd_id, SNDRV_ID_DESC);85 MODULE_PARM( snd_enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i");86 MODULE_PARM_DESC( snd_enable, "Enable CMI8330 soundcard.");87 MODULE_PARM_SYNTAX( snd_enable, SNDRV_ENABLE_DESC);88 #ifdef __ISAPNP__ 89 MODULE_PARM( snd_isapnp, "1-" __MODULE_STRING(SNDRV_CARDS) "i");90 MODULE_PARM_DESC( snd_isapnp, "ISA PnP detection for specified soundcard.");91 MODULE_PARM_SYNTAX( snd_isapnp, SNDRV_ISAPNP_DESC);92 #endif 93 94 MODULE_PARM(s nd_sbport, "1-" __MODULE_STRING(SNDRV_CARDS) "l");95 MODULE_PARM_DESC(s nd_sbport, "Port # for CMI8330 SB driver.");96 MODULE_PARM_SYNTAX(s nd_sbport, SNDRV_ENABLED ",allows:{{0x220,0x280,0x20}},prefers:{0x220},base:16,dialog:list");97 MODULE_PARM(s nd_sbirq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");98 MODULE_PARM_DESC(s nd_sbirq, "IRQ # for CMI8330 SB driver.");99 MODULE_PARM_SYNTAX(s nd_sbirq, SNDRV_ENABLED ",allows:{{5},{7},{9},{10},{11},{12}},prefers:{5},dialog:list");100 MODULE_PARM(s nd_sbdma8, "1-" __MODULE_STRING(SNDRV_CARDS) "i");101 MODULE_PARM_DESC(s nd_sbdma8, "DMA8 for CMI8330 SB driver.");102 MODULE_PARM_SYNTAX(s nd_sbdma8, SNDRV_DMA8_DESC ",prefers:{1}");103 MODULE_PARM(s nd_sbdma16, "1-" __MODULE_STRING(SNDRV_CARDS) "i");104 MODULE_PARM_DESC(s nd_sbdma16, "DMA16 for CMI8330 SB driver.");105 MODULE_PARM_SYNTAX(s nd_sbdma16, SNDRV_ENABLED ",allows:{{5},{7}},prefers:{5},dialog:list");106 107 MODULE_PARM( snd_wssport, "1-" __MODULE_STRING(SNDRV_CARDS) "l");108 MODULE_PARM_DESC( snd_wssport, "Port # for CMI8330 WSS driver.");109 MODULE_PARM_SYNTAX( snd_wssport, SNDRV_ENABLED ",allows:{{0x530},{0xe80,0xf40,0xc0}},prefers:{0x530},base:16,dialog:list");110 MODULE_PARM( snd_wssirq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");111 MODULE_PARM_DESC( snd_wssirq, "IRQ # for CMI8330 WSS driver.");112 MODULE_PARM_SYNTAX( snd_wssirq, SNDRV_ENABLED ",allows:{{5},{7},{9},{10},{11},{12}},prefers:{11},dialog:list");113 MODULE_PARM( snd_wssdma, "1-" __MODULE_STRING(SNDRV_CARDS) "i");114 MODULE_PARM_DESC( snd_wssdma, "DMA for CMI8330 WSS driver.");115 MODULE_PARM_SYNTAX( snd_wssdma, SNDRV_DMA8_DESC ",prefers:{0}");73 static int isapnp[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 1}; 74 #endif 75 #endif 76 static long sbport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; 77 static int sbirq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; 78 static int sbdma8[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; 79 static int sbdma16[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; 80 static long wssport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; 81 static int wssirq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; 82 static int wssdma[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; 83 84 MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); 85 MODULE_PARM_DESC(index, "Index value for CMI8330 soundcard."); 86 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC); 87 MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s"); 88 MODULE_PARM_DESC(id, "ID string for CMI8330 soundcard."); 89 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC); 90 MODULE_PARM(enable, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); 91 MODULE_PARM_DESC(enable, "Enable CMI8330 soundcard."); 92 MODULE_PARM_SYNTAX(enable, SNDRV_ENABLE_DESC); 93 #ifdef __ISAPNP__ 94 MODULE_PARM(isapnp, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); 95 MODULE_PARM_DESC(isapnp, "ISA PnP detection for specified soundcard."); 96 MODULE_PARM_SYNTAX(isapnp, SNDRV_ISAPNP_DESC); 97 #endif 98 99 MODULE_PARM(sbport, "1-" __MODULE_STRING(SNDRV_CARDS) "l"); 100 MODULE_PARM_DESC(sbport, "Port # for CMI8330 SB driver."); 101 MODULE_PARM_SYNTAX(sbport, SNDRV_ENABLED ",allows:{{0x220,0x280,0x20}},prefers:{0x220},base:16,dialog:list"); 102 MODULE_PARM(sbirq, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); 103 MODULE_PARM_DESC(sbirq, "IRQ # for CMI8330 SB driver."); 104 MODULE_PARM_SYNTAX(sbirq, SNDRV_ENABLED ",allows:{{5},{7},{9},{10},{11},{12}},prefers:{5},dialog:list"); 105 MODULE_PARM(sbdma8, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); 106 MODULE_PARM_DESC(sbdma8, "DMA8 for CMI8330 SB driver."); 107 MODULE_PARM_SYNTAX(sbdma8, SNDRV_DMA8_DESC ",prefers:{1}"); 108 MODULE_PARM(sbdma16, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); 109 MODULE_PARM_DESC(sbdma16, "DMA16 for CMI8330 SB driver."); 110 MODULE_PARM_SYNTAX(sbdma16, SNDRV_ENABLED ",allows:{{5},{7}},prefers:{5},dialog:list"); 111 112 MODULE_PARM(wssport, "1-" __MODULE_STRING(SNDRV_CARDS) "l"); 113 MODULE_PARM_DESC(wssport, "Port # for CMI8330 WSS driver."); 114 MODULE_PARM_SYNTAX(wssport, SNDRV_ENABLED ",allows:{{0x530},{0xe80,0xf40,0xc0}},prefers:{0x530},base:16,dialog:list"); 115 MODULE_PARM(wssirq, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); 116 MODULE_PARM_DESC(wssirq, "IRQ # for CMI8330 WSS driver."); 117 MODULE_PARM_SYNTAX(wssirq, SNDRV_ENABLED ",allows:{{5},{7},{9},{10},{11},{12}},prefers:{11},dialog:list"); 118 MODULE_PARM(wssdma, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); 119 MODULE_PARM_DESC(wssdma, "DMA for CMI8330 WSS driver."); 120 MODULE_PARM_SYNTAX(wssdma, SNDRV_DMA8_DESC ",prefers:{0}"); 116 121 117 122 #define CMI8330_RMUX3D 16 … … 247 252 return -EAGAIN; 248 253 /* allocate AD1848 resources */ 249 if ( snd_wssport[dev] != SNDRV_AUTO_PORT)250 isapnp_resource_change(&pdev->resource[0], snd_wssport[dev], 8);251 if ( snd_wssdma[dev] != SNDRV_AUTO_DMA)252 isapnp_resource_change(&pdev->dma_resource[0], snd_wssdma[dev], 1);253 if ( snd_wssirq[dev] != SNDRV_AUTO_IRQ)254 isapnp_resource_change(&pdev->irq_resource[0], snd_wssirq[dev], 1);254 if (wssport[dev] != SNDRV_AUTO_PORT) 255 isapnp_resource_change(&pdev->resource[0], wssport[dev], 8); 256 if (wssdma[dev] != SNDRV_AUTO_DMA) 257 isapnp_resource_change(&pdev->dma_resource[0], wssdma[dev], 1); 258 if (wssirq[dev] != SNDRV_AUTO_IRQ) 259 isapnp_resource_change(&pdev->irq_resource[0], wssirq[dev], 1); 255 260 256 261 if (pdev->activate(pdev)<0) { … … 258 263 return -EBUSY; 259 264 } 260 snd_wssport[dev] = pdev->resource[0].start;261 snd_wssdma[dev] = pdev->dma_resource[0].start;262 snd_wssirq[dev] = pdev->irq_resource[0].start;265 wssport[dev] = pdev->resource[0].start; 266 wssdma[dev] = pdev->dma_resource[0].start; 267 wssirq[dev] = pdev->irq_resource[0].start; 263 268 264 269 /* allocate SB16 resources */ … … 268 273 return -EAGAIN; 269 274 } 270 if (s nd_sbport[dev] != SNDRV_AUTO_PORT)271 isapnp_resource_change(&pdev->resource[0], s nd_sbport[dev], 16);272 if (s nd_sbdma8[dev] != SNDRV_AUTO_DMA)273 isapnp_resource_change(&pdev->dma_resource[0], s nd_sbdma8[dev], 1);274 if (s nd_sbdma16[dev] != SNDRV_AUTO_DMA)275 isapnp_resource_change(&pdev->dma_resource[1], s nd_sbdma16[dev], 1);276 if (s nd_sbirq[dev] != SNDRV_AUTO_IRQ)277 isapnp_resource_change(&pdev->irq_resource[0], s nd_sbirq[dev], 1);275 if (sbport[dev] != SNDRV_AUTO_PORT) 276 isapnp_resource_change(&pdev->resource[0], sbport[dev], 16); 277 if (sbdma8[dev] != SNDRV_AUTO_DMA) 278 isapnp_resource_change(&pdev->dma_resource[0], sbdma8[dev], 1); 279 if (sbdma16[dev] != SNDRV_AUTO_DMA) 280 isapnp_resource_change(&pdev->dma_resource[1], sbdma16[dev], 1); 281 if (sbirq[dev] != SNDRV_AUTO_IRQ) 282 isapnp_resource_change(&pdev->irq_resource[0], sbirq[dev], 1); 278 283 279 284 if (pdev->activate(pdev)<0) { … … 282 287 return -EBUSY; 283 288 } 284 s nd_sbport[dev] = pdev->resource[0].start;285 s nd_sbdma8[dev] = pdev->dma_resource[0].start;286 s nd_sbdma16[dev] = pdev->dma_resource[1].start;287 s nd_sbirq[dev] = pdev->irq_resource[0].start;289 sbport[dev] = pdev->resource[0].start; 290 sbdma8[dev] = pdev->dma_resource[0].start; 291 sbdma16[dev] = pdev->dma_resource[1].start; 292 sbirq[dev] = pdev->irq_resource[0].start; 288 293 289 294 return 0; … … 326 331 327 332 #ifdef __ISAPNP__ 328 if (! snd_isapnp[dev]) {329 #endif 330 if ( snd_wssport[dev] == SNDRV_AUTO_PORT) {331 snd_printk("specify snd_wssport\n");333 if (!isapnp[dev]) { 334 #endif 335 if (wssport[dev] == SNDRV_AUTO_PORT) { 336 snd_printk("specify wssport\n"); 332 337 return -EINVAL; 333 338 } 334 if (s nd_sbport[dev] == SNDRV_AUTO_PORT) {335 snd_printk("specify s nd_sbport\n");339 if (sbport[dev] == SNDRV_AUTO_PORT) { 340 snd_printk("specify sbport\n"); 336 341 return -EINVAL; 337 342 } … … 339 344 } 340 345 #endif 341 card = snd_card_new( snd_index[dev], snd_id[dev], THIS_MODULE,346 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 342 347 sizeof(struct snd_cmi8330)); 343 348 if (card == NULL) { … … 349 354 350 355 #ifdef __ISAPNP__ 351 if ( snd_isapnp[dev] && (err = snd_cmi8330_isapnp(dev, acard)) < 0) {356 if (isapnp[dev] && (err = snd_cmi8330_isapnp(dev, acard)) < 0) { 352 357 snd_printk("PnP detection failed\n"); 353 358 snd_card_free(card); … … 357 362 358 363 if ((err = snd_ad1848_create(card, 359 snd_wssport[dev] + 4,360 snd_wssirq[dev],361 snd_wssdma[dev],364 wssport[dev] + 4, 365 wssirq[dev], 366 wssdma[dev], 362 367 AD1848_HW_DETECT, 363 368 &chip_wss)) < 0) { … … 377 382 } 378 383 379 if ((err = snd_sbdsp_create(card, s nd_sbport[dev],380 s nd_sbirq[dev],384 if ((err = snd_sbdsp_create(card, sbport[dev], 385 sbirq[dev], 381 386 snd_sb16dsp_interrupt, 382 s nd_sbdma8[dev],383 s nd_sbdma16[dev],387 sbdma8[dev], 388 sbdma16[dev], 384 389 SB_HW_AUTO, &chip_sb)) < 0) { 385 390 snd_printk("(SB16) device busy??\n"); … … 438 443 wss_pcm->name, 439 444 chip_wss->port, 440 snd_wssirq[dev],441 snd_wssdma[dev]);445 wssirq[dev], 446 wssdma[dev]); 442 447 443 448 if ((err = snd_card_register(card)) < 0) { … … 466 471 467 472 for ( ; dev < SNDRV_CARDS; dev++) { 468 if (! snd_enable[dev] || !snd_isapnp[dev])473 if (!enable[dev] || !isapnp[dev]) 469 474 continue; 470 475 snd_cmi8330_isapnp_cards[dev] = card; … … 485 490 486 491 for (dev = 0; dev < SNDRV_CARDS; dev++) { 487 if (! snd_enable[dev])492 if (!enable[dev]) 488 493 continue; 489 494 #ifdef __ISAPNP__ 490 if ( snd_isapnp[dev])495 if (isapnp[dev]) 491 496 continue; 492 497 #endif … … 512 517 #ifndef MODULE 513 518 514 /* format is: snd-cmi8330= snd_enable,snd_index,snd_id,snd_isapnp,515 snd_sbport,snd_sbirq,516 snd_sbdma8,snd_sbdma16,517 snd_wssport,snd_wssirq,518 snd_wssdma */519 /* format is: snd-cmi8330=enable,index,id,isapnp, 520 sbport,sbirq, 521 sbdma8,sbdma16, 522 wssport,wssirq, 523 wssdma */ 519 524 520 525 static int __init alsa_card_cmi8330_setup(char *str) … … 525 530 if (nr_dev >= SNDRV_CARDS) 526 531 return 0; 527 (void)(get_option(&str,& snd_enable[nr_dev]) == 2 &&528 get_option(&str,& snd_index[nr_dev]) == 2 &&529 get_id(&str,& snd_id[nr_dev]) == 2 &&532 (void)(get_option(&str,&enable[nr_dev]) == 2 && 533 get_option(&str,&index[nr_dev]) == 2 && 534 get_id(&str,&id[nr_dev]) == 2 && 530 535 get_option(&str,&pnp) == 2 && 531 get_option(&str,(int *)&s nd_sbport[nr_dev]) == 2 &&532 get_option(&str,&s nd_sbirq[nr_dev]) == 2 &&533 get_option(&str,&s nd_sbdma8[nr_dev]) == 2 &&534 get_option(&str,&s nd_sbdma16[nr_dev]) == 2 &&535 get_option(&str,(int *)& snd_wssport[nr_dev]) == 2 &&536 get_option(&str,& snd_wssirq[nr_dev]) == 2 &&537 get_option(&str,& snd_wssdma[nr_dev]) == 2);536 get_option(&str,(int *)&sbport[nr_dev]) == 2 && 537 get_option(&str,&sbirq[nr_dev]) == 2 && 538 get_option(&str,&sbdma8[nr_dev]) == 2 && 539 get_option(&str,&sbdma16[nr_dev]) == 2 && 540 get_option(&str,(int *)&wssport[nr_dev]) == 2 && 541 get_option(&str,&wssirq[nr_dev]) == 2 && 542 get_option(&str,&wssdma[nr_dev]) == 2); 538 543 #ifdef __ISAPNP__ 539 544 if (pnp != INT_MAX) 540 snd_isapnp[nr_dev] = pnp;545 isapnp[nr_dev] = pnp; 541 546 #endif 542 547 nr_dev++;
Note:
See TracChangeset
for help on using the changeset viewer.