Changeset 212 for GPL/branches/alsa-resync1/alsa-kernel/isa/sgalaxy.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/sgalaxy.c
r207 r212 27 27 #include <linux/delay.h> 28 28 #include <linux/time.h> 29 #include <linux/irq.h> 29 30 #include <sound/core.h> 30 31 #include <sound/sb.h> … … 41 42 MODULE_DEVICES("{{Aztech Systems,Sound Galaxy}}"); 42 43 43 static int snd_index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */44 static char * snd_id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */44 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 45 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 45 46 static int snd_enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE; /* Enable this card */ 46 static long s nd_sbport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240 */47 static long snd_wssport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x530,0xe80,0xf40,0x604 */48 static int snd_irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 7,9,10,11 */49 static int snd_dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3 */50 51 MODULE_PARM( snd_index, "1-" __MODULE_STRING(SNDRV_CARDS) "i");52 MODULE_PARM_DESC( snd_index, "Index value for Sound Galaxy soundcard.");53 MODULE_PARM_SYNTAX( snd_index, SNDRV_INDEX_DESC);54 MODULE_PARM( snd_id, "1-" __MODULE_STRING(SNDRV_CARDS) "s");55 MODULE_PARM_DESC( snd_id, "ID string for Sound Galaxy soundcard.");56 MODULE_PARM_SYNTAX( snd_id, SNDRV_ID_DESC);57 MODULE_PARM(s nd_sbport, "1-" __MODULE_STRING(SNDRV_CARDS) "l");58 MODULE_PARM_DESC(s nd_sbport, "Port # for Sound Galaxy SB driver.");59 MODULE_PARM_SYNTAX(s nd_sbport, SNDRV_ENABLED ",allows:{{0x220},{0x240}},dialog:list");60 MODULE_PARM( snd_wssport, "1-" __MODULE_STRING(SNDRV_CARDS) "l");61 MODULE_PARM_DESC( snd_wssport, "Port # for Sound Galaxy WSS driver.");62 MODULE_PARM_SYNTAX( snd_wssport, SNDRV_ENABLED ",allows:{{0x530},{0xe80},{0xf40},{0x604}},dialog:list");63 MODULE_PARM( snd_irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i");64 MODULE_PARM_DESC( snd_irq, "IRQ # for Sound Galaxy driver.");65 MODULE_PARM_SYNTAX( snd_irq, SNDRV_ENABLED ",allows:{{7},{9},{10},{11}},dialog:list");66 MODULE_PARM( snd_dma1, "1-" __MODULE_STRING(SNDRV_CARDS) "i");67 MODULE_PARM_DESC( snd_dma1, "DMA1 # for Sound Galaxy driver.");68 MODULE_PARM_SYNTAX( snd_dma1, SNDRV_DMA8_DESC);47 static long sbport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x220,0x240 */ 48 static long wssport[SNDRV_CARDS] = SNDRV_DEFAULT_PORT; /* 0x530,0xe80,0xf40,0x604 */ 49 static int irq[SNDRV_CARDS] = SNDRV_DEFAULT_IRQ; /* 7,9,10,11 */ 50 static int dma1[SNDRV_CARDS] = SNDRV_DEFAULT_DMA; /* 0,1,3 */ 51 52 MODULE_PARM(index, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); 53 MODULE_PARM_DESC(index, "Index value for Sound Galaxy soundcard."); 54 MODULE_PARM_SYNTAX(index, SNDRV_INDEX_DESC); 55 MODULE_PARM(id, "1-" __MODULE_STRING(SNDRV_CARDS) "s"); 56 MODULE_PARM_DESC(id, "ID string for Sound Galaxy soundcard."); 57 MODULE_PARM_SYNTAX(id, SNDRV_ID_DESC); 58 MODULE_PARM(sbport, "1-" __MODULE_STRING(SNDRV_CARDS) "l"); 59 MODULE_PARM_DESC(sbport, "Port # for Sound Galaxy SB driver."); 60 MODULE_PARM_SYNTAX(sbport, SNDRV_ENABLED ",allows:{{0x220},{0x240}},dialog:list"); 61 MODULE_PARM(wssport, "1-" __MODULE_STRING(SNDRV_CARDS) "l"); 62 MODULE_PARM_DESC(wssport, "Port # for Sound Galaxy WSS driver."); 63 MODULE_PARM_SYNTAX(wssport, SNDRV_ENABLED ",allows:{{0x530},{0xe80},{0xf40},{0x604}},dialog:list"); 64 MODULE_PARM(irq, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); 65 MODULE_PARM_DESC(irq, "IRQ # for Sound Galaxy driver."); 66 MODULE_PARM_SYNTAX(irq, SNDRV_ENABLED ",allows:{{7},{9},{10},{11}},dialog:list"); 67 MODULE_PARM(dma1, "1-" __MODULE_STRING(SNDRV_CARDS) "i"); 68 MODULE_PARM_DESC(dma1, "DMA1 # for Sound Galaxy driver."); 69 MODULE_PARM_SYNTAX(dma1, SNDRV_DMA8_DESC); 69 70 70 71 #define SGALAXY_AUXC_LEFT 18 … … 111 112 } 112 113 114 static void snd_sgalaxy_dummy_interrupt(int irq, void *dev_id, struct pt_regs *regs) 115 { 116 } 117 113 118 static int __init snd_sgalaxy_setup_wss(unsigned long port, int irq, int dma) 114 119 { … … 117 122 static int dma_bits[] = {1, 2, 0, 3}; 118 123 int tmp, tmp1; 119 120 unsigned long flags;121 124 122 125 if ((tmp = inb(port + 3)) == 0xff) … … 141 144 #endif 142 145 143 save_flags(flags);144 cli();145 146 146 /* initialize IRQ for WSS codec */ 147 147 tmp = interrupt_bits[irq % 16]; 148 if (tmp < 0) { 149 restore_flags(flags); 148 if (tmp < 0) 150 149 return -EINVAL; 151 } 150 151 if (request_irq(irq, snd_sgalaxy_dummy_interrupt, SA_INTERRUPT, "sgalaxy", NULL)) 152 return -EIO; 153 152 154 outb(tmp | 0x40, port); 153 155 tmp1 = dma_bits[dma % 4]; 154 156 outb(tmp | tmp1, port); 155 157 156 restore_flags(flags); 158 free_irq(irq, NULL); 159 157 160 return 0; 158 161 } … … 165 168 166 169 /* switch to WSS mode */ 167 snd_sgalaxy_sbdsp_reset(s nd_sbport[dev]);168 169 snd_sgalaxy_sbdsp_command(s nd_sbport[dev], 9);170 snd_sgalaxy_sbdsp_command(s nd_sbport[dev], 0);170 snd_sgalaxy_sbdsp_reset(sbport[dev]); 171 172 snd_sgalaxy_sbdsp_command(sbport[dev], 9); 173 snd_sgalaxy_sbdsp_command(sbport[dev], 0); 171 174 172 175 udelay(400); 173 return snd_sgalaxy_setup_wss( snd_wssport[dev], irq, dma);176 return snd_sgalaxy_setup_wss(wssport[dev], irq, dma); 174 177 } 175 178 … … 220 223 static int possible_irqs[] = {7, 9, 10, 11, -1}; 221 224 static int possible_dmas[] = {1, 3, 0, -1}; 222 int err, irq,dma1;225 int err, xirq, xdma1; 223 226 snd_card_t *card; 224 227 ad1848_t *chip; 225 228 226 if (s nd_sbport[dev] == SNDRV_AUTO_PORT) {229 if (sbport[dev] == SNDRV_AUTO_PORT) { 227 230 snd_printk("specify SB port\n"); 228 231 return -EINVAL; 229 232 } 230 if ( snd_wssport[dev] == SNDRV_AUTO_PORT) {233 if (wssport[dev] == SNDRV_AUTO_PORT) { 231 234 snd_printk("specify WSS port\n"); 232 235 return -EINVAL; 233 236 } 234 card = snd_card_new( snd_index[dev], snd_id[dev], THIS_MODULE, 0);237 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 235 238 if (card == NULL) 236 239 return -ENOMEM; 237 240 238 irq = snd_irq[dev];239 if ( irq == SNDRV_AUTO_IRQ) {240 if (( irq = snd_legacy_find_free_irq(possible_irqs)) < 0) {241 xirq = irq[dev]; 242 if (xirq == SNDRV_AUTO_IRQ) { 243 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { 241 244 snd_card_free(card); 242 245 snd_printk("unable to find a free IRQ\n"); … … 244 247 } 245 248 } 246 dma1 = snd_dma1[dev];247 if ( dma1 == SNDRV_AUTO_DMA) {248 if (( dma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {249 xdma1 = dma1[dev]; 250 if (xdma1 == SNDRV_AUTO_DMA) { 251 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { 249 252 snd_card_free(card); 250 253 snd_printk("unable to find a free DMA\n"); … … 253 256 } 254 257 255 if ((err = snd_sgalaxy_detect(dev, irq,dma1)) < 0) {256 snd_card_free(card); 257 return err; 258 } 259 260 if ((err = snd_ad1848_create(card, snd_wssport[dev] + 4,261 irq,dma1,258 if ((err = snd_sgalaxy_detect(dev, xirq, xdma1)) < 0) { 259 snd_card_free(card); 260 return err; 261 } 262 263 if ((err = snd_ad1848_create(card, wssport[dev] + 4, 264 xirq, xdma1, 262 265 AD1848_HW_DETECT, &chip)) < 0) { 263 266 snd_card_free(card); … … 284 287 strcpy(card->shortname, "Sound Galaxy"); 285 288 sprintf(card->longname, "Sound Galaxy at 0x%lx, irq %d, dma %d", 286 snd_wssport[dev], irq,dma1);289 wssport[dev], xirq, xdma1); 287 290 288 291 if ((err = snd_card_register(card)) < 0) { … … 325 328 #ifndef MODULE 326 329 327 /* format is: snd-sgalaxy=snd_enable, snd_index,snd_id,328 snd_sbport,snd_wssport,329 snd_irq,snd_dma1 */330 /* format is: snd-sgalaxy=snd_enable,index,id, 331 sbport,wssport, 332 irq,dma1 */ 330 333 331 334 static int __init alsa_card_sgalaxy_setup(char *str) … … 336 339 return 0; 337 340 (void)(get_option(&str,&snd_enable[nr_dev]) == 2 && 338 get_option(&str,& snd_index[nr_dev]) == 2 &&339 get_id(&str,& snd_id[nr_dev]) == 2 &&340 get_option(&str,(int *)&s nd_sbport[nr_dev]) == 2 &&341 get_option(&str,(int *)& snd_wssport[nr_dev]) == 2 &&342 get_option(&str,(int *)& snd_irq[nr_dev]) == 2 &&343 get_option(&str,(int *)& snd_dma1[nr_dev]) == 2);341 get_option(&str,&index[nr_dev]) == 2 && 342 get_id(&str,&id[nr_dev]) == 2 && 343 get_option(&str,(int *)&sbport[nr_dev]) == 2 && 344 get_option(&str,(int *)&wssport[nr_dev]) == 2 && 345 get_option(&str,(int *)&irq[nr_dev]) == 2 && 346 get_option(&str,(int *)&dma1[nr_dev]) == 2); 344 347 nr_dev++; 345 348 return 1;
Note:
See TracChangeset
for help on using the changeset viewer.