• Home
  • Raw
  • Download

Lines Matching +full:tcb +full:- +full:capture

6  *  Copyright (c) by James Courtier-Dutton <James@superbug.co.uk>
10 * --
13 * --
27 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
45 #if 0 /* for testing purposes - digital out -> capture */
48 #if 0 /* for testing purposes - set S/PDIF to AC3 output */
51 #if 0 /* for testing purposes - feed the front signal to Center/LFE outputs */
57 MODULE_PARM_DESC(high_res_gpr_volume, "GPR mixer controls use 31-bit range.");
131 /* 0x0a */ "PCM Capture Left",
132 /* 0x0b */ "PCM Capture Right",
133 /* 0x0c */ "MIC Capture",
174 /* 0x12 */ "ADC Capture Left",
175 /* 0x13 */ "ADC Capture Right",
304 static const DECLARE_TLV_DB_SCALE(snd_emu10k1_db_scale1, -4000, 40, 1);
308 static const DECLARE_TLV_DB_SCALE(snd_emu10k1_bass_treble_db_scale, -1200, 60, 0);
321 (struct snd_emu10k1_fx8010_ctl *) kcontrol->private_value; in snd_emu10k1_gpr_ctl_info()
323 if (ctl->min == 0 && ctl->max == 1) in snd_emu10k1_gpr_ctl_info()
324 uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; in snd_emu10k1_gpr_ctl_info()
326 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_emu10k1_gpr_ctl_info()
327 uinfo->count = ctl->vcount; in snd_emu10k1_gpr_ctl_info()
328 uinfo->value.integer.min = ctl->min; in snd_emu10k1_gpr_ctl_info()
329 uinfo->value.integer.max = ctl->max; in snd_emu10k1_gpr_ctl_info()
337 (struct snd_emu10k1_fx8010_ctl *) kcontrol->private_value; in snd_emu10k1_gpr_ctl_get()
341 spin_lock_irqsave(&emu->reg_lock, flags); in snd_emu10k1_gpr_ctl_get()
342 for (i = 0; i < ctl->vcount; i++) in snd_emu10k1_gpr_ctl_get()
343 ucontrol->value.integer.value[i] = ctl->value[i]; in snd_emu10k1_gpr_ctl_get()
344 spin_unlock_irqrestore(&emu->reg_lock, flags); in snd_emu10k1_gpr_ctl_get()
352 (struct snd_emu10k1_fx8010_ctl *) kcontrol->private_value; in snd_emu10k1_gpr_ctl_put()
358 spin_lock_irqsave(&emu->reg_lock, flags); in snd_emu10k1_gpr_ctl_put()
359 for (i = 0; i < ctl->vcount; i++) { in snd_emu10k1_gpr_ctl_put()
360 nval = ucontrol->value.integer.value[i]; in snd_emu10k1_gpr_ctl_put()
361 if (nval < ctl->min) in snd_emu10k1_gpr_ctl_put()
362 nval = ctl->min; in snd_emu10k1_gpr_ctl_put()
363 if (nval > ctl->max) in snd_emu10k1_gpr_ctl_put()
364 nval = ctl->max; in snd_emu10k1_gpr_ctl_put()
365 if (nval != ctl->value[i]) in snd_emu10k1_gpr_ctl_put()
367 val = ctl->value[i] = nval; in snd_emu10k1_gpr_ctl_put()
368 switch (ctl->translation) { in snd_emu10k1_gpr_ctl_put()
370 snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[i], 0, val); in snd_emu10k1_gpr_ctl_put()
373 snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[i], 0, db_table[val]); in snd_emu10k1_gpr_ctl_put()
376 if ((ctl->count % 5) != 0 || (ctl->count / 5) != ctl->vcount) { in snd_emu10k1_gpr_ctl_put()
377 change = -EIO; in snd_emu10k1_gpr_ctl_put()
381 … snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[j * ctl->vcount + i], 0, bass_table[val][j]); in snd_emu10k1_gpr_ctl_put()
384 if ((ctl->count % 5) != 0 || (ctl->count / 5) != ctl->vcount) { in snd_emu10k1_gpr_ctl_put()
385 change = -EIO; in snd_emu10k1_gpr_ctl_put()
389 …snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[j * ctl->vcount + i], 0, treble_table[val][j]); in snd_emu10k1_gpr_ctl_put()
392 snd_emu10k1_ptr_write(emu, emu->gpr_base + ctl->gpr[i], 0, onoff_table[val]); in snd_emu10k1_gpr_ctl_put()
397 spin_unlock_irqrestore(&emu->reg_lock, flags); in snd_emu10k1_gpr_ctl_put()
409 irq = emu->fx8010.irq_handlers; in snd_emu10k1_fx8010_interrupt()
411 nirq = irq->next; /* irq ptr can be removed from list */ in snd_emu10k1_fx8010_interrupt()
412 if (snd_emu10k1_ptr_read(emu, emu->gpr_base + irq->gpr_running, 0) & 0xffff0000) { in snd_emu10k1_fx8010_interrupt()
413 if (irq->handler) in snd_emu10k1_fx8010_interrupt()
414 irq->handler(emu, irq->private_data); in snd_emu10k1_fx8010_interrupt()
415 snd_emu10k1_ptr_write(emu, emu->gpr_base + irq->gpr_running, 0, 1); in snd_emu10k1_fx8010_interrupt()
429 irq->handler = handler; in snd_emu10k1_fx8010_register_irq_handler()
430 irq->gpr_running = gpr_running; in snd_emu10k1_fx8010_register_irq_handler()
431 irq->private_data = private_data; in snd_emu10k1_fx8010_register_irq_handler()
432 irq->next = NULL; in snd_emu10k1_fx8010_register_irq_handler()
433 spin_lock_irqsave(&emu->fx8010.irq_lock, flags); in snd_emu10k1_fx8010_register_irq_handler()
434 if (emu->fx8010.irq_handlers == NULL) { in snd_emu10k1_fx8010_register_irq_handler()
435 emu->fx8010.irq_handlers = irq; in snd_emu10k1_fx8010_register_irq_handler()
436 emu->dsp_interrupt = snd_emu10k1_fx8010_interrupt; in snd_emu10k1_fx8010_register_irq_handler()
439 irq->next = emu->fx8010.irq_handlers; in snd_emu10k1_fx8010_register_irq_handler()
440 emu->fx8010.irq_handlers = irq; in snd_emu10k1_fx8010_register_irq_handler()
442 spin_unlock_irqrestore(&emu->fx8010.irq_lock, flags); in snd_emu10k1_fx8010_register_irq_handler()
452 spin_lock_irqsave(&emu->fx8010.irq_lock, flags); in snd_emu10k1_fx8010_unregister_irq_handler()
453 if ((tmp = emu->fx8010.irq_handlers) == irq) { in snd_emu10k1_fx8010_unregister_irq_handler()
454 emu->fx8010.irq_handlers = tmp->next; in snd_emu10k1_fx8010_unregister_irq_handler()
455 if (emu->fx8010.irq_handlers == NULL) { in snd_emu10k1_fx8010_unregister_irq_handler()
457 emu->dsp_interrupt = NULL; in snd_emu10k1_fx8010_unregister_irq_handler()
460 while (tmp && tmp->next != irq) in snd_emu10k1_fx8010_unregister_irq_handler()
461 tmp = tmp->next; in snd_emu10k1_fx8010_unregister_irq_handler()
463 tmp->next = tmp->next->next; in snd_emu10k1_fx8010_unregister_irq_handler()
465 spin_unlock_irqrestore(&emu->fx8010.irq_lock, flags); in snd_emu10k1_fx8010_unregister_irq_handler()
480 code = (u_int32_t __force *)icode->code + (*ptr) * 2; in snd_emu10k1_write_op()
481 set_bit(*ptr, icode->code_valid); in snd_emu10k1_write_op()
497 code = (u_int32_t __force *)icode->code + (*ptr) * 2; in snd_emu10k1_audigy_write_op()
498 set_bit(*ptr, icode->code_valid); in snd_emu10k1_audigy_write_op()
509 pc += emu->audigy ? A_MICROCODEBASE : MICROCODEBASE; in snd_emu10k1_efx_write()
515 pc += emu->audigy ? A_MICROCODEBASE : MICROCODEBASE; in snd_emu10k1_efx_read()
526 for (gpr = 0; gpr < (emu->audigy ? 0x200 : 0x100); gpr++) { in snd_emu10k1_gpr_poke()
527 if (!test_bit(gpr, icode->gpr_valid)) in snd_emu10k1_gpr_poke()
530 val = *(__force u32 *)&icode->gpr_map[gpr]; in snd_emu10k1_gpr_poke()
531 else if (get_user(val, &icode->gpr_map[gpr])) in snd_emu10k1_gpr_poke()
532 return -EFAULT; in snd_emu10k1_gpr_poke()
533 snd_emu10k1_ptr_write(emu, emu->gpr_base + gpr, 0, val); in snd_emu10k1_gpr_poke()
544 for (gpr = 0; gpr < (emu->audigy ? 0x200 : 0x100); gpr++) { in snd_emu10k1_gpr_peek()
545 set_bit(gpr, icode->gpr_valid); in snd_emu10k1_gpr_peek()
546 val = snd_emu10k1_ptr_read(emu, emu->gpr_base + gpr, 0); in snd_emu10k1_gpr_peek()
547 if (put_user(val, &icode->gpr_map[gpr])) in snd_emu10k1_gpr_peek()
548 return -EFAULT; in snd_emu10k1_gpr_peek()
560 for (tram = 0; tram < (emu->audigy ? 0x100 : 0xa0); tram++) { in snd_emu10k1_tram_poke()
561 if (!test_bit(tram, icode->tram_valid)) in snd_emu10k1_tram_poke()
564 val = *(__force u32 *)&icode->tram_data_map[tram]; in snd_emu10k1_tram_poke()
565 addr = *(__force u32 *)&icode->tram_addr_map[tram]; in snd_emu10k1_tram_poke()
567 if (get_user(val, &icode->tram_data_map[tram]) || in snd_emu10k1_tram_poke()
568 get_user(addr, &icode->tram_addr_map[tram])) in snd_emu10k1_tram_poke()
569 return -EFAULT; in snd_emu10k1_tram_poke()
572 if (!emu->audigy) { in snd_emu10k1_tram_poke()
588 memset(icode->tram_valid, 0, sizeof(icode->tram_valid)); in snd_emu10k1_tram_peek()
589 for (tram = 0; tram < (emu->audigy ? 0x100 : 0xa0); tram++) { in snd_emu10k1_tram_peek()
590 set_bit(tram, icode->tram_valid); in snd_emu10k1_tram_peek()
592 if (!emu->audigy) { in snd_emu10k1_tram_peek()
598 if (put_user(val, &icode->tram_data_map[tram]) || in snd_emu10k1_tram_peek()
599 put_user(addr, &icode->tram_addr_map[tram])) in snd_emu10k1_tram_peek()
600 return -EFAULT; in snd_emu10k1_tram_peek()
611 for (pc = 0; pc < (emu->audigy ? 2*1024 : 2*512); pc += 2) { in snd_emu10k1_code_poke()
612 if (!test_bit(pc / 2, icode->code_valid)) in snd_emu10k1_code_poke()
615 lo = *(__force u32 *)&icode->code[pc + 0]; in snd_emu10k1_code_poke()
616 hi = *(__force u32 *)&icode->code[pc + 1]; in snd_emu10k1_code_poke()
618 if (get_user(lo, &icode->code[pc + 0]) || in snd_emu10k1_code_poke()
619 get_user(hi, &icode->code[pc + 1])) in snd_emu10k1_code_poke()
620 return -EFAULT; in snd_emu10k1_code_poke()
633 memset(icode->code_valid, 0, sizeof(icode->code_valid)); in snd_emu10k1_code_peek()
634 for (pc = 0; pc < (emu->audigy ? 2*1024 : 2*512); pc += 2) { in snd_emu10k1_code_peek()
635 set_bit(pc / 2, icode->code_valid); in snd_emu10k1_code_peek()
636 if (put_user(snd_emu10k1_efx_read(emu, pc + 0), &icode->code[pc + 0])) in snd_emu10k1_code_peek()
637 return -EFAULT; in snd_emu10k1_code_peek()
638 if (put_user(snd_emu10k1_efx_read(emu, pc + 1), &icode->code[pc + 1])) in snd_emu10k1_code_peek()
639 return -EFAULT; in snd_emu10k1_code_peek()
650 list_for_each_entry(ctl, &emu->fx8010.gpr_ctl, list) { in snd_emu10k1_look_for_ctl()
651 kcontrol = ctl->kcontrol; in snd_emu10k1_look_for_ctl()
652 if (kcontrol->id.iface == id->iface && in snd_emu10k1_look_for_ctl()
653 !strcmp(kcontrol->id.name, id->name) && in snd_emu10k1_look_for_ctl()
654 kcontrol->id.index == id->index) in snd_emu10k1_look_for_ctl()
695 if (emu->support_tlv) { in copy_gctl()
699 return -EFAULT; in copy_gctl()
707 return -EFAULT; in copy_gctl()
708 gctl->tlv = NULL; in copy_gctl()
719 if (emu->support_tlv) in copy_gctl_to_user()
736 for (i = 0, _id = icode->gpr_del_controls; in snd_emu10k1_verify_controls()
737 i < icode->gpr_del_control_count; i++, _id++) { in snd_emu10k1_verify_controls()
741 return -EFAULT; in snd_emu10k1_verify_controls()
743 return -ENOENT; in snd_emu10k1_verify_controls()
747 return -ENOMEM; in snd_emu10k1_verify_controls()
749 for (i = 0; i < icode->gpr_add_control_count; i++) { in snd_emu10k1_verify_controls()
750 if (copy_gctl(emu, gctl, icode->gpr_add_controls, i, in snd_emu10k1_verify_controls()
752 err = -EFAULT; in snd_emu10k1_verify_controls()
755 if (snd_emu10k1_look_for_ctl(emu, &gctl->id)) in snd_emu10k1_verify_controls()
757 down_read(&emu->card->controls_rwsem); in snd_emu10k1_verify_controls()
758 if (snd_ctl_find_id(emu->card, &gctl->id) != NULL) { in snd_emu10k1_verify_controls()
759 up_read(&emu->card->controls_rwsem); in snd_emu10k1_verify_controls()
760 err = -EEXIST; in snd_emu10k1_verify_controls()
763 up_read(&emu->card->controls_rwsem); in snd_emu10k1_verify_controls()
764 if (gctl->id.iface != SNDRV_CTL_ELEM_IFACE_MIXER && in snd_emu10k1_verify_controls()
765 gctl->id.iface != SNDRV_CTL_ELEM_IFACE_PCM) { in snd_emu10k1_verify_controls()
766 err = -EINVAL; in snd_emu10k1_verify_controls()
770 for (i = 0; i < icode->gpr_list_control_count; i++) { in snd_emu10k1_verify_controls()
772 if (copy_gctl(emu, gctl, icode->gpr_list_controls, i, in snd_emu10k1_verify_controls()
774 err = -EFAULT; in snd_emu10k1_verify_controls()
787 ctl = (struct snd_emu10k1_fx8010_ctl *) kctl->private_value; in snd_emu10k1_ctl_private_free()
788 kctl->private_value = 0; in snd_emu10k1_ctl_private_free()
789 list_del(&ctl->list); in snd_emu10k1_ctl_private_free()
791 kfree(kctl->tlv.p); in snd_emu10k1_ctl_private_free()
810 err = -ENOMEM; in snd_emu10k1_add_controls()
814 for (i = 0; i < icode->gpr_add_control_count; i++) { in snd_emu10k1_add_controls()
815 if (copy_gctl(emu, gctl, icode->gpr_add_controls, i, in snd_emu10k1_add_controls()
817 err = -EFAULT; in snd_emu10k1_add_controls()
820 if (gctl->id.iface != SNDRV_CTL_ELEM_IFACE_MIXER && in snd_emu10k1_add_controls()
821 gctl->id.iface != SNDRV_CTL_ELEM_IFACE_PCM) { in snd_emu10k1_add_controls()
822 err = -EINVAL; in snd_emu10k1_add_controls()
825 if (! gctl->id.name[0]) { in snd_emu10k1_add_controls()
826 err = -EINVAL; in snd_emu10k1_add_controls()
829 ctl = snd_emu10k1_look_for_ctl(emu, &gctl->id); in snd_emu10k1_add_controls()
831 knew.iface = gctl->id.iface; in snd_emu10k1_add_controls()
832 knew.name = gctl->id.name; in snd_emu10k1_add_controls()
833 knew.index = gctl->id.index; in snd_emu10k1_add_controls()
834 knew.device = gctl->id.device; in snd_emu10k1_add_controls()
835 knew.subdevice = gctl->id.subdevice; in snd_emu10k1_add_controls()
837 knew.tlv.p = copy_tlv((__force const unsigned int __user *)gctl->tlv, in_kernel); in snd_emu10k1_add_controls()
844 nctl->vcount = gctl->vcount; in snd_emu10k1_add_controls()
845 nctl->count = gctl->count; in snd_emu10k1_add_controls()
847 nctl->gpr[j] = gctl->gpr[j]; in snd_emu10k1_add_controls()
848 nctl->value[j] = ~gctl->value[j]; /* inverted, we want to write new value in gpr_ctl_put() */ in snd_emu10k1_add_controls()
849 val->value.integer.value[j] = gctl->value[j]; in snd_emu10k1_add_controls()
851 nctl->min = gctl->min; in snd_emu10k1_add_controls()
852 nctl->max = gctl->max; in snd_emu10k1_add_controls()
853 nctl->translation = gctl->translation; in snd_emu10k1_add_controls()
857 err = -ENOMEM; in snd_emu10k1_add_controls()
863 if ((err = snd_ctl_add(emu->card, kctl = snd_ctl_new1(&knew, emu))) < 0) { in snd_emu10k1_add_controls()
868 kctl->private_free = snd_emu10k1_ctl_private_free; in snd_emu10k1_add_controls()
869 ctl->kcontrol = kctl; in snd_emu10k1_add_controls()
870 list_add_tail(&ctl->list, &emu->fx8010.gpr_ctl); in snd_emu10k1_add_controls()
873 nctl->list = ctl->list; in snd_emu10k1_add_controls()
874 nctl->kcontrol = ctl->kcontrol; in snd_emu10k1_add_controls()
876 snd_ctl_notify(emu->card, SNDRV_CTL_EVENT_MASK_VALUE | in snd_emu10k1_add_controls()
877 SNDRV_CTL_EVENT_MASK_INFO, &ctl->kcontrol->id); in snd_emu10k1_add_controls()
879 snd_emu10k1_gpr_ctl_put(ctl->kcontrol, val); in snd_emu10k1_add_controls()
896 struct snd_card *card = emu->card; in snd_emu10k1_del_controls()
898 for (i = 0, _id = icode->gpr_del_controls; in snd_emu10k1_del_controls()
899 i < icode->gpr_del_control_count; i++, _id++) { in snd_emu10k1_del_controls()
903 return -EFAULT; in snd_emu10k1_del_controls()
904 down_write(&card->controls_rwsem); in snd_emu10k1_del_controls()
907 snd_ctl_remove(card, ctl->kcontrol); in snd_emu10k1_del_controls()
908 up_write(&card->controls_rwsem); in snd_emu10k1_del_controls()
924 return -ENOMEM; in snd_emu10k1_list_controls()
926 list_for_each_entry(ctl, &emu->fx8010.gpr_ctl, list) { in snd_emu10k1_list_controls()
928 if (icode->gpr_list_controls && in snd_emu10k1_list_controls()
929 i < icode->gpr_list_control_count) { in snd_emu10k1_list_controls()
931 id = &ctl->kcontrol->id; in snd_emu10k1_list_controls()
932 gctl->id.iface = id->iface; in snd_emu10k1_list_controls()
933 strlcpy(gctl->id.name, id->name, sizeof(gctl->id.name)); in snd_emu10k1_list_controls()
934 gctl->id.index = id->index; in snd_emu10k1_list_controls()
935 gctl->id.device = id->device; in snd_emu10k1_list_controls()
936 gctl->id.subdevice = id->subdevice; in snd_emu10k1_list_controls()
937 gctl->vcount = ctl->vcount; in snd_emu10k1_list_controls()
938 gctl->count = ctl->count; in snd_emu10k1_list_controls()
940 gctl->gpr[j] = ctl->gpr[j]; in snd_emu10k1_list_controls()
941 gctl->value[j] = ctl->value[j]; in snd_emu10k1_list_controls()
943 gctl->min = ctl->min; in snd_emu10k1_list_controls()
944 gctl->max = ctl->max; in snd_emu10k1_list_controls()
945 gctl->translation = ctl->translation; in snd_emu10k1_list_controls()
946 if (copy_gctl_to_user(emu, icode->gpr_list_controls, in snd_emu10k1_list_controls()
949 return -EFAULT; in snd_emu10k1_list_controls()
954 icode->gpr_list_control_total = total; in snd_emu10k1_list_controls()
965 mutex_lock(&emu->fx8010.lock); in snd_emu10k1_icode_poke()
969 strlcpy(emu->fx8010.name, icode->name, sizeof(emu->fx8010.name)); in snd_emu10k1_icode_poke()
970 /* stop FX processor - this may be dangerous, but it's better to miss in snd_emu10k1_icode_poke()
971 some samples than generate wrong ones - [jk] */ in snd_emu10k1_icode_poke()
972 if (emu->audigy) in snd_emu10k1_icode_poke()
973 snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg | A_DBG_SINGLE_STEP); in snd_emu10k1_icode_poke()
975 snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg | EMU10K1_DBG_SINGLE_STEP); in snd_emu10k1_icode_poke()
993 if (emu->audigy) in snd_emu10k1_icode_poke()
994 snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg); in snd_emu10k1_icode_poke()
996 snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg); in snd_emu10k1_icode_poke()
998 mutex_unlock(&emu->fx8010.lock); in snd_emu10k1_icode_poke()
1007 mutex_lock(&emu->fx8010.lock); in snd_emu10k1_icode_peek()
1008 strlcpy(icode->name, emu->fx8010.name, sizeof(icode->name)); in snd_emu10k1_icode_peek()
1017 mutex_unlock(&emu->fx8010.lock); in snd_emu10k1_icode_peek()
1028 if (ipcm->substream >= EMU10K1_FX8010_PCM_COUNT) in snd_emu10k1_ipcm_poke()
1029 return -EINVAL; in snd_emu10k1_ipcm_poke()
1030 ipcm->substream = array_index_nospec(ipcm->substream, in snd_emu10k1_ipcm_poke()
1032 if (ipcm->channels > 32) in snd_emu10k1_ipcm_poke()
1033 return -EINVAL; in snd_emu10k1_ipcm_poke()
1034 pcm = &emu->fx8010.pcm[ipcm->substream]; in snd_emu10k1_ipcm_poke()
1035 mutex_lock(&emu->fx8010.lock); in snd_emu10k1_ipcm_poke()
1036 spin_lock_irq(&emu->reg_lock); in snd_emu10k1_ipcm_poke()
1037 if (pcm->opened) { in snd_emu10k1_ipcm_poke()
1038 err = -EBUSY; in snd_emu10k1_ipcm_poke()
1041 if (ipcm->channels == 0) { /* remove */ in snd_emu10k1_ipcm_poke()
1042 pcm->valid = 0; in snd_emu10k1_ipcm_poke()
1045 if (ipcm->channels != 2) { in snd_emu10k1_ipcm_poke()
1046 err = -EINVAL; in snd_emu10k1_ipcm_poke()
1049 pcm->valid = 1; in snd_emu10k1_ipcm_poke()
1050 pcm->opened = 0; in snd_emu10k1_ipcm_poke()
1051 pcm->channels = ipcm->channels; in snd_emu10k1_ipcm_poke()
1052 pcm->tram_start = ipcm->tram_start; in snd_emu10k1_ipcm_poke()
1053 pcm->buffer_size = ipcm->buffer_size; in snd_emu10k1_ipcm_poke()
1054 pcm->gpr_size = ipcm->gpr_size; in snd_emu10k1_ipcm_poke()
1055 pcm->gpr_count = ipcm->gpr_count; in snd_emu10k1_ipcm_poke()
1056 pcm->gpr_tmpcount = ipcm->gpr_tmpcount; in snd_emu10k1_ipcm_poke()
1057 pcm->gpr_ptr = ipcm->gpr_ptr; in snd_emu10k1_ipcm_poke()
1058 pcm->gpr_trigger = ipcm->gpr_trigger; in snd_emu10k1_ipcm_poke()
1059 pcm->gpr_running = ipcm->gpr_running; in snd_emu10k1_ipcm_poke()
1060 for (i = 0; i < pcm->channels; i++) in snd_emu10k1_ipcm_poke()
1061 pcm->etram[i] = ipcm->etram[i]; in snd_emu10k1_ipcm_poke()
1064 spin_unlock_irq(&emu->reg_lock); in snd_emu10k1_ipcm_poke()
1065 mutex_unlock(&emu->fx8010.lock); in snd_emu10k1_ipcm_poke()
1076 if (ipcm->substream >= EMU10K1_FX8010_PCM_COUNT) in snd_emu10k1_ipcm_peek()
1077 return -EINVAL; in snd_emu10k1_ipcm_peek()
1078 ipcm->substream = array_index_nospec(ipcm->substream, in snd_emu10k1_ipcm_peek()
1080 pcm = &emu->fx8010.pcm[ipcm->substream]; in snd_emu10k1_ipcm_peek()
1081 mutex_lock(&emu->fx8010.lock); in snd_emu10k1_ipcm_peek()
1082 spin_lock_irq(&emu->reg_lock); in snd_emu10k1_ipcm_peek()
1083 ipcm->channels = pcm->channels; in snd_emu10k1_ipcm_peek()
1084 ipcm->tram_start = pcm->tram_start; in snd_emu10k1_ipcm_peek()
1085 ipcm->buffer_size = pcm->buffer_size; in snd_emu10k1_ipcm_peek()
1086 ipcm->gpr_size = pcm->gpr_size; in snd_emu10k1_ipcm_peek()
1087 ipcm->gpr_ptr = pcm->gpr_ptr; in snd_emu10k1_ipcm_peek()
1088 ipcm->gpr_count = pcm->gpr_count; in snd_emu10k1_ipcm_peek()
1089 ipcm->gpr_tmpcount = pcm->gpr_tmpcount; in snd_emu10k1_ipcm_peek()
1090 ipcm->gpr_trigger = pcm->gpr_trigger; in snd_emu10k1_ipcm_peek()
1091 ipcm->gpr_running = pcm->gpr_running; in snd_emu10k1_ipcm_peek()
1092 for (i = 0; i < pcm->channels; i++) in snd_emu10k1_ipcm_peek()
1093 ipcm->etram[i] = pcm->etram[i]; in snd_emu10k1_ipcm_peek()
1094 ipcm->res1 = ipcm->res2 = 0; in snd_emu10k1_ipcm_peek()
1095 ipcm->pad = 0; in snd_emu10k1_ipcm_peek()
1096 spin_unlock_irq(&emu->reg_lock); in snd_emu10k1_ipcm_peek()
1097 mutex_unlock(&emu->fx8010.lock); in snd_emu10k1_ipcm_peek()
1110 ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; in snd_emu10k1_init_mono_control()
1111 strcpy(ctl->id.name, name); in snd_emu10k1_init_mono_control()
1112 ctl->vcount = ctl->count = 1; in snd_emu10k1_init_mono_control()
1113 ctl->gpr[0] = gpr + 0; ctl->value[0] = defval; in snd_emu10k1_init_mono_control()
1115 ctl->min = 0; in snd_emu10k1_init_mono_control()
1116 ctl->max = 0x7fffffff; in snd_emu10k1_init_mono_control()
1117 ctl->tlv = snd_emu10k1_db_linear; in snd_emu10k1_init_mono_control()
1118 ctl->translation = EMU10K1_GPR_TRANSLATION_NONE; in snd_emu10k1_init_mono_control()
1120 ctl->min = 0; in snd_emu10k1_init_mono_control()
1121 ctl->max = 100; in snd_emu10k1_init_mono_control()
1122 ctl->tlv = snd_emu10k1_db_scale1; in snd_emu10k1_init_mono_control()
1123 ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100; in snd_emu10k1_init_mono_control()
1131 ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; in snd_emu10k1_init_stereo_control()
1132 strcpy(ctl->id.name, name); in snd_emu10k1_init_stereo_control()
1133 ctl->vcount = ctl->count = 2; in snd_emu10k1_init_stereo_control()
1134 ctl->gpr[0] = gpr + 0; ctl->value[0] = defval; in snd_emu10k1_init_stereo_control()
1135 ctl->gpr[1] = gpr + 1; ctl->value[1] = defval; in snd_emu10k1_init_stereo_control()
1137 ctl->min = 0; in snd_emu10k1_init_stereo_control()
1138 ctl->max = 0x7fffffff; in snd_emu10k1_init_stereo_control()
1139 ctl->tlv = snd_emu10k1_db_linear; in snd_emu10k1_init_stereo_control()
1140 ctl->translation = EMU10K1_GPR_TRANSLATION_NONE; in snd_emu10k1_init_stereo_control()
1142 ctl->min = 0; in snd_emu10k1_init_stereo_control()
1143 ctl->max = 100; in snd_emu10k1_init_stereo_control()
1144 ctl->tlv = snd_emu10k1_db_scale1; in snd_emu10k1_init_stereo_control()
1145 ctl->translation = EMU10K1_GPR_TRANSLATION_TABLE100; in snd_emu10k1_init_stereo_control()
1153 ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; in snd_emu10k1_init_mono_onoff_control()
1154 strcpy(ctl->id.name, name); in snd_emu10k1_init_mono_onoff_control()
1155 ctl->vcount = ctl->count = 1; in snd_emu10k1_init_mono_onoff_control()
1156 ctl->gpr[0] = gpr + 0; ctl->value[0] = defval; in snd_emu10k1_init_mono_onoff_control()
1157 ctl->min = 0; in snd_emu10k1_init_mono_onoff_control()
1158 ctl->max = 1; in snd_emu10k1_init_mono_onoff_control()
1159 ctl->translation = EMU10K1_GPR_TRANSLATION_ONOFF; in snd_emu10k1_init_mono_onoff_control()
1166 ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; in snd_emu10k1_init_stereo_onoff_control()
1167 strcpy(ctl->id.name, name); in snd_emu10k1_init_stereo_onoff_control()
1168 ctl->vcount = ctl->count = 2; in snd_emu10k1_init_stereo_onoff_control()
1169 ctl->gpr[0] = gpr + 0; ctl->value[0] = defval; in snd_emu10k1_init_stereo_onoff_control()
1170 ctl->gpr[1] = gpr + 1; ctl->value[1] = defval; in snd_emu10k1_init_stereo_onoff_control()
1171 ctl->min = 0; in snd_emu10k1_init_stereo_onoff_control()
1172 ctl->max = 1; in snd_emu10k1_init_stereo_onoff_control()
1173 ctl->translation = EMU10K1_GPR_TRANSLATION_ONOFF; in snd_emu10k1_init_stereo_onoff_control()
1177 * Used for emu1010 - conversion from 32-bit capture inputs from HANA
1178 * to 2 x 16-bit registers in audigy - their values are read via DMA.
1187 A_OP(icode, ptr, iANDXOR, A_GPR(tmp), A_GPR(tmp + 1), A_GPR(bit_shifter16 - 1), A_C_00000000); in snd_emu10k1_audigy_dsp_convert_32_to_2x16()
1188 A_OP(icode, ptr, iTSTNEG, A_GPR(tmp + 2), A_GPR(tmp), A_C_80000000, A_GPR(bit_shifter16 - 2)); in snd_emu10k1_audigy_dsp_convert_32_to_2x16()
1190 A_OP(icode, ptr, iANDXOR, A_GPR(tmp), A_GPR(tmp), A_GPR(bit_shifter16 - 3), A_C_00000000); in snd_emu10k1_audigy_dsp_convert_32_to_2x16()
1206 const int capture = playback + (SND_EMU10K1_PLAYBACK_CHANNELS * 2); /* we reserve 10 voices */ in _snd_emu10k1_audigy_init_efx() local
1207 const int stereo_mix = capture + 2; in _snd_emu10k1_audigy_init_efx()
1214 err = -ENOMEM; in _snd_emu10k1_audigy_init_efx()
1219 icode->gpr_map = (u_int32_t __user *) kcalloc(512 + 256 + 256 + 2 * 1024, in _snd_emu10k1_audigy_init_efx()
1221 if (!icode->gpr_map) in _snd_emu10k1_audigy_init_efx()
1228 gpr_map = (u32 __force *)icode->gpr_map; in _snd_emu10k1_audigy_init_efx()
1230 icode->tram_data_map = icode->gpr_map + 512; in _snd_emu10k1_audigy_init_efx()
1231 icode->tram_addr_map = icode->tram_data_map + 256; in _snd_emu10k1_audigy_init_efx()
1232 icode->code = icode->tram_addr_map + 256; in _snd_emu10k1_audigy_init_efx()
1236 set_bit(i, icode->gpr_valid); in _snd_emu10k1_audigy_init_efx()
1240 set_bit(i, icode->tram_valid); in _snd_emu10k1_audigy_init_efx()
1242 strcpy(icode->name, "Audigy DSP code for ALSA"); in _snd_emu10k1_audigy_init_efx()
1252 snd_emu10k1_ptr_write(emu, A_DBG, 0, (emu->fx8010.dbg = 0) | A_DBG_SINGLE_STEP); in _snd_emu10k1_audigy_init_efx()
1272 if (emu->card_capabilities->spk71) { in _snd_emu10k1_audigy_init_efx()
1304 /* Wave (PCM) Capture */ in _snd_emu10k1_audigy_init_efx()
1305 A_OP(icode, &ptr, iMAC0, A_GPR(capture+0), A_C_00000000, A_GPR(gpr), A_FXBUS(FXBUS_PCM_LEFT)); in _snd_emu10k1_audigy_init_efx()
1306 A_OP(icode, &ptr, iMAC0, A_GPR(capture+1), A_C_00000000, A_GPR(gpr+1), A_FXBUS(FXBUS_PCM_RIGHT)); in _snd_emu10k1_audigy_init_efx()
1307 snd_emu10k1_init_stereo_control(&controls[nctl++], "PCM Capture Volume", gpr, 0); in _snd_emu10k1_audigy_init_efx()
1310 /* Synth Capture */ in _snd_emu10k1_audigy_init_efx()
1311 A_OP(icode, &ptr, iMAC0, A_GPR(capture+0), A_GPR(capture+0), A_GPR(gpr), A_FXBUS(FXBUS_MIDI_LEFT)); in _snd_emu10k1_audigy_init_efx()
1312 …A_OP(icode, &ptr, iMAC0, A_GPR(capture+1), A_GPR(capture+1), A_GPR(gpr+1), A_FXBUS(FXBUS_MIDI_RIGH… in _snd_emu10k1_audigy_init_efx()
1313 snd_emu10k1_init_stereo_control(&controls[nctl++], "Synth Capture Volume", gpr, 0); in _snd_emu10k1_audigy_init_efx()
1322 /* emu1212 DSP 0 and DSP 1 Capture */ in _snd_emu10k1_audigy_init_efx()
1323 if (emu->card_capabilities->emu_model) { in _snd_emu10k1_audigy_init_efx()
1324 if (emu->card_capabilities->ca0108_chip) { in _snd_emu10k1_audigy_init_efx()
1327 A_OP(icode, &ptr, iMAC0, A_GPR(capture+0), A_GPR(capture+0), A_GPR(gpr), A_GPR(tmp)); in _snd_emu10k1_audigy_init_efx()
1329 A_OP(icode, &ptr, iMAC0, A_GPR(capture+1), A_GPR(capture+1), A_GPR(gpr), A_GPR(tmp)); in _snd_emu10k1_audigy_init_efx()
1331 A_OP(icode, &ptr, iMAC0, A_GPR(capture+0), A_GPR(capture+0), A_GPR(gpr), A_P16VIN(0x0)); in _snd_emu10k1_audigy_init_efx()
1332 A_OP(icode, &ptr, iMAC0, A_GPR(capture+1), A_GPR(capture+1), A_GPR(gpr+1), A_P16VIN(0x1)); in _snd_emu10k1_audigy_init_efx()
1334 snd_emu10k1_init_stereo_control(&controls[nctl++], "EMU Capture Volume", gpr, 0); in _snd_emu10k1_audigy_init_efx()
1337 /* AC'97 Playback Volume - used only for mic (renamed later) */ in _snd_emu10k1_audigy_init_efx()
1342 /* AC'97 Capture Volume - used only for mic */ in _snd_emu10k1_audigy_init_efx()
1343 A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_AC97_L); in _snd_emu10k1_audigy_init_efx()
1344 A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_AC97_R); in _snd_emu10k1_audigy_init_efx()
1345 snd_emu10k1_init_stereo_control(&controls[nctl++], "Mic Capture Volume", gpr, 0); in _snd_emu10k1_audigy_init_efx()
1348 /* mic capture buffer */ in _snd_emu10k1_audigy_init_efx()
1355 emu->card_capabilities->ac97_chip ? "Audigy CD Playback Volume" : "CD Playback Volume", in _snd_emu10k1_audigy_init_efx()
1358 /* Audigy CD Capture Volume */ in _snd_emu10k1_audigy_init_efx()
1359 A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_SPDIF_CD_L); in _snd_emu10k1_audigy_init_efx()
1360 A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_SPDIF_CD_R); in _snd_emu10k1_audigy_init_efx()
1362 emu->card_capabilities->ac97_chip ? "Audigy CD Capture Volume" : "CD Capture Volume", in _snd_emu10k1_audigy_init_efx()
1371 /* Optical SPDIF Capture Volume */ in _snd_emu10k1_audigy_init_efx()
1372 A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_OPT_SPDIF_L); in _snd_emu10k1_audigy_init_efx()
1373 A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_OPT_SPDIF_R); in _snd_emu10k1_audigy_init_efx()
1374 …snd_emu10k1_init_stereo_control(&controls[nctl++], SNDRV_CTL_NAME_IEC958("Optical ",CAPTURE,VOLUME… in _snd_emu10k1_audigy_init_efx()
1381 emu->card_capabilities->ac97_chip ? "Line2 Playback Volume" : "Line Playback Volume", in _snd_emu10k1_audigy_init_efx()
1384 /* Line2 Capture Volume */ in _snd_emu10k1_audigy_init_efx()
1385 A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_LINE2_L); in _snd_emu10k1_audigy_init_efx()
1386 A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_LINE2_R); in _snd_emu10k1_audigy_init_efx()
1388 emu->card_capabilities->ac97_chip ? "Line2 Capture Volume" : "Line Capture Volume", in _snd_emu10k1_audigy_init_efx()
1397 /* Philips ADC Capture Volume */ in _snd_emu10k1_audigy_init_efx()
1398 A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_ADC_L); in _snd_emu10k1_audigy_init_efx()
1399 A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_ADC_R); in _snd_emu10k1_audigy_init_efx()
1400 snd_emu10k1_init_stereo_control(&controls[nctl++], "Analog Mix Capture Volume", gpr, 0); in _snd_emu10k1_audigy_init_efx()
1407 emu->card_capabilities->ac97_chip ? "Aux2 Playback Volume" : "Aux Playback Volume", in _snd_emu10k1_audigy_init_efx()
1410 /* Aux2 Capture Volume */ in _snd_emu10k1_audigy_init_efx()
1411 A_ADD_VOLUME_IN(capture, gpr, A_EXTIN_AUX2_L); in _snd_emu10k1_audigy_init_efx()
1412 A_ADD_VOLUME_IN(capture+1, gpr+1, A_EXTIN_AUX2_R); in _snd_emu10k1_audigy_init_efx()
1414 emu->card_capabilities->ac97_chip ? "Aux2 Capture Volume" : "Aux Capture Volume", in _snd_emu10k1_audigy_init_efx()
1442 if (emu->card_capabilities->spk71) { in _snd_emu10k1_audigy_init_efx()
1476 if (emu->card_capabilities->spk71) { in _snd_emu10k1_audigy_init_efx()
1483 ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; in _snd_emu10k1_audigy_init_efx()
1484 strcpy(ctl->id.name, "Tone Control - Bass"); in _snd_emu10k1_audigy_init_efx()
1485 ctl->vcount = 2; in _snd_emu10k1_audigy_init_efx()
1486 ctl->count = 10; in _snd_emu10k1_audigy_init_efx()
1487 ctl->min = 0; in _snd_emu10k1_audigy_init_efx()
1488 ctl->max = 40; in _snd_emu10k1_audigy_init_efx()
1489 ctl->value[0] = ctl->value[1] = 20; in _snd_emu10k1_audigy_init_efx()
1490 ctl->translation = EMU10K1_GPR_TRANSLATION_BASS; in _snd_emu10k1_audigy_init_efx()
1492 ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; in _snd_emu10k1_audigy_init_efx()
1493 strcpy(ctl->id.name, "Tone Control - Treble"); in _snd_emu10k1_audigy_init_efx()
1494 ctl->vcount = 2; in _snd_emu10k1_audigy_init_efx()
1495 ctl->count = 10; in _snd_emu10k1_audigy_init_efx()
1496 ctl->min = 0; in _snd_emu10k1_audigy_init_efx()
1497 ctl->max = 40; in _snd_emu10k1_audigy_init_efx()
1498 ctl->value[0] = ctl->value[1] = 20; in _snd_emu10k1_audigy_init_efx()
1499 ctl->translation = EMU10K1_GPR_TRANSLATION_TREBLE; in _snd_emu10k1_audigy_init_efx()
1511 for (z = 0; z < 4; z++) { /* front/rear/center-lfe/side */ in _snd_emu10k1_audigy_init_efx()
1549 snd_emu10k1_init_stereo_onoff_control(controls + nctl++, "Tone Control - Switch", gpr, 0); in _snd_emu10k1_audigy_init_efx()
1569 if (emu->card_capabilities->spk71) in _snd_emu10k1_audigy_init_efx()
1577 if (emu->card_capabilities->emu_model) { in _snd_emu10k1_audigy_init_efx()
1579 dev_info(emu->card->dev, "EMU outputs on\n"); in _snd_emu10k1_audigy_init_efx()
1581 if (emu->card_capabilities->ca0108_chip) { in _snd_emu10k1_audigy_init_efx()
1595 A_OP(icode, &ptr, iSKIP, A_GPR_COND, A_GPR_COND, A_GPR(gpr - 2), A_C_00000001); in _snd_emu10k1_audigy_init_efx()
1597 A_OP(icode, &ptr, iANDXOR, A_GPR(tmp + 2), A_GPR(tmp + 2), A_GPR(gpr - 1), A_C_00000000); in _snd_emu10k1_audigy_init_efx()
1601 if ((z==1) && (emu->card_capabilities->spdif_bug)) { in _snd_emu10k1_audigy_init_efx()
1603 dev_info(emu->card->dev, in _snd_emu10k1_audigy_init_efx()
1605 emu->card_capabilities->name); in _snd_emu10k1_audigy_init_efx()
1606 …A_OP(icode, &ptr, iACC3, A_EXTOUT(A_EXTOUT_FRONT_L + z), A_GPR(gpr - 3), A_C_00000000, A_C_0000000… in _snd_emu10k1_audigy_init_efx()
1607 A_OP(icode, &ptr, iACC3, A_GPR(gpr - 3), A_GPR(tmp + 0), A_GPR(tmp + 1), A_C_00000000); in _snd_emu10k1_audigy_init_efx()
1623 A_PUT_OUTPUT(A_EXTOUT_ADC_CAP_L, capture); in _snd_emu10k1_audigy_init_efx()
1624 A_PUT_OUTPUT(A_EXTOUT_ADC_CAP_R, capture+1); in _snd_emu10k1_audigy_init_efx()
1627 if (emu->card_capabilities->emu_model) { in _snd_emu10k1_audigy_init_efx()
1628 if (emu->card_capabilities->ca0108_chip) { in _snd_emu10k1_audigy_init_efx()
1629 dev_info(emu->card->dev, "EMU2 inputs on\n"); in _snd_emu10k1_audigy_init_efx()
1637 dev_info(emu->card->dev, "EMU inputs on\n"); in _snd_emu10k1_audigy_init_efx()
1638 /* Capture 16 (originally 8) channels of S32_LE sound */ in _snd_emu10k1_audigy_init_efx()
1641 dev_dbg(emu->card->dev, "emufx.c: gpr=0x%x, tmp=0x%x\n", in _snd_emu10k1_audigy_init_efx()
1657 …snd_emu10k1_audigy_dsp_convert_32_to_2x16( icode, &ptr, tmp, bit_shifter16, A_GPR(gpr - 1), A_FXBU… in _snd_emu10k1_audigy_init_efx()
1658 A_OP(icode, &ptr, iACC3, A_GPR(gpr - 1), A_P16VIN(0x1), A_C_00000000, A_C_00000000); in _snd_emu10k1_audigy_init_efx()
1660 …snd_emu10k1_audigy_dsp_convert_32_to_2x16( icode, &ptr, tmp, bit_shifter16, A_GPR(gpr - 1), A_FXBU… in _snd_emu10k1_audigy_init_efx()
1661 A_OP(icode, &ptr, iACC3, A_GPR(gpr - 1), A_P16VIN(0x2), A_C_00000000, A_C_00000000); in _snd_emu10k1_audigy_init_efx()
1663 …snd_emu10k1_audigy_dsp_convert_32_to_2x16( icode, &ptr, tmp, bit_shifter16, A_GPR(gpr - 1), A_FXBU… in _snd_emu10k1_audigy_init_efx()
1664 A_OP(icode, &ptr, iACC3, A_GPR(gpr - 1), A_P16VIN(0x3), A_C_00000000, A_C_00000000); in _snd_emu10k1_audigy_init_efx()
1668 …snd_emu10k1_audigy_dsp_convert_32_to_2x16( icode, &ptr, tmp, bit_shifter16, A_GPR(gpr - 1), A_FXBU… in _snd_emu10k1_audigy_init_efx()
1669 A_OP(icode, &ptr, iACC3, A_GPR(gpr - 1), A_P16VIN(0x4), A_C_00000000, A_C_00000000); in _snd_emu10k1_audigy_init_efx()
1672 …snd_emu10k1_audigy_dsp_convert_32_to_2x16( icode, &ptr, tmp, bit_shifter16, A_GPR(gpr - 1), A_FXBU… in _snd_emu10k1_audigy_init_efx()
1673 A_OP(icode, &ptr, iACC3, A_GPR(gpr - 1), A_P16VIN(0x5), A_C_00000000, A_C_00000000); in _snd_emu10k1_audigy_init_efx()
1675 …snd_emu10k1_audigy_dsp_convert_32_to_2x16( icode, &ptr, tmp, bit_shifter16, A_GPR(gpr - 1), A_FXBU… in _snd_emu10k1_audigy_init_efx()
1676 A_OP(icode, &ptr, iACC3, A_GPR(gpr - 1), A_P16VIN(0x6), A_C_00000000, A_C_00000000); in _snd_emu10k1_audigy_init_efx()
1678 …snd_emu10k1_audigy_dsp_convert_32_to_2x16( icode, &ptr, tmp, bit_shifter16, A_GPR(gpr - 1), A_FXBU… in _snd_emu10k1_audigy_init_efx()
1679 A_OP(icode, &ptr, iACC3, A_GPR(gpr - 1), A_P16VIN(0x7), A_C_00000000, A_C_00000000); in _snd_emu10k1_audigy_init_efx()
1680 /* Pavel Hofman - we still have voices, A_FXBUS2s, and in _snd_emu10k1_audigy_init_efx()
1681 * A_P16VINs available - in _snd_emu10k1_audigy_init_efx()
1682 * let's add 8 more capture channels - total of 16 in _snd_emu10k1_audigy_init_efx()
1687 A_GPR(gpr - 1), in _snd_emu10k1_audigy_init_efx()
1689 A_OP(icode, &ptr, iACC3, A_GPR(gpr - 1), A_P16VIN(0x8), in _snd_emu10k1_audigy_init_efx()
1694 A_GPR(gpr - 1), in _snd_emu10k1_audigy_init_efx()
1696 A_OP(icode, &ptr, iACC3, A_GPR(gpr - 1), A_P16VIN(0x9), in _snd_emu10k1_audigy_init_efx()
1701 A_GPR(gpr - 1), in _snd_emu10k1_audigy_init_efx()
1703 A_OP(icode, &ptr, iACC3, A_GPR(gpr - 1), A_P16VIN(0xa), in _snd_emu10k1_audigy_init_efx()
1708 A_GPR(gpr - 1), in _snd_emu10k1_audigy_init_efx()
1710 A_OP(icode, &ptr, iACC3, A_GPR(gpr - 1), A_P16VIN(0xb), in _snd_emu10k1_audigy_init_efx()
1715 A_GPR(gpr - 1), in _snd_emu10k1_audigy_init_efx()
1717 A_OP(icode, &ptr, iACC3, A_GPR(gpr - 1), A_P16VIN(0xc), in _snd_emu10k1_audigy_init_efx()
1722 A_GPR(gpr - 1), in _snd_emu10k1_audigy_init_efx()
1724 A_OP(icode, &ptr, iACC3, A_GPR(gpr - 1), A_P16VIN(0xd), in _snd_emu10k1_audigy_init_efx()
1729 A_GPR(gpr - 1), in _snd_emu10k1_audigy_init_efx()
1731 A_OP(icode, &ptr, iACC3, A_GPR(gpr - 1), A_P16VIN(0xe), in _snd_emu10k1_audigy_init_efx()
1736 A_GPR(gpr - 1), in _snd_emu10k1_audigy_init_efx()
1738 A_OP(icode, &ptr, iACC3, A_GPR(gpr - 1), A_P16VIN(0xf), in _snd_emu10k1_audigy_init_efx()
1751 /* EFX capture - capture the 16 EXTINs */ in _snd_emu10k1_audigy_init_efx()
1752 /* Capture 16 channels of S16_LE sound */ in _snd_emu10k1_audigy_init_efx()
1765 err = -EIO; in _snd_emu10k1_audigy_init_efx()
1772 icode->gpr_add_control_count = nctl; in _snd_emu10k1_audigy_init_efx()
1773 icode->gpr_add_controls = (struct snd_emu10k1_fx8010_control_gpr __user *)controls; in _snd_emu10k1_audigy_init_efx()
1774 emu->support_tlv = 1; /* support TLV */ in _snd_emu10k1_audigy_init_efx()
1776 emu->support_tlv = 0; /* clear again */ in _snd_emu10k1_audigy_init_efx()
1781 kfree((void __force *)icode->gpr_map); in _snd_emu10k1_audigy_init_efx()
1842 int err, i, z, gpr, tmp, playback, capture; in _snd_emu10k1_init_efx() local
1849 err = -ENOMEM; in _snd_emu10k1_init_efx()
1854 icode->gpr_map = (u_int32_t __user *) kcalloc(256 + 160 + 160 + 2 * 512, in _snd_emu10k1_init_efx()
1856 if (!icode->gpr_map) in _snd_emu10k1_init_efx()
1869 gpr_map = (u32 __force *)icode->gpr_map; in _snd_emu10k1_init_efx()
1871 icode->tram_data_map = icode->gpr_map + 256; in _snd_emu10k1_init_efx()
1872 icode->tram_addr_map = icode->tram_data_map + 160; in _snd_emu10k1_init_efx()
1873 icode->code = icode->tram_addr_map + 160; in _snd_emu10k1_init_efx()
1877 set_bit(i, icode->gpr_valid); in _snd_emu10k1_init_efx()
1881 set_bit(i, icode->tram_valid); in _snd_emu10k1_init_efx()
1883 strcpy(icode->name, "SB Live! FX8010 code for ALSA v1.2 by Jaroslav Kysela"); in _snd_emu10k1_init_efx()
1888 capture = playback + (SND_EMU10K1_PLAYBACK_CHANNELS * 2); in _snd_emu10k1_init_efx()
1889 gpr = capture + SND_EMU10K1_CAPTURE_CHANNELS; in _snd_emu10k1_init_efx()
1894 snd_emu10k1_ptr_write(emu, DBG, 0, (emu->fx8010.dbg = 0) | EMU10K1_DBG_SINGLE_STEP); in _snd_emu10k1_init_efx()
1913 ipcm->substream = 0; in _snd_emu10k1_init_efx()
1914 ipcm->channels = 2; in _snd_emu10k1_init_efx()
1915 ipcm->tram_start = 0; in _snd_emu10k1_init_efx()
1916 ipcm->buffer_size = (64 * 1024) / 2; in _snd_emu10k1_init_efx()
1917 ipcm->gpr_size = gpr++; in _snd_emu10k1_init_efx()
1918 ipcm->gpr_ptr = gpr++; in _snd_emu10k1_init_efx()
1919 ipcm->gpr_count = gpr++; in _snd_emu10k1_init_efx()
1920 ipcm->gpr_tmpcount = gpr++; in _snd_emu10k1_init_efx()
1921 ipcm->gpr_trigger = gpr++; in _snd_emu10k1_init_efx()
1922 ipcm->gpr_running = gpr++; in _snd_emu10k1_init_efx()
1923 ipcm->etram[0] = 0; in _snd_emu10k1_init_efx()
1924 ipcm->etram[1] = 1; in _snd_emu10k1_init_efx()
1932 gpr_map[gpr + 6] = (0x22 - 0x01) - 1; /* skip at 01 to 22 */ in _snd_emu10k1_init_efx()
1933 gpr_map[gpr + 7] = (0x22 - 0x06) - 1; /* skip at 06 to 22 */ in _snd_emu10k1_init_efx()
1937 gpr_map[gpr + 11] = (0x24 - 0x0a) - 1; /* skip at 0a to 24 */ in _snd_emu10k1_init_efx()
1941 /* 00: */ OP(icode, &ptr, iMAC0, C_00000000, GPR(ipcm->gpr_trigger), C_00000000, C_00000000); in _snd_emu10k1_init_efx()
1944 /* 02: */ OP(icode, &ptr, iMAC0, C_00000000, GPR(ipcm->gpr_running), C_00000000, C_00000000); in _snd_emu10k1_init_efx()
1952 …/* 08: */ OP(icode, &ptr, iANDXOR, GPR(ipcm->gpr_running), GPR(ipcm->gpr_running), C_00000000, C_0… in _snd_emu10k1_init_efx()
1957 …/* 0c: */ OP(icode, &ptr, iANDXOR, GPR(tmp + 0), ETRAM_DATA(ipcm->etram[0]), GPR(gpr + 0), C_00000… in _snd_emu10k1_init_efx()
1963 …/* 11: */ OP(icode, &ptr, iANDXOR, GPR(tmp + 0), ETRAM_DATA(ipcm->etram[1]), GPR(gpr + 0), C_00000… in _snd_emu10k1_init_efx()
1969 /* 16: */ OP(icode, &ptr, iACC3, GPR(tmp + 0), GPR(ipcm->gpr_ptr), C_00000001, C_00000000); in _snd_emu10k1_init_efx()
1970 /* 17: */ OP(icode, &ptr, iMACINT0, C_00000000, GPR(tmp + 0), C_ffffffff, GPR(ipcm->gpr_size)); in _snd_emu10k1_init_efx()
1973 /* 1a: */ OP(icode, &ptr, iACC3, GPR(ipcm->gpr_ptr), GPR(tmp + 0), C_00000000, C_00000000); in _snd_emu10k1_init_efx()
1975 …/* 1b: */ OP(icode, &ptr, iACC3, GPR(ipcm->gpr_tmpcount), GPR(ipcm->gpr_tmpcount), C_ffffffff, C_0… in _snd_emu10k1_init_efx()
1977 …/* 1d: */ OP(icode, &ptr, iACC3, GPR(ipcm->gpr_tmpcount), GPR(ipcm->gpr_count), C_00000000, C_0000… in _snd_emu10k1_init_efx()
1979 …/* 1f: */ OP(icode, &ptr, iANDXOR, GPR(ipcm->gpr_running), GPR(ipcm->gpr_running), C_00000001, C_0… in _snd_emu10k1_init_efx()
1981 …/* 20: */ OP(icode, &ptr, iANDXOR, GPR(ipcm->gpr_running), GPR(ipcm->gpr_running), C_00010000, C_0… in _snd_emu10k1_init_efx()
1984 …/* 22: */ OP(icode, &ptr, iMACINT1, ETRAM_ADDR(ipcm->etram[0]), GPR(gpr + 8), GPR_DBAC, C_ffffffff… in _snd_emu10k1_init_efx()
1985 …/* 23: */ OP(icode, &ptr, iMACINT1, ETRAM_ADDR(ipcm->etram[1]), GPR(gpr + 9), GPR_DBAC, C_ffffffff… in _snd_emu10k1_init_efx()
2010 /* Wave Capture Volume + Switch */ in _snd_emu10k1_init_efx()
2013 VOLUME(icode, &ptr, capture + z, tmp + 0, gpr + z); in _snd_emu10k1_init_efx()
2015 snd_emu10k1_init_stereo_control(controls + i++, "Wave Capture Volume", gpr, 0); in _snd_emu10k1_init_efx()
2016 snd_emu10k1_init_stereo_onoff_control(controls + i++, "Wave Capture Switch", gpr + 2, 0); in _snd_emu10k1_init_efx()
2025 /* Synth Capture Volume + Switch */ in _snd_emu10k1_init_efx()
2028 VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z); in _snd_emu10k1_init_efx()
2030 snd_emu10k1_init_stereo_control(controls + i++, "Synth Capture Volume", gpr, 0); in _snd_emu10k1_init_efx()
2031 snd_emu10k1_init_stereo_onoff_control(controls + i++, "Synth Capture Switch", gpr + 2, 0); in _snd_emu10k1_init_efx()
2040 /* Surround Capture Volume + Switch */ in _snd_emu10k1_init_efx()
2043 VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z); in _snd_emu10k1_init_efx()
2045 snd_emu10k1_init_stereo_control(controls + i++, "Surround Capture Volume", gpr, 0); in _snd_emu10k1_init_efx()
2046 snd_emu10k1_init_stereo_onoff_control(controls + i++, "Surround Capture Switch", gpr + 2, 0); in _snd_emu10k1_init_efx()
2063 /* Front Capture Volume + Switch */ in _snd_emu10k1_init_efx()
2066 VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z); in _snd_emu10k1_init_efx()
2068 snd_emu10k1_init_stereo_control(controls + i++, "Front Capture Volume", gpr, 0); in _snd_emu10k1_init_efx()
2069 snd_emu10k1_init_mono_onoff_control(controls + i++, "Front Capture Switch", gpr + 2, 0); in _snd_emu10k1_init_efx()
2076 if (emu->fx8010.extin_mask & ((1<<EXTIN_AC97_L)|(1<<EXTIN_AC97_R))) { in _snd_emu10k1_init_efx()
2080 snd_emu10k1_init_stereo_control(controls + i++, "AC97 Playback Volume", gpr-2, 0); in _snd_emu10k1_init_efx()
2081 /* AC'97 Capture Volume */ in _snd_emu10k1_init_efx()
2082 VOLUME_ADDIN(icode, &ptr, capture + 0, EXTIN_AC97_L, gpr); gpr++; in _snd_emu10k1_init_efx()
2083 VOLUME_ADDIN(icode, &ptr, capture + 1, EXTIN_AC97_R, gpr); gpr++; in _snd_emu10k1_init_efx()
2084 snd_emu10k1_init_stereo_control(controls + i++, "AC97 Capture Volume", gpr-2, 100); in _snd_emu10k1_init_efx()
2087 if (emu->fx8010.extin_mask & ((1<<EXTIN_SPDIF_CD_L)|(1<<EXTIN_SPDIF_CD_R))) { in _snd_emu10k1_init_efx()
2094 /* IEC958 TTL Capture Volume + Switch */ in _snd_emu10k1_init_efx()
2097 VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z); in _snd_emu10k1_init_efx()
2099 …snd_emu10k1_init_stereo_control(controls + i++, SNDRV_CTL_NAME_IEC958("TTL ",CAPTURE,VOLUME), gpr,… in _snd_emu10k1_init_efx()
2100 …snd_emu10k1_init_stereo_onoff_control(controls + i++, SNDRV_CTL_NAME_IEC958("TTL ",CAPTURE,SWITCH)… in _snd_emu10k1_init_efx()
2104 if (emu->fx8010.extin_mask & ((1<<EXTIN_ZOOM_L)|(1<<EXTIN_ZOOM_R))) { in _snd_emu10k1_init_efx()
2111 /* Zoom Video Capture Volume + Switch */ in _snd_emu10k1_init_efx()
2114 VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z); in _snd_emu10k1_init_efx()
2116 snd_emu10k1_init_stereo_control(controls + i++, "Zoom Video Capture Volume", gpr, 0); in _snd_emu10k1_init_efx()
2117 snd_emu10k1_init_stereo_onoff_control(controls + i++, "Zoom Video Capture Switch", gpr + 2, 0); in _snd_emu10k1_init_efx()
2121 if (emu->fx8010.extin_mask & ((1<<EXTIN_TOSLINK_L)|(1<<EXTIN_TOSLINK_R))) { in _snd_emu10k1_init_efx()
2128 /* IEC958 Optical Capture Volume */ in _snd_emu10k1_init_efx()
2131 VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z); in _snd_emu10k1_init_efx()
2133 …snd_emu10k1_init_stereo_control(controls + i++, SNDRV_CTL_NAME_IEC958("LiveDrive ",CAPTURE,VOLUME)… in _snd_emu10k1_init_efx()
2134 …snd_emu10k1_init_stereo_onoff_control(controls + i++, SNDRV_CTL_NAME_IEC958("LiveDrive ",CAPTURE,S… in _snd_emu10k1_init_efx()
2138 if (emu->fx8010.extin_mask & ((1<<EXTIN_LINE1_L)|(1<<EXTIN_LINE1_R))) { in _snd_emu10k1_init_efx()
2145 /* Line LiveDrive Capture Volume + Switch */ in _snd_emu10k1_init_efx()
2148 VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z); in _snd_emu10k1_init_efx()
2150 snd_emu10k1_init_stereo_control(controls + i++, "Line LiveDrive Capture Volume", gpr, 0); in _snd_emu10k1_init_efx()
2151 …snd_emu10k1_init_stereo_onoff_control(controls + i++, "Line LiveDrive Capture Switch", gpr + 2, 0); in _snd_emu10k1_init_efx()
2155 if (emu->fx8010.extin_mask & ((1<<EXTIN_COAX_SPDIF_L)|(1<<EXTIN_COAX_SPDIF_R))) { in _snd_emu10k1_init_efx()
2162 /* IEC958 Coax Capture Volume + Switch */ in _snd_emu10k1_init_efx()
2165 VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z); in _snd_emu10k1_init_efx()
2167 …snd_emu10k1_init_stereo_control(controls + i++, SNDRV_CTL_NAME_IEC958("Coaxial ",CAPTURE,VOLUME), … in _snd_emu10k1_init_efx()
2168 …snd_emu10k1_init_stereo_onoff_control(controls + i++, SNDRV_CTL_NAME_IEC958("Coaxial ",CAPTURE,SWI… in _snd_emu10k1_init_efx()
2172 if (emu->fx8010.extin_mask & ((1<<EXTIN_LINE2_L)|(1<<EXTIN_LINE2_R))) { in _snd_emu10k1_init_efx()
2177 controls[i-1].id.index = 1; in _snd_emu10k1_init_efx()
2180 /* Line LiveDrive Capture Volume */ in _snd_emu10k1_init_efx()
2183 VOLUME_ADD(icode, &ptr, capture + z, tmp + 0, gpr + z); in _snd_emu10k1_init_efx()
2185 snd_emu10k1_init_stereo_control(controls + i++, "Line2 LiveDrive Capture Volume", gpr, 0); in _snd_emu10k1_init_efx()
2186 controls[i-1].id.index = 1; in _snd_emu10k1_init_efx()
2187 …snd_emu10k1_init_stereo_onoff_control(controls + i++, "Line2 LiveDrive Capture Switch", gpr + 2, 0… in _snd_emu10k1_init_efx()
2188 controls[i-1].id.index = 1; in _snd_emu10k1_init_efx()
2203 ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; in _snd_emu10k1_init_efx()
2204 strcpy(ctl->id.name, "Tone Control - Bass"); in _snd_emu10k1_init_efx()
2205 ctl->vcount = 2; in _snd_emu10k1_init_efx()
2206 ctl->count = 10; in _snd_emu10k1_init_efx()
2207 ctl->min = 0; in _snd_emu10k1_init_efx()
2208 ctl->max = 40; in _snd_emu10k1_init_efx()
2209 ctl->value[0] = ctl->value[1] = 20; in _snd_emu10k1_init_efx()
2210 ctl->tlv = snd_emu10k1_bass_treble_db_scale; in _snd_emu10k1_init_efx()
2211 ctl->translation = EMU10K1_GPR_TRANSLATION_BASS; in _snd_emu10k1_init_efx()
2213 ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER; in _snd_emu10k1_init_efx()
2214 strcpy(ctl->id.name, "Tone Control - Treble"); in _snd_emu10k1_init_efx()
2215 ctl->vcount = 2; in _snd_emu10k1_init_efx()
2216 ctl->count = 10; in _snd_emu10k1_init_efx()
2217 ctl->min = 0; in _snd_emu10k1_init_efx()
2218 ctl->max = 40; in _snd_emu10k1_init_efx()
2219 ctl->value[0] = ctl->value[1] = 20; in _snd_emu10k1_init_efx()
2220 ctl->tlv = snd_emu10k1_bass_treble_db_scale; in _snd_emu10k1_init_efx()
2221 ctl->translation = EMU10K1_GPR_TRANSLATION_TREBLE; in _snd_emu10k1_init_efx()
2233 for (z = 0; z < 3; z++) { /* front/rear/center-lfe */ in _snd_emu10k1_init_efx()
2271 snd_emu10k1_init_stereo_onoff_control(controls + i++, "Tone Control - Switch", gpr, 0); in _snd_emu10k1_init_efx()
2277 if (emu->fx8010.extout_mask & ((1<<EXTOUT_AC97_L)|(1<<EXTOUT_AC97_R))) { in _snd_emu10k1_init_efx()
2284 if (emu->fx8010.extout_mask & ((1<<EXTOUT_TOSLINK_L)|(1<<EXTOUT_TOSLINK_R))) { in _snd_emu10k1_init_efx()
2301 if (emu->fx8010.extout_mask & ((1<<EXTOUT_HEADPHONE_L)|(1<<EXTOUT_HEADPHONE_R))) { in _snd_emu10k1_init_efx()
2313 controls[i-1].id.index = 1; /* AC'97 can have also Headphone control */ in _snd_emu10k1_init_efx()
2315 controls[i-1].id.index = 1; in _snd_emu10k1_init_efx()
2317 controls[i-1].id.index = 1; in _snd_emu10k1_init_efx()
2322 if (emu->fx8010.extout_mask & ((1<<EXTOUT_REAR_L)|(1<<EXTOUT_REAR_R))) in _snd_emu10k1_init_efx()
2326 if (emu->fx8010.extout_mask & ((1<<EXTOUT_AC97_REAR_L)|(1<<EXTOUT_AC97_REAR_R))) in _snd_emu10k1_init_efx()
2330 if (emu->fx8010.extout_mask & (1<<EXTOUT_AC97_CENTER)) { in _snd_emu10k1_init_efx()
2340 if (emu->fx8010.extout_mask & (1<<EXTOUT_AC97_LFE)) { in _snd_emu10k1_init_efx()
2352 OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_ADC_CAP_L + z), GPR(capture + z), C_00000000, C_00000000); in _snd_emu10k1_init_efx()
2355 if (emu->fx8010.extout_mask & (1<<EXTOUT_MIC_CAP)) in _snd_emu10k1_init_efx()
2356 OP(icode, &ptr, iACC3, EXTOUT(EXTOUT_MIC_CAP), GPR(capture + 2), C_00000000, C_00000000); in _snd_emu10k1_init_efx()
2358 /* EFX capture - capture the 16 EXTINS */ in _snd_emu10k1_init_efx()
2359 if (emu->card_capabilities->sblive51) { in _snd_emu10k1_init_efx()
2364 * We route AC97L and R to FX capture 14 and 15, SPDIF CD in to FX capture in _snd_emu10k1_init_efx()
2365 * 0 and 3, then the rest of the EXTINs to the corresponding FX capture in _snd_emu10k1_init_efx()
2383 err = -EIO; in _snd_emu10k1_init_efx()
2388 err = -EIO; in _snd_emu10k1_init_efx()
2396 if ((err = snd_emu10k1_fx8010_tram_setup(emu, ipcm->buffer_size)) < 0) in _snd_emu10k1_init_efx()
2398 icode->gpr_add_control_count = i; in _snd_emu10k1_init_efx()
2399 icode->gpr_add_controls = (struct snd_emu10k1_fx8010_control_gpr __user *)controls; in _snd_emu10k1_init_efx()
2400 emu->support_tlv = 1; /* support TLV */ in _snd_emu10k1_init_efx()
2402 emu->support_tlv = 0; /* clear again */ in _snd_emu10k1_init_efx()
2410 kfree((void __force *)icode->gpr_map); in _snd_emu10k1_init_efx()
2418 spin_lock_init(&emu->fx8010.irq_lock); in snd_emu10k1_init_efx()
2419 INIT_LIST_HEAD(&emu->fx8010.gpr_ctl); in snd_emu10k1_init_efx()
2420 if (emu->audigy) in snd_emu10k1_init_efx()
2429 if (emu->audigy) in snd_emu10k1_free_efx()
2430 snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg = A_DBG_SINGLE_STEP); in snd_emu10k1_free_efx()
2432 snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg = EMU10K1_DBG_SINGLE_STEP); in snd_emu10k1_free_efx()
2439 return -EINVAL;
2440 snd_emu10k1_ptr_write(emu, emu->gpr_base + 0x94 + output, 0, 1);
2447 return -EINVAL;
2448 snd_emu10k1_ptr_write(emu, emu->gpr_base + 0x94 + output, 0, 0);
2459 size = (size - 1) >> 13; in snd_emu10k1_fx8010_tram_setup()
2467 if ((emu->fx8010.etram_pages.bytes / 2) == size) in snd_emu10k1_fx8010_tram_setup()
2469 spin_lock_irq(&emu->emu_lock); in snd_emu10k1_fx8010_tram_setup()
2470 outl(HCFG_LOCKTANKCACHE_MASK | inl(emu->port + HCFG), emu->port + HCFG); in snd_emu10k1_fx8010_tram_setup()
2471 spin_unlock_irq(&emu->emu_lock); in snd_emu10k1_fx8010_tram_setup()
2472 snd_emu10k1_ptr_write(emu, TCB, 0, 0); in snd_emu10k1_fx8010_tram_setup()
2474 if (emu->fx8010.etram_pages.area != NULL) { in snd_emu10k1_fx8010_tram_setup()
2475 snd_dma_free_pages(&emu->fx8010.etram_pages); in snd_emu10k1_fx8010_tram_setup()
2476 emu->fx8010.etram_pages.area = NULL; in snd_emu10k1_fx8010_tram_setup()
2477 emu->fx8010.etram_pages.bytes = 0; in snd_emu10k1_fx8010_tram_setup()
2481 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(emu->pci), in snd_emu10k1_fx8010_tram_setup()
2482 size * 2, &emu->fx8010.etram_pages) < 0) in snd_emu10k1_fx8010_tram_setup()
2483 return -ENOMEM; in snd_emu10k1_fx8010_tram_setup()
2484 memset(emu->fx8010.etram_pages.area, 0, size * 2); in snd_emu10k1_fx8010_tram_setup()
2485 snd_emu10k1_ptr_write(emu, TCB, 0, emu->fx8010.etram_pages.addr); in snd_emu10k1_fx8010_tram_setup()
2487 spin_lock_irq(&emu->emu_lock); in snd_emu10k1_fx8010_tram_setup()
2488 outl(inl(emu->port + HCFG) & ~HCFG_LOCKTANKCACHE_MASK, emu->port + HCFG); in snd_emu10k1_fx8010_tram_setup()
2489 spin_unlock_irq(&emu->emu_lock); in snd_emu10k1_fx8010_tram_setup()
2515 info->internal_tram_size = emu->fx8010.itram_size; in snd_emu10k1_fx8010_info()
2516 info->external_tram_size = emu->fx8010.etram_pages.bytes / 2; in snd_emu10k1_fx8010_info()
2518 extin = emu->audigy ? audigy_ins : creative_ins; in snd_emu10k1_fx8010_info()
2519 extout = emu->audigy ? audigy_outs : creative_outs; in snd_emu10k1_fx8010_info()
2520 fxbus_mask = emu->fx8010.fxbus_mask; in snd_emu10k1_fx8010_info()
2521 extin_mask = emu->fx8010.extin_mask; in snd_emu10k1_fx8010_info()
2522 extout_mask = emu->fx8010.extout_mask; in snd_emu10k1_fx8010_info()
2524 copy_string(info->fxbus_names[res], fxbus_mask & (1 << res) ? *fxbus : NULL, "FXBUS", res); in snd_emu10k1_fx8010_info()
2525 copy_string(info->extin_names[res], extin_mask & (1 << res) ? *extin : NULL, "Unused", res); in snd_emu10k1_fx8010_info()
2526 copy_string(info->extout_names[res], extout_mask & (1 << res) ? *extout : NULL, "Unused", res); in snd_emu10k1_fx8010_info()
2529 copy_string(info->extout_names[res], extout_mask & (1 << res) ? *extout : NULL, "Unused", res); in snd_emu10k1_fx8010_info()
2530 info->gpr_controls = emu->fx8010.gpr_count; in snd_emu10k1_fx8010_info()
2535 struct snd_emu10k1 *emu = hw->private_data; in snd_emu10k1_fx8010_ioctl()
2545 emu->support_tlv = 1; in snd_emu10k1_fx8010_ioctl()
2550 return -ENOMEM; in snd_emu10k1_fx8010_ioctl()
2554 return -EFAULT; in snd_emu10k1_fx8010_ioctl()
2560 return -EPERM; in snd_emu10k1_fx8010_ioctl()
2575 return -EFAULT; in snd_emu10k1_fx8010_ioctl()
2593 return -EFAULT; in snd_emu10k1_fx8010_ioctl()
2599 return -EPERM; in snd_emu10k1_fx8010_ioctl()
2601 return -EFAULT; in snd_emu10k1_fx8010_ioctl()
2602 mutex_lock(&emu->fx8010.lock); in snd_emu10k1_fx8010_ioctl()
2604 mutex_unlock(&emu->fx8010.lock); in snd_emu10k1_fx8010_ioctl()
2608 return -EPERM; in snd_emu10k1_fx8010_ioctl()
2609 if (emu->audigy) in snd_emu10k1_fx8010_ioctl()
2610 snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg |= A_DBG_SINGLE_STEP); in snd_emu10k1_fx8010_ioctl()
2612 snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg |= EMU10K1_DBG_SINGLE_STEP); in snd_emu10k1_fx8010_ioctl()
2616 return -EPERM; in snd_emu10k1_fx8010_ioctl()
2617 if (emu->audigy) in snd_emu10k1_fx8010_ioctl()
2618 snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg = 0); in snd_emu10k1_fx8010_ioctl()
2620 snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg = 0); in snd_emu10k1_fx8010_ioctl()
2624 return -EPERM; in snd_emu10k1_fx8010_ioctl()
2625 if (emu->audigy) in snd_emu10k1_fx8010_ioctl()
2626 snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg | A_DBG_ZC); in snd_emu10k1_fx8010_ioctl()
2628 snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg | EMU10K1_DBG_ZC); in snd_emu10k1_fx8010_ioctl()
2630 if (emu->audigy) in snd_emu10k1_fx8010_ioctl()
2631 snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg); in snd_emu10k1_fx8010_ioctl()
2633 snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg); in snd_emu10k1_fx8010_ioctl()
2637 return -EPERM; in snd_emu10k1_fx8010_ioctl()
2639 return -EFAULT; in snd_emu10k1_fx8010_ioctl()
2641 return -EINVAL; in snd_emu10k1_fx8010_ioctl()
2642 if (emu->audigy) in snd_emu10k1_fx8010_ioctl()
2643 snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg |= A_DBG_SINGLE_STEP | addr); in snd_emu10k1_fx8010_ioctl()
2645 snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg |= EMU10K1_DBG_SINGLE_STEP | addr); in snd_emu10k1_fx8010_ioctl()
2647 if (emu->audigy) in snd_emu10k1_fx8010_ioctl()
2648 …snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg |= A_DBG_SINGLE_STEP | A_DBG_STEP_ADDR | addr… in snd_emu10k1_fx8010_ioctl()
2650 …snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg |= EMU10K1_DBG_SINGLE_STEP | EMU10K1_DBG_STEP |… in snd_emu10k1_fx8010_ioctl()
2653 if (emu->audigy) in snd_emu10k1_fx8010_ioctl()
2658 return -EFAULT; in snd_emu10k1_fx8010_ioctl()
2661 return -ENOTTY; in snd_emu10k1_fx8010_ioctl()
2674 if ((err = snd_hwdep_new(emu->card, "FX8010", device, &hw)) < 0) in snd_emu10k1_fx8010_new()
2676 strcpy(hw->name, "EMU10K1 (FX8010)"); in snd_emu10k1_fx8010_new()
2677 hw->iface = SNDRV_HWDEP_IFACE_EMU10K1; in snd_emu10k1_fx8010_new()
2678 hw->ops.open = snd_emu10k1_fx8010_open; in snd_emu10k1_fx8010_new()
2679 hw->ops.ioctl = snd_emu10k1_fx8010_ioctl; in snd_emu10k1_fx8010_new()
2680 hw->ops.release = snd_emu10k1_fx8010_release; in snd_emu10k1_fx8010_new()
2681 hw->private_data = emu; in snd_emu10k1_fx8010_new()
2690 len = emu->audigy ? 0x200 : 0x100; in snd_emu10k1_efx_alloc_pm_buffer()
2691 emu->saved_gpr = kmalloc_array(len, 4, GFP_KERNEL); in snd_emu10k1_efx_alloc_pm_buffer()
2692 if (! emu->saved_gpr) in snd_emu10k1_efx_alloc_pm_buffer()
2693 return -ENOMEM; in snd_emu10k1_efx_alloc_pm_buffer()
2694 len = emu->audigy ? 0x100 : 0xa0; in snd_emu10k1_efx_alloc_pm_buffer()
2695 emu->tram_val_saved = kmalloc_array(len, 4, GFP_KERNEL); in snd_emu10k1_efx_alloc_pm_buffer()
2696 emu->tram_addr_saved = kmalloc_array(len, 4, GFP_KERNEL); in snd_emu10k1_efx_alloc_pm_buffer()
2697 if (! emu->tram_val_saved || ! emu->tram_addr_saved) in snd_emu10k1_efx_alloc_pm_buffer()
2698 return -ENOMEM; in snd_emu10k1_efx_alloc_pm_buffer()
2699 len = emu->audigy ? 2 * 1024 : 2 * 512; in snd_emu10k1_efx_alloc_pm_buffer()
2700 emu->saved_icode = vmalloc(array_size(len, 4)); in snd_emu10k1_efx_alloc_pm_buffer()
2701 if (! emu->saved_icode) in snd_emu10k1_efx_alloc_pm_buffer()
2702 return -ENOMEM; in snd_emu10k1_efx_alloc_pm_buffer()
2708 kfree(emu->saved_gpr); in snd_emu10k1_efx_free_pm_buffer()
2709 kfree(emu->tram_val_saved); in snd_emu10k1_efx_free_pm_buffer()
2710 kfree(emu->tram_addr_saved); in snd_emu10k1_efx_free_pm_buffer()
2711 vfree(emu->saved_icode); in snd_emu10k1_efx_free_pm_buffer()
2721 len = emu->audigy ? 0x200 : 0x100; in snd_emu10k1_efx_suspend()
2723 emu->saved_gpr[i] = snd_emu10k1_ptr_read(emu, emu->gpr_base + i, 0); in snd_emu10k1_efx_suspend()
2725 len = emu->audigy ? 0x100 : 0xa0; in snd_emu10k1_efx_suspend()
2727 emu->tram_val_saved[i] = snd_emu10k1_ptr_read(emu, TANKMEMDATAREGBASE + i, 0); in snd_emu10k1_efx_suspend()
2728 emu->tram_addr_saved[i] = snd_emu10k1_ptr_read(emu, TANKMEMADDRREGBASE + i, 0); in snd_emu10k1_efx_suspend()
2729 if (emu->audigy) { in snd_emu10k1_efx_suspend()
2730 emu->tram_addr_saved[i] >>= 12; in snd_emu10k1_efx_suspend()
2731 emu->tram_addr_saved[i] |= in snd_emu10k1_efx_suspend()
2736 len = emu->audigy ? 2 * 1024 : 2 * 512; in snd_emu10k1_efx_suspend()
2738 emu->saved_icode[i] = snd_emu10k1_efx_read(emu, i); in snd_emu10k1_efx_suspend()
2746 if (emu->fx8010.etram_pages.bytes > 0) { in snd_emu10k1_efx_resume()
2748 size = emu->fx8010.etram_pages.bytes / 2; in snd_emu10k1_efx_resume()
2749 size = (size - 1) >> 13; in snd_emu10k1_efx_resume()
2754 outl(HCFG_LOCKTANKCACHE_MASK | inl(emu->port + HCFG), emu->port + HCFG); in snd_emu10k1_efx_resume()
2755 snd_emu10k1_ptr_write(emu, TCB, 0, emu->fx8010.etram_pages.addr); in snd_emu10k1_efx_resume()
2757 outl(inl(emu->port + HCFG) & ~HCFG_LOCKTANKCACHE_MASK, emu->port + HCFG); in snd_emu10k1_efx_resume()
2760 if (emu->audigy) in snd_emu10k1_efx_resume()
2761 snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg | A_DBG_SINGLE_STEP); in snd_emu10k1_efx_resume()
2763 snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg | EMU10K1_DBG_SINGLE_STEP); in snd_emu10k1_efx_resume()
2765 len = emu->audigy ? 0x200 : 0x100; in snd_emu10k1_efx_resume()
2767 snd_emu10k1_ptr_write(emu, emu->gpr_base + i, 0, emu->saved_gpr[i]); in snd_emu10k1_efx_resume()
2769 len = emu->audigy ? 0x100 : 0xa0; in snd_emu10k1_efx_resume()
2772 emu->tram_val_saved[i]); in snd_emu10k1_efx_resume()
2773 if (! emu->audigy) in snd_emu10k1_efx_resume()
2775 emu->tram_addr_saved[i]); in snd_emu10k1_efx_resume()
2778 emu->tram_addr_saved[i] << 12); in snd_emu10k1_efx_resume()
2780 emu->tram_addr_saved[i] >> 20); in snd_emu10k1_efx_resume()
2784 len = emu->audigy ? 2 * 1024 : 2 * 512; in snd_emu10k1_efx_resume()
2786 snd_emu10k1_efx_write(emu, i, emu->saved_icode[i]); in snd_emu10k1_efx_resume()
2789 if (emu->audigy) in snd_emu10k1_efx_resume()
2790 snd_emu10k1_ptr_write(emu, A_DBG, 0, emu->fx8010.dbg); in snd_emu10k1_efx_resume()
2792 snd_emu10k1_ptr_write(emu, DBG, 0, emu->fx8010.dbg); in snd_emu10k1_efx_resume()