/linux-4.4.14/sound/oss/ |
H A D | uart401.c | 46 #define DATAPORT (devc->base) 47 #define COMDPORT (devc->base+1) 48 #define STATPORT (devc->base+1) 50 static int uart401_status(struct uart401_devc *devc) uart401_status() argument 55 #define input_avail(devc) (!(uart401_status(devc)&INPUT_AVAIL)) 56 #define output_ready(devc) (!(uart401_status(devc)&OUTPUT_READY)) 58 static void uart401_cmd(struct uart401_devc *devc, unsigned char cmd) uart401_cmd() argument 63 static int uart401_read(struct uart401_devc *devc) uart401_read() argument 68 static void uart401_write(struct uart401_devc *devc, unsigned char byte) uart401_write() argument 79 static int reset_uart401(struct uart401_devc *devc); 80 static void enter_uart_mode(struct uart401_devc *devc); 82 static void uart401_input_loop(struct uart401_devc *devc) uart401_input_loop() argument 86 while (input_avail(devc) && --work_limit) uart401_input_loop() 88 unsigned char c = uart401_read(devc); uart401_input_loop() 91 devc->input_byte = c; uart401_input_loop() 92 else if (devc->opened & OPEN_READ && devc->midi_input_intr) uart401_input_loop() 93 devc->midi_input_intr(devc->my_dev, c); uart401_input_loop() 96 printk(KERN_WARNING "Too much work in interrupt on uart401 (0x%X). UART jabbering ??\n", devc->base); uart401_input_loop() 101 struct uart401_devc *devc = dev_id; uart401intr() local 103 if (devc == NULL) uart401intr() 105 printk(KERN_ERR "uart401: bad devc\n"); uart401intr() 109 if (input_avail(devc)) uart401intr() 110 uart401_input_loop(devc); uart401intr() 120 struct uart401_devc *devc = (struct uart401_devc *) uart401_open() local 121 midi_devs[dev]->devc; uart401_open() 123 if (devc->opened) uart401_open() 128 while (input_avail(devc)) uart401_open() 129 uart401_read(devc); uart401_open() 131 devc->midi_input_intr = input; uart401_open() 132 devc->opened = mode; uart401_open() 133 enter_uart_mode(devc); uart401_open() 134 devc->disabled = 0; uart401_open() 141 struct uart401_devc *devc = (struct uart401_devc *) uart401_close() local 142 midi_devs[dev]->devc; uart401_close() 144 reset_uart401(devc); uart401_close() 145 devc->opened = 0; uart401_close() 152 struct uart401_devc *devc = (struct uart401_devc *) uart401_out() local 153 midi_devs[dev]->devc; uart401_out() 155 if (devc->disabled) uart401_out() 161 spin_lock_irqsave(&devc->lock,flags); uart401_out() 162 if (input_avail(devc)) uart401_out() 163 uart401_input_loop(devc); uart401_out() 165 spin_unlock_irqrestore(&devc->lock,flags); uart401_out() 172 for (timeout = 30000; timeout > 0 && !output_ready(devc); timeout--); uart401_out() 174 if (!output_ready(devc)) uart401_out() 177 devc->disabled = 1; uart401_out() 178 reset_uart401(devc); uart401_out() 179 enter_uart_mode(devc); uart401_out() 182 uart401_write(devc, midi_byte); uart401_out() 224 static void enter_uart_mode(struct uart401_devc *devc) enter_uart_mode() argument 229 spin_lock_irqsave(&devc->lock,flags); enter_uart_mode() 230 for (timeout = 30000; timeout > 0 && !output_ready(devc); timeout--); enter_uart_mode() 232 devc->input_byte = 0; enter_uart_mode() 233 uart401_cmd(devc, UART_MODE_ON); enter_uart_mode() 237 if (devc->input_byte == MPU_ACK) enter_uart_mode() 239 else if (input_avail(devc)) enter_uart_mode() 240 if (uart401_read(devc) == MPU_ACK) enter_uart_mode() 243 spin_unlock_irqrestore(&devc->lock,flags); enter_uart_mode() 246 static int reset_uart401(struct uart401_devc *devc) reset_uart401() argument 258 for (timeout = 30000; timeout > 0 && !output_ready(devc); timeout--); reset_uart401() 259 devc->input_byte = 0; reset_uart401() 260 uart401_cmd(devc, MPU_RESET); reset_uart401() 269 if (devc->input_byte == MPU_ACK) /* Interrupt */ reset_uart401() 271 else if (input_avail(devc)) reset_uart401() 273 if (uart401_read(devc) == MPU_ACK) reset_uart401() 281 uart401_input_loop(devc); reset_uart401() 290 struct uart401_devc *devc; probe_uart401() local 305 devc = kmalloc(sizeof(struct uart401_devc), GFP_KERNEL); probe_uart401() 306 if (!devc) { probe_uart401() 311 devc->base = hw_config->io_base; probe_uart401() 312 devc->irq = hw_config->irq; probe_uart401() 313 devc->osp = hw_config->osp; probe_uart401() 314 devc->midi_input_intr = NULL; probe_uart401() 315 devc->opened = 0; probe_uart401() 316 devc->input_byte = 0; probe_uart401() 317 devc->my_dev = 0; probe_uart401() 318 devc->share_irq = 0; probe_uart401() 319 spin_lock_init(&devc->lock); probe_uart401() 321 spin_lock_irqsave(&devc->lock,flags); probe_uart401() 322 ok = reset_uart401(devc); probe_uart401() 323 spin_unlock_irqrestore(&devc->lock,flags); probe_uart401() 331 if (devc->irq < 0) { probe_uart401() 332 devc->share_irq = 1; probe_uart401() 333 devc->irq *= -1; probe_uart401() 335 devc->share_irq = 0; probe_uart401() 337 if (!devc->share_irq) probe_uart401() 338 if (request_irq(devc->irq, uart401intr, 0, "MPU-401 UART", devc) < 0) { probe_uart401() 339 printk(KERN_WARNING "uart401: Failed to allocate IRQ%d\n", devc->irq); probe_uart401() 340 devc->share_irq = 1; probe_uart401() 342 devc->my_dev = sound_alloc_mididev(); probe_uart401() 343 enter_uart_mode(devc); probe_uart401() 345 if (devc->my_dev == -1) { probe_uart401() 350 midi_devs[devc->my_dev] = kmemdup(&uart401_operations, probe_uart401() 353 if (!midi_devs[devc->my_dev]) { probe_uart401() 359 midi_devs[devc->my_dev]->owner = owner; probe_uart401() 361 midi_devs[devc->my_dev]->devc = devc; probe_uart401() 362 midi_devs[devc->my_dev]->converter = kmemdup(&std_midi_synth, probe_uart401() 366 if (!midi_devs[devc->my_dev]->converter) { probe_uart401() 370 strcpy(midi_devs[devc->my_dev]->info.name, name); probe_uart401() 371 midi_devs[devc->my_dev]->converter->id = "UART401"; probe_uart401() 372 midi_devs[devc->my_dev]->converter->midi_dev = devc->my_dev; probe_uart401() 375 midi_devs[devc->my_dev]->converter->owner = owner; probe_uart401() 377 hw_config->slots[4] = devc->my_dev; probe_uart401() 379 devc->opened = 0; probe_uart401() 382 kfree(midi_devs[devc->my_dev]); probe_uart401() 384 sound_unload_mididev(devc->my_dev); probe_uart401() 386 if (!devc->share_irq) probe_uart401() 387 free_irq(devc->irq, devc); probe_uart401() 389 kfree(devc); probe_uart401() 397 struct uart401_devc *devc; unload_uart401() local 406 devc = midi_devs[hw_config->slots[4]]->devc; unload_uart401() 407 if (devc == NULL) unload_uart401() 410 reset_uart401(devc); unload_uart401() 413 if (!devc->share_irq) unload_uart401() 414 free_irq(devc->irq, devc); unload_uart401() 415 kfree(midi_devs[devc->my_dev]->converter); unload_uart401() 416 kfree(midi_devs[devc->my_dev]); unload_uart401() 417 kfree(devc); unload_uart401()
|
H A D | sb_audio.c | 36 sb_devc *devc = audio_devs[dev]->devc; sb_audio_open() local 39 if (devc == NULL) sb_audio_open() 44 if (devc->caps & SB_NO_RECORDING && mode & OPEN_READ) sb_audio_open() 49 spin_lock_irqsave(&devc->lock, flags); sb_audio_open() 50 if (devc->opened) sb_audio_open() 52 spin_unlock_irqrestore(&devc->lock, flags); sb_audio_open() 55 if (devc->dma16 != -1 && devc->dma16 != devc->dma8 && !devc->duplex) sb_audio_open() 57 if (sound_open_dma(devc->dma16, "Sound Blaster 16 bit")) sb_audio_open() 59 spin_unlock_irqrestore(&devc->lock, flags); sb_audio_open() 63 devc->opened = mode; sb_audio_open() 64 spin_unlock_irqrestore(&devc->lock, flags); sb_audio_open() 66 devc->irq_mode = IMODE_NONE; sb_audio_open() 67 devc->irq_mode_16 = IMODE_NONE; sb_audio_open() 68 devc->fullduplex = devc->duplex && sb_audio_open() 70 sb_dsp_reset(devc); sb_audio_open() 74 * cause devc->iomap has no register mapping for RECLEV sb_audio_open() 76 if (devc->model == MDL_ESS) ess_mixer_reload (devc, SOUND_MIXER_RECLEV); sb_audio_open() 85 if (devc->submodel == SUBMDL_ALS007) sb_audio_open() 88 sb_setmixer(devc,ALS007_OUTPUT_CTRL2, sb_audio_open() 89 sb_getmixer(devc,ALS007_OUTPUT_CTRL2) & 0xf9); sb_audio_open() 91 sb_setmixer(devc,ALS007_OUTPUT_CTRL2, sb_audio_open() 92 sb_getmixer(devc,ALS007_OUTPUT_CTRL2) | 0x06); sb_audio_open() 99 sb_devc *devc = audio_devs[dev]->devc; sb_audio_close() local 102 if(devc->duplex sb_audio_close() 103 && !devc->fullduplex sb_audio_close() 104 && (devc->opened & OPEN_READ) && (devc->opened & OPEN_WRITE)) sb_audio_close() 107 audio_devs[dev]->dmap_out->dma = devc->dma8; sb_audio_close() 108 audio_devs[dev]->dmap_in->dma = ( devc->duplex ) ? sb_audio_close() 109 devc->dma16 : devc->dma8; sb_audio_close() 111 if (devc->dma16 != -1 && devc->dma16 != devc->dma8 && !devc->duplex) sb_audio_close() 112 sound_close_dma(devc->dma16); sb_audio_close() 116 if ((devc->submodel == SUBMDL_ALS007) && (devc->opened & OPEN_READ)) sb_audio_close() 118 sb_setmixer(devc,ALS007_OUTPUT_CTRL2, sb_audio_close() 119 sb_getmixer(devc,ALS007_OUTPUT_CTRL2) | 0x06); sb_audio_close() 121 devc->opened = 0; sb_audio_close() 127 sb_devc *devc = audio_devs[dev]->devc; sb_set_output_parms() local 129 if (!devc->fullduplex || devc->bits == AFMT_S16_LE) sb_set_output_parms() 131 devc->trg_buf = buf; sb_set_output_parms() 132 devc->trg_bytes = nr_bytes; sb_set_output_parms() 133 devc->trg_intrflag = intrflag; sb_set_output_parms() 134 devc->irq_mode = IMODE_OUTPUT; sb_set_output_parms() 138 devc->trg_buf_16 = buf; sb_set_output_parms() 139 devc->trg_bytes_16 = nr_bytes; sb_set_output_parms() 140 devc->trg_intrflag_16 = intrflag; sb_set_output_parms() 141 devc->irq_mode_16 = IMODE_OUTPUT; sb_set_output_parms() 147 sb_devc *devc = audio_devs[dev]->devc; sb_set_input_parms() local 149 if (!devc->fullduplex || devc->bits != AFMT_S16_LE) sb_set_input_parms() 151 devc->trg_buf = buf; sb_set_input_parms() 152 devc->trg_bytes = count; sb_set_input_parms() 153 devc->trg_intrflag = intrflag; sb_set_input_parms() 154 devc->irq_mode = IMODE_INPUT; sb_set_input_parms() 158 devc->trg_buf_16 = buf; sb_set_input_parms() 159 devc->trg_bytes_16 = count; sb_set_input_parms() 160 devc->trg_intrflag_16 = intrflag; sb_set_input_parms() 161 devc->irq_mode_16 = IMODE_INPUT; sb_set_input_parms() 173 sb_devc *devc = audio_devs[dev]->devc; sb1_audio_output_block() local 181 devc->irq_mode = IMODE_OUTPUT; sb1_audio_output_block() 183 spin_lock_irqsave(&devc->lock, flags); sb1_audio_output_block() 184 if (sb_dsp_command(devc, 0x14)) /* 8 bit DAC using DMA */ sb1_audio_output_block() 186 sb_dsp_command(devc, (unsigned char) (count & 0xff)); sb1_audio_output_block() 187 sb_dsp_command(devc, (unsigned char) ((count >> 8) & 0xff)); sb1_audio_output_block() 191 spin_unlock_irqrestore(&devc->lock, flags); sb1_audio_output_block() 192 devc->intr_active = 1; sb1_audio_output_block() 199 sb_devc *devc = audio_devs[dev]->devc; sb1_audio_start_input() local 211 devc->irq_mode = IMODE_INPUT; sb1_audio_start_input() 213 spin_lock_irqsave(&devc->lock, flags); sb1_audio_start_input() 214 if (sb_dsp_command(devc, 0x24)) /* 8 bit ADC using DMA */ sb1_audio_start_input() 216 sb_dsp_command(devc, (unsigned char) (count & 0xff)); sb1_audio_start_input() 217 sb_dsp_command(devc, (unsigned char) ((count >> 8) & 0xff)); sb1_audio_start_input() 221 spin_unlock_irqrestore(&devc->lock, flags); sb1_audio_start_input() 223 devc->intr_active = 1; sb1_audio_start_input() 228 sb_devc *devc = audio_devs[dev]->devc; sb1_audio_trigger() local 230 bits &= devc->irq_mode; sb1_audio_trigger() 233 sb_dsp_command(devc, 0xd0); /* Halt DMA */ sb1_audio_trigger() 236 switch (devc->irq_mode) sb1_audio_trigger() 239 sb1_audio_start_input(dev, devc->trg_buf, devc->trg_bytes, sb1_audio_trigger() 240 devc->trg_intrflag); sb1_audio_trigger() 244 sb1_audio_output_block(dev, devc->trg_buf, devc->trg_bytes, sb1_audio_trigger() 245 devc->trg_intrflag); sb1_audio_trigger() 249 devc->trigger_bits = bits; sb1_audio_trigger() 254 sb_devc *devc = audio_devs[dev]->devc; sb1_audio_prepare_for_input() local 257 spin_lock_irqsave(&devc->lock, flags); sb1_audio_prepare_for_input() 258 if (sb_dsp_command(devc, 0x40)) sb1_audio_prepare_for_input() 259 sb_dsp_command(devc, devc->tconst); sb1_audio_prepare_for_input() 260 sb_dsp_command(devc, DSP_CMD_SPKOFF); sb1_audio_prepare_for_input() 261 spin_unlock_irqrestore(&devc->lock, flags); sb1_audio_prepare_for_input() 263 devc->trigger_bits = 0; sb1_audio_prepare_for_input() 269 sb_devc *devc = audio_devs[dev]->devc; sb1_audio_prepare_for_output() local 272 spin_lock_irqsave(&devc->lock, flags); sb1_audio_prepare_for_output() 273 if (sb_dsp_command(devc, 0x40)) sb1_audio_prepare_for_output() 274 sb_dsp_command(devc, devc->tconst); sb1_audio_prepare_for_output() 275 sb_dsp_command(devc, DSP_CMD_SPKON); sb1_audio_prepare_for_output() 276 spin_unlock_irqrestore(&devc->lock, flags); sb1_audio_prepare_for_output() 277 devc->trigger_bits = 0; sb1_audio_prepare_for_output() 284 sb_devc *devc = audio_devs[dev]->devc; sb1_audio_set_speed() local 287 if (devc->opened & OPEN_READ) sb1_audio_set_speed() 298 devc->tconst = (256 - ((1000000 + speed / 2) / speed)) & 0xff; sb1_audio_set_speed() 299 tmp = 256 - devc->tconst; sb1_audio_set_speed() 302 devc->speed = speed; sb1_audio_set_speed() 304 return devc->speed; sb1_audio_set_speed() 309 sb_devc *devc = audio_devs[dev]->devc; sb1_audio_set_channels() local 310 return devc->channels = 1; sb1_audio_set_channels() 315 sb_devc *devc = audio_devs[dev]->devc; sb1_audio_set_bits() local 316 return devc->bits = 8; sb1_audio_set_bits() 322 sb_devc *devc = audio_devs[dev]->devc; sb1_audio_halt_xfer() local 324 spin_lock_irqsave(&devc->lock, flags); sb1_audio_halt_xfer() 325 sb_dsp_reset(devc); sb1_audio_halt_xfer() 326 spin_unlock_irqrestore(&devc->lock, flags); sb1_audio_halt_xfer() 338 sb_devc *devc = audio_devs[dev]->devc; sb20_audio_output_block() local 347 devc->irq_mode = IMODE_OUTPUT; sb20_audio_output_block() 349 spin_lock_irqsave(&devc->lock, flags); sb20_audio_output_block() 350 if (sb_dsp_command(devc, 0x48)) /* DSP Block size */ sb20_audio_output_block() 352 sb_dsp_command(devc, (unsigned char) (count & 0xff)); sb20_audio_output_block() 353 sb_dsp_command(devc, (unsigned char) ((count >> 8) & 0xff)); sb20_audio_output_block() 355 if (devc->speed * devc->channels <= 23000) sb20_audio_output_block() 360 if (!sb_dsp_command(devc, cmd)) sb20_audio_output_block() 365 spin_unlock_irqrestore(&devc->lock, flags); sb20_audio_output_block() 366 devc->intr_active = 1; sb20_audio_output_block() 373 sb_devc *devc = audio_devs[dev]->devc; sb20_audio_start_input() local 386 devc->irq_mode = IMODE_INPUT; sb20_audio_start_input() 388 spin_lock_irqsave(&devc->lock, flags); sb20_audio_start_input() 389 if (sb_dsp_command(devc, 0x48)) /* DSP Block size */ sb20_audio_start_input() 391 sb_dsp_command(devc, (unsigned char) (count & 0xff)); sb20_audio_start_input() 392 sb_dsp_command(devc, (unsigned char) ((count >> 8) & 0xff)); sb20_audio_start_input() 394 if (devc->speed * devc->channels <= (devc->major == 3 ? 23000 : 13000)) sb20_audio_start_input() 399 if (!sb_dsp_command(devc, cmd)) sb20_audio_start_input() 404 spin_unlock_irqrestore(&devc->lock, flags); sb20_audio_start_input() 405 devc->intr_active = 1; sb20_audio_start_input() 410 sb_devc *devc = audio_devs[dev]->devc; sb20_audio_trigger() local 411 bits &= devc->irq_mode; sb20_audio_trigger() 414 sb_dsp_command(devc, 0xd0); /* Halt DMA */ sb20_audio_trigger() 417 switch (devc->irq_mode) sb20_audio_trigger() 420 sb20_audio_start_input(dev, devc->trg_buf, devc->trg_bytes, sb20_audio_trigger() 421 devc->trg_intrflag); sb20_audio_trigger() 425 sb20_audio_output_block(dev, devc->trg_buf, devc->trg_bytes, sb20_audio_trigger() 426 devc->trg_intrflag); sb20_audio_trigger() 430 devc->trigger_bits = bits; sb20_audio_trigger() 439 sb_devc *devc = audio_devs[dev]->devc; sb201_audio_set_speed() local 449 if (devc->opened & OPEN_READ && speed > 15000) sb201_audio_set_speed() 451 s = speed * devc->channels; sb201_audio_set_speed() 452 devc->tconst = (256 - ((1000000 + s / 2) / s)) & 0xff; sb201_audio_set_speed() 453 tmp = 256 - devc->tconst; sb201_audio_set_speed() 454 speed = ((1000000 + tmp / 2) / tmp) / devc->channels; sb201_audio_set_speed() 456 devc->speed = speed; sb201_audio_set_speed() 458 return devc->speed; sb201_audio_set_speed() 467 sb_devc *devc = audio_devs[dev]->devc; sbpro_audio_prepare_for_input() local 471 if (devc->dma16 >= 0 && devc->dma16 != devc->dma8) sbpro_audio_prepare_for_input() 473 devc->bits == 16 ? devc->dma16 : devc->dma8; sbpro_audio_prepare_for_input() 475 if (devc->model == MDL_JAZZ || devc->model == MDL_SMW) sbpro_audio_prepare_for_input() 476 if (devc->bits == AFMT_S16_LE) sbpro_audio_prepare_for_input() 479 spin_lock_irqsave(&devc->lock, flags); sbpro_audio_prepare_for_input() 480 if (sb_dsp_command(devc, 0x40)) sbpro_audio_prepare_for_input() 481 sb_dsp_command(devc, devc->tconst); sbpro_audio_prepare_for_input() 482 sb_dsp_command(devc, DSP_CMD_SPKOFF); sbpro_audio_prepare_for_input() 483 if (devc->channels == 1) sbpro_audio_prepare_for_input() 484 sb_dsp_command(devc, 0xa0 | bits); /* Mono input */ sbpro_audio_prepare_for_input() 486 sb_dsp_command(devc, 0xa8 | bits); /* Stereo input */ sbpro_audio_prepare_for_input() 487 spin_unlock_irqrestore(&devc->lock, flags); sbpro_audio_prepare_for_input() 489 devc->trigger_bits = 0; sbpro_audio_prepare_for_input() 495 sb_devc *devc = audio_devs[dev]->devc; sbpro_audio_prepare_for_output() local 500 if (devc->dma16 >= 0 && devc->dma16 != devc->dma8) sbpro_audio_prepare_for_output() 501 audio_devs[dev]->dmap_out->dma = audio_devs[dev]->dmap_in->dma = devc->bits == 16 ? devc->dma16 : devc->dma8; sbpro_audio_prepare_for_output() 502 if (devc->model == MDL_SBPRO) sbpro_audio_prepare_for_output() 503 sb_mixer_set_stereo(devc, devc->channels == 2); sbpro_audio_prepare_for_output() 505 spin_lock_irqsave(&devc->lock, flags); sbpro_audio_prepare_for_output() 506 if (sb_dsp_command(devc, 0x40)) sbpro_audio_prepare_for_output() 507 sb_dsp_command(devc, devc->tconst); sbpro_audio_prepare_for_output() 508 sb_dsp_command(devc, DSP_CMD_SPKON); sbpro_audio_prepare_for_output() 510 if (devc->model == MDL_JAZZ || devc->model == MDL_SMW) sbpro_audio_prepare_for_output() 512 if (devc->bits == AFMT_S16_LE) sbpro_audio_prepare_for_output() 515 if (devc->channels == 1) sbpro_audio_prepare_for_output() 516 sb_dsp_command(devc, 0xa0 | bits); /* Mono output */ sbpro_audio_prepare_for_output() 518 sb_dsp_command(devc, 0xa8 | bits); /* Stereo output */ sbpro_audio_prepare_for_output() 519 spin_unlock_irqrestore(&devc->lock, flags); sbpro_audio_prepare_for_output() 523 spin_unlock_irqrestore(&devc->lock, flags); sbpro_audio_prepare_for_output() 524 tmp = sb_getmixer(devc, 0x0e); sbpro_audio_prepare_for_output() 525 if (devc->channels == 1) sbpro_audio_prepare_for_output() 529 sb_setmixer(devc, 0x0e, tmp); sbpro_audio_prepare_for_output() 531 devc->trigger_bits = 0; sbpro_audio_prepare_for_output() 537 sb_devc *devc = audio_devs[dev]->devc; sbpro_audio_set_speed() local 545 if (devc->channels > 1 && speed > 22050) sbpro_audio_set_speed() 549 return devc->speed; sbpro_audio_set_speed() 554 sb_devc *devc = audio_devs[dev]->devc; sbpro_audio_set_channels() local 558 if (channels != devc->channels) sbpro_audio_set_channels() 560 devc->channels = channels; sbpro_audio_set_channels() 561 if (devc->model == MDL_SBPRO && devc->channels == 2) sbpro_audio_set_channels() 562 sbpro_audio_set_speed(dev, devc->speed); sbpro_audio_set_channels() 565 return devc->channels; sbpro_audio_set_channels() 570 sb_devc *devc = audio_devs[dev]->devc; jazz16_audio_set_speed() local 582 s = speed * devc->channels; jazz16_audio_set_speed() 584 devc->tconst = (256 - ((1000000 + s / 2) / s)) & 0xff; jazz16_audio_set_speed() 586 tmp = 256 - devc->tconst; jazz16_audio_set_speed() 587 speed = ((1000000 + tmp / 2) / tmp) / devc->channels; jazz16_audio_set_speed() 589 devc->speed = speed; jazz16_audio_set_speed() 591 return devc->speed; jazz16_audio_set_speed() 600 sb_devc *devc = audio_devs[dev]->devc; sb16_audio_set_speed() local 601 int max_speed = devc->submodel == SUBMDL_ALS100 ? 48000 : 44100; sb16_audio_set_speed() 611 devc->speed = speed; sb16_audio_set_speed() 613 return devc->speed; sb16_audio_set_speed() 618 sb_devc *devc = audio_devs[dev]->devc; sb16_audio_set_bits() local 623 devc->bits = bits; sb16_audio_set_bits() 625 devc->bits = AFMT_U8; sb16_audio_set_bits() 628 return devc->bits; sb16_audio_set_bits() 633 sb_devc *devc = audio_devs[dev]->devc; sb16_audio_prepare_for_input() local 635 if (!devc->fullduplex) sb16_audio_prepare_for_input() 639 devc->bits == AFMT_S16_LE ? sb16_audio_prepare_for_input() 640 devc->dma16 : devc->dma8; sb16_audio_prepare_for_input() 642 else if (devc->bits == AFMT_S16_LE) sb16_audio_prepare_for_input() 644 audio_devs[dev]->dmap_out->dma = devc->dma8; sb16_audio_prepare_for_input() 645 audio_devs[dev]->dmap_in->dma = devc->dma16; sb16_audio_prepare_for_input() 649 audio_devs[dev]->dmap_out->dma = devc->dma16; sb16_audio_prepare_for_input() 650 audio_devs[dev]->dmap_in->dma = devc->dma8; sb16_audio_prepare_for_input() 653 devc->trigger_bits = 0; sb16_audio_prepare_for_input() 659 sb_devc *devc = audio_devs[dev]->devc; sb16_audio_prepare_for_output() local 661 if (!devc->fullduplex) sb16_audio_prepare_for_output() 665 devc->bits == AFMT_S16_LE ? sb16_audio_prepare_for_output() 666 devc->dma16 : devc->dma8; sb16_audio_prepare_for_output() 668 else if (devc->bits == AFMT_S16_LE) sb16_audio_prepare_for_output() 670 audio_devs[dev]->dmap_out->dma = devc->dma8; sb16_audio_prepare_for_output() 671 audio_devs[dev]->dmap_in->dma = devc->dma16; sb16_audio_prepare_for_output() 675 audio_devs[dev]->dmap_out->dma = devc->dma16; sb16_audio_prepare_for_output() 676 audio_devs[dev]->dmap_in->dma = devc->dma8; sb16_audio_prepare_for_output() 679 devc->trigger_bits = 0; sb16_audio_prepare_for_output() 687 sb_devc *devc = audio_devs[dev]->devc; sb16_audio_output_block() local 690 if (!devc->fullduplex || devc->bits == AFMT_S16_LE) sb16_audio_output_block() 692 devc->irq_mode = IMODE_OUTPUT; sb16_audio_output_block() 693 devc->intr_active = 1; sb16_audio_output_block() 697 devc->irq_mode_16 = IMODE_OUTPUT; sb16_audio_output_block() 698 devc->intr_active_16 = 1; sb16_audio_output_block() 702 spin_lock_irqsave(&devc->lock, flags); sb16_audio_output_block() 703 bits = devc->bits; sb16_audio_output_block() 704 if (devc->fullduplex) sb16_audio_output_block() 705 devc->bits = (devc->bits == AFMT_S16_LE) ? sb16_audio_output_block() 707 spin_unlock_irqrestore(&devc->lock, flags); sb16_audio_output_block() 710 if (devc->bits == AFMT_S16_LE) sb16_audio_output_block() 714 spin_lock_irqsave(&devc->lock, flags); sb16_audio_output_block() 718 sb_dsp_command(devc, 0x41); sb16_audio_output_block() 719 sb_dsp_command(devc, (unsigned char) ((devc->speed >> 8) & 0xff)); sb16_audio_output_block() 720 sb_dsp_command(devc, (unsigned char) (devc->speed & 0xff)); sb16_audio_output_block() 722 sb_dsp_command(devc, (devc->bits == AFMT_S16_LE ? 0xb6 : 0xc6)); sb16_audio_output_block() 723 sb_dsp_command(devc, ((devc->channels == 2 ? 0x20 : 0) + sb16_audio_output_block() 724 (devc->bits == AFMT_S16_LE ? 0x10 : 0))); sb16_audio_output_block() 725 sb_dsp_command(devc, (unsigned char) (cnt & 0xff)); sb16_audio_output_block() 726 sb_dsp_command(devc, (unsigned char) (cnt >> 8)); sb16_audio_output_block() 729 devc->bits = bits; sb16_audio_output_block() 730 spin_unlock_irqrestore(&devc->lock, flags); sb16_audio_output_block() 744 sb_devc *devc = audio_devs[dev]->devc; sb16_audio_start_input() local 746 if (!devc->fullduplex || devc->bits != AFMT_S16_LE) sb16_audio_start_input() 748 devc->irq_mode = IMODE_INPUT; sb16_audio_start_input() 749 devc->intr_active = 1; sb16_audio_start_input() 753 devc->irq_mode_16 = IMODE_INPUT; sb16_audio_start_input() 754 devc->intr_active_16 = 1; sb16_audio_start_input() 758 if (devc->bits == AFMT_S16_LE) sb16_audio_start_input() 762 spin_lock_irqsave(&devc->lock, flags); sb16_audio_start_input() 766 sb_dsp_command(devc, 0x42); sb16_audio_start_input() 767 sb_dsp_command(devc, (unsigned char) ((devc->speed >> 8) & 0xff)); sb16_audio_start_input() 768 sb_dsp_command(devc, (unsigned char) (devc->speed & 0xff)); sb16_audio_start_input() 770 sb_dsp_command(devc, (devc->bits == AFMT_S16_LE ? 0xbe : 0xce)); sb16_audio_start_input() 771 sb_dsp_command(devc, ((devc->channels == 2 ? 0x20 : 0) + sb16_audio_start_input() 772 (devc->bits == AFMT_S16_LE ? 0x10 : 0))); sb16_audio_start_input() 773 sb_dsp_command(devc, (unsigned char) (cnt & 0xff)); sb16_audio_start_input() 774 sb_dsp_command(devc, (unsigned char) (cnt >> 8)); sb16_audio_start_input() 776 spin_unlock_irqrestore(&devc->lock, flags); sb16_audio_start_input() 781 sb_devc *devc = audio_devs[dev]->devc; sb16_audio_trigger() local 783 int bits_16 = bits & devc->irq_mode_16; sb16_audio_trigger() 784 bits &= devc->irq_mode; sb16_audio_trigger() 787 sb_dsp_command(devc, 0xd0); /* Halt DMA */ sb16_audio_trigger() 792 switch (devc->irq_mode) sb16_audio_trigger() 796 devc->trg_buf, sb16_audio_trigger() 797 devc->trg_bytes, sb16_audio_trigger() 798 devc->trg_intrflag); sb16_audio_trigger() 803 devc->trg_buf, sb16_audio_trigger() 804 devc->trg_bytes, sb16_audio_trigger() 805 devc->trg_intrflag); sb16_audio_trigger() 811 switch (devc->irq_mode_16) sb16_audio_trigger() 815 devc->trg_buf_16, sb16_audio_trigger() 816 devc->trg_bytes_16, sb16_audio_trigger() 817 devc->trg_intrflag_16); sb16_audio_trigger() 822 devc->trg_buf_16, sb16_audio_trigger() 823 devc->trg_bytes_16, sb16_audio_trigger() 824 devc->trg_intrflag_16); sb16_audio_trigger() 830 devc->trigger_bits = bits | bits_16; sb16_audio_trigger() 844 sb_devc *devc = audio_devs[dev]->devc; sb16_copy_from_user() local 850 if (!devc->fullduplex) sb16_copy_from_user() 858 else if (devc->bits == AFMT_S16_LE) sb16_copy_from_user() 924 sb_devc *devc = audio_devs[dev]->devc; sb16_audio_mmap() local 925 devc->fullduplex = 0; sb16_audio_mmap() 1026 void sb_audio_init(sb_devc * devc, char *name, struct module *owner) sb_audio_init() argument 1033 switch (devc->model) sb_audio_init() 1062 driver = ess_audio_init (devc, &audio_flags, &format_mask); sb_audio_init() 1069 if (devc->dma8 != devc->dma16 && devc->dma16 != -1) sb_audio_init() 1072 devc->duplex = 1; sb_audio_init() 1086 if ((devc->dev = sound_install_audiodrv(AUDIO_DRIVER_VERSION, sb_audio_init() 1088 audio_flags, format_mask, devc, sb_audio_init() 1089 devc->dma8, sb_audio_init() 1090 devc->duplex ? devc->dma16 : devc->dma8)) < 0) sb_audio_init() 1095 audio_devs[devc->dev]->mixer_dev = devc->my_mixerdev; sb_audio_init() 1096 audio_devs[devc->dev]->min_fragment = 5; sb_audio_init()
|
H A D | sb_mixer.c | 222 static void sb_mixer_reset(sb_devc * devc); 224 void sb_mixer_set_stereo(sb_devc * devc, int mode) sb_mixer_set_stereo() argument 226 sb_chgmixer(devc, OUT_FILTER, STEREO_DAC, (mode ? STEREO_DAC : MONO_DAC)); sb_mixer_set_stereo() 229 static int detect_mixer(sb_devc * devc) detect_mixer() argument 235 static void oss_change_bits(sb_devc *devc, unsigned char *regval, int dev, int chn, int newval) oss_change_bits() argument 240 mask = (1 << (*devc->iomap)[dev][chn].nbits) - 1; oss_change_bits() 243 shift = (*devc->iomap)[dev][chn].bitoffs - (*devc->iomap)[dev][LEFT_CHN].nbits + 1; oss_change_bits() 249 static int sb_mixer_get(sb_devc * devc, int dev) sb_mixer_get() argument 251 if (!((1 << dev) & devc->supported_devices)) sb_mixer_get() 253 return devc->levels[dev]; sb_mixer_get() 256 void smw_mixer_init(sb_devc * devc) smw_mixer_init() argument 260 sb_setmixer(devc, 0x00, 0x18); /* Mute unused (Telephone) line */ smw_mixer_init() 261 sb_setmixer(devc, 0x10, 0x38); /* Config register 2 */ smw_mixer_init() 263 devc->supported_devices = 0; smw_mixer_init() 266 devc->supported_devices |= (1 << i); smw_mixer_init() 268 devc->supported_rec_devices = devc->supported_devices & smw_mixer_init() 270 sb_mixer_reset(devc); smw_mixer_init() 273 int sb_common_mixer_set(sb_devc * devc, int dev, int left, int right) sb_common_mixer_set() argument 278 if ((dev < 0) || (dev >= devc->iomap_sz)) sb_common_mixer_set() 281 regoffs = (*devc->iomap)[dev][LEFT_CHN].regno; sb_common_mixer_set() 286 val = sb_getmixer(devc, regoffs); sb_common_mixer_set() 287 oss_change_bits(devc, &val, dev, LEFT_CHN, left); sb_common_mixer_set() 289 if ((*devc->iomap)[dev][RIGHT_CHN].regno != regoffs) /* sb_common_mixer_set() 293 sb_setmixer(devc, regoffs, val); /* sb_common_mixer_set() 296 regoffs = (*devc->iomap)[dev][RIGHT_CHN].regno; sb_common_mixer_set() 303 val = sb_getmixer(devc, regoffs); /* sb_common_mixer_set() 307 oss_change_bits(devc, &val, dev, RIGHT_CHN, right); sb_common_mixer_set() 309 sb_setmixer(devc, regoffs, val); sb_common_mixer_set() 314 static int smw_mixer_set(sb_devc * devc, int dev, int left, int right) smw_mixer_set() argument 321 sb_setmixer(devc, 0x0b, 96 - (96 * left / 100)); /* 96=mute, 0=max */ smw_mixer_set() 322 sb_setmixer(devc, 0x0c, 96 - (96 * right / 100)); smw_mixer_set() 327 devc->levels[dev] = left | (right << 8); smw_mixer_set() 329 val = ((devc->levels[SOUND_MIXER_TREBLE] & 0xff) * 16 / (unsigned) 100) << 4; smw_mixer_set() 330 val |= ((devc->levels[SOUND_MIXER_BASS] & 0xff) * 16 / (unsigned) 100) & 0x0f; smw_mixer_set() 331 sb_setmixer(devc, 0x0d, val); smw_mixer_set() 334 val = (((devc->levels[SOUND_MIXER_TREBLE] >> 8) & 0xff) * 16 / (unsigned) 100) << 4; smw_mixer_set() 335 val |= (((devc->levels[SOUND_MIXER_BASS] >> 8) & 0xff) * 16 / (unsigned) 100) & 0x0f; smw_mixer_set() 336 sb_setmixer(devc, 0x0e, val); smw_mixer_set() 347 sb_setmixer(devc, reg, (24 - (24 * left / 100)) | 0x20); /* 24=mute, 0=max */ smw_mixer_set() 348 sb_setmixer(devc, reg + 1, (24 - (24 * right / 100)) | 0x40); smw_mixer_set() 351 devc->levels[dev] = left | (right << 8); smw_mixer_set() 355 static int sb_mixer_set(sb_devc * devc, int dev, int value) sb_mixer_set() argument 369 if (!(devc->supported_devices & (1 << dev))) /* sb_mixer_set() 375 switch (devc->model) { sb_mixer_set() 377 retval = smw_mixer_set(devc, dev, left, right); sb_mixer_set() 380 retval = ess_mixer_set(devc, dev, left, right); sb_mixer_set() 383 retval = sb_common_mixer_set(devc, dev, left, right); sb_mixer_set() 385 if (retval >= 0) devc->levels[dev] = retval; sb_mixer_set() 393 static void set_recsrc(sb_devc * devc, int src) set_recsrc() argument 395 sb_setmixer(devc, RECORD_SRC, (sb_getmixer(devc, RECORD_SRC) & ~7) | (src & 0x7)); set_recsrc() 398 static int set_recmask(sb_devc * devc, int mask) set_recmask() argument 403 devmask = mask & devc->supported_rec_devices; set_recmask() 405 switch (devc->model) set_recmask() 411 if (devc->model == MDL_ESS && ess_set_recmask (devc, &devmask)) { set_recmask() 422 devmask &= ~devc->recmask; set_recmask() 434 if (devmask ^ devc->recmask) /* set_recmask() 441 set_recsrc(devc, SRC__MIC); set_recmask() 445 set_recsrc(devc, SRC__LINE); set_recmask() 449 set_recsrc(devc, SRC__CD); set_recmask() 453 set_recsrc(devc, SRC__MIC); set_recmask() 462 if (devc->submodel == SUBMDL_ALS007) set_recmask() 467 sb_setmixer(devc, ALS007_RECORD_SRC, ALS007_LINE); set_recmask() 470 sb_setmixer(devc, ALS007_RECORD_SRC, ALS007_CD); set_recmask() 473 sb_setmixer(devc, ALS007_RECORD_SRC, ALS007_SYNTH); set_recmask() 476 sb_setmixer(devc, ALS007_RECORD_SRC, ALS007_MIC); set_recmask() 490 sb_setmixer (devc, SB16_IMASK_L, regimageL); set_recmask() 491 sb_setmixer (devc, SB16_IMASK_R, regimageR); set_recmask() 496 devc->recmask = devmask; set_recmask() 497 return devc->recmask; set_recmask() 500 static int set_outmask(sb_devc * devc, int mask) set_outmask() argument 505 devmask = mask & devc->supported_out_devices; set_outmask() 507 switch (devc->model) set_outmask() 510 if (devc->submodel == SUBMDL_ALS007) set_outmask() 521 sb_setmixer (devc, SB16_OMASK, regimage); set_outmask() 529 devc->outmask = devmask; set_outmask() 530 return devc->outmask; set_outmask() 535 sb_devc *devc = mixer_devs[dev]->devc; sb_mixer_ioctl() local 544 if (devc->model == MDL_SB16) { sb_mixer_ioctl() 549 sb_setmixer(devc, 0x43, (~val) & 0x01); sb_mixer_ioctl() 556 if (devc->minor < 15) sb_mixer_ioctl() 561 sb_chgmixer(devc, AWE_3DSE, 0x01, val); sb_mixer_ioctl() 564 ret = sb_getmixer(devc, AWE_3DSE)&0x01; sb_mixer_ioctl() 581 ret = set_recmask(devc, val); sb_mixer_ioctl() 585 ret = set_outmask(devc, val); sb_mixer_ioctl() 589 ret = sb_mixer_set(devc, cmd & 0xff, val); sb_mixer_ioctl() 595 ret = devc->recmask; sb_mixer_ioctl() 599 ret = devc->outmask; sb_mixer_ioctl() 603 ret = devc->supported_devices; sb_mixer_ioctl() 607 ret = devc->supported_devices; sb_mixer_ioctl() 609 if (devc->model == MDL_ESS) sb_mixer_ioctl() 611 else if (devc->model != MDL_JAZZ && devc->model != MDL_SMW) sb_mixer_ioctl() 616 ret = devc->supported_rec_devices; sb_mixer_ioctl() 620 ret = devc->supported_out_devices; sb_mixer_ioctl() 624 ret = devc->mixer_caps; sb_mixer_ioctl() 628 ret = sb_mixer_get(devc, cmd & 0xff); sb_mixer_ioctl() 652 static void sb_mixer_reset(sb_devc * devc) sb_mixer_reset() argument 657 sprintf(name, "SB_%d", devc->sbmixnum); sb_mixer_reset() 659 if (devc->sbmo.sm_games) sb_mixer_reset() 660 devc->levels = load_mixer_volumes(name, smg_default_levels, 1); sb_mixer_reset() 662 devc->levels = load_mixer_volumes(name, sb_default_levels, 1); sb_mixer_reset() 665 sb_mixer_set(devc, i, devc->levels[i]); sb_mixer_reset() 667 if (devc->model != MDL_ESS || !ess_mixer_reset (devc)) { sb_mixer_reset() 668 set_recmask(devc, SOUND_MASK_MIC); sb_mixer_reset() 672 int sb_mixer_init(sb_devc * devc, struct module *owner) sb_mixer_init() argument 677 devc->sbmixnum = sbmixnum++; sb_mixer_init() 678 devc->levels = NULL; sb_mixer_init() 680 sb_setmixer(devc, 0x00, 0); /* Reset mixer */ sb_mixer_init() 682 if (!(mixer_type = detect_mixer(devc))) sb_mixer_init() 685 switch (devc->model) sb_mixer_init() 692 devc->mixer_caps = SOUND_CAP_EXCL_INPUT; sb_mixer_init() 693 devc->supported_devices = SBPRO_MIXER_DEVICES; sb_mixer_init() 694 devc->supported_rec_devices = SBPRO_RECORDING_DEVICES; sb_mixer_init() 695 devc->iomap = &sbpro_mix; sb_mixer_init() 696 devc->iomap_sz = ARRAY_SIZE(sbpro_mix); sb_mixer_init() 700 ess_mixer_init (devc); sb_mixer_init() 704 devc->mixer_caps = SOUND_CAP_EXCL_INPUT; sb_mixer_init() 705 devc->supported_devices = 0; sb_mixer_init() 706 devc->supported_rec_devices = 0; sb_mixer_init() 707 devc->iomap = &sbpro_mix; sb_mixer_init() 708 devc->iomap_sz = ARRAY_SIZE(sbpro_mix); sb_mixer_init() 709 smw_mixer_init(devc); sb_mixer_init() 713 devc->mixer_caps = 0; sb_mixer_init() 714 devc->supported_rec_devices = SB16_RECORDING_DEVICES; sb_mixer_init() 715 devc->supported_out_devices = SB16_OUTFILTER_DEVICES; sb_mixer_init() 716 if (devc->submodel != SUBMDL_ALS007) sb_mixer_init() 718 devc->supported_devices = SB16_MIXER_DEVICES; sb_mixer_init() 719 devc->iomap = &sb16_mix; sb_mixer_init() 720 devc->iomap_sz = ARRAY_SIZE(sb16_mix); sb_mixer_init() 724 devc->supported_devices = ALS007_MIXER_DEVICES; sb_mixer_init() 725 devc->iomap = &als007_mix; sb_mixer_init() 726 devc->iomap_sz = ARRAY_SIZE(als007_mix); sb_mixer_init() 731 printk(KERN_WARNING "sb_mixer: Unsupported mixer type %d\n", devc->model); sb_mixer_init() 747 if (devc->submodel != SUBMDL_ALS007) sb_mixer_init() 752 mixer_devs[m]->devc = devc; sb_mixer_init() 757 devc->my_mixerdev = m; sb_mixer_init() 758 sb_mixer_reset(devc); sb_mixer_init() 762 void sb_mixer_unload(sb_devc *devc) sb_mixer_unload() argument 764 if (devc->my_mixerdev == -1) sb_mixer_unload() 767 kfree(mixer_devs[devc->my_mixerdev]); sb_mixer_unload() 768 sound_unload_mixerdev(devc->my_mixerdev); sb_mixer_unload()
|
H A D | sb_common.c | 86 int sb_dsp_command(sb_devc * devc, unsigned char val) sb_dsp_command() argument 113 int sb_dsp_get_byte(sb_devc * devc) sb_dsp_get_byte() argument 125 static void sb_intr (sb_devc *devc) sb_intr() argument 130 if (devc->model == MDL_SB16) sb_intr() 132 src = sb_getmixer(devc, IRQ_STAT); /* Interrupt source register */ sb_intr() 135 if(devc->midi_irq_cookie) sb_intr() 136 uart401intr(devc->irq, devc->midi_irq_cookie); sb_intr() 141 if (devc->intr_active && (!devc->fullduplex || (src & 0x01))) sb_intr() 143 switch (devc->irq_mode) sb_intr() 146 DMAbuf_outputintr(devc->dev, 1); sb_intr() 150 DMAbuf_inputintr(devc->dev); sb_intr() 157 sb_midi_interrupt(devc); sb_intr() 165 else if (devc->intr_active_16 && (src & 0x02)) sb_intr() 167 switch (devc->irq_mode_16) sb_intr() 170 DMAbuf_outputintr(devc->dev, 1); sb_intr() 174 DMAbuf_inputintr(devc->dev); sb_intr() 192 if (devc->model == MDL_SB16 && src & 0x02) sb_intr() 196 static void pci_intr(sb_devc *devc) pci_intr() argument 198 int src = inb(devc->pcibase+0x1A); pci_intr() 201 sb_intr(devc); pci_intr() 206 sb_devc *devc = dev_id; sbintr() local 208 devc->irq_ok = 1; sbintr() 210 switch (devc->model) { sbintr() 212 pci_intr (devc); sbintr() 216 ess_intr (devc); sbintr() 219 sb_intr (devc); sbintr() 225 int sb_dsp_reset(sb_devc * devc) sb_dsp_reset() argument 229 if (devc->model == MDL_ESS) return ess_dsp_reset (devc); sb_dsp_reset() 250 static void dsp_get_vers(sb_devc * devc) dsp_get_vers() argument 257 spin_lock_irqsave(&devc->lock, flags); dsp_get_vers() 258 devc->major = devc->minor = 0; dsp_get_vers() 259 sb_dsp_command(devc, 0xe1); /* Get version */ dsp_get_vers() 265 if (devc->major == 0) dsp_get_vers() 266 devc->major = inb(DSP_READ); dsp_get_vers() 269 devc->minor = inb(DSP_READ); dsp_get_vers() 274 spin_unlock_irqrestore(&devc->lock, flags); dsp_get_vers() 275 DDB(printk("DSP version %d.%02d\n", devc->major, devc->minor)); dsp_get_vers() 278 static int sb16_set_dma_hw(sb_devc * devc) sb16_set_dma_hw() argument 282 if (devc->dma8 != 0 && devc->dma8 != 1 && devc->dma8 != 3) sb16_set_dma_hw() 284 printk(KERN_ERR "SB16: Invalid 8 bit DMA (%d)\n", devc->dma8); sb16_set_dma_hw() 287 bits = (1 << devc->dma8); sb16_set_dma_hw() 289 if (devc->dma16 >= 5 && devc->dma16 <= 7) sb16_set_dma_hw() 290 bits |= (1 << devc->dma16); sb16_set_dma_hw() 292 sb_setmixer(devc, DMA_NR, bits); sb16_set_dma_hw() 296 static void sb16_set_mpu_port(sb_devc * devc, struct address_info *hw_config) sb16_set_mpu_port() argument 301 unsigned char bits = sb_getmixer(devc, 0x84) & ~0x06; sb16_set_mpu_port() 306 sb_setmixer(devc, 0x84, bits | 0x04); sb16_set_mpu_port() 310 sb_setmixer(devc, 0x84, bits | 0x00); sb16_set_mpu_port() 314 sb_setmixer(devc, 0x84, bits | 0x02); /* Disable MPU */ sb16_set_mpu_port() 319 static int sb16_set_irq_hw(sb_devc * devc, int level) sb16_set_irq_hw() argument 341 sb_setmixer(devc, IRQ_NR, ival); sb16_set_irq_hw() 345 static void relocate_Jazz16(sb_devc * devc, struct address_info *hw_config) relocate_Jazz16() argument 380 static int init_Jazz16(sb_devc * devc, struct address_info *hw_config) init_Jazz16() argument 388 if (!sb_dsp_command(devc, 0xfa)) init_Jazz16() 391 if (sb_dsp_get_byte(devc) != 0x12) init_Jazz16() 417 devc->dma16 = hw_config->dma2; init_Jazz16() 419 if (!sb_dsp_command(devc, 0xfb)) init_Jazz16() 422 if (!sb_dsp_command(devc, jazz_dma_bits[hw_config->dma] | init_Jazz16() 426 if (!sb_dsp_command(devc, jazz_irq_bits[hw_config->irq])) init_Jazz16() 432 devc->model = MDL_JAZZ; init_Jazz16() 436 devc->caps |= SB_NO_MIDI; init_Jazz16() 440 static void relocate_ess1688(sb_devc * devc) relocate_ess1688() argument 444 switch (devc->base) relocate_ess1688() 484 inb(devc->base); relocate_ess1688() 485 if (sb_dsp_reset(devc)) /* Bingo */ relocate_ess1688() 503 sb_devc *devc = &sb_info; sb_dsp_detect() local 508 if(sbmo) memcpy(&devc->sbmo, sbmo, sizeof(struct sb_module_options)); sb_dsp_detect() 520 spin_lock_init(&devc->lock); sb_dsp_detect() 521 devc->type = hw_config->card_subtype; sb_dsp_detect() 523 devc->base = hw_config->io_base; sb_dsp_detect() 524 devc->irq = hw_config->irq; sb_dsp_detect() 525 devc->dma8 = hw_config->dma; sb_dsp_detect() 527 devc->dma16 = -1; sb_dsp_detect() 528 devc->pcibase = pciio; sb_dsp_detect() 532 devc->model = MDL_ESSPCI; sb_dsp_detect() 533 devc->caps |= SB_PCI_IRQ; sb_dsp_detect() 540 devc->model = MDL_YMPCI; sb_dsp_detect() 541 devc->caps |= SB_PCI_IRQ; sb_dsp_detect() 548 if (devc->sbmo.acer) sb_dsp_detect() 552 spin_lock_irqsave(&devc->lock, flags); sb_dsp_detect() 553 inb(devc->base + 0x09); sb_dsp_detect() 554 inb(devc->base + 0x09); sb_dsp_detect() 555 inb(devc->base + 0x09); sb_dsp_detect() 556 inb(devc->base + 0x0b); sb_dsp_detect() 557 inb(devc->base + 0x09); sb_dsp_detect() 558 inb(devc->base + 0x0b); sb_dsp_detect() 559 inb(devc->base + 0x09); sb_dsp_detect() 560 inb(devc->base + 0x09); sb_dsp_detect() 561 inb(devc->base + 0x0b); sb_dsp_detect() 562 inb(devc->base + 0x09); sb_dsp_detect() 563 inb(devc->base + 0x00); sb_dsp_detect() 564 spin_unlock_irqrestore(&devc->lock, flags); sb_dsp_detect() 570 if (sb_dsp_reset(devc)) sb_dsp_detect() 571 dsp_get_vers(devc); sb_dsp_detect() 573 devc->major = 0; sb_dsp_detect() 575 if (devc->type == 0 || devc->type == MDL_JAZZ || devc->type == MDL_SMW) sb_dsp_detect() 576 if (devc->major == 0 || (devc->major == 3 && devc->minor == 1)) sb_dsp_detect() 577 relocate_Jazz16(devc, hw_config); sb_dsp_detect() 579 if (devc->major == 0 && (devc->type == MDL_ESS || devc->type == 0)) sb_dsp_detect() 580 relocate_ess1688(devc); sb_dsp_detect() 582 if (!sb_dsp_reset(devc)) sb_dsp_detect() 590 if (devc->major == 0) sb_dsp_detect() 591 dsp_get_vers(devc); sb_dsp_detect() 593 if (devc->major == 3 && devc->minor == 1) sb_dsp_detect() 595 if (devc->type == MDL_AZTECH) /* SG Washington? */ sb_dsp_detect() 597 if (sb_dsp_command(devc, 0x09)) sb_dsp_detect() 598 if (sb_dsp_command(devc, 0x00)) /* Enter WSS mode */ sb_dsp_detect() 605 devc->caps = SB_NO_AUDIO | SB_NO_MIDI; /* Mixer only */ sb_dsp_detect() 606 devc->model = MDL_AZTECH; sb_dsp_detect() 611 if(devc->type == MDL_ESSPCI) sb_dsp_detect() 612 devc->model = MDL_ESSPCI; sb_dsp_detect() 614 if(devc->type == MDL_YMPCI) sb_dsp_detect() 617 devc->model = MDL_YMPCI; sb_dsp_detect() 625 detected_devc = kmemdup(devc, sizeof(sb_devc), GFP_KERNEL); sb_dsp_detect() 631 MDB(printk(KERN_INFO "SB %d.%02d detected OK (%x)\n", devc->major, devc->minor, hw_config->io_base)); sb_dsp_detect() 637 sb_devc *devc; sb_dsp_init() local 653 devc = detected_devc; sb_dsp_init() 656 if (devc->base != hw_config->io_base) sb_dsp_init() 659 release_region(devc->base, 16); sb_dsp_init() 666 devc->caps = hw_config->driver_use_1; sb_dsp_init() 668 if (!((devc->caps & SB_NO_AUDIO) && (devc->caps & SB_NO_MIDI)) && hw_config->irq > 0) sb_dsp_init() 676 int i=(devc->caps&SB_PCI_IRQ)?IRQF_SHARED:0; sb_dsp_init() 678 if (request_irq(hw_config->irq, sbintr, i, "soundblaster", devc) < 0) sb_dsp_init() 681 release_region(devc->base, 16); sb_dsp_init() 684 devc->irq_ok = 0; sb_dsp_init() 686 if (devc->major == 4) sb_dsp_init() 687 if (!sb16_set_irq_hw(devc, devc->irq)) /* Unsupported IRQ */ sb_dsp_init() 689 free_irq(devc->irq, devc); sb_dsp_init() 690 release_region(devc->base, 16); sb_dsp_init() 693 if ((devc->type == 0 || devc->type == MDL_ESS) && sb_dsp_init() 694 devc->major == 3 && devc->minor == 1) sb_dsp_init() 696 if ((devc->type != 0 && devc->type != MDL_ESS) || sb_dsp_init() 697 !ess_init(devc, hw_config)) sb_dsp_init() 699 if ((devc->type != 0 && devc->type != MDL_JAZZ && sb_dsp_init() 700 devc->type != MDL_SMW) || !init_Jazz16(devc, hw_config)) sb_dsp_init() 706 if (devc->major == 4 && devc->minor <= 11 ) /* Won't work */ sb_dsp_init() 707 devc->irq_ok = 1; sb_dsp_init() 712 for (n = 0; n < 3 && devc->irq_ok == 0; n++) sb_dsp_init() 714 if (sb_dsp_command(devc, 0xf2)) /* Cause interrupt immediately */ sb_dsp_init() 718 for (i = 0; !devc->irq_ok && i < 10000; i++); sb_dsp_init() 721 if (!devc->irq_ok) sb_dsp_init() 722 printk(KERN_WARNING "sb: Interrupt test on IRQ%d failed - Probable IRQ conflict\n", devc->irq); sb_dsp_init() 725 DDB(printk("IRQ test OK (IRQ%d)\n", devc->irq)); sb_dsp_init() 730 last_sb = devc; sb_dsp_init() 732 switch (devc->major) sb_dsp_init() 735 devc->model = hw_config->card_subtype = MDL_SB1; sb_dsp_init() 739 if (devc->minor == 0) sb_dsp_init() 740 devc->model = hw_config->card_subtype = MDL_SB2; sb_dsp_init() 742 devc->model = hw_config->card_subtype = MDL_SB201; sb_dsp_init() 746 switch (devc->model) { sb_dsp_init() 748 devc->model = hw_config->card_subtype = MDL_SBPRO; sb_dsp_init() 753 ess_dsp_init(devc, hw_config); sb_dsp_init() 759 devc->model = hw_config->card_subtype = MDL_SB16; sb_dsp_init() 767 if ((devc->minor == 2) && sb_getmixer(devc,0x3c) && sb_getmixer(devc,0x4c)) sb_dsp_init() 769 mixer30 = sb_getmixer(devc,0x30); sb_dsp_init() 770 sb_setmixer(devc,0x22,(mixer22=sb_getmixer(devc,0x22)) & 0x0f); sb_dsp_init() 771 sb_setmixer(devc,0x30,0xff); sb_dsp_init() 774 if ((sb_getmixer(devc,0x30) != 0xff) || ((sb_getmixer(devc,0x22) & 0xf0) != 0x10)) sb_dsp_init() 776 devc->submodel = SUBMDL_ALS100; sb_dsp_init() 782 sb_setmixer(devc,0x3c,0x1f); /* Enable all inputs */ sb_dsp_init() 783 sb_setmixer(devc,0x4c,0x1f); sb_dsp_init() 784 sb_setmixer(devc,0x22,mixer22); /* Restore 0x22 to original value */ sb_dsp_init() 785 devc->submodel = SUBMDL_ALS007; sb_dsp_init() 789 sb_setmixer(devc,0x30,mixer30); sb_dsp_init() 795 devc->dma16 = devc->dma8; sb_dsp_init() 799 devc->dma16 = devc->dma8; sb_dsp_init() 802 devc->dma16 = hw_config->dma2; sb_dsp_init() 804 if(!sb16_set_dma_hw(devc)) { sb_dsp_init() 805 free_irq(devc->irq, devc); sb_dsp_init() 810 devc->caps |= SB_NO_MIDI; sb_dsp_init() 813 if (!(devc->caps & SB_NO_MIXER)) sb_dsp_init() 814 if (devc->major == 3 || devc->major == 4) sb_dsp_init() 815 sb_mixer_init(devc, owner); sb_dsp_init() 817 if (!(devc->caps & SB_NO_MIDI)) sb_dsp_init() 818 sb_dsp_midi_init(devc, owner); sb_dsp_init() 823 sprintf(name, "%s (%d.%02d)", hw_config->name, devc->major, devc->minor); sb_dsp_init() 833 if (devc->model <= MDL_SBPRO) sb_dsp_init() 835 if (devc->major == 3 && devc->minor != 1) /* "True" SB Pro should have v3.1 (rare ones may have 3.2). */ sb_dsp_init() 842 else if (!sb_be_quiet && devc->model == MDL_SBPRO) sb_dsp_init() 844 printk(KERN_INFO "SB DSP version is just %d.%02d which means that your card is\n", devc->major, devc->minor); sb_dsp_init() 849 hw_config->card_subtype = devc->model; sb_dsp_init() 850 hw_config->slots[0]=devc->dev; sb_dsp_init() 851 last_devc = devc; /* For SB MPU detection */ sb_dsp_init() 853 if (!(devc->caps & SB_NO_AUDIO) && devc->dma8 >= 0) sb_dsp_init() 855 if (sound_alloc_dma(devc->dma8, "SoundBlaster8")) sb_dsp_init() 857 printk(KERN_WARNING "Sound Blaster: Can't allocate 8 bit DMA channel %d\n", devc->dma8); sb_dsp_init() 859 if (devc->dma16 >= 0 && devc->dma16 != devc->dma8) sb_dsp_init() 861 if (sound_alloc_dma(devc->dma16, "SoundBlaster16")) sb_dsp_init() 862 printk(KERN_WARNING "Sound Blaster: can't allocate 16 bit DMA channel %d.\n", devc->dma16); sb_dsp_init() 864 sb_audio_init(devc, name, owner); sb_dsp_init() 865 hw_config->slots[0]=devc->dev; sb_dsp_init() 879 sb_devc *devc; sb_dsp_unload() local 881 devc = audio_devs[hw_config->slots[0]]->devc; sb_dsp_unload() 883 if (devc && devc->base == hw_config->io_base) sb_dsp_unload() 885 if ((devc->model & MDL_ESS) && devc->pcibase) sb_dsp_unload() 886 release_region(devc->pcibase, 8); sb_dsp_unload() 888 release_region(devc->base, 16); sb_dsp_unload() 890 if (!(devc->caps & SB_NO_AUDIO)) sb_dsp_unload() 892 sound_free_dma(devc->dma8); sb_dsp_unload() 893 if (devc->dma16 >= 0) sb_dsp_unload() 894 sound_free_dma(devc->dma16); sb_dsp_unload() 896 if (!(devc->caps & SB_NO_AUDIO && devc->caps & SB_NO_MIDI)) sb_dsp_unload() 898 if (devc->irq > 0) sb_dsp_unload() 899 free_irq(devc->irq, devc); sb_dsp_unload() 901 sb_mixer_unload(devc); sb_dsp_unload() 906 sound_unload_mididev(devc->my_mididev); sb_dsp_unload() 907 sound_unload_audiodev(devc->dev); sb_dsp_unload() 909 kfree(devc); sb_dsp_unload() 924 void sb_setmixer(sb_devc * devc, unsigned int port, unsigned int value) sb_setmixer() argument 928 if (devc->model == MDL_ESS) { sb_setmixer() 929 ess_setmixer (devc, port, value); sb_setmixer() 933 spin_lock_irqsave(&devc->lock, flags); sb_setmixer() 940 spin_unlock_irqrestore(&devc->lock, flags); sb_setmixer() 943 unsigned int sb_getmixer(sb_devc * devc, unsigned int port) sb_getmixer() argument 948 if (devc->model == MDL_ESS) return ess_getmixer (devc, port); sb_getmixer() 950 spin_lock_irqsave(&devc->lock, flags); sb_getmixer() 957 spin_unlock_irqrestore(&devc->lock, flags); sb_getmixer() 963 (sb_devc * devc, unsigned int reg, unsigned int mask, unsigned int val) sb_chgmixer() 967 value = sb_getmixer(devc, reg); sb_chgmixer() 969 sb_setmixer(devc, reg, value); sb_chgmixer() 976 static void smw_putmem(sb_devc * devc, int base, int addr, unsigned char val) smw_putmem() argument 989 static unsigned char smw_getmem(sb_devc * devc, int base, int addr) smw_getmem() argument 1004 static int smw_midi_init(sb_devc * devc, struct address_info *hw_config) smw_midi_init() argument 1027 smw_putmem(devc, mp_base, 0, 0x00); smw_midi_init() 1028 smw_putmem(devc, mp_base, 1, 0xff); smw_midi_init() 1031 if (smw_getmem(devc, mp_base, 0) != 0x00 || smw_getmem(devc, mp_base, 1) != 0xff) smw_midi_init() 1033 DDB(printk("SM Wave: No microcontroller RAM detected (%02x, %02x)\n", smw_getmem(devc, mp_base, 0), smw_getmem(devc, mp_base, 1))); smw_midi_init() 1040 devc->model = MDL_SMW; smw_midi_init() 1041 smw_mixer_init(devc); smw_midi_init() 1062 smw_putmem(devc, mp_base, i, smw_ucode[i]); smw_midi_init() 1069 if (smw_getmem(devc, mp_base, i) != smw_ucode[i]) smw_midi_init() 1109 static int init_Jazz16_midi(sb_devc * devc, struct address_info *hw_config) init_Jazz16_midi() argument 1112 int sb_base = devc->base; init_Jazz16_midi() 1167 smw_midi_init(devc, hw_config); init_Jazz16_midi() 1169 if (!sb_dsp_command(devc, 0xfb)) init_Jazz16_midi() 1172 if (!sb_dsp_command(devc, jazz_dma_bits[devc->dma8] | init_Jazz16_midi() 1173 (jazz_dma_bits[devc->dma16] << 4))) init_Jazz16_midi() 1176 if (!sb_dsp_command(devc, jazz_irq_bits[devc->irq] | init_Jazz16_midi() 1185 sb_devc *devc = last_devc; probe_sbmpu() local 1198 if(devc->model == MDL_SB16 && devc->minor >= 12) probe_sbmpu() 1200 unsigned char bits = sb_getmixer(devc, 0x84) & ~0x06; probe_sbmpu() 1201 sb_setmixer(devc, 0x84, bits | 0x02); /* Disable MPU */ probe_sbmpu() 1207 if (devc->model == MDL_ESS) probe_sbmpu() 1215 if (!ess_midi_init(devc, hw_config)) { probe_sbmpu() 1220 devc->midi_irq_cookie = NULL; probe_sbmpu() 1233 switch (devc->model) probe_sbmpu() 1242 if (hw_config->irq < 3 || hw_config->irq == devc->irq) probe_sbmpu() 1243 hw_config->irq = -devc->irq; probe_sbmpu() 1244 if (devc->minor > 12) /* What is Vibra's version??? */ probe_sbmpu() 1245 sb16_set_mpu_port(devc, hw_config); probe_sbmpu() 1249 if (hw_config->irq < 3 || hw_config->irq == devc->irq) probe_sbmpu() 1250 hw_config->irq = -devc->irq; probe_sbmpu() 1251 if (!init_Jazz16_midi(devc, hw_config)) probe_sbmpu() 1265 last_sb->midi_irq_cookie=midi_devs[hw_config->slots[4]]->devc; probe_sbmpu() 962 sb_chgmixer(sb_devc * devc, unsigned int reg, unsigned int mask, unsigned int val) sb_chgmixer() argument
|
H A D | sb_midi.c | 36 sb_devc *devc = midi_devs[dev]->devc; sb_midi_open() local 39 if (devc == NULL) sb_midi_open() 42 spin_lock_irqsave(&devc->lock, flags); sb_midi_open() 43 if (devc->opened) sb_midi_open() 45 spin_unlock_irqrestore(&devc->lock, flags); sb_midi_open() 48 devc->opened = 1; sb_midi_open() 49 spin_unlock_irqrestore(&devc->lock, flags); sb_midi_open() 51 devc->irq_mode = IMODE_MIDI; sb_midi_open() 52 devc->midi_broken = 0; sb_midi_open() 54 sb_dsp_reset(devc); sb_midi_open() 56 if (!sb_dsp_command(devc, 0x35)) /* Start MIDI UART mode */ sb_midi_open() 58 devc->opened = 0; sb_midi_open() 61 devc->intr_active = 1; sb_midi_open() 65 devc->input_opened = 1; sb_midi_open() 66 devc->midi_input_intr = input; sb_midi_open() 73 sb_devc *devc = midi_devs[dev]->devc; sb_midi_close() local 76 if (devc == NULL) sb_midi_close() 79 spin_lock_irqsave(&devc->lock, flags); sb_midi_close() 80 sb_dsp_reset(devc); sb_midi_close() 81 devc->intr_active = 0; sb_midi_close() 82 devc->input_opened = 0; sb_midi_close() 83 devc->opened = 0; sb_midi_close() 84 spin_unlock_irqrestore(&devc->lock, flags); sb_midi_close() 89 sb_devc *devc = midi_devs[dev]->devc; sb_midi_out() local 91 if (devc == NULL) sb_midi_out() 94 if (devc->midi_broken) sb_midi_out() 97 if (!sb_dsp_command(devc, midi_byte)) sb_midi_out() 99 devc->midi_broken = 1; sb_midi_out() 112 sb_devc *devc = midi_devs[dev]->devc; sb_midi_end_read() local 114 if (devc == NULL) sb_midi_end_read() 117 sb_dsp_reset(devc); sb_midi_end_read() 118 devc->intr_active = 0; sb_midi_end_read() 127 void sb_midi_interrupt(sb_devc * devc) sb_midi_interrupt() argument 132 if (devc == NULL) sb_midi_interrupt() 135 spin_lock_irqsave(&devc->lock, flags); sb_midi_interrupt() 138 if (devc->input_opened) sb_midi_interrupt() 139 devc->midi_input_intr(devc->my_mididev, data); sb_midi_interrupt() 141 spin_unlock_irqrestore(&devc->lock, flags); sb_midi_interrupt() 162 void sb_dsp_midi_init(sb_devc * devc, struct module *owner) sb_dsp_midi_init() argument 166 if (devc->model < 2) /* No MIDI support for SB 1.x */ sb_dsp_midi_init() 176 std_midi_synth.midi_dev = devc->my_mididev = dev; sb_dsp_midi_init() 190 midi_devs[dev]->devc = devc; sb_dsp_midi_init()
|
H A D | mpu401.c | 84 static inline int mpu401_status(struct mpu_config *devc) mpu401_status() argument 86 return inb(STATPORT(devc->base)); mpu401_status() 89 #define input_avail(devc) (!(mpu401_status(devc)&INPUT_AVAIL)) 90 #define output_ready(devc) (!(mpu401_status(devc)&OUTPUT_READY)) 92 static inline void write_command(struct mpu_config *devc, unsigned char cmd) write_command() argument 94 outb(cmd, COMDPORT(devc->base)); write_command() 97 static inline int read_data(struct mpu_config *devc) read_data() argument 99 return inb(DATAPORT(devc->base)); read_data() 102 static inline void write_data(struct mpu_config *devc, unsigned char byte) write_data() argument 104 outb(byte, DATAPORT(devc->base)); write_data() 117 static int reset_mpu401(struct mpu_config *devc); 118 static void set_uart_mode(int dev, struct mpu_config *devc, int arg); 122 static void timer_ext_event(struct mpu_config *devc, int event, int parm); 175 static int mpu_input_scanner(struct mpu_config *devc, unsigned char midic) mpu_input_scanner() argument 178 switch (devc->m_state) mpu_input_scanner() 192 if (devc->timer_flag) mpu_input_scanner() 215 devc->m_state = ST_SYSMSG; mpu_input_scanner() 222 devc->m_state = ST_TIMED; mpu_input_scanner() 233 devc->m_state = ST_DATABYTE; mpu_input_scanner() 238 msg = ((int) (devc->last_status & 0xf0) >> 4); mpu_input_scanner() 240 devc->m_left = len_tab[msg] - 1; mpu_input_scanner() 242 devc->m_ptr = 2; mpu_input_scanner() 243 devc->m_buf[0] = devc->last_status; mpu_input_scanner() 244 devc->m_buf[1] = midic; mpu_input_scanner() 246 if (devc->m_left <= 0) mpu_input_scanner() 248 devc->m_state = ST_INIT; mpu_input_scanner() 249 do_midi_msg(devc->synthno, devc->m_buf, devc->m_ptr); mpu_input_scanner() 250 devc->m_ptr = 0; mpu_input_scanner() 255 devc->m_state = ST_INIT; mpu_input_scanner() 277 devc->last_status = midic; mpu_input_scanner() 280 devc->m_left = len_tab[msg]; mpu_input_scanner() 282 devc->m_ptr = 1; mpu_input_scanner() 283 devc->m_buf[0] = midic; mpu_input_scanner() 285 if (devc->m_left <= 0) mpu_input_scanner() 287 devc->m_state = ST_INIT; mpu_input_scanner() 288 do_midi_msg(devc->synthno, devc->m_buf, devc->m_ptr); mpu_input_scanner() 289 devc->m_ptr = 0; mpu_input_scanner() 300 devc->m_state = ST_SYSEX; mpu_input_scanner() 304 devc->m_state = ST_MTC; mpu_input_scanner() 308 devc->m_state = ST_SONGPOS; mpu_input_scanner() 309 devc->m_ptr = 0; mpu_input_scanner() 313 devc->m_state = ST_SONGSEL; mpu_input_scanner() 318 devc->m_state = ST_INIT; mpu_input_scanner() 326 devc->m_state = ST_INIT; mpu_input_scanner() 327 timer_ext_event(devc, TMR_CLOCK, 0); mpu_input_scanner() 331 devc->m_state = ST_INIT; mpu_input_scanner() 332 timer_ext_event(devc, TMR_START, 0); mpu_input_scanner() 336 devc->m_state = ST_INIT; mpu_input_scanner() 337 timer_ext_event(devc, TMR_CONTINUE, 0); mpu_input_scanner() 341 devc->m_state = ST_INIT; mpu_input_scanner() 342 timer_ext_event(devc, TMR_STOP, 0); mpu_input_scanner() 347 devc->m_state = ST_INIT; mpu_input_scanner() 352 devc->m_state = ST_INIT; mpu_input_scanner() 357 devc->m_state = ST_INIT; mpu_input_scanner() 362 devc->m_state = ST_INIT; mpu_input_scanner() 370 devc->m_state = ST_INIT; mpu_input_scanner() 377 BUFTEST(devc); mpu_input_scanner() 378 devc->m_buf[devc->m_ptr++] = midic; mpu_input_scanner() 379 if (devc->m_ptr == 2) mpu_input_scanner() 381 devc->m_state = ST_INIT; mpu_input_scanner() 382 devc->m_ptr = 0; mpu_input_scanner() 383 timer_ext_event(devc, TMR_SPP, mpu_input_scanner() 384 ((devc->m_buf[1] & 0x7f) << 7) | mpu_input_scanner() 385 (devc->m_buf[0] & 0x7f)); mpu_input_scanner() 390 BUFTEST(devc); mpu_input_scanner() 391 devc->m_buf[devc->m_ptr++] = midic; mpu_input_scanner() 392 if ((--devc->m_left) <= 0) mpu_input_scanner() 394 devc->m_state = ST_INIT; mpu_input_scanner() 395 do_midi_msg(devc->synthno, devc->m_buf, devc->m_ptr); mpu_input_scanner() 396 devc->m_ptr = 0; mpu_input_scanner() 401 printk("Bad state %d ", devc->m_state); mpu_input_scanner() 402 devc->m_state = ST_INIT; mpu_input_scanner() 407 static void mpu401_input_loop(struct mpu_config *devc) mpu401_input_loop() argument 413 spin_lock_irqsave(&devc->lock,flags); mpu401_input_loop() 414 busy = devc->m_busy; mpu401_input_loop() 415 devc->m_busy = 1; mpu401_input_loop() 416 spin_unlock_irqrestore(&devc->lock,flags); mpu401_input_loop() 423 while (input_avail(devc) && n-- > 0) mpu401_input_loop() 425 unsigned char c = read_data(devc); mpu401_input_loop() 427 if (devc->mode == MODE_SYNTH) mpu401_input_loop() 429 mpu_input_scanner(devc, c); mpu401_input_loop() 431 else if (devc->opened & OPEN_READ && devc->inputintr != NULL) mpu401_input_loop() 432 devc->inputintr(devc->devno, c); mpu401_input_loop() 434 devc->m_busy = 0; mpu401_input_loop() 439 struct mpu_config *devc; mpuintr() local 443 devc = &dev_conf[dev]; mpuintr() 445 if (input_avail(devc)) mpuintr() 448 if (devc->base != 0 && (devc->opened & OPEN_READ || devc->mode == MODE_SYNTH)) mpuintr() 449 mpu401_input_loop(devc); mpuintr() 453 read_data(devc); mpuintr() 465 struct mpu_config *devc; mpu401_open() local 471 devc = &dev_conf[dev]; mpu401_open() 473 if (devc->opened) mpu401_open() 482 if (!devc->initialized) mpu401_open() 484 if (mpu401_status(devc) == 0xff) /* Bus float */ mpu401_open() 489 reset_mpu401(devc); mpu401_open() 499 if ((err = coprocessor->open(coprocessor->devc, COPR_MIDI)) < 0) mpu401_open() 507 set_uart_mode(dev, devc, 1); mpu401_open() 508 devc->mode = MODE_MIDI; mpu401_open() 509 devc->synthno = 0; mpu401_open() 511 mpu401_input_loop(devc); mpu401_open() 513 devc->inputintr = input; mpu401_open() 514 devc->opened = mode; mpu401_open() 521 struct mpu_config *devc; mpu401_close() local 524 devc = &dev_conf[dev]; mpu401_close() 525 if (devc->uart_mode) mpu401_close() 526 reset_mpu401(devc); /* mpu401_close() 529 devc->mode = 0; mpu401_close() 530 devc->inputintr = NULL; mpu401_close() 534 coprocessor->close(coprocessor->devc, COPR_MIDI); mpu401_close() 537 devc->opened = 0; mpu401_close() 545 struct mpu_config *devc; mpu401_out() local 547 devc = &dev_conf[dev]; mpu401_out() 554 for (timeout = 30000; timeout > 0 && !output_ready(devc); timeout--); mpu401_out() 556 spin_lock_irqsave(&devc->lock,flags); mpu401_out() 557 if (!output_ready(devc)) mpu401_out() 560 spin_unlock_irqrestore(&devc->lock,flags); mpu401_out() 563 write_data(devc, midi_byte); mpu401_out() 564 spin_unlock_irqrestore(&devc->lock,flags); mpu401_out() 572 struct mpu_config *devc; mpu401_command() local 574 devc = &dev_conf[dev]; mpu401_command() 576 if (devc->uart_mode) /* mpu401_command() 586 if (input_avail(devc)) mpu401_command() 587 mpu401_input_loop(devc); mpu401_command() 601 spin_lock_irqsave(&devc->lock,flags); mpu401_command() 603 if (!output_ready(devc)) mpu401_command() 605 spin_unlock_irqrestore(&devc->lock,flags); mpu401_command() 608 write_command(devc, cmd->cmd); mpu401_command() 613 if (input_avail(devc)) mpu401_command() 615 if (devc->opened && devc->mode == MODE_SYNTH) mpu401_command() 617 if (mpu_input_scanner(devc, read_data(devc)) == MPU_ACK) mpu401_command() 623 if (read_data(devc) == MPU_ACK) mpu401_command() 630 spin_unlock_irqrestore(&devc->lock,flags); mpu401_command() 637 for (timeout = 3000; timeout > 0 && !output_ready(devc); timeout--); mpu401_command() 641 spin_unlock_irqrestore(&devc->lock,flags); mpu401_command() 655 if (input_avail(devc)) mpu401_command() 657 cmd->data[i] = read_data(devc); mpu401_command() 662 spin_unlock_irqrestore(&devc->lock,flags); mpu401_command() 667 spin_unlock_irqrestore(&devc->lock,flags); mpu401_command() 689 struct mpu_config *devc = &dev_conf[dev]; mpu401_prefix_cmd() local 691 if (devc->uart_mode) mpu401_prefix_cmd() 724 struct mpu_config *devc; mpu401_ioctl() local 728 devc = &dev_conf[dev]; mpu401_ioctl() 732 if (!(devc->capabilities & MPU_CAP_INTLG)) { /* No intelligent mode */ mpu401_ioctl() 738 set_uart_mode(dev, devc, !val); mpu401_ioctl() 769 struct mpu_config *devc; mpu_synth_ioctl() local 776 devc = &dev_conf[midi_dev]; mpu_synth_ioctl() 798 struct mpu_config *devc; mpu_synth_open() local 806 devc = &dev_conf[midi_dev]; mpu_synth_open() 815 if (!devc->initialized) mpu_synth_open() 817 if (mpu401_status(devc) == 0xff) /* Bus float */ mpu_synth_open() 822 reset_mpu401(devc); mpu_synth_open() 824 if (devc->opened) mpu_synth_open() 826 devc->mode = MODE_SYNTH; mpu_synth_open() 827 devc->synthno = dev; mpu_synth_open() 829 devc->inputintr = NULL; mpu_synth_open() 836 if ((err = coprocessor->open(coprocessor->devc, COPR_MIDI)) < 0) mpu_synth_open() 842 devc->opened = mode; mpu_synth_open() 843 reset_mpu401(devc); mpu_synth_open() 857 struct mpu_config *devc; mpu_synth_close() local 862 devc = &dev_conf[midi_dev]; mpu_synth_close() 866 devc->inputintr = NULL; mpu_synth_close() 870 coprocessor->close(coprocessor->devc, COPR_MIDI); mpu_synth_close() 873 devc->opened = 0; mpu_synth_close() 874 devc->mode = 0; mpu_synth_close() 926 static void mpu401_chk_version(int n, struct mpu_config *devc) mpu401_chk_version() argument 930 devc->version = devc->revision = 0; mpu401_chk_version() 937 devc->version = tmp; mpu401_chk_version() 940 devc->version = 0; mpu401_chk_version() 943 devc->revision = tmp; mpu401_chk_version() 952 struct mpu_config *devc; attach_mpu401() local 962 devc = &dev_conf[m]; attach_mpu401() 963 devc->base = hw_config->io_base; attach_mpu401() 964 devc->osp = hw_config->osp; attach_mpu401() 965 devc->irq = hw_config->irq; attach_mpu401() 966 devc->opened = 0; attach_mpu401() 967 devc->uart_mode = 0; attach_mpu401() 968 devc->initialized = 0; attach_mpu401() 969 devc->version = 0; attach_mpu401() 970 devc->revision = 0; attach_mpu401() 971 devc->capabilities = 0; attach_mpu401() 972 devc->timer_flag = 0; attach_mpu401() 973 devc->m_busy = 0; attach_mpu401() 974 devc->m_state = ST_INIT; attach_mpu401() 975 devc->shared_irq = hw_config->always_detect; attach_mpu401() 976 spin_lock_init(&devc->lock); attach_mpu401() 978 if (devc->irq < 0) attach_mpu401() 980 devc->irq *= -1; attach_mpu401() 981 devc->shared_irq = 1; attach_mpu401() 987 if (!reset_mpu401(devc)) attach_mpu401() 993 if (!devc->shared_irq) attach_mpu401() 995 if (request_irq(devc->irq, mpuintr, 0, "mpu401", attach_mpu401() 998 printk(KERN_WARNING "mpu401: Failed to allocate IRQ%d\n", devc->irq); attach_mpu401() 1003 spin_lock_irqsave(&devc->lock,flags); attach_mpu401() 1004 mpu401_chk_version(m, devc); attach_mpu401() 1005 if (devc->version == 0) attach_mpu401() 1006 mpu401_chk_version(m, devc); attach_mpu401() 1007 spin_unlock_irqrestore(&devc->lock, flags); attach_mpu401() 1010 if (devc->version != 0) attach_mpu401() 1013 devc->capabilities |= MPU_CAP_INTLG; /* Supports intelligent mode */ attach_mpu401() 1024 if (!(devc->capabilities & MPU_CAP_INTLG)) /* No intelligent mode */ attach_mpu401() 1051 if (devc->version == 0x20 && devc->revision >= 0x07) /* MusicQuest interface */ attach_mpu401() 1053 int ports = (devc->revision & 0x08) ? 32 : 16; attach_mpu401() 1055 devc->capabilities |= MPU_CAP_SYNC | MPU_CAP_SMPTE | attach_mpu401() 1058 revision_char = (devc->revision == 0x7f) ? 'M' : ' '; attach_mpu401() 1066 revision_char = devc->revision ? devc->revision + '@' : ' '; attach_mpu401() 1067 if ((int) devc->revision > ('Z' - '@')) attach_mpu401() 1070 devc->capabilities |= MPU_CAP_SYNC | MPU_CAP_FSK; attach_mpu401() 1077 (int) (devc->version & 0xf0) >> 4, attach_mpu401() 1078 devc->version & 0x0f, attach_mpu401() 1088 mpu401_synth_operations[m]->midi_dev = devc->devno = m; attach_mpu401() 1089 mpu401_synth_operations[devc->devno]->info = &mpu_synth_info[devc->devno]; attach_mpu401() 1091 if (devc->capabilities & MPU_CAP_INTLG) /* Intelligent mode */ attach_mpu401() 1094 midi_devs[m] = &mpu401_midi_operations[devc->devno]; attach_mpu401() 1105 free_irq(devc->irq, hw_config); attach_mpu401() 1113 static int reset_mpu401(struct mpu_config *devc) reset_mpu401() argument 1126 timeout_limit = devc->initialized ? 30000 : 100000; reset_mpu401() 1127 devc->initialized = 1; reset_mpu401() 1132 ok = output_ready(devc); reset_mpu401() 1134 write_command(devc, MPU_RESET); /* reset_mpu401() 1145 spin_lock_irqsave(&devc->lock,flags); reset_mpu401() 1146 if (input_avail(devc)) reset_mpu401() 1147 if (read_data(devc) == MPU_ACK) reset_mpu401() 1149 spin_unlock_irqrestore(&devc->lock,flags); reset_mpu401() 1154 devc->m_state = ST_INIT; reset_mpu401() 1155 devc->m_ptr = 0; reset_mpu401() 1156 devc->m_left = 0; reset_mpu401() 1157 devc->last_status = 0; reset_mpu401() 1158 devc->uart_mode = 0; reset_mpu401() 1163 static void set_uart_mode(int dev, struct mpu_config *devc, int arg) set_uart_mode() argument 1165 if (!arg && (devc->capabilities & MPU_CAP_INTLG)) set_uart_mode() 1167 if ((devc->uart_mode == 0) == (arg == 0)) set_uart_mode() 1169 reset_mpu401(devc); /* This exits the uart mode */ set_uart_mode() 1176 devc->uart_mode = 0; set_uart_mode() 1180 devc->uart_mode = arg; set_uart_mode() 1275 static void tmr_reset(struct mpu_config *devc) tmr_reset() argument 1279 spin_lock_irqsave(&devc->lock,flags); tmr_reset() 1283 spin_unlock_irqrestore(&devc->lock,flags); tmr_reset() 1338 struct mpu_config *devc= &dev_conf[midi_dev]; mpu_start_timer() local 1340 tmr_reset(devc); mpu_start_timer() 1365 struct mpu_config *devc= &dev_conf[midi_dev]; mpu_timer_open() local 1370 tmr_reset(devc); mpu_timer_open() 1637 static void timer_ext_event(struct mpu_config *devc, int event, int parm) timer_ext_event() argument 1639 int midi_dev = devc->devno; timer_ext_event() 1641 if (!devc->timer_flag) timer_ext_event() 1696 struct mpu_config *devc; mpu_timer_init() local 1699 devc = &dev_conf[midi_dev]; mpu_timer_init() 1714 if (devc->version < 0x20) /* Original MPU-401 */ mpu_timer_init() 1726 if (devc->revision) mpu_timer_init() 1729 if (devc->revision & 0x02) mpu_timer_init() 1733 if (devc->revision & 0x40) mpu_timer_init()
|
H A D | waveartist.c | 154 static void vnc_configure_mixer(struct wavnc_info *devc, 173 waveartist_iack(struct wavnc_info *devc) waveartist_iack() argument 175 unsigned int ctlr_port = devc->hw.io_base + CTLR; waveartist_iack() 192 waveartist_reset(struct wavnc_info *devc) waveartist_reset() argument 194 struct address_info *hw = &devc->hw; waveartist_reset() 227 waveartist_cmd(struct wavnc_info *devc, waveartist_cmd() argument 231 unsigned int io_base = devc->hw.io_base; waveartist_cmd() 303 waveartist_cmd1(struct wavnc_info *devc, unsigned int cmd) waveartist_cmd1() argument 305 return waveartist_cmd(devc, 1, &cmd, 0, NULL); waveartist_cmd1() 312 waveartist_cmd1_r(struct wavnc_info *devc, unsigned int cmd) waveartist_cmd1_r() argument 316 waveartist_cmd(devc, 1, &cmd, 1, &ret); waveartist_cmd1_r() 326 waveartist_cmd2(struct wavnc_info *devc, unsigned int cmd, unsigned int arg) waveartist_cmd2() argument 333 return waveartist_cmd(devc, 2, vals, 1, vals); waveartist_cmd2() 340 waveartist_cmd3(struct wavnc_info *devc, unsigned int cmd, waveartist_cmd3() argument 349 return waveartist_cmd(devc, 3, vals, 0, NULL); waveartist_cmd3() 353 waveartist_getrev(struct wavnc_info *devc, char *rev) waveartist_getrev() argument 358 waveartist_cmd(devc, 1, &cmd, 2, temp); waveartist_getrev() 375 struct wavnc_info *devc; waveartist_open() local 382 devc = (struct wavnc_info *) audio_devs[dev]->devc; waveartist_open() 386 if (portc->open_mode || (devc->open_mode & mode)) { waveartist_open() 391 devc->audio_mode = 0; waveartist_open() 392 devc->open_mode |= mode; waveartist_open() 397 devc->record_dev = dev; waveartist_open() 399 devc->playback_dev = dev; waveartist_open() 408 struct wavnc_info *devc = (struct wavnc_info *) waveartist_close() local 409 audio_devs[dev]->devc; waveartist_close() 418 devc->audio_mode = 0; waveartist_close() 419 devc->open_mode &= ~portc->open_mode; waveartist_close() 430 struct wavnc_info *devc = (struct wavnc_info *) waveartist_output_block() local 431 audio_devs[dev]->devc; waveartist_output_block() 449 if (devc->audio_mode & PCM_ENABLE_OUTPUT && waveartist_output_block() 452 count == devc->xfer_count) { waveartist_output_block() 453 devc->audio_mode |= PCM_ENABLE_OUTPUT; waveartist_output_block() 464 waveartist_cmd2(devc, WACMD_OUTPUTSIZE, count); waveartist_output_block() 466 devc->xfer_count = count; waveartist_output_block() 467 devc->audio_mode |= PCM_ENABLE_OUTPUT; waveartist_output_block() 477 struct wavnc_info *devc = (struct wavnc_info *) waveartist_start_input() local 478 audio_devs[dev]->devc; waveartist_start_input() 494 if (devc->audio_mode & PCM_ENABLE_INPUT && waveartist_start_input() 497 count == devc->xfer_count) { waveartist_start_input() 498 devc->audio_mode |= PCM_ENABLE_INPUT; waveartist_start_input() 509 waveartist_cmd2(devc, WACMD_INPUTSIZE, count); waveartist_start_input() 511 devc->xfer_count = count; waveartist_start_input() 512 devc->audio_mode |= PCM_ENABLE_INPUT; waveartist_start_input() 570 struct wavnc_info *devc = (struct wavnc_info *) waveartist_prepare_for_input() local 571 audio_devs[dev]->devc; waveartist_prepare_for_input() 576 if (devc->audio_mode) waveartist_prepare_for_input() 584 if (waveartist_cmd2(devc, WACMD_INPUTFORMAT, bits)) waveartist_prepare_for_input() 588 if (waveartist_cmd2(devc, WACMD_INPUTCHANNELS, portc->channels)) waveartist_prepare_for_input() 595 if (waveartist_cmd2(devc, WACMD_INPUTSPEED, speed)) waveartist_prepare_for_input() 599 if (waveartist_cmd2(devc, WACMD_INPUTDMA, 1)) waveartist_prepare_for_input() 603 if (waveartist_cmd2(devc, WACMD_INPUTFORMAT, bits)) waveartist_prepare_for_input() 607 devc->xfer_count = 0; waveartist_prepare_for_input() 613 inb(devc->hw.io_base + CTLR)); waveartist_prepare_for_input() 615 inb(devc->hw.io_base + STATR)); waveartist_prepare_for_input() 617 inb(devc->hw.io_base + IRQSTAT)); waveartist_prepare_for_input() 627 struct wavnc_info *devc = (struct wavnc_info *) waveartist_prepare_for_output() local 628 audio_devs[dev]->devc; waveartist_prepare_for_output() 641 if (waveartist_cmd2(devc, WACMD_OUTPUTSPEED, speed) && waveartist_prepare_for_output() 642 waveartist_cmd2(devc, WACMD_OUTPUTSPEED, speed)) waveartist_prepare_for_output() 646 if (waveartist_cmd2(devc, WACMD_OUTPUTCHANNELS, portc->channels)) waveartist_prepare_for_output() 650 if (waveartist_cmd2(devc, WACMD_OUTPUTDMA, 0)) waveartist_prepare_for_output() 654 if (waveartist_cmd2(devc, WACMD_OUTPUTFORMAT, bits)) waveartist_prepare_for_output() 658 devc->xfer_count = 0; waveartist_prepare_for_output() 663 printk("WA CTLR reg: 0x%02X.\n",inb(devc->hw.io_base + CTLR)); waveartist_prepare_for_output() 664 printk("WA STAT reg: 0x%02X.\n",inb(devc->hw.io_base + STATR)); waveartist_prepare_for_output() 665 printk("WA IRQS reg: 0x%02X.\n",inb(devc->hw.io_base + IRQSTAT)); waveartist_prepare_for_output() 676 struct wavnc_info *devc; waveartist_halt() local 684 devc = (struct wavnc_info *) audio_devs[dev]->devc; waveartist_halt() 685 devc->audio_mode = 0; waveartist_halt() 691 struct wavnc_info *devc = (struct wavnc_info *) waveartist_halt_input() local 692 audio_devs[dev]->devc; waveartist_halt_input() 700 waveartist_cmd1(devc, WACMD_INPUTSTOP); waveartist_halt_input() 702 devc->audio_mode &= ~PCM_ENABLE_INPUT; waveartist_halt_input() 708 if (inb(devc->hw.io_base + STATR) & IRQ_REQ) waveartist_halt_input() 709 waveartist_iack(devc); waveartist_halt_input() 711 // devc->audio_mode &= ~PCM_ENABLE_INPUT; waveartist_halt_input() 719 struct wavnc_info *devc = (struct wavnc_info *) waveartist_halt_output() local 720 audio_devs[dev]->devc; waveartist_halt_output() 725 waveartist_cmd1(devc, WACMD_OUTPUTSTOP); waveartist_halt_output() 727 devc->audio_mode &= ~PCM_ENABLE_OUTPUT; waveartist_halt_output() 733 if (inb(devc->hw.io_base + STATR) & IRQ_REQ) waveartist_halt_output() 734 waveartist_iack(devc); waveartist_halt_output() 736 // devc->audio_mode &= ~PCM_ENABLE_OUTPUT; waveartist_halt_output() 744 struct wavnc_info *devc = (struct wavnc_info *) waveartist_trigger() local 745 audio_devs[dev]->devc; waveartist_trigger() 761 state &= devc->audio_mode; waveartist_trigger() 768 waveartist_cmd1(devc, WACMD_INPUTSTART); waveartist_trigger() 775 waveartist_cmd1(devc, WACMD_OUTPUTSTART); waveartist_trigger() 851 struct wavnc_info *devc = dev_id; waveartist_intr() local 855 irqstatus = inb(devc->hw.io_base + IRQSTAT); waveartist_intr() 856 status = inb(devc->hw.io_base + STATR); waveartist_intr() 863 waveartist_iack(devc); waveartist_intr() 872 if ((status & DMA0) && (devc->audio_mode & PCM_ENABLE_OUTPUT)) { waveartist_intr() 873 DMAbuf_outputintr(devc->playback_dev, 1); waveartist_intr() 876 if ((status & DMA1) && (devc->audio_mode & PCM_ENABLE_INPUT)) { waveartist_intr() 877 DMAbuf_inputintr(devc->record_dev); waveartist_intr() 934 waveartist_mixer_update(struct wavnc_info *devc, int whichDev) waveartist_mixer_update() argument 938 lev_left = devc->levels[whichDev] & 0xff; waveartist_mixer_update() 939 lev_right = devc->levels[whichDev] >> 8; waveartist_mixer_update() 960 left = waveartist_cmd1_r(devc, WACMD_GET_LEVEL | waveartist_mixer_update() 964 right = waveartist_cmd1_r(devc, WACMD_GET_LEVEL | waveartist_mixer_update() 971 waveartist_cmd3(devc, WACMD_SET_MIXER, left, right); waveartist_mixer_update() 975 waveartist_cmd3(devc, WACMD_SET_LEVEL, waveartist_mixer_update() 981 waveartist_cmd3(devc, 0x0100 | WACMD_SET_LEVEL, waveartist_mixer_update() 995 waveartist_set_adc_mux(struct wavnc_info *devc, char left_dev, waveartist_set_adc_mux() argument 1000 reg_08 = waveartist_cmd1_r(devc, WACMD_GET_LEVEL | 0x0800); waveartist_set_adc_mux() 1001 reg_09 = waveartist_cmd1_r(devc, WACMD_GET_LEVEL | 0x0900); waveartist_set_adc_mux() 1005 waveartist_cmd3(devc, WACMD_SET_MIXER, reg_08, reg_09); waveartist_set_adc_mux() 1019 waveartist_select_input(struct wavnc_info *devc, unsigned int recmask, waveartist_select_input() argument 1047 waveartist_decode_mixer(struct wavnc_info *devc, int dev, waveartist_decode_mixer() argument 1060 devc->levels[dev] = lev_l | lev_r << 8; waveartist_decode_mixer() 1074 static int waveartist_get_mixer(struct wavnc_info *devc, int dev) waveartist_get_mixer() argument 1076 return devc->levels[dev]; waveartist_get_mixer() 1092 waveartist_set_recmask(struct wavnc_info *devc, unsigned int recmask) waveartist_set_recmask() argument 1096 recmask &= devc->mix->recording_devs; waveartist_set_recmask() 1103 recmask &= ~devc->recmask; waveartist_set_recmask() 1109 devc->recmask = devc->mix->select_input(devc, recmask, waveartist_set_recmask() 1112 waveartist_set_adc_mux(devc, dev_l, dev_r); waveartist_set_recmask() 1116 waveartist_set_mixer(struct wavnc_info *devc, int dev, unsigned int level) waveartist_set_mixer() argument 1130 if (!(devc->mix->stereo_devs & (1 << dev))) waveartist_set_mixer() 1133 dev = devc->mix->decode_mixer(devc, dev, lev_left, lev_right); waveartist_set_mixer() 1136 waveartist_mixer_update(devc, dev); waveartist_set_mixer() 1144 struct wavnc_info *devc = (struct wavnc_info *)audio_devs[dev]->devc; waveartist_mixer_ioctl() local 1171 waveartist_set_recmask(devc, val); waveartist_mixer_ioctl() 1177 devc->mix->supported_devs & (1 << nr)) waveartist_mixer_ioctl() 1178 ret = waveartist_set_mixer(devc, nr, val); waveartist_mixer_ioctl() 1187 ret = devc->recmask; waveartist_mixer_ioctl() 1191 ret = devc->mix->supported_devs; waveartist_mixer_ioctl() 1195 ret = devc->mix->stereo_devs; waveartist_mixer_ioctl() 1199 ret = devc->mix->recording_devs; waveartist_mixer_ioctl() 1208 ret = devc->mix->get_mixer(devc, nr); waveartist_mixer_ioctl() 1228 waveartist_mixer_reset(struct wavnc_info *devc) waveartist_mixer_reset() argument 1233 printk("%s: mixer_reset\n", devc->hw.name); waveartist_mixer_reset() 1238 waveartist_cmd1(devc, WACMD_RST_MIXER); waveartist_mixer_reset() 1244 waveartist_cmd3(devc, WACMD_SET_MIXER, 0x9800, 0xa836); waveartist_mixer_reset() 1249 waveartist_cmd3(devc, WACMD_SET_MIXER, 0x4c00, 0x8c00); waveartist_mixer_reset() 1254 waveartist_cmd3(devc, WACMD_SET_MIXER, 0x2801, 0x6800); waveartist_mixer_reset() 1259 waveartist_set_recmask(devc, 0); waveartist_mixer_reset() 1262 waveartist_mixer_update(devc, i); waveartist_mixer_reset() 1265 static int __init waveartist_init(struct wavnc_info *devc) waveartist_init() argument 1271 if (waveartist_reset(devc)) waveartist_init() 1274 sprintf(dev_name, "%s (%s", devc->hw.name, devc->chip_name); waveartist_init() 1276 if (waveartist_getrev(devc, rev)) { waveartist_init() 1282 conf_printf2(dev_name, devc->hw.io_base, devc->hw.irq, waveartist_init() 1283 devc->hw.dma, devc->hw.dma2); waveartist_init() 1291 devc->audio_flags, AFMT_U8 | AFMT_S16_LE | AFMT_S8, waveartist_init() 1292 devc, devc->hw.dma, devc->hw.dma2); waveartist_init() 1299 waveartist_mixer_reset(devc); waveartist_init() 1304 waveartist_iack(devc); waveartist_init() 1306 if (request_irq(devc->hw.irq, waveartist_intr, 0, devc->hw.name, devc) < 0) { waveartist_init() 1308 devc->hw.name, devc->hw.irq); waveartist_init() 1312 if (sound_alloc_dma(devc->hw.dma, devc->hw.name)) { waveartist_init() 1314 devc->hw.name, devc->hw.dma); waveartist_init() 1318 if (devc->hw.dma != devc->hw.dma2 && devc->hw.dma2 != NO_DMA) waveartist_init() 1319 if (sound_alloc_dma(devc->hw.dma2, devc->hw.name)) { waveartist_init() 1321 devc->hw.name, devc->hw.dma2); waveartist_init() 1325 waveartist_set_ctlr(&devc->hw, 0, DMA1_IE | DMA0_IE); waveartist_init() 1332 devc); waveartist_init() 1337 sound_free_dma(devc->hw.dma); waveartist_init() 1340 free_irq(devc->hw.irq, devc); waveartist_init() 1354 struct wavnc_info *devc = &adev_info[nr_waveartist_devs]; probe_waveartist() local 1381 devc->hw = *hw_config; probe_waveartist() 1382 devc->open_mode = 0; probe_waveartist() 1383 devc->chip_name = "RWA-010"; probe_waveartist() 1391 struct wavnc_info *devc = &adev_info[nr_waveartist_devs]; attach_waveartist() local 1398 devc->hw = *hw; attach_waveartist() 1399 devc->hw.irq = (hw->irq > 0) ? hw->irq : 0; attach_waveartist() 1400 devc->open_mode = 0; attach_waveartist() 1401 devc->playback_dev = 0; attach_waveartist() 1402 devc->record_dev = 0; attach_waveartist() 1403 devc->audio_flags = DMA_AUTOMODE; attach_waveartist() 1404 devc->levels = levels; attach_waveartist() 1407 devc->audio_flags |= DMA_DUPLEX; attach_waveartist() 1409 devc->mix = mix; attach_waveartist() 1410 devc->dev_no = waveartist_init(devc); attach_waveartist() 1412 if (devc->dev_no < 0) attach_waveartist() 1423 vnc_configure_mixer(devc, 0); attach_waveartist() 1425 devc->no_autoselect = 1; attach_waveartist() 1434 struct wavnc_info *devc = NULL; unload_waveartist() local 1439 devc = adev_info + i; unload_waveartist() 1443 if (devc != NULL) { unload_waveartist() 1451 release_region(devc->hw.io_base, 15); unload_waveartist() 1453 waveartist_set_ctlr(&devc->hw, DMA1_IE|DMA0_IE, 0); unload_waveartist() 1455 if (devc->hw.irq >= 0) unload_waveartist() 1456 free_irq(devc->hw.irq, devc); unload_waveartist() 1458 sound_free_dma(devc->hw.dma); unload_waveartist() 1460 if (devc->hw.dma != devc->hw.dma2 && unload_waveartist() 1461 devc->hw.dma2 != NO_DMA) unload_waveartist() 1462 sound_free_dma(devc->hw.dma2); unload_waveartist() 1464 mixer = audio_devs[devc->dev_no]->mixer_dev; unload_waveartist() 1469 if (devc->dev_no >= 0) unload_waveartist() 1470 sound_unload_audiodev(devc->dev_no); unload_waveartist() 1502 vnc_mute_spkr(struct wavnc_info *devc) vnc_mute_spkr() argument 1507 nw_cpld_modify(CPLD_UNMUTE, devc->spkr_mute_state ? 0 : CPLD_UNMUTE); vnc_mute_spkr() 1512 vnc_mute_lout(struct wavnc_info *devc) vnc_mute_lout() argument 1516 left = waveartist_cmd1_r(devc, WACMD_GET_LEVEL); vnc_mute_lout() 1517 right = waveartist_cmd1_r(devc, WACMD_GET_LEVEL | 0x400); vnc_mute_lout() 1519 if (devc->line_mute_state) { vnc_mute_lout() 1526 waveartist_cmd3(devc, WACMD_SET_MIXER, left, right); vnc_mute_lout() 1531 vnc_volume_slider(struct wavnc_info *devc) vnc_volume_slider() argument 1591 netwinder_select_input(struct wavnc_info *devc, unsigned int recmask, netwinder_select_input() argument 1606 waveartist_cmd1(devc, WACMD_SET_MONO); /* left */ netwinder_select_input() 1611 waveartist_cmd1(devc, WACMD_SET_MONO); /* left */ netwinder_select_input() 1616 waveartist_cmd1(devc, WACMD_SET_MONO | 0x100); /* right */ netwinder_select_input() 1628 netwinder_decode_mixer(struct wavnc_info *devc, int dev, unsigned char lev_l, netwinder_decode_mixer() argument 1637 devc->levels[dev] = lev_l | lev_r << 8; netwinder_decode_mixer() 1641 devc->levels[SOUND_MIXER_MIC] &= 0xff; netwinder_decode_mixer() 1642 devc->levels[SOUND_MIXER_MIC] |= lev_l << 8; netwinder_decode_mixer() 1646 devc->levels[SOUND_MIXER_MIC] &= 0xff00; netwinder_decode_mixer() 1647 devc->levels[SOUND_MIXER_MIC] |= lev_l; netwinder_decode_mixer() 1652 devc->levels[SOUND_MIXER_LINE1] = lev_l; netwinder_decode_mixer() 1667 static int netwinder_get_mixer(struct wavnc_info *devc, int dev) netwinder_get_mixer() argument 1677 levels = devc->levels[dev]; netwinder_get_mixer() 1681 levels = devc->levels[SOUND_MIXER_MIC] >> 8; netwinder_get_mixer() 1686 levels = devc->levels[SOUND_MIXER_MIC] & 0xff; netwinder_get_mixer() 1691 levels = devc->levels[SOUND_MIXER_LINE1] & 0xff; netwinder_get_mixer() 1727 vnc_configure_mixer(struct wavnc_info *devc, unsigned int recmask) vnc_configure_mixer() argument 1729 if (!devc->no_autoselect) { vnc_configure_mixer() 1730 if (devc->handset_detect) { vnc_configure_mixer() 1732 devc->spkr_mute_state = devc->line_mute_state = 1; vnc_configure_mixer() 1733 } else if (devc->telephone_detect) { vnc_configure_mixer() 1735 devc->spkr_mute_state = devc->line_mute_state = 1; vnc_configure_mixer() 1740 if ((devc->recmask & SOUND_MASK_LINE) == 0) vnc_configure_mixer() 1741 devc->recmask = SOUND_MASK_MIC; vnc_configure_mixer() 1742 devc->spkr_mute_state = devc->line_mute_state = 0; vnc_configure_mixer() 1744 vnc_mute_spkr(devc); vnc_configure_mixer() 1745 vnc_mute_lout(devc); vnc_configure_mixer() 1747 if (recmask != devc->recmask) vnc_configure_mixer() 1748 waveartist_set_recmask(devc, recmask); vnc_configure_mixer() 1753 vnc_slider(struct wavnc_info *devc) vnc_slider() argument 1765 old_hs = devc->handset_detect; vnc_slider() 1766 old_td = devc->telephone_detect; vnc_slider() 1768 devc->handset_detect = !(temp & 0x10); vnc_slider() 1769 devc->telephone_detect = !!(temp & 0x20); vnc_slider() 1771 if (!devc->no_autoselect && vnc_slider() 1772 (old_hs != devc->handset_detect || vnc_slider() 1773 old_td != devc->telephone_detect)) vnc_slider() 1774 vnc_configure_mixer(devc, devc->recmask); vnc_slider() 1776 slider_volume = vnc_volume_slider(devc); vnc_slider() 1783 if (abs(devc->slider_vol - slider_volume) > 20) vnc_slider() 1784 devc->use_slider = 1; vnc_slider() 1791 if (slider_volume != temp && devc->use_slider) { vnc_slider() 1792 devc->slider_vol = slider_volume; vnc_slider() 1794 waveartist_set_mixer(devc, SOUND_MIXER_VOLUME, vnc_slider() 1819 struct wavnc_info *devc = (struct wavnc_info *)audio_devs[dev]->devc; vnc_private_ioctl() local 1837 prev_auto_state = devc->no_autoselect; vnc_private_ioctl() 1838 prev_spkr_mute = devc->spkr_mute_state; vnc_private_ioctl() 1839 prev_line_mute = devc->line_mute_state; vnc_private_ioctl() 1841 devc->no_autoselect = (val & VNC_DISABLE_AUTOSWITCH) ? 1 : 0; vnc_private_ioctl() 1842 devc->spkr_mute_state = (val & VNC_MUTE_INTERNAL_SPKR) ? 1 : 0; vnc_private_ioctl() 1843 devc->line_mute_state = (val & VNC_MUTE_LINE_OUT) ? 1 : 0; vnc_private_ioctl() 1845 if (prev_spkr_mute != devc->spkr_mute_state) vnc_private_ioctl() 1846 vnc_mute_spkr(devc); vnc_private_ioctl() 1848 if (prev_line_mute != devc->line_mute_state) vnc_private_ioctl() 1849 vnc_mute_lout(devc); vnc_private_ioctl() 1851 if (prev_auto_state != devc->no_autoselect) vnc_private_ioctl() 1852 vnc_configure_mixer(devc, devc->recmask); vnc_private_ioctl() 1865 waveartist_cmd1(devc, 0x16); vnc_private_ioctl() 1869 waveartist_cmd1(devc, 0x18); vnc_private_ioctl() 1890 waveartist_mixer_reset(devc); vnc_private_ioctl() 1894 waveartist_cmd3(devc, WACMD_SET_MIXER, mixer_reg[0], mixer_reg[4]); vnc_private_ioctl() 1895 waveartist_cmd3(devc, WACMD_SET_MIXER, mixer_reg[1], mixer_reg[5]); vnc_private_ioctl() 1896 waveartist_cmd3(devc, WACMD_SET_MIXER, mixer_reg[2], mixer_reg[6]); vnc_private_ioctl() 1897 waveartist_cmd3(devc, WACMD_SET_MIXER, mixer_reg[3], mixer_reg[7]); vnc_private_ioctl() 1898 waveartist_cmd3(devc, WACMD_SET_MIXER, mixer_reg[8], mixer_reg[9]); vnc_private_ioctl() 1900 waveartist_cmd3(devc, WACMD_SET_LEVEL, mixer_reg[10], mixer_reg[11]); vnc_private_ioctl() 1901 waveartist_cmd3(devc, WACMD_SET_LEVEL, mixer_reg[12], mixer_reg[13]); vnc_private_ioctl() 1908 waveartist_cmd(devc, 1, &i, 1, mixer_reg + (i >> 8)); vnc_private_ioctl() 1924 val = (devc->spkr_mute_state ? VNC_MUTE_INTERNAL_SPKR : 0) | vnc_private_ioctl() 1925 (devc->line_mute_state ? VNC_MUTE_LINE_OUT : 0) | vnc_private_ioctl() 1926 (devc->handset_detect ? VNC_HANDSET_DETECT : 0) | vnc_private_ioctl() 1927 (devc->telephone_detect ? VNC_PHONE_DETECT : 0) | vnc_private_ioctl() 1928 (devc->no_autoselect ? VNC_DISABLE_AUTOSWITCH : 0); vnc_private_ioctl() 1943 devc->use_slider = 0; vnc_private_ioctl() 1955 devc->levels[SOUND_MIXER_SPEAKER] = val | (val << 8); vnc_private_ioctl() 1956 devc->spkr_mute_state = (val <= 50); vnc_private_ioctl() 1957 vnc_mute_spkr(devc); vnc_private_ioctl()
|
H A D | ad1848.c | 135 static int ad_format_mask[13 /*devc->model */ ] = 162 } capabilities [10 /*devc->model */ ] = { 204 static int ad_read(ad1848_info * devc, int reg) ad_read() argument 209 while (timeout > 0 && inb(devc->base) == 0x80) /*Are we initializing */ ad_read() 214 outb(((unsigned char) (reg & 0xff) | devc->MCE_bit), io_Index_Addr(devc)); ad_read() 215 x = inb(io_Indexed_Data(devc)); ad_read() 223 outb(((unsigned char) (23 & 0xff) | devc->MCE_bit), io_Index_Addr(devc)); ad_read() 224 outb(((unsigned char) (xra & 0xff)), io_Indexed_Data(devc)); ad_read() 225 x = inb(io_Indexed_Data(devc)); ad_read() 231 static void ad_write(ad1848_info * devc, int reg, int data) ad_write() argument 235 while (timeout > 0 && inb(devc->base) == 0x80) /* Are we initializing */ ad_write() 240 outb(((unsigned char) (reg & 0xff) | devc->MCE_bit), io_Index_Addr(devc)); ad_write() 241 outb(((unsigned char) (data & 0xff)), io_Indexed_Data(devc)); ad_write() 249 outb(((unsigned char) (23 & 0xff) | devc->MCE_bit), io_Index_Addr(devc)); ad_write() 250 outb(((unsigned char) (xra & 0xff)), io_Indexed_Data(devc)); ad_write() 251 outb((unsigned char) (data & 0xff), io_Indexed_Data(devc)); ad_write() 255 static void wait_for_calibration(ad1848_info * devc) wait_for_calibration() argument 267 while (timeout > 0 && inb(devc->base) == 0x80) wait_for_calibration() 269 if (inb(devc->base) & 0x80) wait_for_calibration() 273 while (timeout > 0 && !(ad_read(devc, 11) & 0x20)) wait_for_calibration() 275 if (!(ad_read(devc, 11) & 0x20)) wait_for_calibration() 279 while (timeout > 0 && (ad_read(devc, 11) & 0x20)) wait_for_calibration() 281 if (ad_read(devc, 11) & 0x20) wait_for_calibration() 282 if ((devc->model != MD_1845) && (devc->model != MD_1845_SSCAPE)) wait_for_calibration() 286 static void ad_mute(ad1848_info * devc) ad_mute() argument 297 prev = devc->saved_regs[i] = ad_read(devc, i); ad_mute() 302 static void ad_unmute(ad1848_info * devc) ad_unmute() argument 306 static void ad_enter_MCE(ad1848_info * devc) ad_enter_MCE() argument 311 while (timeout > 0 && inb(devc->base) == 0x80) /*Are we initializing */ ad_enter_MCE() 314 devc->MCE_bit = 0x40; ad_enter_MCE() 315 prev = inb(io_Index_Addr(devc)); ad_enter_MCE() 320 outb((devc->MCE_bit), io_Index_Addr(devc)); ad_enter_MCE() 323 static void ad_leave_MCE(ad1848_info * devc) ad_leave_MCE() argument 328 while (timeout > 0 && inb(devc->base) == 0x80) /*Are we initializing */ ad_leave_MCE() 331 acal = ad_read(devc, 9); ad_leave_MCE() 333 devc->MCE_bit = 0x00; ad_leave_MCE() 334 prev = inb(io_Index_Addr(devc)); ad_leave_MCE() 335 outb((0x00), io_Index_Addr(devc)); /* Clear the MCE bit */ ad_leave_MCE() 341 outb((0x00), io_Index_Addr(devc)); /* Clear the MCE bit */ ad_leave_MCE() 343 wait_for_calibration(devc); ad_leave_MCE() 346 static int ad1848_set_recmask(ad1848_info * devc, int mask) ad1848_set_recmask() argument 352 mask &= devc->supported_rec_devices; ad1848_set_recmask() 357 if (devc->mixer_reroute[i] != i) ad1848_set_recmask() 362 mask |= (1 << devc->mixer_reroute[i]); ad1848_set_recmask() 372 spin_lock_irqsave(&devc->lock,flags); ad1848_set_recmask() 377 mask &= ~devc->recmask; /* Filter out active settings */ ad1848_set_recmask() 412 ad_write(devc, 0, (ad_read(devc, 0) & 0x3f) | recdev); ad1848_set_recmask() 413 ad_write(devc, 1, (ad_read(devc, 1) & 0x3f) | recdev); ad1848_set_recmask() 420 if ((devc->supported_rec_devices & (1 << i)) == 0) ad1848_set_recmask() 424 if (devc->mix_devices[i][j].nbits == 0) /* Inexistent channel */ ad1848_set_recmask() 432 set_rec_bit = ((mask & (1 << i)) != 0) ^ devc->mix_devices[i][j].recpol; ad1848_set_recmask() 434 val = ad_read(devc, devc->mix_devices[i][j].recreg); ad1848_set_recmask() 435 val &= ~(1 << devc->mix_devices[i][j].recpos); ad1848_set_recmask() 436 val |= (set_rec_bit << devc->mix_devices[i][j].recpos); ad1848_set_recmask() 437 ad_write(devc, devc->mix_devices[i][j].recreg, val); ad1848_set_recmask() 441 spin_unlock_irqrestore(&devc->lock,flags); ad1848_set_recmask() 446 if (devc->mixer_reroute[i] != i) ad1848_set_recmask() 448 if (mask & (1 << devc->mixer_reroute[i])) ad1848_set_recmask() 450 mask &= ~(1 << devc->mixer_reroute[i]); ad1848_set_recmask() 455 devc->recmask = mask; ad1848_set_recmask() 459 static void oss_change_bits(ad1848_info *devc, unsigned char *regval, oss_change_bits() argument 468 set_mute_bit = (newval == 0) ^ devc->mix_devices[dev][chn].mutepol; oss_change_bits() 470 if (devc->mix_devices[dev][chn].polarity == 1) /* Reverse */ oss_change_bits() 473 mask = (1 << devc->mix_devices[dev][chn].nbits) - 1; oss_change_bits() 474 shift = devc->mix_devices[dev][chn].bitpos; oss_change_bits() 476 if (devc->mix_devices[dev][chn].mutepos == 8) oss_change_bits() 483 mute = (set_mute_bit << devc->mix_devices[dev][chn].mutepos); oss_change_bits() 484 mutemask = ~(1 << devc->mix_devices[dev][chn].mutepos); oss_change_bits() 495 static int ad1848_mixer_get(ad1848_info * devc, int dev) ad1848_mixer_get() argument 497 if (!((1 << dev) & devc->supported_devices)) ad1848_mixer_get() 500 dev = devc->mixer_reroute[dev]; ad1848_mixer_get() 502 return devc->levels[dev]; ad1848_mixer_get() 505 static void ad1848_mixer_set_channel(ad1848_info *devc, int dev, int value, int channel) ad1848_mixer_set_channel() argument 511 regoffs = devc->mix_devices[dev][channel].regno; ad1848_mixer_set_channel() 512 muteregoffs = devc->mix_devices[dev][channel].mutereg; ad1848_mixer_set_channel() 513 val = ad_read(devc, regoffs); ad1848_mixer_set_channel() 516 muteval = ad_read(devc, muteregoffs); ad1848_mixer_set_channel() 517 oss_change_bits(devc, &val, &muteval, dev, channel, value); ad1848_mixer_set_channel() 520 oss_change_bits(devc, &val, &val, dev, channel, value); ad1848_mixer_set_channel() 522 spin_lock_irqsave(&devc->lock,flags); ad1848_mixer_set_channel() 523 ad_write(devc, regoffs, val); ad1848_mixer_set_channel() 524 devc->saved_regs[regoffs] = val; ad1848_mixer_set_channel() 526 ad_write(devc, muteregoffs, muteval); ad1848_mixer_set_channel() 527 devc->saved_regs[muteregoffs] = muteval; ad1848_mixer_set_channel() 529 spin_unlock_irqrestore(&devc->lock,flags); ad1848_mixer_set_channel() 532 static int ad1848_mixer_set(ad1848_info * devc, int dev, int value) ad1848_mixer_set() argument 541 if (!(devc->supported_devices & (1 << dev))) ad1848_mixer_set() 544 dev = devc->mixer_reroute[dev]; ad1848_mixer_set() 546 if (devc->mix_devices[dev][LEFT_CHN].nbits == 0) ad1848_mixer_set() 554 if (devc->mix_devices[dev][RIGHT_CHN].nbits == 0) /* Mono control */ ad1848_mixer_set() 563 devc->levels[dev] = retvol; ad1848_mixer_set() 568 ad1848_mixer_set_channel(devc, dev, left, LEFT_CHN); ad1848_mixer_set() 573 if (devc->mix_devices[dev][RIGHT_CHN].nbits == 0) ad1848_mixer_set() 575 ad1848_mixer_set_channel(devc, dev, right, RIGHT_CHN); ad1848_mixer_set() 581 static void ad1848_mixer_reset(ad1848_info * devc) ad1848_mixer_reset() argument 587 devc->mix_devices = &(ad1848_mix_devices[0]); ad1848_mixer_reset() 589 sprintf(name, "%s_%d", devc->chip_name, nr_ad1848_devs); ad1848_mixer_reset() 592 devc->mixer_reroute[i] = i; ad1848_mixer_reset() 594 devc->supported_rec_devices = MODE1_REC_DEVICES; ad1848_mixer_reset() 596 switch (devc->model) ad1848_mixer_reset() 602 devc->supported_devices = MODE2_MIXER_DEVICES; ad1848_mixer_reset() 606 devc->supported_devices = C930_MIXER_DEVICES; ad1848_mixer_reset() 607 devc->mix_devices = &(c930_mix_devices[0]); ad1848_mixer_reset() 611 devc->supported_devices = MODE3_MIXER_DEVICES; ad1848_mixer_reset() 612 devc->mix_devices = &(iwave_mix_devices[0]); ad1848_mixer_reset() 617 devc->mix_devices = &(cs42xb_mix_devices[0]); ad1848_mixer_reset() 618 devc->supported_devices = MODE3_MIXER_DEVICES; ad1848_mixer_reset() 623 devc->supported_devices = MODE3_MIXER_DEVICES; ad1848_mixer_reset() 628 devc->supported_devices = SPRO_MIXER_DEVICES; ad1848_mixer_reset() 629 devc->supported_rec_devices = SPRO_REC_DEVICES; ad1848_mixer_reset() 630 devc->mix_devices = &(spro_mix_devices[0]); ad1848_mixer_reset() 635 devc->supported_devices = MODE1_MIXER_DEVICES; ad1848_mixer_reset() 638 devc->orig_devices = devc->supported_devices; ad1848_mixer_reset() 639 devc->orig_rec_devices = devc->supported_rec_devices; ad1848_mixer_reset() 641 devc->levels = load_mixer_volumes(name, default_mixer_levels, 1); ad1848_mixer_reset() 645 if (devc->supported_devices & (1 << i)) ad1848_mixer_reset() 646 ad1848_mixer_set(devc, i, devc->levels[i]); ad1848_mixer_reset() 649 ad1848_set_recmask(devc, SOUND_MASK_MIC); ad1848_mixer_reset() 651 devc->mixer_output_port = devc->levels[31] | AUDIO_HEADPHONE | AUDIO_LINE_OUT; ad1848_mixer_reset() 653 spin_lock_irqsave(&devc->lock,flags); ad1848_mixer_reset() 655 if (devc->mixer_output_port & AUDIO_SPEAKER) ad1848_mixer_reset() 656 ad_write(devc, 26, ad_read(devc, 26) & ~0x40); /* Unmute mono out */ ad1848_mixer_reset() 658 ad_write(devc, 26, ad_read(devc, 26) | 0x40); /* Mute mono out */ ad1848_mixer_reset() 665 ad_write(devc, 16, 0x60); ad1848_mixer_reset() 667 spin_unlock_irqrestore(&devc->lock,flags); ad1848_mixer_reset() 672 ad1848_info *devc = mixer_devs[dev]->devc; ad1848_mixer_ioctl() local 684 devc->mixer_output_port = val; ad1848_mixer_ioctl() 686 devc->mixer_output_port = val; ad1848_mixer_ioctl() 687 spin_lock_irqsave(&devc->lock,flags); ad1848_mixer_ioctl() 689 ad_write(devc, 26, ad_read(devc, 26) & ~0x40); /* Unmute mono out */ ad1848_mixer_ioctl() 691 ad_write(devc, 26, ad_read(devc, 26) | 0x40); /* Mute mono out */ ad1848_mixer_ioctl() 692 spin_unlock_irqrestore(&devc->lock,flags); ad1848_mixer_ioctl() 694 val = devc->mixer_output_port; ad1848_mixer_ioctl() 712 val = ad1848_set_recmask(devc, val); ad1848_mixer_ioctl() 718 val = ad1848_mixer_set(devc, cmd & 0xff, val); ad1848_mixer_ioctl() 732 val = devc->recmask; ad1848_mixer_ioctl() 736 val = devc->supported_devices; ad1848_mixer_ioctl() 740 val = devc->supported_devices; ad1848_mixer_ioctl() 741 if (devc->model != MD_C930) ad1848_mixer_ioctl() 746 val = devc->supported_rec_devices; ad1848_mixer_ioctl() 754 val = ad1848_mixer_get(devc, cmd & 0xff); ad1848_mixer_ioctl() 766 ad1848_info *devc = (ad1848_info *) audio_devs[dev]->devc; ad1848_set_speed() local 810 if (devc->model == MD_1845 || devc->model == MD_1845_SSCAPE) /* AD1845 has different timer than others */ ad1848_set_speed() 866 ad1848_info *devc = (ad1848_info *) audio_devs[dev]->devc; ad1848_set_bits() local 921 if (!(arg & ad_format_mask[devc->model])) ad1848_set_bits() 967 ad1848_info *devc; ad1848_open() local 974 devc = (ad1848_info *) audio_devs[dev]->devc; ad1848_open() 978 spin_lock(&devc->lock); ad1848_open() 979 if (portc->open_mode || (devc->open_mode & mode)) ad1848_open() 981 spin_unlock(&devc->lock); ad1848_open() 984 devc->dual_dma = 0; ad1848_open() 988 devc->dual_dma = 1; ad1848_open() 990 devc->intr_active = 0; ad1848_open() 991 devc->audio_mode = 0; ad1848_open() 992 devc->open_mode |= mode; ad1848_open() 994 spin_unlock(&devc->lock); ad1848_open() 998 devc->record_dev = dev; ad1848_open() 1000 devc->playback_dev = dev; ad1848_open() 1004 spin_lock_irqsave(&devc->lock,flags); ad1848_open() 1005 ad_mute(devc); ad1848_open() 1006 spin_unlock_irqrestore(&devc->lock,flags); ad1848_open() 1014 ad1848_info *devc = (ad1848_info *) audio_devs[dev]->devc; ad1848_close() local 1017 devc->intr_active = 0; ad1848_close() 1020 spin_lock_irqsave(&devc->lock,flags); ad1848_close() 1022 devc->audio_mode = 0; ad1848_close() 1023 devc->open_mode &= ~portc->open_mode; ad1848_close() 1026 ad_unmute(devc); ad1848_close() 1027 spin_unlock_irqrestore(&devc->lock,flags); ad1848_close() 1033 ad1848_info *devc = (ad1848_info *) audio_devs[dev]->devc; ad1848_output_block() local 1051 if ((devc->audio_mode & PCM_ENABLE_OUTPUT) && (audio_devs[dev]->flags & DMA_AUTOMODE) && ad1848_output_block() 1053 cnt == devc->xfer_count) ad1848_output_block() 1055 devc->audio_mode |= PCM_ENABLE_OUTPUT; ad1848_output_block() 1056 devc->intr_active = 1; ad1848_output_block() 1061 spin_lock_irqsave(&devc->lock,flags); ad1848_output_block() 1063 ad_write(devc, 15, (unsigned char) (cnt & 0xff)); ad1848_output_block() 1064 ad_write(devc, 14, (unsigned char) ((cnt >> 8) & 0xff)); ad1848_output_block() 1066 devc->xfer_count = cnt; ad1848_output_block() 1067 devc->audio_mode |= PCM_ENABLE_OUTPUT; ad1848_output_block() 1068 devc->intr_active = 1; ad1848_output_block() 1069 spin_unlock_irqrestore(&devc->lock,flags); ad1848_output_block() 1075 ad1848_info *devc = (ad1848_info *) audio_devs[dev]->devc; ad1848_start_input() local 1092 if ((devc->audio_mode & PCM_ENABLE_INPUT) && (audio_devs[dev]->flags & DMA_AUTOMODE) && ad1848_start_input() 1094 cnt == devc->xfer_count) ad1848_start_input() 1096 devc->audio_mode |= PCM_ENABLE_INPUT; ad1848_start_input() 1097 devc->intr_active = 1; ad1848_start_input() 1102 spin_lock_irqsave(&devc->lock,flags); ad1848_start_input() 1104 if (devc->model == MD_1848) ad1848_start_input() 1106 ad_write(devc, 15, (unsigned char) (cnt & 0xff)); ad1848_start_input() 1107 ad_write(devc, 14, (unsigned char) ((cnt >> 8) & 0xff)); ad1848_start_input() 1111 ad_write(devc, 31, (unsigned char) (cnt & 0xff)); ad1848_start_input() 1112 ad_write(devc, 30, (unsigned char) ((cnt >> 8) & 0xff)); ad1848_start_input() 1115 ad_unmute(devc); ad1848_start_input() 1117 devc->xfer_count = cnt; ad1848_start_input() 1118 devc->audio_mode |= PCM_ENABLE_INPUT; ad1848_start_input() 1119 devc->intr_active = 1; ad1848_start_input() 1120 spin_unlock_irqrestore(&devc->lock,flags); ad1848_start_input() 1128 ad1848_info *devc = (ad1848_info *) audio_devs[dev]->devc; ad1848_prepare_for_output() local 1131 ad_mute(devc); ad1848_prepare_for_output() 1133 spin_lock_irqsave(&devc->lock,flags); ad1848_prepare_for_output() 1139 ad_enter_MCE(devc); /* Enables changes to the format select reg */ ad1848_prepare_for_output() 1141 if (devc->model == MD_1845 || devc->model == MD_1845_SSCAPE) /* Use alternate speed select registers */ ad1848_prepare_for_output() 1145 ad_write(devc, 22, (portc->speed >> 8) & 0xff); /* Speed MSB */ ad1848_prepare_for_output() 1146 ad_write(devc, 23, portc->speed & 0xff); /* Speed LSB */ ad1848_prepare_for_output() 1148 old_fs = ad_read(devc, 8); ad1848_prepare_for_output() 1150 if (devc->model == MD_4232 || devc->model >= MD_4236) ad1848_prepare_for_output() 1152 tmp = ad_read(devc, 16); ad1848_prepare_for_output() 1153 ad_write(devc, 16, tmp | 0x30); ad1848_prepare_for_output() 1155 if (devc->model == MD_IWAVE) ad1848_prepare_for_output() 1156 ad_write(devc, 17, 0xc2); /* Disable variable frequency select */ ad1848_prepare_for_output() 1158 ad_write(devc, 8, fs); ad1848_prepare_for_output() 1165 while (timeout < 100 && inb(devc->base) != 0x80) ad1848_prepare_for_output() 1168 while (timeout < 10000 && inb(devc->base) == 0x80) ad1848_prepare_for_output() 1171 if (devc->model >= MD_4232) ad1848_prepare_for_output() 1172 ad_write(devc, 16, tmp & ~0x30); ad1848_prepare_for_output() 1174 ad_leave_MCE(devc); /* ad1848_prepare_for_output() 1177 spin_unlock_irqrestore(&devc->lock,flags); ad1848_prepare_for_output() 1178 devc->xfer_count = 0; ad1848_prepare_for_output() 1181 if (dev == timer_installed && devc->timer_running) ad1848_prepare_for_output() 1196 ad1848_info *devc = (ad1848_info *) audio_devs[dev]->devc; ad1848_prepare_for_input() local 1199 if (devc->audio_mode) ad1848_prepare_for_input() 1202 spin_lock_irqsave(&devc->lock,flags); ad1848_prepare_for_input() 1208 ad_enter_MCE(devc); /* Enables changes to the format select reg */ ad1848_prepare_for_input() 1210 if ((devc->model == MD_1845) || (devc->model == MD_1845_SSCAPE)) /* Use alternate speed select registers */ ad1848_prepare_for_input() 1214 ad_write(devc, 22, (portc->speed >> 8) & 0xff); /* Speed MSB */ ad1848_prepare_for_input() 1215 ad_write(devc, 23, portc->speed & 0xff); /* Speed LSB */ ad1848_prepare_for_input() 1217 if (devc->model == MD_4232) ad1848_prepare_for_input() 1219 tmp = ad_read(devc, 16); ad1848_prepare_for_input() 1220 ad_write(devc, 16, tmp | 0x30); ad1848_prepare_for_input() 1222 if (devc->model == MD_IWAVE) ad1848_prepare_for_input() 1223 ad_write(devc, 17, 0xc2); /* Disable variable frequency select */ ad1848_prepare_for_input() 1229 if (devc->model != MD_1848) ad1848_prepare_for_input() 1231 old_fs = ad_read(devc, 28); ad1848_prepare_for_input() 1232 ad_write(devc, 28, fs); ad1848_prepare_for_input() 1239 while (timeout < 100 && inb(devc->base) != 0x80) ad1848_prepare_for_input() 1243 while (timeout < 10000 && inb(devc->base) == 0x80) ad1848_prepare_for_input() 1246 if (devc->model != MD_1848 && devc->model != MD_1845 && devc->model != MD_1845_SSCAPE) ad1848_prepare_for_input() 1253 unsigned char tmp = portc->speed_bits | (ad_read(devc, 8) & 0xf0); ad1848_prepare_for_input() 1255 ad_write(devc, 8, tmp); ad1848_prepare_for_input() 1260 while (timeout < 100 && inb(devc->base) != 0x80) ad1848_prepare_for_input() 1264 while (timeout < 10000 && inb(devc->base) == 0x80) ad1848_prepare_for_input() 1271 old_fs = ad_read(devc, 8); ad1848_prepare_for_input() 1272 ad_write(devc, 8, fs); ad1848_prepare_for_input() 1277 while (timeout < 100 && inb(devc->base) != 0x80) ad1848_prepare_for_input() 1280 while (timeout < 10000 && inb(devc->base) == 0x80) ad1848_prepare_for_input() 1284 if (devc->model == MD_4232) ad1848_prepare_for_input() 1285 ad_write(devc, 16, tmp & ~0x30); ad1848_prepare_for_input() 1287 ad_leave_MCE(devc); /* ad1848_prepare_for_input() 1290 spin_unlock_irqrestore(&devc->lock,flags); ad1848_prepare_for_input() 1291 devc->xfer_count = 0; ad1848_prepare_for_input() 1294 if (dev == timer_installed && devc->timer_running) ad1848_prepare_for_input() 1308 ad1848_info *devc = (ad1848_info *) audio_devs[dev]->devc; ad1848_halt() local 1311 unsigned char bits = ad_read(devc, 9); ad1848_halt() 1318 devc->audio_mode = 0; ad1848_halt() 1323 ad1848_info *devc = (ad1848_info *) audio_devs[dev]->devc; ad1848_halt_input() local 1326 if (!(ad_read(devc, 9) & 0x02)) ad1848_halt_input() 1329 spin_lock_irqsave(&devc->lock,flags); ad1848_halt_input() 1331 ad_mute(devc); ad1848_halt_input() 1340 if (ad_read(devc, 11) & 0x10) ad1848_halt_input() 1342 ad_write(devc, 9, ad_read(devc, 9) & ~0x02); /* Stop capture */ ad1848_halt_input() 1346 devc->audio_mode &= ~PCM_ENABLE_INPUT; ad1848_halt_input() 1349 outb(0, io_Status(devc)); /* Clear interrupt status */ ad1848_halt_input() 1350 outb(0, io_Status(devc)); /* Clear interrupt status */ ad1848_halt_input() 1352 devc->audio_mode &= ~PCM_ENABLE_INPUT; ad1848_halt_input() 1354 spin_unlock_irqrestore(&devc->lock,flags); ad1848_halt_input() 1359 ad1848_info *devc = (ad1848_info *) audio_devs[dev]->devc; ad1848_halt_output() local 1362 if (!(ad_read(devc, 9) & 0x01)) ad1848_halt_output() 1365 spin_lock_irqsave(&devc->lock,flags); ad1848_halt_output() 1367 ad_mute(devc); ad1848_halt_output() 1375 if (ad_read(devc, 11) & 0x10) ad1848_halt_output() 1377 ad_write(devc, 9, ad_read(devc, 9) & ~0x01); /* Stop playback */ ad1848_halt_output() 1382 devc->audio_mode &= ~PCM_ENABLE_OUTPUT; ad1848_halt_output() 1385 outb((0), io_Status(devc)); /* Clear interrupt status */ ad1848_halt_output() 1386 outb((0), io_Status(devc)); /* Clear interrupt status */ ad1848_halt_output() 1388 devc->audio_mode &= ~PCM_ENABLE_OUTPUT; ad1848_halt_output() 1390 spin_unlock_irqrestore(&devc->lock,flags); ad1848_halt_output() 1395 ad1848_info *devc = (ad1848_info *) audio_devs[dev]->devc; ad1848_trigger() local 1400 spin_lock_irqsave(&devc->lock,flags); ad1848_trigger() 1401 state &= devc->audio_mode; ad1848_trigger() 1403 tmp = old = ad_read(devc, 9); ad1848_trigger() 1419 /* ad_mute(devc); */ ad1848_trigger() 1422 ad_write(devc, 9, tmp); ad1848_trigger() 1423 ad_unmute(devc); ad1848_trigger() 1425 spin_unlock_irqrestore(&devc->lock,flags); ad1848_trigger() 1428 static void ad1848_init_hw(ad1848_info * devc) ad1848_init_hw() argument 1469 if(devc->model >= MD_4236) ad1848_init_hw() 1473 ad_write(devc, i, init_values[i]); ad1848_init_hw() 1476 ad_mute(devc); /* Initialize some variables */ ad1848_init_hw() 1477 ad_unmute(devc); /* Leave it unmuted now */ ad1848_init_hw() 1479 if (devc->model > MD_1848) ad1848_init_hw() 1481 if (devc->model == MD_1845_SSCAPE) ad1848_init_hw() 1482 ad_write(devc, 12, ad_read(devc, 12) | 0x50); ad1848_init_hw() 1484 ad_write(devc, 12, ad_read(devc, 12) | 0x40); /* Mode2 = enabled */ ad1848_init_hw() 1486 if (devc->model == MD_IWAVE) ad1848_init_hw() 1487 ad_write(devc, 12, 0x6c); /* Select codec mode 3 */ ad1848_init_hw() 1489 if (devc->model != MD_1845_SSCAPE) ad1848_init_hw() 1491 ad_write(devc, i, init_values[i]); ad1848_init_hw() 1493 if (devc->model == MD_IWAVE) ad1848_init_hw() 1494 ad_write(devc, 16, 0x30); /* Playback and capture counters enabled */ ad1848_init_hw() 1496 if (devc->model > MD_1848) ad1848_init_hw() 1498 if (devc->audio_flags & DMA_DUPLEX) ad1848_init_hw() 1499 ad_write(devc, 9, ad_read(devc, 9) & ~0x04); /* Dual DMA mode */ ad1848_init_hw() 1501 ad_write(devc, 9, ad_read(devc, 9) | 0x04); /* Single DMA mode */ ad1848_init_hw() 1503 if (devc->model == MD_1845 || devc->model == MD_1845_SSCAPE) ad1848_init_hw() 1504 ad_write(devc, 27, ad_read(devc, 27) | 0x08); /* Alternate freq select enabled */ ad1848_init_hw() 1506 if (devc->model == MD_IWAVE) ad1848_init_hw() 1508 ad_write(devc, 12, 0x6c); /* Select codec mode 3 */ ad1848_init_hw() 1509 ad_write(devc, 16, 0x30); /* Playback and capture counters enabled */ ad1848_init_hw() 1510 ad_write(devc, 17, 0xc2); /* Alternate feature enable */ ad1848_init_hw() 1515 devc->audio_flags &= ~DMA_DUPLEX; ad1848_init_hw() 1516 ad_write(devc, 9, ad_read(devc, 9) | 0x04); /* Single DMA mode */ ad1848_init_hw() 1518 ad_write(devc, 12, ad_read(devc, 12) | 0x40); /* Mode2 = enabled */ ad1848_init_hw() 1521 outb((0), io_Status(devc)); /* Clear pending interrupts */ ad1848_init_hw() 1527 ad_enter_MCE(devc); /* In case the bit was off */ ad1848_init_hw() 1528 ad_leave_MCE(devc); ad1848_init_hw() 1530 ad1848_mixer_reset(devc); ad1848_init_hw() 1536 ad1848_info *devc = &adev_info[nr_ad1848_devs]; ad1848_detect() local 1574 spin_lock_init(&devc->lock); ad1848_detect() 1575 devc->base = io_base; ad1848_detect() 1576 devc->irq_ok = 0; ad1848_detect() 1577 devc->timer_running = 0; ad1848_detect() 1578 devc->MCE_bit = 0x40; ad1848_detect() 1579 devc->irq = 0; ad1848_detect() 1580 devc->open_mode = 0; ad1848_detect() 1581 devc->chip_name = devc->name = "AD1848"; ad1848_detect() 1582 devc->model = MD_1848; /* AD1848 or CS4248 */ ad1848_detect() 1583 devc->levels = NULL; ad1848_detect() 1584 devc->debug_flag = 0; ad1848_detect() 1596 if (inb(devc->base) == 0xff) ad1848_detect() 1609 unsigned char x = inb(devc->base); ad1848_detect() 1617 if (inb(devc->base) == 0x80) /* Not ready. Let's wait */ ad1848_detect() 1618 ad_leave_MCE(devc); ad1848_detect() 1620 if ((inb(devc->base) & 0x80) != 0x00) /* Not a AD1848 */ ad1848_detect() 1622 DDB(printk("ad1848 detect error - step A (%02x)\n", (int) inb(devc->base))); ad1848_detect() 1633 ad_write(devc, 0, 0xaa); ad1848_detect() 1634 ad_write(devc, 1, 0x45); /* 0x55 with bit 0x10 clear */ ad1848_detect() 1636 if ((tmp1 = ad_read(devc, 0)) != 0xaa || (tmp2 = ad_read(devc, 1)) != 0x45) ad1848_detect() 1647 ad_write(devc, 0, 0x45); ad1848_detect() 1648 ad_write(devc, 1, 0xaa); ad1848_detect() 1650 if ((tmp1 = ad_read(devc, 0)) != 0x45 || (tmp2 = ad_read(devc, 1)) != 0xaa) ad1848_detect() 1667 tmp = ad_read(devc, 12); ad1848_detect() 1668 ad_write(devc, 12, (~tmp) & 0x0f); ad1848_detect() 1670 if ((tmp & 0x0f) != ((tmp1 = ad_read(devc, 12)) & 0x0f)) ad1848_detect() 1696 ad_write(devc, 12, 0); /* Mode2=disabled */ ad1848_detect() 1700 if ((tmp1 = ad_read(devc, i)) != (tmp2 = ad_read(devc, i + 16))) ad1848_detect() 1719 ad_write(devc, 12, 0x40); /* Set mode2, clear 0x80 */ ad1848_detect() 1725 tmp1 = ad_read(devc, 12); ad1848_detect() 1731 devc->chip_name = "CS4248"; /* Our best knowledge just now */ ad1848_detect() 1742 ad_write(devc, 16, 0); /* Set I16 to known value */ ad1848_detect() 1744 ad_write(devc, 0, 0x45); ad1848_detect() 1745 if ((tmp1 = ad_read(devc, 16)) != 0x45) /* No change -> CS4231? */ ad1848_detect() 1747 ad_write(devc, 0, 0xaa); ad1848_detect() 1748 if ((tmp1 = ad_read(devc, 16)) == 0xaa) /* Rotten bits? */ ad1848_detect() 1759 tmp1 = ad_read(devc, 25); /* Original bits */ ad1848_detect() 1760 ad_write(devc, 25, ~tmp1); /* Invert all bits */ ad1848_detect() 1761 if ((ad_read(devc, 25) & 0xe7) == (tmp1 & 0xe7)) ad1848_detect() 1769 devc->chip_name = "CS4231"; ad1848_detect() 1770 devc->model = MD_4231; ad1848_detect() 1778 id = ad_read(devc, 25); ad1848_detect() 1780 id = ad_read(devc, 25); ad1848_detect() 1782 id = ad_read(devc, 25); ad1848_detect() 1783 DDB(printk("ad1848_detect() - step J (%02x/%02x)\n", id, ad_read(devc, 25))); ad1848_detect() 1793 unsigned char tmp = ad_read(devc, 23); ad1848_detect() 1794 ad_write(devc, 23, ~tmp); ad1848_detect() 1798 devc->model = MD_IWAVE; ad1848_detect() 1799 devc->chip_name = "IWave"; ad1848_detect() 1801 else if (ad_read(devc, 23) != tmp) /* AD1845 ? */ ad1848_detect() 1803 devc->chip_name = "AD1845"; ad1848_detect() 1804 devc->model = MD_1845; ad1848_detect() 1810 devc->chip_name = "CS4248"; ad1848_detect() 1811 devc->model = MD_1848; ad1848_detect() 1812 ad_write(devc, 12, ad_read(devc, 12) & ~0x40); /* Mode2 off */ ad1848_detect() 1814 ad_write(devc, 23, tmp); /* Restore */ ad1848_detect() 1822 ad_write(devc, 12, ad_read(devc, 12) | 0x60); /* switch to mode 3 */ ad1848_detect() 1823 ad_write(devc, 23, 0x9c); /* select extended register 25 */ ad1848_detect() 1824 xid = inb(io_Indexed_Data(devc)); ad1848_detect() 1825 ad_write(devc, 12, ad_read(devc, 12) & ~0x60); /* back to mode 0 */ ad1848_detect() 1829 devc->chip_name = "CS4237B(B)"; ad1848_detect() 1830 devc->model = MD_42xB; ad1848_detect() 1834 devc->chip_name = "CS4238"; ad1848_detect() 1835 devc->model = MD_42xB; ad1848_detect() 1838 devc->chip_name = "CS4238B"; ad1848_detect() 1839 devc->model = MD_42xB; ad1848_detect() 1842 devc->chip_name = "CS4236B"; ad1848_detect() 1843 devc->model = MD_4236; ad1848_detect() 1846 devc->chip_name = "CS4237B"; ad1848_detect() 1847 devc->model = MD_42xB; ad1848_detect() 1850 devc->chip_name = "CS4235"; ad1848_detect() 1851 devc->model = MD_4235; ad1848_detect() 1854 devc->chip_name = "CS4239"; ad1848_detect() 1855 devc->model = MD_4239; ad1848_detect() 1859 devc->chip_name = "CS42xx"; ad1848_detect() 1860 devc->model = MD_4232; ad1848_detect() 1867 devc->chip_name = "CS4232"; ad1848_detect() 1868 devc->model = MD_4232; ad1848_detect() 1874 devc->chip_name = "CS4231A"; ad1848_detect() 1875 devc->model = MD_4231A; ad1848_detect() 1879 devc->chip_name = "CS4321"; ad1848_detect() 1880 devc->model = MD_4231; ad1848_detect() 1885 DDB(printk("ad1848: I25 = %02x/%02x\n", ad_read(devc, 25), ad_read(devc, 25) & 0xe7)); ad1848_detect() 1888 devc->chip_name = "82C930"; ad1848_detect() 1889 devc->model = MD_C930; ad1848_detect() 1893 devc->chip_name = "CS4231"; ad1848_detect() 1894 devc->model = MD_4231; ad1848_detect() 1899 ad_write(devc, 25, tmp1); /* Restore bits */ ad1848_detect() 1915 if ((tmp1 = ad_read(devc, i)) != (tmp2 = ad_read(devc, i + 16))) { ad1848_detect() 1918 devc->chip_name = "SoundPro CMI 8330"; ad1848_detect() 1927 if (devc->model != MD_1848) ad1848_detect() 1932 if (devc->model == MD_1848 && ad1847_flag) ad1848_detect() 1933 devc->chip_name = "AD1847"; ad1848_detect() 1937 devc->model = MD_1845_SSCAPE; ad1848_detect() 1955 ad1848_info *devc = &adev_info[nr_ad1848_devs]; ad1848_init() local 1959 devc->irq = (irq > 0) ? irq : 0; ad1848_init() 1960 devc->open_mode = 0; ad1848_init() 1961 devc->timer_ticks = 0; ad1848_init() 1962 devc->dma1 = dma_playback; ad1848_init() 1963 devc->dma2 = dma_capture; ad1848_init() 1964 devc->subtype = cfg.card_subtype; ad1848_init() 1965 devc->audio_flags = DMA_AUTOMODE; ad1848_init() 1966 devc->playback_dev = devc->record_dev = 0; ad1848_init() 1968 devc->name = name; ad1848_init() 1972 "%s (%s)", name, devc->chip_name); ad1848_init() 1975 "Generic audio codec (%s)", devc->chip_name); ad1848_init() 1977 rename_region(ports, devc->name); ad1848_init() 1979 conf_printf2(dev_name, devc->base, devc->irq, dma_playback, dma_capture); ad1848_init() 1981 if (devc->model == MD_1848 || devc->model == MD_C930) ad1848_init() 1982 devc->audio_flags |= DMA_HARDSTOP; ad1848_init() 1984 if (devc->model > MD_1848) ad1848_init() 1986 if (devc->dma1 == devc->dma2 || devc->dma2 == -1 || devc->dma1 == -1) ad1848_init() 1987 devc->audio_flags &= ~DMA_DUPLEX; ad1848_init() 1989 devc->audio_flags |= DMA_DUPLEX; ad1848_init() 1994 release_region(devc->base, 4); ad1848_init() 2002 devc->audio_flags, ad1848_init() 2003 ad_format_mask[devc->model], ad1848_init() 2004 devc, ad1848_init() 2008 release_region(devc->base, 4); ad1848_init() 2021 ad1848_init_hw(devc); ad1848_init() 2025 devc->dev_no = my_dev; ad1848_init() 2026 if (request_irq(devc->irq, adintr, 0, devc->name, ad1848_init() 2031 devc->irq = 0; ad1848_init() 2033 if (capabilities[devc->model].flags & CAP_F_TIMER) ad1848_init() 2037 unsigned char tmp = ad_read(devc, 16); ad1848_init() 2040 devc->timer_ticks = 0; ad1848_init() 2042 ad_write(devc, 21, 0x00); /* Timer MSB */ ad1848_init() 2043 ad_write(devc, 20, 0x10); /* Timer LSB */ ad1848_init() 2045 ad_write(devc, 16, tmp | 0x40); /* Enable timer */ ad1848_init() 2046 for (x = 0; x < 100000 && devc->timer_ticks == 0; x++); ad1848_init() 2047 ad_write(devc, 16, tmp & ~0x40); /* Disable timer */ ad1848_init() 2049 if (devc->timer_ticks == 0) ad1848_init() 2054 devc->irq_ok = 1; ad1848_init() 2057 devc->irq_ok = 1; ad1848_init() 2061 devc->irq_ok = 1; /* Couldn't test. assume it's OK */ ad1848_init() 2063 irq2dev[-irq] = devc->dev_no = my_dev; ad1848_init() 2066 if ((capabilities[devc->model].flags & CAP_F_TIMER) && ad1848_init() 2067 devc->irq_ok) ad1848_init() 2073 if (sound_alloc_dma(dma_playback, devc->name)) ad1848_init() 2077 if (sound_alloc_dma(dma_capture, devc->name)) ad1848_init() 2085 devc)) >= 0) ad1848_init() 2096 ad1848_info *devc; ad1848_control() local 2102 devc = &adev_info[nr_ad1848_devs - 1]; ad1848_control() 2107 if (devc->model != MD_1845 && devc->model != MD_1845_SSCAPE) ad1848_control() 2109 spin_lock_irqsave(&devc->lock,flags); ad1848_control() 2110 ad_enter_MCE(devc); ad1848_control() 2111 ad_write(devc, 29, (ad_read(devc, 29) & 0x1f) | (arg << 5)); ad1848_control() 2112 ad_leave_MCE(devc); ad1848_control() 2113 spin_unlock_irqrestore(&devc->lock,flags); ad1848_control() 2124 if (!(devc->supported_devices & (1 << o)) && ad1848_control() 2125 !(devc->supported_rec_devices & (1 << o))) ad1848_control() 2130 ad1848_mixer_set(devc, o, 0); /* Shut up it */ ad1848_control() 2131 devc->supported_devices &= ~(1 << o); ad1848_control() 2132 devc->supported_rec_devices &= ~(1 << o); ad1848_control() 2140 devc->mixer_reroute[n] = o; /* Rename the control */ ad1848_control() 2141 if (devc->supported_devices & (1 << o)) ad1848_control() 2142 devc->supported_devices |= (1 << n); ad1848_control() 2143 if (devc->supported_rec_devices & (1 << o)) ad1848_control() 2144 devc->supported_rec_devices |= (1 << n); ad1848_control() 2146 devc->supported_devices &= ~(1 << o); ad1848_control() 2147 devc->supported_rec_devices &= ~(1 << o); ad1848_control() 2157 ad1848_info *devc = NULL; ad1848_unload() local 2159 for (i = 0; devc == NULL && i < nr_ad1848_devs; i++) ad1848_unload() 2163 devc = &adev_info[i]; ad1848_unload() 2164 dev = devc->dev_no; ad1848_unload() 2168 if (devc != NULL) ad1848_unload() 2171 release_region(devc->base, 4); ad1848_unload() 2175 if (devc->irq > 0) /* There is no point in freeing irq, if it wasn't allocated */ ad1848_unload() 2176 free_irq(devc->irq, (void *)(long)devc->dev_no); ad1848_unload() 2184 mixer = audio_devs[devc->dev_no]->mixer_dev; ad1848_unload() 2199 ad1848_info *devc; adintr() local 2206 devc = (ad1848_info *) audio_devs[dev]->devc; adintr() 2210 status = inb(io_Status(devc)); adintr() 2214 if (devc->model == MD_1848) adintr() 2215 outb((0), io_Status(devc)); /* Clear interrupt status */ adintr() 2219 if (devc->model == MD_C930) adintr() 2222 spin_lock(&devc->lock); adintr() 2231 spin_unlock(&devc->lock); adintr() 2235 else if (devc->model != MD_1848) adintr() 2237 spin_lock(&devc->lock); adintr() 2238 alt_stat = ad_read(devc, 24); adintr() 2239 ad_write(devc, 24, ad_read(devc, 24) & ~alt_stat); /* Selective ack */ adintr() 2240 spin_unlock(&devc->lock); adintr() 2243 if ((devc->open_mode & OPEN_READ) && (devc->audio_mode & PCM_ENABLE_INPUT) && (alt_stat & 0x20)) adintr() 2245 DMAbuf_inputintr(devc->record_dev); adintr() 2247 if ((devc->open_mode & OPEN_WRITE) && (devc->audio_mode & PCM_ENABLE_OUTPUT) && adintr() 2250 DMAbuf_outputintr(devc->playback_dev, 1); adintr() 2252 if (devc->model != MD_1848 && (alt_stat & 0x40)) /* Timer interrupt */ adintr() 2254 devc->timer_ticks++; adintr() 2256 if (timer_installed == dev && devc->timer_running) adintr() 2267 if (inb(io_Status(devc)) & 0x01 && cnt++ < 4) adintr() 2701 ad1848_info *devc = (ad1848_info *) audio_devs[dev]->devc; ad1848_tmr_start() local 2705 spin_lock_irqsave(&devc->lock,flags); ad1848_tmr_start() 2718 if (devc->model == MD_1845 || devc->model == MD_1845_SSCAPE) ad1848_tmr_start() 2720 else if (ad_read(devc, 8) & 0x01) ad1848_tmr_start() 2733 ad_write(devc, 21, (divider >> 8) & 0xff); /* Set upper bits */ ad1848_tmr_start() 2734 ad_write(devc, 20, divider & 0xff); /* Set lower bits */ ad1848_tmr_start() 2735 ad_write(devc, 16, ad_read(devc, 16) | 0x40); /* Start the timer */ ad1848_tmr_start() 2736 devc->timer_running = 1; ad1848_tmr_start() 2737 spin_unlock_irqrestore(&devc->lock,flags); ad1848_tmr_start() 2756 ad1848_info *devc = (ad1848_info *) audio_devs[dev]->devc; ad1848_tmr_disable() local 2758 spin_lock_irqsave(&devc->lock,flags); ad1848_tmr_disable() 2759 ad_write(devc, 16, ad_read(devc, 16) & ~0x40); ad1848_tmr_disable() 2760 devc->timer_running = 0; ad1848_tmr_disable() 2761 spin_unlock_irqrestore(&devc->lock,flags); ad1848_tmr_disable() 2767 ad1848_info *devc = (ad1848_info *) audio_devs[dev]->devc; ad1848_tmr_restart() local 2772 spin_lock_irqsave(&devc->lock,flags); ad1848_tmr_restart() 2773 ad_write(devc, 16, ad_read(devc, 16) | 0x40); ad1848_tmr_restart() 2774 devc->timer_running = 1; ad1848_tmr_restart() 2775 spin_unlock_irqrestore(&devc->lock,flags); ad1848_tmr_restart()
|
H A D | sb_ess.c | 217 static void ess_show_mixerregs (sb_devc *devc); 219 static int ess_read (sb_devc * devc, unsigned char reg); 220 static int ess_write (sb_devc * devc, unsigned char reg, unsigned char data); 222 (sb_devc * devc, unsigned int reg, unsigned int mask, unsigned int val); 264 (sb_devc *devc, struct ess_command *cmdtab[]) ess_exec_commands() 268 cmd = cmdtab [ ((devc->channels != 1) << 1) + (devc->bits != AFMT_U8) ]; ess_exec_commands() 271 ess_write (devc, cmd->cmd, cmd->data); ess_exec_commands() 277 (sb_devc *devc, unsigned int reg, unsigned int mask, unsigned int val) ess_change() 281 value = ess_read (devc, reg); ess_change() 283 ess_write (devc, reg, value); ess_change() 289 sb_devc *devc = audio_devs[dev]->devc; ess_set_output_parms() local 291 if (devc->duplex) { ess_set_output_parms() 292 devc->trg_buf_16 = buf; ess_set_output_parms() 293 devc->trg_bytes_16 = nr_bytes; ess_set_output_parms() 294 devc->trg_intrflag_16 = intrflag; ess_set_output_parms() 295 devc->irq_mode_16 = IMODE_OUTPUT; ess_set_output_parms() 297 devc->trg_buf = buf; ess_set_output_parms() 298 devc->trg_bytes = nr_bytes; ess_set_output_parms() 299 devc->trg_intrflag = intrflag; ess_set_output_parms() 300 devc->irq_mode = IMODE_OUTPUT; ess_set_output_parms() 307 sb_devc *devc = audio_devs[dev]->devc; ess_set_input_parms() local 309 devc->trg_buf = buf; ess_set_input_parms() 310 devc->trg_bytes = count; ess_set_input_parms() 311 devc->trg_intrflag = intrflag; ess_set_input_parms() 312 devc->irq_mode = IMODE_INPUT; ess_set_input_parms() 373 static void ess_common_speed (sb_devc *devc, int *speedp, int *divp) ess_common_speed() argument 377 if (devc->duplex) { ess_common_speed() 381 if (devc->submodel == SUBMDL_ES1888) { ess_common_speed() 386 } else if(devc->caps & SB_CAP_ES18XX_RATE) { ess_common_speed() 387 if (devc->submodel == SUBMDL_ES1888) { ess_common_speed() 404 static void ess_speed (sb_devc *devc, int audionum) ess_speed() argument 409 ess_common_speed (devc, &(devc->speed), &div); ess_speed() 412 printk (KERN_INFO "FKS: ess_speed (%d) b speed = %d, div=%x\n", audionum, devc->speed, div); ess_speed() 416 speed = (devc->speed * 9) / 20; ess_speed() 420 if (!devc->duplex) audionum = 1; ess_speed() 424 sb_chg_mixer(devc, 0x71, 0x20, 0x20) ess_speed() 426 ess_write (devc, 0xa1, div); ess_speed() 427 ess_write (devc, 0xa2, div2); ess_speed() 429 ess_setmixer (devc, 0x70, div); ess_speed() 433 ess_write (devc, 0xa2, div2); ess_speed() 434 ess_setmixer (devc, 0x72, div2); ess_speed() 440 sb_devc *devc = audio_devs[dev]->devc; ess_audio_prepare_for_input() local 442 ess_speed(devc, 1); ess_audio_prepare_for_input() 444 sb_dsp_command(devc, DSP_CMD_SPKOFF); ess_audio_prepare_for_input() 446 ess_write (devc, 0xb8, 0x0e); /* Auto init DMA mode */ ess_audio_prepare_for_input() 447 ess_change (devc, 0xa8, 0x03, 3 - devc->channels); /* Mono/stereo */ ess_audio_prepare_for_input() 448 ess_write (devc, 0xb9, 2); /* Demand mode (4 bytes/DMA request) */ ess_audio_prepare_for_input() 450 ess_exec_commands (devc, ess_inp_cmds); ess_audio_prepare_for_input() 452 ess_change (devc, 0xb1, 0xf0, 0x50); ess_audio_prepare_for_input() 453 ess_change (devc, 0xb2, 0xf0, 0x50); ess_audio_prepare_for_input() 455 devc->trigger_bits = 0; ess_audio_prepare_for_input() 461 sb_devc *devc = audio_devs[dev]->devc; ess_audio_prepare_for_output_audio1() local 463 sb_dsp_reset(devc); ess_audio_prepare_for_output_audio1() 464 ess_speed(devc, 1); ess_audio_prepare_for_output_audio1() 465 ess_write (devc, 0xb8, 4); /* Auto init DMA mode */ ess_audio_prepare_for_output_audio1() 466 ess_change (devc, 0xa8, 0x03, 3 - devc->channels); /* Mono/stereo */ ess_audio_prepare_for_output_audio1() 467 ess_write (devc, 0xb9, 2); /* Demand mode (4 bytes/request) */ ess_audio_prepare_for_output_audio1() 469 ess_exec_commands (devc, ess_out_cmds); ess_audio_prepare_for_output_audio1() 471 ess_change (devc, 0xb1, 0xf0, 0x50); /* Enable DMA */ ess_audio_prepare_for_output_audio1() 472 ess_change (devc, 0xb2, 0xf0, 0x50); /* Enable IRQ */ ess_audio_prepare_for_output_audio1() 474 sb_dsp_command(devc, DSP_CMD_SPKON); /* There be sound! */ ess_audio_prepare_for_output_audio1() 476 devc->trigger_bits = 0; ess_audio_prepare_for_output_audio1() 482 sb_devc *devc = audio_devs[dev]->devc; ess_audio_prepare_for_output_audio2() local 486 sb_dsp_reset(devc); ess_audio_prepare_for_output_audio2() 494 ess_chgmixer (devc, 0x78, 0xd0, 0xd0); ess_audio_prepare_for_output_audio2() 496 ess_speed(devc, 2); ess_audio_prepare_for_output_audio2() 499 bits = ess_getmixer (devc, 0x7a) & 0x18; ess_audio_prepare_for_output_audio2() 502 if (devc->channels != 1) bits |= 0x02; ess_audio_prepare_for_output_audio2() 505 if (devc->bits != AFMT_U8) bits |= 0x05; /* 16 bit */ ess_audio_prepare_for_output_audio2() 510 ess_setmixer (devc, 0x7a, bits); ess_audio_prepare_for_output_audio2() 512 ess_mixer_reload (devc, SOUND_MIXER_PCM); /* There be sound! */ ess_audio_prepare_for_output_audio2() 514 devc->trigger_bits = 0; ess_audio_prepare_for_output_audio2() 520 sb_devc *devc = audio_devs[dev]->devc; ess_audio_prepare_for_output() local 527 if (devc->duplex) { ess_audio_prepare_for_output() 537 sb_devc *devc = audio_devs[dev]->devc; ess_audio_halt_xfer() local 539 spin_lock_irqsave(&devc->lock, flags); ess_audio_halt_xfer() 540 sb_dsp_reset(devc); ess_audio_halt_xfer() 541 spin_unlock_irqrestore(&devc->lock, flags); ess_audio_halt_xfer() 546 if (devc->duplex) ess_chgmixer(devc, 0x78, 0x03, 0x00); ess_audio_halt_xfer() 553 sb_devc *devc = audio_devs[dev]->devc; ess_audio_start_input() local 563 devc->irq_mode = IMODE_INPUT; ess_audio_start_input() 565 ess_write (devc, 0xa4, (unsigned char) ((unsigned short) c & 0xff)); ess_audio_start_input() 566 ess_write (devc, 0xa5, (unsigned char) (((unsigned short) c >> 8) & 0xff)); ess_audio_start_input() 568 ess_change (devc, 0xb8, 0x0f, 0x0f); /* Go */ ess_audio_start_input() 569 devc->intr_active = 1; ess_audio_start_input() 576 sb_devc *devc = audio_devs[dev]->devc; ess_audio_output_block_audio1() local 583 devc->irq_mode = IMODE_OUTPUT; ess_audio_output_block_audio1() 585 ess_write (devc, 0xa4, (unsigned char) ((unsigned short) c & 0xff)); ess_audio_output_block_audio1() 586 ess_write (devc, 0xa5, (unsigned char) (((unsigned short) c >> 8) & 0xff)); ess_audio_output_block_audio1() 588 ess_change (devc, 0xb8, 0x05, 0x05); /* Go */ ess_audio_output_block_audio1() 589 devc->intr_active = 1; ess_audio_output_block_audio1() 596 sb_devc *devc = audio_devs[dev]->devc; ess_audio_output_block_audio2() local 602 ess_setmixer (devc, 0x74, (unsigned char) ((unsigned short) c & 0xff)); ess_audio_output_block_audio2() 603 ess_setmixer (devc, 0x76, (unsigned char) (((unsigned short) c >> 8) & 0xff)); ess_audio_output_block_audio2() 604 ess_chgmixer (devc, 0x78, 0x03, 0x03); /* Go */ ess_audio_output_block_audio2() 606 devc->irq_mode_16 = IMODE_OUTPUT; ess_audio_output_block_audio2() 607 devc->intr_active_16 = 1; ess_audio_output_block_audio2() 613 sb_devc *devc = audio_devs[dev]->devc; ess_audio_output_block() local 615 if (devc->duplex) { ess_audio_output_block() 628 sb_devc *devc = audio_devs[dev]->devc; ess_audio_trigger() local 630 int bits_16 = bits & devc->irq_mode_16; ess_audio_trigger() 631 bits &= devc->irq_mode; ess_audio_trigger() 635 sb_dsp_command(devc, 0xd0); /* Halt DMA */ ess_audio_trigger() 639 switch (devc->irq_mode) ess_audio_trigger() 642 ess_audio_start_input(dev, devc->trg_buf, devc->trg_bytes, ess_audio_trigger() 643 devc->trg_intrflag); ess_audio_trigger() 647 ess_audio_output_block(dev, devc->trg_buf, devc->trg_bytes, ess_audio_trigger() 648 devc->trg_intrflag); ess_audio_trigger() 654 switch (devc->irq_mode_16) { ess_audio_trigger() 656 ess_audio_start_input(dev, devc->trg_buf_16, devc->trg_bytes_16, ess_audio_trigger() 657 devc->trg_intrflag_16); ess_audio_trigger() 661 ess_audio_output_block(dev, devc->trg_buf_16, devc->trg_bytes_16, ess_audio_trigger() 662 devc->trg_intrflag_16); ess_audio_trigger() 667 devc->trigger_bits = bits | bits_16; ess_audio_trigger() 672 sb_devc *devc = audio_devs[dev]->devc; ess_audio_set_speed() local 676 minspeed = (devc->duplex ? 6215 : 5000 ); ess_audio_set_speed() 677 maxspeed = (devc->duplex ? 44100 : 48000); ess_audio_set_speed() 681 ess_common_speed (devc, &speed, &dummydiv); ess_audio_set_speed() 683 devc->speed = speed; ess_audio_set_speed() 685 return devc->speed; ess_audio_set_speed() 693 sb_devc *devc = audio_devs[dev]->devc; ess_audio_set_bits() local 697 devc->bits = bits; ess_audio_set_bits() 699 devc->bits = AFMT_U8; ess_audio_set_bits() 703 return devc->bits; ess_audio_set_bits() 712 sb_devc *devc = audio_devs[dev]->devc; ess_audio_set_channels() local 714 if (channels == 1 || channels == 2) devc->channels = channels; ess_audio_set_channels() 716 return devc->channels; ess_audio_set_channels() 739 (sb_devc *devc, int *audio_flags, int *format_mask) ess_audio_init() 744 if (devc->duplex) { ess_audio_init() 750 tmp_dma = devc->dma16; ess_audio_init() 751 devc->dma16 = devc->dma8; ess_audio_init() 752 devc->dma8 = tmp_dma; ess_audio_init() 793 * So IMODE_MIDI isn't a value for devc->irq_mode. 795 void ess_intr (sb_devc *devc) ess_intr() argument 800 if (devc->submodel == SUBMDL_ES1887) { ess_intr() 801 src = ess_getmixer (devc, 0x7f) >> 4; ess_intr() 811 , devc->dev, devc->intr_active , src & 0x01, devc->irq_mode ); ess_intr() 814 , devc->dev, devc->intr_active_16, src & 0x02, devc->irq_mode_16); ess_intr() 818 if (devc->submodel == SUBMDL_ES1887 && (src & 0x02)) { ess_intr() 819 ess_chgmixer (devc, 0x7a, 0x80, 0x00); ess_intr() 827 static void ess_extended (sb_devc * devc) ess_extended() argument 831 sb_dsp_command(devc, 0xc6); ess_extended() 834 static int ess_write (sb_devc * devc, unsigned char reg, unsigned char data) ess_write() argument 841 if (!sb_dsp_command(devc, reg)) ess_write() 844 return sb_dsp_command(devc, data); ess_write() 847 static int ess_read (sb_devc * devc, unsigned char reg) ess_read() argument 852 if (!sb_dsp_command(devc, 0xc0)) return -1; ess_read() 854 if (!sb_dsp_command(devc, reg )) return -1; ess_read() 856 return sb_dsp_get_byte(devc); ess_read() 859 int ess_dsp_reset(sb_devc * devc) ess_dsp_reset() argument 865 ess_show_mixerregs (devc); ess_dsp_reset() 880 ess_extended (devc); ess_dsp_reset() 884 ess_show_mixerregs (devc); ess_dsp_reset() 915 static int ess_common_set_irq_hw (sb_devc * devc) ess_common_set_irq_hw() argument 919 if ((irq_bits = ess_irq_bits (devc->irq)) == -1) return 0; ess_common_set_irq_hw() 921 if (!ess_write (devc, 0xb1, 0x50 | (irq_bits << 2))) { ess_common_set_irq_hw() 935 static void ess_es1887_set_irq_hw (sb_devc * devc) ess_es1887_set_irq_hw() argument 939 if ((irq_bits = ess_irq_bits (devc->irq)) == -1) return; ess_es1887_set_irq_hw() 941 ess_chgmixer (devc, 0x7f, 0x0f, 0x01 | ((irq_bits + 1) << 1)); ess_es1887_set_irq_hw() 944 static int ess_set_irq_hw (sb_devc * devc) ess_set_irq_hw() argument 946 if (devc->submodel == SUBMDL_ES1887) ess_es1887_set_irq_hw (devc); ess_set_irq_hw() 948 return ess_common_set_irq_hw (devc); ess_set_irq_hw() 962 static void FKS_test (sb_devc * devc) FKS_test() argument 965 val1 = ess_getmixer (devc, 0x64); FKS_test() 966 ess_setmixer (devc, 0x64, ~val1); FKS_test() 967 val2 = ess_getmixer (devc, 0x64) ^ ~val1; FKS_test() 968 ess_setmixer (devc, 0x64, val1); FKS_test() 969 val1 ^= ess_getmixer (devc, 0x64); FKS_test() 974 static unsigned int ess_identify (sb_devc * devc) ess_identify() argument 979 spin_lock_irqsave(&devc->lock, flags); ess_identify() 987 spin_unlock_irqrestore(&devc->lock, flags); ess_identify() 1000 static int ess_probe (sb_devc * devc, int reg, int xorval) ess_probe() argument 1004 val1 = ess_getmixer (devc, reg); ess_probe() 1006 ess_setmixer (devc, reg, val2); ess_probe() 1007 val3 = ess_getmixer (devc, reg); ess_probe() 1008 ess_setmixer (devc, reg, val1); ess_probe() 1013 int ess_init(sb_devc * devc, struct address_info *hw_config) argument 1024 sb_dsp_command(devc, 0xe7); /* Return identification */ 1043 devc->model = MDL_SBPRO; 1062 devc->model = MDL_ESS; 1063 devc->submodel = ess_minor & 0x0f; 1069 switch (devc->sbmo.esstype) { 1101 printk (KERN_ERR "Invalid esstype=%d specified\n", devc->sbmo.esstype); 1105 devc->submodel = submodel; 1106 sprintf (modelname, "ES%d", devc->sbmo.esstype); 1113 FKS_test (devc); 1119 if (chip == NULL && devc->sbmo.esstype == ESSTYPE_LIKE20) { 1126 type = ess_identify (devc); 1131 devc->submodel = SUBMDL_ES1868; 1135 devc->submodel = SUBMDL_ES1869; 1139 devc->submodel = SUBMDL_ES1878; 1143 devc->submodel = SUBMDL_ES1879; 1160 if (chip == NULL && !ess_probe(devc, 0x64, (1 << 4))) { 1168 if (chip == NULL && ess_probe(devc, 0x64, (1 << 2))) { 1169 if (ess_probe (devc, 0x70, 0x7f)) { 1170 if (ess_probe (devc, 0x64, (1 << 5))) { 1172 devc->submodel = SUBMDL_ES1887; 1175 devc->submodel = SUBMDL_ES1888; 1179 devc->submodel = SUBMDL_ES1788; 1187 (devc->sbmo.esstype == ESSTYPE_DETECT || 1188 devc->sbmo.esstype == ESSTYPE_LIKE20) ? 1190 devc->sbmo.esstype == ESSTYPE_LIKE20 ? 1199 switch(devc->submodel) { 1205 devc->caps |= SB_CAP_ES18XX_RATE; 1211 sb_dsp_reset(devc); /* Turn on extended mode */ 1216 cfg = ess_getmixer (devc, 0x40); 1217 ess_setmixer (devc, 0x40, cfg | 0x03); 1218 if (devc->submodel >= 8) { /* ES1688 */ 1219 devc->caps |= SB_NO_MIDI; /* ES1688 uses MPU401 MIDI mode */ 1221 sb_dsp_reset (devc); 1227 return ess_set_irq_hw (devc); 1230 static int ess_set_dma_hw(sb_devc * devc) ess_set_dma_hw() argument 1237 , devc->dma8, devc->dma16, devc->duplex); ess_set_dma_hw() 1243 dma = devc->dma8; ess_set_dma_hw() 1260 if (!ess_write (devc, 0xb2, cfg | (dma_bits << 2))) { ess_set_dma_hw() 1265 if (devc->duplex) { ess_set_dma_hw() 1266 dma = devc->dma16; ess_set_dma_hw() 1288 ess_chgmixer (devc, 0x78, 0x20, dma16_bits); ess_set_dma_hw() 1289 ess_chgmixer (devc, 0x7d, 0x07, dma_bits); ess_set_dma_hw() 1302 int ess_dsp_init (sb_devc *devc, struct address_info *hw_config) ess_dsp_init() argument 1307 if (devc->model != MDL_ESS) { ess_dsp_init() 1320 if (devc->submodel == SUBMDL_ES1887) { ess_dsp_init() 1322 devc->dma16 = hw_config->dma2; ess_dsp_init() 1325 * devc->duplex initialization is put here, cause ess_dsp_init() 1328 if (devc->dma8 != devc->dma16 && devc->dma16 != -1) { ess_dsp_init() 1329 devc->duplex = 1; ess_dsp_init() 1332 if (!ess_set_dma_hw (devc)) { ess_dsp_init() 1333 free_irq(devc->irq, devc); ess_dsp_init() 1548 static void ess_show_mixerregs (sb_devc *devc) ess_show_mixerregs() argument 1555 printk (KERN_INFO "res (%x)=%x\n", *mp, (int)(ess_getmixer (devc, *mp))); ess_show_mixerregs() 1561 void ess_setmixer (sb_devc * devc, unsigned int port, unsigned int value) ess_setmixer() argument 1569 spin_lock_irqsave(&devc->lock, flags); ess_setmixer() 1571 ess_write (devc, port, value); ess_setmixer() 1579 spin_unlock_irqrestore(&devc->lock, flags); ess_setmixer() 1582 unsigned int ess_getmixer (sb_devc * devc, unsigned int port) ess_getmixer() argument 1587 spin_lock_irqsave(&devc->lock, flags); ess_getmixer() 1590 val = ess_read (devc, port); ess_getmixer() 1598 spin_unlock_irqrestore(&devc->lock, flags); ess_getmixer() 1604 (sb_devc * devc, unsigned int reg, unsigned int mask, unsigned int val) ess_chgmixer() 1608 value = ess_getmixer (devc, reg); ess_chgmixer() 1610 ess_setmixer (devc, reg, value); ess_chgmixer() 1616 void ess_mixer_init (sb_devc * devc) ess_mixer_init() argument 1618 devc->mixer_caps = SOUND_CAP_EXCL_INPUT; ess_mixer_init() 1623 switch (devc->submodel) { ess_mixer_init() 1625 devc->supported_devices = ES1887_MIXER_DEVICES; ess_mixer_init() 1626 devc->supported_rec_devices = ES1887_RECORDING_DEVICES; ess_mixer_init() 1628 printk (KERN_INFO "FKS: ess_mixer_init dup = %d\n", devc->duplex); ess_mixer_init() 1630 if (devc->duplex) { ess_mixer_init() 1631 devc->iomap = &es1887_mix; ess_mixer_init() 1632 devc->iomap_sz = ARRAY_SIZE(es1887_mix); ess_mixer_init() 1634 devc->iomap = &es_rec_mix; ess_mixer_init() 1635 devc->iomap_sz = ARRAY_SIZE(es_rec_mix); ess_mixer_init() 1639 if (devc->submodel < 8) { ess_mixer_init() 1640 devc->supported_devices = ES688_MIXER_DEVICES; ess_mixer_init() 1641 devc->supported_rec_devices = ES688_RECORDING_DEVICES; ess_mixer_init() 1642 devc->iomap = &es688_mix; ess_mixer_init() 1643 devc->iomap_sz = ARRAY_SIZE(es688_mix); ess_mixer_init() 1649 devc->supported_devices = ES1688_MIXER_DEVICES; ess_mixer_init() 1650 devc->supported_rec_devices = ES1688_RECORDING_DEVICES; ess_mixer_init() 1651 if (devc->submodel < 0x10) { ess_mixer_init() 1652 devc->iomap = &es1688_mix; ess_mixer_init() 1653 devc->iomap_sz = ARRAY_SIZE(es688_mix); ess_mixer_init() 1655 devc->iomap = &es1688later_mix; ess_mixer_init() 1656 devc->iomap_sz = ARRAY_SIZE(es1688later_mix); ess_mixer_init() 1664 * take care of recording levels of recorded inputs (devc->recmask) too! 1666 int ess_mixer_set(sb_devc *devc, int dev, int left, int right) ess_mixer_set() argument 1668 if (ess_has_rec_mixer (devc->submodel) && (devc->recmask & (1 << dev))) { ess_mixer_set() 1669 sb_common_mixer_set (devc, dev + ES_REC_MIXER_RECDIFF, left, right); ess_mixer_set() 1671 return sb_common_mixer_set (devc, dev, left, right); ess_mixer_set() 1679 void ess_mixer_reload (sb_devc *devc, int dev) ess_mixer_reload() argument 1683 value = devc->levels[dev]; ess_mixer_reload() 1687 sb_common_mixer_set(devc, dev, left, right); ess_mixer_reload() 1690 static int es_rec_set_recmask(sb_devc * devc, int mask) es_rec_set_recmask() argument 1704 cur_mask = devc->recmask; es_rec_set_recmask() 1711 value = devc->levels[i]; es_rec_set_recmask() 1718 sb_common_mixer_set(devc, i + ES_REC_MIXER_RECDIFF, left, right); es_rec_set_recmask() 1724 int ess_set_recmask(sb_devc * devc, int *mask) ess_set_recmask() argument 1728 if (ess_has_rec_mixer (devc->submodel)) { ess_set_recmask() 1729 *mask = es_rec_set_recmask (devc, *mask); ess_set_recmask() 1739 int ess_mixer_reset (sb_devc * devc) ess_mixer_reset() argument 1744 if (ess_has_rec_mixer (devc->submodel)) { ess_mixer_reset() 1745 switch (devc->submodel) { ess_mixer_reset() 1752 ess_chgmixer(devc, 0x7a, 0x18, 0x08); ess_mixer_reset() 1753 ess_chgmixer(devc, 0x1c, 0x07, 0x07); ess_mixer_reset() 1759 devc->recmask = devc->supported_rec_devices; ess_mixer_reset() 1760 es_rec_set_recmask(devc, 0); ess_mixer_reset() 1761 devc->recmask = 0; ess_mixer_reset() 1778 int ess_midi_init(sb_devc * devc, struct address_info *hw_config) ess_midi_init() argument 1782 cfg = ess_getmixer (devc, 0x40) & 0x03; ess_midi_init() 1784 if (devc->submodel < 8) { ess_midi_init() 1785 ess_setmixer (devc, 0x40, cfg | 0x03); /* Enable OPL3 & joystick */ ess_midi_init() 1791 ess_setmixer (devc, 0x40, cfg); ess_midi_init() 1818 ess_setmixer (devc, 0x40, cfg | 0x03); ess_midi_init() 263 ess_exec_commands(sb_devc *devc, struct ess_command *cmdtab[]) ess_exec_commands() argument 276 ess_change(sb_devc *devc, unsigned int reg, unsigned int mask, unsigned int val) ess_change() argument 738 ess_audio_init(sb_devc *devc, int *audio_flags, int *format_mask) ess_audio_init() argument 1603 ess_chgmixer(sb_devc * devc, unsigned int reg, unsigned int mask, unsigned int val) ess_chgmixer() argument
|
H A D | opl3.c | 78 static struct opl_devinfo *devc = NULL; variable in typeref:struct:opl_devinfo 94 devc->cmask = 0x3f; /* Connect all possible 4 OP voice operators */ enter_4op_mode() 95 opl3_command(devc->right_io, CONNECTION_SELECT_REGISTER, 0x3f); enter_4op_mode() 108 devc->lv_map[i] = v4op[i]; enter_4op_mode() 109 devc->v_alloc->max_voice = devc->nr_voice = 12; enter_4op_mode() 128 devc->fm_info.nr_voices = (devc->nr_voice == 12) ? 6 : devc->nr_voice; opl3_ioctl() 129 if (copy_to_user(arg, &devc->fm_info, sizeof(devc->fm_info))) opl3_ioctl() 137 if (devc->model == 2) opl3_ioctl() 162 if (devc != NULL) opl3_detect() 168 devc = kzalloc(sizeof(*devc), GFP_KERNEL); opl3_detect() 170 if (devc == NULL) opl3_detect() 177 strcpy(devc->fm_info.name, "OPL2"); opl3_detect() 179 if (!request_region(ioaddr, 4, devc->fm_info.name)) { opl3_detect() 184 devc->base = ioaddr; opl3_detect() 263 kfree(devc); opl3_detect() 264 devc = NULL; opl3_detect() 272 if (voice < 0 || voice >= devc->nr_voice) opl3_kill_note() 275 devc->v_alloc->map[voice] = 0; opl3_kill_note() 277 map = &pv_map[devc->lv_map[voice]]; opl3_kill_note() 282 opl3_command(map->ioaddr, KEYON_BLOCK + map->voice_num, devc->voc[voice].keyon_byte & ~0x20); opl3_kill_note() 283 devc->voc[voice].keyon_byte = 0; opl3_kill_note() 284 devc->voc[voice].bender = 0; opl3_kill_note() 285 devc->voc[voice].volume = 64; opl3_kill_note() 286 devc->voc[voice].panning = 0xffff; /* Not set */ opl3_kill_note() 287 devc->voc[voice].bender_range = 200; opl3_kill_note() 288 devc->voc[voice].orig_freq = 0; opl3_kill_note() 289 devc->voc[voice].current_freq = 0; opl3_kill_note() 290 devc->voc[voice].mode = 0; opl3_kill_note() 304 if (instr->key != FM_PATCH && (instr->key != OPL3_PATCH || devc->model != 2)) store_instr() 306 memcpy((char *) &(devc->i_map[instr_no]), (char *) instr, sizeof(*instr)); store_instr() 312 if (voice < 0 || voice >= devc->nr_voice) opl3_set_instr() 317 devc->act_i[voice] = &devc->i_map[instr_no]; opl3_set_instr() 376 if (voice < 0 || voice >= devc->nr_voice) set_voice_volume() 379 map = &pv_map[devc->lv_map[voice]]; set_voice_volume() 380 instr = devc->act_i[voice]; set_voice_volume() 383 instr = &devc->i_map[0]; set_voice_volume() 388 if (devc->voc[voice].mode == 0) set_voice_volume() 391 if (devc->voc[voice].mode == 2) set_voice_volume() 419 * The connection method for 4 OP devc->voc is defined by the rightmost set_voice_volume() 464 if (voice < 0 || voice >= devc->nr_voice) opl3_start_note() 467 map = &pv_map[devc->lv_map[voice]]; opl3_start_note() 468 pan = devc->voc[voice].panning; opl3_start_note() 477 set_voice_volume(voice, volume, devc->voc[voice].volume); opl3_start_note() 506 instr = devc->act_i[voice]; opl3_start_note() 509 instr = &devc->i_map[0]; opl3_start_note() 528 voice_shift = (map->ioaddr == devc->left_io) ? 0 : 3; opl3_start_note() 536 devc->cmask &= ~(1 << voice_shift); opl3_start_note() 540 devc->cmask |= (1 << voice_shift); opl3_start_note() 543 opl3_command(devc->right_io, CONNECTION_SELECT_REGISTER, devc->cmask); opl3_start_note() 644 devc->voc[voice].mode = voice_mode; opl3_start_note() 645 set_voice_volume(voice, volume, devc->voc[voice].volume); opl3_start_note() 647 freq = devc->voc[voice].orig_freq = note_to_freq(note) / 1000; opl3_start_note() 654 freq = compute_finetune(devc->voc[voice].orig_freq, devc->voc[voice].bender, devc->voc[voice].bender_range, 0); opl3_start_note() 655 devc->voc[voice].current_freq = freq; opl3_start_note() 669 devc->voc[voice].keyon_byte = data; opl3_start_note() 729 if (devc->model != 2) opl3_command() 737 if (devc->model != 2) opl3_command() 749 devc->lv_map[i] = i; opl3_reset() 751 for (i = 0; i < devc->nr_voice; i++) opl3_reset() 753 opl3_command(pv_map[devc->lv_map[i]].ioaddr, opl3_reset() 754 KSL_LEVEL + pv_map[devc->lv_map[i]].op[0], 0xff); opl3_reset() 756 opl3_command(pv_map[devc->lv_map[i]].ioaddr, opl3_reset() 757 KSL_LEVEL + pv_map[devc->lv_map[i]].op[1], 0xff); opl3_reset() 759 if (pv_map[devc->lv_map[i]].voice_mode == 4) opl3_reset() 761 opl3_command(pv_map[devc->lv_map[i]].ioaddr, opl3_reset() 762 KSL_LEVEL + pv_map[devc->lv_map[i]].op[2], 0xff); opl3_reset() 764 opl3_command(pv_map[devc->lv_map[i]].ioaddr, opl3_reset() 765 KSL_LEVEL + pv_map[devc->lv_map[i]].op[3], 0xff); opl3_reset() 771 if (devc->model == 2) opl3_reset() 773 devc->v_alloc->max_voice = devc->nr_voice = 18; opl3_reset() 785 if (devc->busy) opl3_open() 787 devc->busy = 1; opl3_open() 789 devc->v_alloc->max_voice = devc->nr_voice = (devc->model == 2) ? 18 : 9; opl3_open() 790 devc->v_alloc->timestamp = 0; opl3_open() 794 devc->v_alloc->map[i] = 0; opl3_open() 795 devc->v_alloc->alloc_times[i] = 0; opl3_open() 798 devc->cmask = 0x00; /* opl3_open() 801 if (devc->model == 2) opl3_open() 802 opl3_command(devc->right_io, CONNECTION_SELECT_REGISTER, devc->cmask); opl3_open() 808 devc->busy = 0; opl3_close() 809 devc->v_alloc->max_voice = devc->nr_voice = (devc->model == 2) ? 18 : 9; opl3_close() 811 devc->fm_info.nr_drums = 0; opl3_close() 812 devc->fm_info.perc_mode = 0; opl3_close() 848 if (voice < 0 || voice >= devc->nr_voice) opl3_panning() 851 devc->voc[voice].panning = value; opl3_panning() 870 if (voice < 0 || voice >= devc->nr_voice) opl3_aftertouch() 873 map = &pv_map[devc->lv_map[voice]]; opl3_aftertouch() 882 instr = devc->act_i[voice]; opl3_aftertouch() 885 instr = &devc->i_map[0]; opl3_aftertouch() 887 if (devc->voc[voice].mode == 4) opl3_aftertouch() 937 map = &pv_map[devc->lv_map[voice]]; bend_pitch() 942 devc->voc[voice].bender = value; bend_pitch() 945 if (!(devc->voc[voice].keyon_byte & 0x20)) bend_pitch() 950 freq = compute_finetune(devc->voc[voice].orig_freq, devc->voc[voice].bender, devc->voc[voice].bender_range, 0); bend_pitch() 951 devc->voc[voice].current_freq = freq; bend_pitch() 961 devc->voc[voice].keyon_byte = data; bend_pitch() 967 if (voice < 0 || voice >= devc->nr_voice) opl3_controller() 977 devc->voc[voice].bender_range = value; opl3_controller() 981 devc->voc[voice].volume = value / 128; opl3_controller() 985 devc->voc[voice].panning = (value * 2) - 128; opl3_controller() 992 if (voice < 0 || voice >= devc->nr_voice) opl3_bender() 1008 instr_no = devc->chn_info[chn].pgm_num; opl3_alloc_voice() 1010 instr = &devc->i_map[instr_no]; opl3_alloc_voice() 1012 devc->nr_voice != 12) /* Not in 4 OP mode */ opl3_alloc_voice() 1014 else if (devc->nr_voice == 12) /* 4 OP mode */ opl3_alloc_voice() 1026 if (devc->nr_voice == 12) /* 4 OP mode. Use the '2 OP only' operators first */ opl3_alloc_voice() 1030 avail = devc->nr_voice; opl3_alloc_voice() 1058 if (best > devc->nr_voice) opl3_alloc_voice() 1059 best -= devc->nr_voice; opl3_alloc_voice() 1061 return best; /* All devc->voc in use. Select the first one. */ opl3_alloc_voice() 1068 if (voice < 0 || voice >= devc->nr_voice) opl3_setup_voice() 1078 devc->voc[voice].bender = 0; opl3_setup_voice() 1079 devc->voc[voice].bender_range = info->bender_range; opl3_setup_voice() 1080 devc->voc[voice].volume = info->controllers[CTL_MAIN_VOLUME]; opl3_setup_voice() 1081 devc->voc[voice].panning = (info->controllers[CTL_PAN] * 2) - 128; opl3_setup_voice() 1115 if (devc == NULL) opl3_init() 1127 devc->nr_voice = 9; opl3_init() 1129 devc->fm_info.device = 0; opl3_init() 1130 devc->fm_info.synth_type = SYNTH_TYPE_FM; opl3_init() 1131 devc->fm_info.synth_subtype = FM_TYPE_ADLIB; opl3_init() 1132 devc->fm_info.perc_mode = 0; opl3_init() 1133 devc->fm_info.nr_voices = 9; opl3_init() 1134 devc->fm_info.nr_drums = 0; opl3_init() 1135 devc->fm_info.instr_bank_size = SBFM_MAXINSTR; opl3_init() 1136 devc->fm_info.capabilities = 0; opl3_init() 1137 devc->left_io = ioaddr; opl3_init() 1138 devc->right_io = ioaddr + 2; opl3_init() 1141 devc->model = 1; opl3_init() 1144 devc->model = 2; opl3_init() 1146 devc->is_opl4 = 1; opl3_init() 1149 opl3_operations.info = &devc->fm_info; opl3_init() 1157 devc->v_alloc = &opl3_operations.alloc; opl3_init() 1158 devc->chn_info = &opl3_operations.chn_info[0]; opl3_init() 1160 if (devc->model == 2) opl3_init() 1162 if (devc->is_opl4) opl3_init() 1163 strcpy(devc->fm_info.name, "Yamaha OPL4/OPL3 FM"); opl3_init() 1165 strcpy(devc->fm_info.name, "Yamaha OPL3"); opl3_init() 1167 devc->v_alloc->max_voice = devc->nr_voice = 18; opl3_init() 1168 devc->fm_info.nr_drums = 0; opl3_init() 1169 devc->fm_info.synth_subtype = FM_TYPE_OPL3; opl3_init() 1170 devc->fm_info.capabilities |= SYNTH_CAP_OPL3; opl3_init() 1175 pv_map[i].ioaddr = devc->left_io; opl3_init() 1177 pv_map[i].ioaddr = devc->right_io; opl3_init() 1179 opl3_command(devc->right_io, OPL3_MODE_REGISTER, OPL3_ENABLE); opl3_init() 1180 opl3_command(devc->right_io, CONNECTION_SELECT_REGISTER, 0x00); opl3_init() 1184 strcpy(devc->fm_info.name, "Yamaha OPL2"); opl3_init() 1185 devc->v_alloc->max_voice = devc->nr_voice = 9; opl3_init() 1186 devc->fm_info.nr_drums = 0; opl3_init() 1189 pv_map[i].ioaddr = devc->left_io; opl3_init() 1191 conf_printf2(devc->fm_info.name, ioaddr, 0, -1, -1); opl3_init() 1194 devc->i_map[i].channel = -1; opl3_init() 1224 if (devc && io != -1) cleanup_opl3() 1226 if (devc->base) { cleanup_opl3() 1227 release_region(devc->base,4); cleanup_opl3() 1228 if (devc->is_opl4) cleanup_opl3() 1229 release_region(devc->base - 8, 2); cleanup_opl3() 1231 kfree(devc); cleanup_opl3() 1232 devc = NULL; cleanup_opl3()
|
H A D | sb.h | 1 #define DSP_RESET (devc->base + 0x6) 2 #define DSP_READ (devc->base + 0xA) 3 #define DSP_WRITE (devc->base + 0xC) 4 #define DSP_COMMAND (devc->base + 0xC) 5 #define DSP_STATUS (devc->base + 0xC) 6 #define DSP_DATA_AVAIL (devc->base + 0xE) 7 #define DSP_DATA_AVL16 (devc->base + 0xF) 8 #define MIXER_ADDR (devc->base + 0x4) 9 #define MIXER_DATA (devc->base + 0x5) 10 #define OPL3_LEFT (devc->base + 0x0) 11 #define OPL3_RIGHT (devc->base + 0x2) 12 #define OPL3_BOTH (devc->base + 0x8) 158 int sb_dsp_command (sb_devc *devc, unsigned char val); 159 int sb_dsp_get_byte(sb_devc * devc); 160 int sb_dsp_reset (sb_devc *devc); 161 void sb_setmixer (sb_devc *devc, unsigned int port, unsigned int value); 162 unsigned int sb_getmixer (sb_devc *devc, unsigned int port); 166 int sb_mixer_init(sb_devc *devc, struct module *owner); 167 void sb_mixer_unload(sb_devc *devc); 168 void sb_mixer_set_stereo (sb_devc *devc, int mode); 169 void smw_mixer_init(sb_devc *devc); 170 void sb_dsp_midi_init (sb_devc *devc, struct module *owner); 171 void sb_audio_init (sb_devc *devc, char *name, struct module *owner); 172 void sb_midi_interrupt (sb_devc *devc); 173 void sb_chgmixer (sb_devc * devc, unsigned int reg, unsigned int mask, unsigned int val); 174 int sb_common_mixer_set(sb_devc * devc, int dev, int left, int right);
|
H A D | pss.c | 73 #define REG(x) (devc->base+x) 144 static struct pss_confdata *devc = &pss_data; variable in typeref:struct:pss_confdata 153 static void pss_write(struct pss_confdata *devc, int data) pss_write() argument 182 devc->base = hw_config->io_base; probe_pss() 183 irq = devc->irq = hw_config->irq; probe_pss() 184 dma = devc->dma = hw_config->dma; probe_pss() 185 devc->osp = hw_config->osp; probe_pss() 187 if (devc->base != 0x220 && devc->base != 0x240) probe_pss() 188 if (devc->base != 0x230 && devc->base != 0x250) /* Some cards use these */ probe_pss() 191 if (!request_region(devc->base, 0x10, "PSS mixer, SB emulation")) { probe_pss() 197 printk(KERN_ERR "No PSS signature detected at 0x%x (0x%x)\n", devc->base, id); probe_pss() 198 release_region(devc->base, 0x10); probe_pss() 201 if (!request_region(devc->base + 0x10, 0x9, "PSS config")) { probe_pss() 203 release_region(devc->base, 0x10); probe_pss() 209 static int set_irq(struct pss_confdata *devc, int dev, int irq) set_irq() argument 235 static void set_io_base(struct pss_confdata *devc, int dev, int base) set_io_base() argument 243 static int set_dma(struct pss_confdata *devc, int dev, int dma) set_dma() argument 267 static int pss_reset_dsp(struct pss_confdata *devc) pss_reset_dsp() argument 278 static int pss_put_dspword(struct pss_confdata *devc, unsigned short word) pss_put_dspword() argument 294 static int pss_get_dspword(struct pss_confdata *devc, unsigned short *word) pss_get_dspword() argument 310 static int pss_download_boot(struct pss_confdata *devc, unsigned char *block, pss_download_boot() argument 327 pss_reset_dsp(devc); pss_download_boot() 401 static void set_master_volume(struct pss_confdata *devc, int left, int right) set_master_volume() argument 414 pss_write(devc, 0x0010); set_master_volume() 415 pss_write(devc, log_scale[left] | 0x0000); set_master_volume() 416 pss_write(devc, 0x0010); set_master_volume() 417 pss_write(devc, log_scale[right] | 0x0100); set_master_volume() 420 static void set_synth_volume(struct pss_confdata *devc, int volume) set_synth_volume() argument 423 pss_write(devc, 0x0080); set_synth_volume() 424 pss_write(devc, vol); set_synth_volume() 425 pss_write(devc, 0x0081); set_synth_volume() 426 pss_write(devc, vol); set_synth_volume() 429 static void set_bass(struct pss_confdata *devc, int level) set_bass() argument 432 pss_write(devc, 0x0010); set_bass() 433 pss_write(devc, vol | 0x0200); set_bass() 436 static void set_treble(struct pss_confdata *devc, int level) set_treble() argument 439 pss_write(devc, 0x0010); set_treble() 440 pss_write(devc, vol | 0x0300); set_treble() 443 static void pss_mixer_reset(struct pss_confdata *devc) pss_mixer_reset() argument 445 set_master_volume(devc, 33, 33); pss_mixer_reset() 446 set_bass(devc, 50); pss_mixer_reset() 447 set_treble(devc, 50); pss_mixer_reset() 448 set_synth_volume(devc, 30); pss_mixer_reset() 449 pss_write (devc, 0x0010); pss_mixer_reset() 450 pss_write (devc, 0x0800 | 0xce); /* Stereo */ pss_mixer_reset() 454 devc->mixer.volume_l = devc->mixer.volume_r = 33; pss_mixer_reset() 455 devc->mixer.bass = 50; pss_mixer_reset() 456 devc->mixer.treble = 50; pss_mixer_reset() 457 devc->mixer.synth = 30; pss_mixer_reset() 503 static int call_ad_mixer(struct pss_confdata *devc, unsigned int cmd, call_ad_mixer() argument 506 if (devc->ad_mixer_dev != NO_WSS_MIXER) call_ad_mixer() 507 return mixer_devs[devc->ad_mixer_dev]->ioctl(devc->ad_mixer_dev, cmd, arg); call_ad_mixer() 514 struct pss_confdata *devc = mixer_devs[dev]->devc; pss_mixer_ioctl() local 523 return call_ad_mixer(devc, cmd, arg); pss_mixer_ioctl() 534 if (devc->ad_mixer_dev != NO_WSS_MIXER) pss_mixer_ioctl() 535 return call_ad_mixer(devc, cmd, arg); pss_mixer_ioctl() 547 &devc->mixer.volume_l, pss_mixer_ioctl() 548 &devc->mixer.volume_r)) pss_mixer_ioctl() 550 set_master_volume(devc, devc->mixer.volume_l, pss_mixer_ioctl() 551 devc->mixer.volume_r); pss_mixer_ioctl() 552 return ret_vol_stereo(devc->mixer.volume_l, pss_mixer_ioctl() 553 devc->mixer.volume_r); pss_mixer_ioctl() 556 if (set_volume_mono(arg, &devc->mixer.bass)) pss_mixer_ioctl() 558 set_bass(devc, devc->mixer.bass); pss_mixer_ioctl() 559 return ret_vol_mono(devc->mixer.bass); pss_mixer_ioctl() 562 if (set_volume_mono(arg, &devc->mixer.treble)) pss_mixer_ioctl() 564 set_treble(devc, devc->mixer.treble); pss_mixer_ioctl() 565 return ret_vol_mono(devc->mixer.treble); pss_mixer_ioctl() 568 if (set_volume_mono(arg, &devc->mixer.synth)) pss_mixer_ioctl() 570 set_synth_volume(devc, devc->mixer.synth); pss_mixer_ioctl() 571 return ret_vol_mono(devc->mixer.synth); pss_mixer_ioctl() 586 if (call_ad_mixer(devc, cmd, arg) == -EINVAL) pss_mixer_ioctl() 593 if (call_ad_mixer(devc, cmd, arg) == -EINVAL) pss_mixer_ioctl() 600 if (devc->ad_mixer_dev != NO_WSS_MIXER) pss_mixer_ioctl() 601 return call_ad_mixer(devc, cmd, arg); pss_mixer_ioctl() 605 if (devc->ad_mixer_dev != NO_WSS_MIXER) pss_mixer_ioctl() 606 return call_ad_mixer(devc, cmd, arg); pss_mixer_ioctl() 611 if (devc->ad_mixer_dev != NO_WSS_MIXER) pss_mixer_ioctl() 612 return call_ad_mixer(devc, cmd, arg); pss_mixer_ioctl() 616 or_mask = ret_vol_stereo(devc->mixer.volume_l, devc->mixer.volume_r); pss_mixer_ioctl() 620 or_mask = ret_vol_mono(devc->mixer.bass); pss_mixer_ioctl() 624 or_mask = ret_vol_mono(devc->mixer.treble); pss_mixer_ioctl() 628 or_mask = ret_vol_mono(devc->mixer.synth); pss_mixer_ioctl() 682 set_io_base(devc, CONF_CDROM, pss_cdrom_port); configure_nonsound_components() 692 devc->base = hw_config->io_base; attach_pss() 693 devc->irq = hw_config->irq; attach_pss() 694 devc->dma = hw_config->dma; attach_pss() 695 devc->osp = hw_config->osp; attach_pss() 696 devc->ad_mixer_dev = NO_WSS_MIXER; attach_pss() 717 if (!set_irq(devc, CONF_PSS, devc->irq)) attach_pss() 724 if (!set_dma(devc, CONF_PSS, devc->dma)) attach_pss() 754 set_io_base(devc, CONF_MIDI, hw_config->io_base); probe_pss_mpu() 755 if (!set_irq(devc, CONF_MIDI, hw_config->irq)) { probe_pss_mpu() 763 if (!pss_download_boot(devc, pss_synth, pss_synthLen, CPF_FIRST | CPF_LAST)) { probe_pss_mpu() 804 if (!pss_download_boot(devc, pss_synth, pss_synthLen, CPF_FIRST | CPF_LAST)) pss_coproc_open() 826 if (!pss_download_boot(devc, pss_synth, pss_synthLen, CPF_FIRST | CPF_LAST)) pss_coproc_reset() 838 if (!pss_download_boot(devc, buf->data, buf->len, buf->flags)) download_boot_block() 887 if (!pss_put_dspword(devc, *data++)) { pss_coproc_ioctl() 908 if (!pss_get_dspword(devc, data++)) { pss_coproc_ioctl() 924 if (!pss_put_dspword(devc, 0x00d0)) { pss_coproc_ioctl() 928 if (!pss_put_dspword(devc, (unsigned short)(dbuf.parm1 & 0xffff))) { pss_coproc_ioctl() 932 if (!pss_get_dspword(devc, &tmp)) { pss_coproc_ioctl() 946 if (!pss_put_dspword(devc, 0x00d1)) { pss_coproc_ioctl() 950 if (!pss_put_dspword(devc, (unsigned short) (dbuf.parm1 & 0xffff))) { pss_coproc_ioctl() 955 if (!pss_put_dspword(devc, tmp)) { pss_coproc_ioctl() 966 if (!pss_put_dspword(devc, 0x00d3)) { pss_coproc_ioctl() 970 if (!pss_put_dspword(devc, (unsigned short)(dbuf.parm1 & 0xffff))) { pss_coproc_ioctl() 975 if (!pss_put_dspword(devc, tmp)) { pss_coproc_ioctl() 980 if (!pss_put_dspword(devc, tmp)) { pss_coproc_ioctl() 991 if (!pss_put_dspword(devc, 0x00d2)) { pss_coproc_ioctl() 995 if (!pss_put_dspword(devc, (unsigned short)(dbuf.parm1 & 0xffff))) { pss_coproc_ioctl() 999 if (!pss_get_dspword(devc, &tmp)) { /* Read MSB */ pss_coproc_ioctl() 1004 if (!pss_get_dspword(devc, &tmp)) { /* Read LSB */ pss_coproc_ioctl() 1050 set_io_base(devc, CONF_WSS, hw_config->io_base); probe_pss_mss() 1051 if (!set_irq(devc, CONF_WSS, hw_config->irq)) { probe_pss_mss() 1055 if (!set_dma(devc, CONF_WSS, hw_config->dma)) { probe_pss_mss() 1078 devc->ad_mixer_dev = NO_WSS_MIXER; probe_pss_mss() 1085 devc)) < 0) probe_pss_mss() 1091 pss_mixer_reset(devc); probe_pss_mss() 1101 devc->ad_mixer_dev = audio_devs[hw_config->slots[0]]->mixer_dev; probe_pss_mss()
|
H A D | v_midi.c | 48 vmidi_devc *devc = midi_devs[dev]->devc; v_midi_open() local 51 if (devc == NULL) v_midi_open() 54 spin_lock_irqsave(&devc->lock,flags); v_midi_open() 55 if (devc->opened) v_midi_open() 57 spin_unlock_irqrestore(&devc->lock,flags); v_midi_open() 60 devc->opened = 1; v_midi_open() 61 spin_unlock_irqrestore(&devc->lock,flags); v_midi_open() 63 devc->intr_active = 1; v_midi_open() 67 devc->input_opened = 1; v_midi_open() 68 devc->midi_input_intr = input; v_midi_open() 76 vmidi_devc *devc = midi_devs[dev]->devc; v_midi_close() local 79 if (devc == NULL) v_midi_close() 82 spin_lock_irqsave(&devc->lock,flags); v_midi_close() 83 devc->intr_active = 0; v_midi_close() 84 devc->input_opened = 0; v_midi_close() 85 devc->opened = 0; v_midi_close() 86 spin_unlock_irqrestore(&devc->lock,flags); v_midi_close() 91 vmidi_devc *devc = midi_devs[dev]->devc; v_midi_out() local 94 if (devc == NULL) v_midi_out() 97 pdevc = midi_devs[devc->pair_mididev]->devc; v_midi_out() 113 vmidi_devc *devc = midi_devs[dev]->devc; v_midi_end_read() local 114 if (devc == NULL) v_midi_end_read() 117 devc->intr_active = 0; v_midi_end_read() 225 midi_devs[midi1]->devc = v_devc[0]; attach_v_midi() 246 midi_devs[midi2]->devc = v_devc[1]; attach_v_midi()
|
H A D | dev_table.c | 53 void *devc, int dma1, int dma2) sound_install_audiodrv() 96 op->devc = devc; sound_install_audiodrv() 111 int driver_size, void *devc) sound_install_mixer() 142 op->devc = devc; sound_install_mixer() 51 sound_install_audiodrv(int vers, char *name, struct audio_driver *driver, int driver_size, int flags, unsigned int format_mask, void *devc, int dma1, int dma2) sound_install_audiodrv() argument 110 sound_install_mixer(int vers, char *name, struct mixer_operations *driver, int driver_size, void *devc) sound_install_mixer() argument
|
H A D | dev_table.h | 157 int (*open) (void *devc, int sub_device); 158 void (*close) (void *devc, int sub_device); 159 int (*ioctl) (void *devc, unsigned int cmd, void __user * arg, int local); 160 void (*reset) (void *devc); 162 void *devc; /* Driver specific info */ member in struct:coproc_operations 209 void *devc; /* Driver specific info */ member in struct:audio_operations 252 void *devc; member in struct:mixer_operations 329 void *devc; member in struct:midi_operations 376 void *devc, int dma1, int dma2); 378 int driver_size, void *devc);
|
H A D | audio.c | 102 if ((ret = coprocessor->open(coprocessor->devc, COPR_PCM)) < 0) { audio_open() 203 coprocessor->close(coprocessor->devc, COPR_PCM); audio_release() 379 return audio_devs[dev]->coproc->ioctl(audio_devs[dev]->coproc->devc, cmd, arg, 0); audio_ioctl()
|
H A D | midibuf.c | 372 return midi_devs[dev]->coproc->ioctl(midi_devs[dev]->coproc->devc, cmd, arg, 0); MIDIbuf_ioctl()
|
/linux-4.4.14/sound/isa/ |
H A D | es18xx.c | 138 struct pnp_dev *devc; member in struct:snd_es18xx 2094 chip->devc = pnp_request_card_device(card, id->devs[1].id, NULL); snd_audiodrive_pnpc() 2095 if (chip->devc == NULL) snd_audiodrive_pnpc() 2099 if (pnp_activate_dev(chip->devc) < 0) { snd_audiodrive_pnpc() 2104 (unsigned long long)pnp_port_start(chip->devc, 0)); snd_audiodrive_pnpc()
|