• Home
  • Raw
  • Download

Lines Matching +full:out +full:- +full:volume +full:- +full:limit

1 // SPDX-License-Identifier: GPL-2.0-or-later
5 * Lee Revell <rlrevell@joe-job.com>
6 * James Courtier-Dutton <James@superbug.co.uk>
24 static const DECLARE_TLV_DB_SCALE(snd_audigy_db_scale2, -10350, 50, 1); /* WM8775 gain scale */
36 err = snd_ctl_add(emu->card, snd_ctl_new1(&kctl, emu)); in add_ctls()
46 uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958; in snd_emu10k1_spdif_info()
47 uinfo->count = 1; in snd_emu10k1_spdif_info()
55 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_emu10k1_spdif_get()
57 /* Limit: emu->spdif_bits */ in snd_emu10k1_spdif_get()
59 return -EINVAL; in snd_emu10k1_spdif_get()
60 ucontrol->value.iec958.status[0] = (emu->spdif_bits[idx] >> 0) & 0xff; in snd_emu10k1_spdif_get()
61 ucontrol->value.iec958.status[1] = (emu->spdif_bits[idx] >> 8) & 0xff; in snd_emu10k1_spdif_get()
62 ucontrol->value.iec958.status[2] = (emu->spdif_bits[idx] >> 16) & 0xff; in snd_emu10k1_spdif_get()
63 ucontrol->value.iec958.status[3] = (emu->spdif_bits[idx] >> 24) & 0xff; in snd_emu10k1_spdif_get()
70 ucontrol->value.iec958.status[0] = 0xff; in snd_emu10k1_spdif_get_mask()
71 ucontrol->value.iec958.status[1] = 0xff; in snd_emu10k1_spdif_get_mask()
72 ucontrol->value.iec958.status[2] = 0xff; in snd_emu10k1_spdif_get_mask()
73 ucontrol->value.iec958.status[3] = 0xff; in snd_emu10k1_spdif_get_mask()
250 * Data destinations - physical EMU outputs.
392 * Data destinations - FPGA outputs going to Alice2 (Audigy) for
460 /* Pavel Hofman - setting defaults for all capture channels.
542 .n_ins = ARRAY_SIZE(emu1010_input_dst) - 6,
557 .n_ins = ARRAY_SIZE(emu1010_input_dst) - 6,
572 .n_ins = ARRAY_SIZE(emu1010_input_dst) - 6,
578 return emu->card_capabilities->emu_model - 1; in emu1010_idx()
588 emu_ri->out_regs[channel], emu_ri->src_regs[src]); in snd_emu1010_output_source_apply()
598 emu_ri->in_regs[channel], emu_ri->src_regs[src]); in snd_emu1010_input_source_apply()
606 for (unsigned i = 0; i < emu_ri->n_outs; i++) in snd_emu1010_apply_sources()
608 emu, i, emu->emu1010.output_source[i]); in snd_emu1010_apply_sources()
609 for (unsigned i = 0; i < emu_ri->n_ins; i++) in snd_emu1010_apply_sources()
611 emu, i, emu->emu1010.input_source[i]); in snd_emu1010_apply_sources()
617 for (unsigned i = 0; i < emu_ri->n_srcs; i++) in emu1010_map_source()
618 if (val == emu_ri->src_regs[i]) in emu1010_map_source()
630 return snd_ctl_enum_info(uinfo, 1, emu_ri->n_srcs, emu_ri->src_texts); in snd_emu1010_input_output_source_info()
639 unsigned channel = kcontrol->private_value; in snd_emu1010_output_source_get()
641 if (channel >= emu_ri->n_outs) in snd_emu1010_output_source_get()
642 return -EINVAL; in snd_emu1010_output_source_get()
643 ucontrol->value.enumerated.item[0] = emu->emu1010.output_source[channel]; in snd_emu1010_output_source_get()
653 unsigned val = ucontrol->value.enumerated.item[0]; in snd_emu1010_output_source_put()
654 unsigned channel = kcontrol->private_value; in snd_emu1010_output_source_put()
657 if (val >= emu_ri->n_srcs) in snd_emu1010_output_source_put()
658 return -EINVAL; in snd_emu1010_output_source_put()
659 if (channel >= emu_ri->n_outs) in snd_emu1010_output_source_put()
660 return -EINVAL; in snd_emu1010_output_source_put()
661 change = (emu->emu1010.output_source[channel] != val); in snd_emu1010_output_source_put()
663 emu->emu1010.output_source[channel] = val; in snd_emu1010_output_source_put()
683 unsigned channel = kcontrol->private_value; in snd_emu1010_input_source_get()
685 if (channel >= emu_ri->n_ins) in snd_emu1010_input_source_get()
686 return -EINVAL; in snd_emu1010_input_source_get()
687 ucontrol->value.enumerated.item[0] = emu->emu1010.input_source[channel]; in snd_emu1010_input_source_get()
697 unsigned val = ucontrol->value.enumerated.item[0]; in snd_emu1010_input_source_put()
698 unsigned channel = kcontrol->private_value; in snd_emu1010_input_source_put()
701 if (val >= emu_ri->n_srcs) in snd_emu1010_input_source_put()
702 return -EINVAL; in snd_emu1010_input_source_put()
703 if (channel >= emu_ri->n_ins) in snd_emu1010_input_source_put()
704 return -EINVAL; in snd_emu1010_input_source_put()
705 change = (emu->emu1010.input_source[channel] != val); in snd_emu1010_input_source_put()
707 emu->emu1010.input_source[channel] = val; in snd_emu1010_input_source_put()
728 emu_ri->out_texts, emu_ri->n_outs); in add_emu1010_source_mixers()
732 emu1010_input_texts, emu_ri->n_ins); in add_emu1010_source_mixers()
756 unsigned int mask = snd_emu1010_adc_pad_regs[kcontrol->private_value]; in snd_emu1010_adc_pads_get()
758 ucontrol->value.integer.value[0] = (emu->emu1010.adc_pads & mask) ? 1 : 0; in snd_emu1010_adc_pads_get()
765 unsigned int mask = snd_emu1010_adc_pad_regs[kcontrol->private_value]; in snd_emu1010_adc_pads_put()
769 val = ucontrol->value.integer.value[0]; in snd_emu1010_adc_pads_put()
770 cache = emu->emu1010.adc_pads; in snd_emu1010_adc_pads_put()
775 change = (cache != emu->emu1010.adc_pads); in snd_emu1010_adc_pads_put()
778 emu->emu1010.adc_pads = cache; in snd_emu1010_adc_pads_put()
814 unsigned int mask = snd_emu1010_dac_regs[kcontrol->private_value]; in snd_emu1010_dac_pads_get()
816 ucontrol->value.integer.value[0] = (emu->emu1010.dac_pads & mask) ? 1 : 0; in snd_emu1010_dac_pads_get()
823 unsigned int mask = snd_emu1010_dac_regs[kcontrol->private_value]; in snd_emu1010_dac_pads_put()
827 val = ucontrol->value.integer.value[0]; in snd_emu1010_dac_pads_put()
828 cache = emu->emu1010.dac_pads; in snd_emu1010_dac_pads_put()
833 change = (cache != emu->emu1010.dac_pads); in snd_emu1010_dac_pads_put()
836 emu->emu1010.dac_pads = cache; in snd_emu1010_dac_pads_put()
867 .n_adc_ctls = ARRAY_SIZE(snd_emu1010_adc_pads) - 1,
869 .n_dac_ctls = ARRAY_SIZE(snd_emu1010_dac_pads) - 1,
874 .n_adc_ctls = ARRAY_SIZE(snd_emu1010_adc_pads) - 2,
876 .n_dac_ctls = ARRAY_SIZE(snd_emu1010_dac_pads) - 2,
928 .num = ARRAY_SIZE(emu1010_clock_vals) - 1,
937 // can mean two things: either E-MU mapped the dock's sources to
959 return snd_ctl_enum_info(uinfo, 1, emu_ci->num, emu_ci->texts); in snd_emu1010_clock_source_info()
967 ucontrol->value.enumerated.item[0] = emu->emu1010.clock_source; in snd_emu1010_clock_source_get()
980 val = ucontrol->value.enumerated.item[0] ; in snd_emu1010_clock_source_put()
981 if (val >= emu_ci->num) in snd_emu1010_clock_source_put()
982 return -EINVAL; in snd_emu1010_clock_source_put()
983 spin_lock_irq(&emu->reg_lock); in snd_emu1010_clock_source_put()
984 change = (emu->emu1010.clock_source != val); in snd_emu1010_clock_source_put()
986 emu->emu1010.clock_source = val; in snd_emu1010_clock_source_put()
987 emu->emu1010.wclock = emu_ci->vals[val]; in snd_emu1010_clock_source_put()
991 snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, emu->emu1010.wclock); in snd_emu1010_clock_source_put()
992 spin_unlock_irq(&emu->reg_lock); in snd_emu1010_clock_source_put()
997 spin_unlock_irq(&emu->reg_lock); in snd_emu1010_clock_source_put()
1028 ucontrol->value.enumerated.item[0] = emu->emu1010.clock_fallback; in snd_emu1010_clock_fallback_get()
1036 unsigned int val = ucontrol->value.enumerated.item[0]; in snd_emu1010_clock_fallback_put()
1040 return -EINVAL; in snd_emu1010_clock_fallback_put()
1041 change = (emu->emu1010.clock_fallback != val); in snd_emu1010_clock_fallback_put()
1043 emu->emu1010.clock_fallback = val; in snd_emu1010_clock_fallback_put()
1044 snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 1 - val); in snd_emu1010_clock_fallback_put()
1075 ucontrol->value.enumerated.item[0] = emu->emu1010.optical_out; in snd_emu1010_optical_out_get()
1087 val = ucontrol->value.enumerated.item[0]; in snd_emu1010_optical_out_put()
1088 /* Limit: uinfo->value.enumerated.items = 2; */ in snd_emu1010_optical_out_put()
1090 return -EINVAL; in snd_emu1010_optical_out_put()
1091 change = (emu->emu1010.optical_out != val); in snd_emu1010_optical_out_put()
1093 emu->emu1010.optical_out = val; in snd_emu1010_optical_out_put()
1094 tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : EMU_HANA_OPTICAL_IN_SPDIF) | in snd_emu1010_optical_out_put()
1095 (emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : EMU_HANA_OPTICAL_OUT_SPDIF); in snd_emu1010_optical_out_put()
1126 ucontrol->value.enumerated.item[0] = emu->emu1010.optical_in; in snd_emu1010_optical_in_get()
1138 val = ucontrol->value.enumerated.item[0]; in snd_emu1010_optical_in_put()
1139 /* Limit: uinfo->value.enumerated.items = 2; */ in snd_emu1010_optical_in_put()
1141 return -EINVAL; in snd_emu1010_optical_in_put()
1142 change = (emu->emu1010.optical_in != val); in snd_emu1010_optical_in_put()
1144 emu->emu1010.optical_in = val; in snd_emu1010_optical_in_put()
1145 tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : EMU_HANA_OPTICAL_IN_SPDIF) | in snd_emu1010_optical_in_put()
1146 (emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : EMU_HANA_OPTICAL_OUT_SPDIF); in snd_emu1010_optical_in_put()
1182 ucontrol->value.enumerated.item[0] = emu->i2c_capture_source; in snd_audigy_i2c_capture_source_get()
1196 * update the capture volume from the cached value in snd_audigy_i2c_capture_source_put()
1199 source_id = ucontrol->value.enumerated.item[0]; in snd_audigy_i2c_capture_source_put()
1200 /* Limit: uinfo->value.enumerated.items = 2; */ in snd_audigy_i2c_capture_source_put()
1201 /* emu->i2c_capture_volume */ in snd_audigy_i2c_capture_source_put()
1203 return -EINVAL; in snd_audigy_i2c_capture_source_put()
1204 change = (emu->i2c_capture_source != source_id); in snd_audigy_i2c_capture_source_put()
1207 spin_lock_irq(&emu->emu_lock); in snd_audigy_i2c_capture_source_put()
1208 gpio = inw(emu->port + A_IOCFG); in snd_audigy_i2c_capture_source_put()
1210 outw(gpio | 0x4, emu->port + A_IOCFG); in snd_audigy_i2c_capture_source_put()
1212 outw(gpio & ~0x4, emu->port + A_IOCFG); in snd_audigy_i2c_capture_source_put()
1213 spin_unlock_irq(&emu->emu_lock); in snd_audigy_i2c_capture_source_put()
1215 ngain = emu->i2c_capture_volume[source_id][0]; /* Left */ in snd_audigy_i2c_capture_source_put()
1216 ogain = emu->i2c_capture_volume[emu->i2c_capture_source][0]; /* Left */ in snd_audigy_i2c_capture_source_put()
1219 ngain = emu->i2c_capture_volume[source_id][1]; /* Right */ in snd_audigy_i2c_capture_source_put()
1220 ogain = emu->i2c_capture_volume[emu->i2c_capture_source][1]; /* Right */ in snd_audigy_i2c_capture_source_put()
1226 emu->i2c_capture_source = source_id; in snd_audigy_i2c_capture_source_put()
1243 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_audigy_i2c_volume_info()
1244 uinfo->count = 2; in snd_audigy_i2c_volume_info()
1245 uinfo->value.integer.min = 0; in snd_audigy_i2c_volume_info()
1246 uinfo->value.integer.max = 255; in snd_audigy_i2c_volume_info()
1256 source_id = kcontrol->private_value; in snd_audigy_i2c_volume_get()
1257 /* Limit: emu->i2c_capture_volume */ in snd_audigy_i2c_volume_get()
1258 /* capture_source: uinfo->value.enumerated.items = 2 */ in snd_audigy_i2c_volume_get()
1260 return -EINVAL; in snd_audigy_i2c_volume_get()
1262 ucontrol->value.integer.value[0] = emu->i2c_capture_volume[source_id][0]; in snd_audigy_i2c_volume_get()
1263 ucontrol->value.integer.value[1] = emu->i2c_capture_volume[source_id][1]; in snd_audigy_i2c_volume_get()
1276 source_id = kcontrol->private_value; in snd_audigy_i2c_volume_put()
1277 /* Limit: emu->i2c_capture_volume */ in snd_audigy_i2c_volume_put()
1278 /* capture_source: uinfo->value.enumerated.items = 2 */ in snd_audigy_i2c_volume_put()
1280 return -EINVAL; in snd_audigy_i2c_volume_put()
1281 ngain0 = ucontrol->value.integer.value[0]; in snd_audigy_i2c_volume_put()
1282 ngain1 = ucontrol->value.integer.value[1]; in snd_audigy_i2c_volume_put()
1284 return -EINVAL; in snd_audigy_i2c_volume_put()
1286 return -EINVAL; in snd_audigy_i2c_volume_put()
1287 ogain = emu->i2c_capture_volume[source_id][0]; /* Left */ in snd_audigy_i2c_volume_put()
1289 if (emu->i2c_capture_source == source_id) in snd_audigy_i2c_volume_put()
1291 emu->i2c_capture_volume[source_id][0] = ngain0; in snd_audigy_i2c_volume_put()
1294 ogain = emu->i2c_capture_volume[source_id][1]; /* Right */ in snd_audigy_i2c_volume_put()
1296 if (emu->i2c_capture_source == source_id) in snd_audigy_i2c_volume_put()
1298 emu->i2c_capture_volume[source_id][1] = ngain1; in snd_audigy_i2c_volume_put()
1316 "Mic Capture Volume",
1317 "Line Capture Volume",
1337 ucontrol->value.enumerated.item[0] = 0;
1340 ucontrol->value.enumerated.item[0] = 1;
1343 ucontrol->value.enumerated.item[0] = 2;
1346 ucontrol->value.enumerated.item[0] = 1;
1358 switch(ucontrol->value.enumerated.item[0]) {
1374 spin_lock_irq(&emu->reg_lock);
1381 spin_unlock_irq(&emu->reg_lock);
1401 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_emu10k1_spdif_put()
1405 /* Limit: emu->spdif_bits */ in snd_emu10k1_spdif_put()
1407 return -EINVAL; in snd_emu10k1_spdif_put()
1408 val = (ucontrol->value.iec958.status[0] << 0) | in snd_emu10k1_spdif_put()
1409 (ucontrol->value.iec958.status[1] << 8) | in snd_emu10k1_spdif_put()
1410 (ucontrol->value.iec958.status[2] << 16) | in snd_emu10k1_spdif_put()
1411 (ucontrol->value.iec958.status[3] << 24); in snd_emu10k1_spdif_put()
1412 change = val != emu->spdif_bits[idx]; in snd_emu10k1_spdif_put()
1415 emu->spdif_bits[idx] = val; in snd_emu10k1_spdif_put()
1443 if (emu->audigy) { in update_emu10k1_fxrt()
1454 static void update_emu10k1_send_volume(struct snd_emu10k1 *emu, int voice, unsigned char *volume) in update_emu10k1_send_volume() argument
1456 snd_emu10k1_ptr_write(emu, PTRX_FXSENDAMOUNT_A, voice, volume[0]); in update_emu10k1_send_volume()
1457 snd_emu10k1_ptr_write(emu, PTRX_FXSENDAMOUNT_B, voice, volume[1]); in update_emu10k1_send_volume()
1458 snd_emu10k1_ptr_write(emu, PSST_FXSENDAMOUNT_C, voice, volume[2]); in update_emu10k1_send_volume()
1459 snd_emu10k1_ptr_write(emu, DSL_FXSENDAMOUNT_D, voice, volume[3]); in update_emu10k1_send_volume()
1460 if (emu->audigy) { in update_emu10k1_send_volume()
1462 snd_emu10k1_compose_audigy_sendamounts(volume)); in update_emu10k1_send_volume()
1471 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_emu10k1_send_routing_info()
1472 uinfo->count = emu->audigy ? 3*8 : 3*4; in snd_emu10k1_send_routing_info()
1473 uinfo->value.integer.min = 0; in snd_emu10k1_send_routing_info()
1474 uinfo->value.integer.max = emu->audigy ? 0x3f : 0x0f; in snd_emu10k1_send_routing_info()
1483 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; in snd_emu10k1_send_routing_get()
1485 int num_efx = emu->audigy ? 8 : 4; in snd_emu10k1_send_routing_get()
1486 int mask = emu->audigy ? 0x3f : 0x0f; in snd_emu10k1_send_routing_get()
1490 ucontrol->value.integer.value[(voice * num_efx) + idx] = in snd_emu10k1_send_routing_get()
1491 mix->send_routing[voice][idx] & mask; in snd_emu10k1_send_routing_get()
1500 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; in snd_emu10k1_send_routing_put()
1502 int num_efx = emu->audigy ? 8 : 4; in snd_emu10k1_send_routing_put()
1503 int mask = emu->audigy ? 0x3f : 0x0f; in snd_emu10k1_send_routing_put()
1505 spin_lock_irq(&emu->reg_lock); in snd_emu10k1_send_routing_put()
1508 val = ucontrol->value.integer.value[(voice * num_efx) + idx] & mask; in snd_emu10k1_send_routing_put()
1509 if (mix->send_routing[voice][idx] != val) { in snd_emu10k1_send_routing_put()
1510 mix->send_routing[voice][idx] = val; in snd_emu10k1_send_routing_put()
1514 if (change && mix->epcm && mix->epcm->voices[0]) { in snd_emu10k1_send_routing_put()
1515 if (!mix->epcm->voices[0]->last) { in snd_emu10k1_send_routing_put()
1516 update_emu10k1_fxrt(emu, mix->epcm->voices[0]->number, in snd_emu10k1_send_routing_put()
1517 &mix->send_routing[1][0]); in snd_emu10k1_send_routing_put()
1518 update_emu10k1_fxrt(emu, mix->epcm->voices[0]->number + 1, in snd_emu10k1_send_routing_put()
1519 &mix->send_routing[2][0]); in snd_emu10k1_send_routing_put()
1521 update_emu10k1_fxrt(emu, mix->epcm->voices[0]->number, in snd_emu10k1_send_routing_put()
1522 &mix->send_routing[0][0]); in snd_emu10k1_send_routing_put()
1525 spin_unlock_irq(&emu->reg_lock); in snd_emu10k1_send_routing_put()
1543 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_emu10k1_send_volume_info()
1544 uinfo->count = emu->audigy ? 3*8 : 3*4; in snd_emu10k1_send_volume_info()
1545 uinfo->value.integer.min = 0; in snd_emu10k1_send_volume_info()
1546 uinfo->value.integer.max = 255; in snd_emu10k1_send_volume_info()
1555 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; in snd_emu10k1_send_volume_get()
1557 int num_efx = emu->audigy ? 8 : 4; in snd_emu10k1_send_volume_get()
1560 ucontrol->value.integer.value[idx] = mix->send_volume[idx/num_efx][idx%num_efx]; in snd_emu10k1_send_volume_get()
1569 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; in snd_emu10k1_send_volume_put()
1571 int num_efx = emu->audigy ? 8 : 4; in snd_emu10k1_send_volume_put()
1573 spin_lock_irq(&emu->reg_lock); in snd_emu10k1_send_volume_put()
1575 val = ucontrol->value.integer.value[idx] & 255; in snd_emu10k1_send_volume_put()
1576 if (mix->send_volume[idx/num_efx][idx%num_efx] != val) { in snd_emu10k1_send_volume_put()
1577 mix->send_volume[idx/num_efx][idx%num_efx] = val; in snd_emu10k1_send_volume_put()
1581 if (change && mix->epcm && mix->epcm->voices[0]) { in snd_emu10k1_send_volume_put()
1582 if (!mix->epcm->voices[0]->last) { in snd_emu10k1_send_volume_put()
1583 update_emu10k1_send_volume(emu, mix->epcm->voices[0]->number, in snd_emu10k1_send_volume_put()
1584 &mix->send_volume[1][0]); in snd_emu10k1_send_volume_put()
1585 update_emu10k1_send_volume(emu, mix->epcm->voices[0]->number + 1, in snd_emu10k1_send_volume_put()
1586 &mix->send_volume[2][0]); in snd_emu10k1_send_volume_put()
1588 update_emu10k1_send_volume(emu, mix->epcm->voices[0]->number, in snd_emu10k1_send_volume_put()
1589 &mix->send_volume[0][0]); in snd_emu10k1_send_volume_put()
1592 spin_unlock_irq(&emu->reg_lock); in snd_emu10k1_send_volume_put()
1600 .name = "EMU10K1 PCM Send Volume",
1609 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_emu10k1_attn_info()
1610 uinfo->count = 3; in snd_emu10k1_attn_info()
1611 uinfo->value.integer.min = 0; in snd_emu10k1_attn_info()
1612 uinfo->value.integer.max = 0x1fffd; in snd_emu10k1_attn_info()
1621 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; in snd_emu10k1_attn_get()
1625 ucontrol->value.integer.value[idx] = mix->attn[idx] * 0xffffU / 0x8000U; in snd_emu10k1_attn_get()
1634 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; in snd_emu10k1_attn_put()
1637 spin_lock_irq(&emu->reg_lock); in snd_emu10k1_attn_put()
1639 unsigned uval = ucontrol->value.integer.value[idx] & 0x1ffff; in snd_emu10k1_attn_put()
1641 if (mix->attn[idx] != val) { in snd_emu10k1_attn_put()
1642 mix->attn[idx] = val; in snd_emu10k1_attn_put()
1646 if (change && mix->epcm && mix->epcm->voices[0]) { in snd_emu10k1_attn_put()
1647 if (!mix->epcm->voices[0]->last) { in snd_emu10k1_attn_put()
1648 snd_emu10k1_ptr_write(emu, VTFT_VOLUMETARGET, mix->epcm->voices[0]->number, mix->attn[1]); in snd_emu10k1_attn_put()
1649 snd_emu10k1_ptr_write(emu, VTFT_VOLUMETARGET, mix->epcm->voices[0]->number + 1, mix->attn[2]); in snd_emu10k1_attn_put()
1651 snd_emu10k1_ptr_write(emu, VTFT_VOLUMETARGET, mix->epcm->voices[0]->number, mix->attn[0]); in snd_emu10k1_attn_put()
1654 spin_unlock_irq(&emu->reg_lock); in snd_emu10k1_attn_put()
1662 .name = "EMU10K1 PCM Volume",
1674 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_emu10k1_efx_send_routing_info()
1675 uinfo->count = emu->audigy ? 8 : 4; in snd_emu10k1_efx_send_routing_info()
1676 uinfo->value.integer.min = 0; in snd_emu10k1_efx_send_routing_info()
1677 uinfo->value.integer.max = emu->audigy ? 0x3f : 0x0f; in snd_emu10k1_efx_send_routing_info()
1686 &emu->efx_pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; in snd_emu10k1_efx_send_routing_get()
1688 int num_efx = emu->audigy ? 8 : 4; in snd_emu10k1_efx_send_routing_get()
1689 int mask = emu->audigy ? 0x3f : 0x0f; in snd_emu10k1_efx_send_routing_get()
1692 ucontrol->value.integer.value[idx] = in snd_emu10k1_efx_send_routing_get()
1693 mix->send_routing[0][idx] & mask; in snd_emu10k1_efx_send_routing_get()
1701 int ch = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_emu10k1_efx_send_routing_put()
1702 struct snd_emu10k1_pcm_mixer *mix = &emu->efx_pcm_mixer[ch]; in snd_emu10k1_efx_send_routing_put()
1704 int num_efx = emu->audigy ? 8 : 4; in snd_emu10k1_efx_send_routing_put()
1705 int mask = emu->audigy ? 0x3f : 0x0f; in snd_emu10k1_efx_send_routing_put()
1707 spin_lock_irq(&emu->reg_lock); in snd_emu10k1_efx_send_routing_put()
1709 val = ucontrol->value.integer.value[idx] & mask; in snd_emu10k1_efx_send_routing_put()
1710 if (mix->send_routing[0][idx] != val) { in snd_emu10k1_efx_send_routing_put()
1711 mix->send_routing[0][idx] = val; in snd_emu10k1_efx_send_routing_put()
1716 if (change && mix->epcm) { in snd_emu10k1_efx_send_routing_put()
1717 if (mix->epcm->voices[ch]) { in snd_emu10k1_efx_send_routing_put()
1718 update_emu10k1_fxrt(emu, mix->epcm->voices[ch]->number, in snd_emu10k1_efx_send_routing_put()
1719 &mix->send_routing[0][0]); in snd_emu10k1_efx_send_routing_put()
1722 spin_unlock_irq(&emu->reg_lock); in snd_emu10k1_efx_send_routing_put()
1740 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_emu10k1_efx_send_volume_info()
1741 uinfo->count = emu->audigy ? 8 : 4; in snd_emu10k1_efx_send_volume_info()
1742 uinfo->value.integer.min = 0; in snd_emu10k1_efx_send_volume_info()
1743 uinfo->value.integer.max = 255; in snd_emu10k1_efx_send_volume_info()
1752 &emu->efx_pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; in snd_emu10k1_efx_send_volume_get()
1754 int num_efx = emu->audigy ? 8 : 4; in snd_emu10k1_efx_send_volume_get()
1757 ucontrol->value.integer.value[idx] = mix->send_volume[0][idx]; in snd_emu10k1_efx_send_volume_get()
1765 int ch = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_emu10k1_efx_send_volume_put()
1766 struct snd_emu10k1_pcm_mixer *mix = &emu->efx_pcm_mixer[ch]; in snd_emu10k1_efx_send_volume_put()
1768 int num_efx = emu->audigy ? 8 : 4; in snd_emu10k1_efx_send_volume_put()
1770 spin_lock_irq(&emu->reg_lock); in snd_emu10k1_efx_send_volume_put()
1772 val = ucontrol->value.integer.value[idx] & 255; in snd_emu10k1_efx_send_volume_put()
1773 if (mix->send_volume[0][idx] != val) { in snd_emu10k1_efx_send_volume_put()
1774 mix->send_volume[0][idx] = val; in snd_emu10k1_efx_send_volume_put()
1778 if (change && mix->epcm) { in snd_emu10k1_efx_send_volume_put()
1779 if (mix->epcm->voices[ch]) { in snd_emu10k1_efx_send_volume_put()
1780 update_emu10k1_send_volume(emu, mix->epcm->voices[ch]->number, in snd_emu10k1_efx_send_volume_put()
1781 &mix->send_volume[0][0]); in snd_emu10k1_efx_send_volume_put()
1784 spin_unlock_irq(&emu->reg_lock); in snd_emu10k1_efx_send_volume_put()
1793 .name = "Multichannel PCM Send Volume",
1802 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_emu10k1_efx_attn_info()
1803 uinfo->count = 1; in snd_emu10k1_efx_attn_info()
1804 uinfo->value.integer.min = 0; in snd_emu10k1_efx_attn_info()
1805 uinfo->value.integer.max = 0x1fffd; in snd_emu10k1_efx_attn_info()
1814 &emu->efx_pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; in snd_emu10k1_efx_attn_get()
1816 ucontrol->value.integer.value[0] = mix->attn[0] * 0xffffU / 0x8000U; in snd_emu10k1_efx_attn_get()
1824 int ch = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_emu10k1_efx_attn_put()
1825 struct snd_emu10k1_pcm_mixer *mix = &emu->efx_pcm_mixer[ch]; in snd_emu10k1_efx_attn_put()
1829 spin_lock_irq(&emu->reg_lock); in snd_emu10k1_efx_attn_put()
1830 uval = ucontrol->value.integer.value[0] & 0x1ffff; in snd_emu10k1_efx_attn_put()
1832 if (mix->attn[0] != val) { in snd_emu10k1_efx_attn_put()
1833 mix->attn[0] = val; in snd_emu10k1_efx_attn_put()
1836 if (change && mix->epcm) { in snd_emu10k1_efx_attn_put()
1837 if (mix->epcm->voices[ch]) { in snd_emu10k1_efx_attn_put()
1838 snd_emu10k1_ptr_write(emu, VTFT_VOLUMETARGET, mix->epcm->voices[ch]->number, mix->attn[0]); in snd_emu10k1_efx_attn_put()
1841 spin_unlock_irq(&emu->reg_lock); in snd_emu10k1_efx_attn_put()
1849 .name = "Multichannel PCM Volume",
1863 if (emu->audigy) in snd_emu10k1_shared_spdif_get()
1864 ucontrol->value.integer.value[0] = inw(emu->port + A_IOCFG) & A_IOCFG_GPOUT0 ? 1 : 0; in snd_emu10k1_shared_spdif_get()
1866 ucontrol->value.integer.value[0] = inl(emu->port + HCFG) & HCFG_GPOUT0 ? 1 : 0; in snd_emu10k1_shared_spdif_get()
1867 if (emu->card_capabilities->invert_shared_spdif) in snd_emu10k1_shared_spdif_get()
1868 ucontrol->value.integer.value[0] = in snd_emu10k1_shared_spdif_get()
1869 !ucontrol->value.integer.value[0]; in snd_emu10k1_shared_spdif_get()
1881 sw = ucontrol->value.integer.value[0]; in snd_emu10k1_shared_spdif_put()
1882 if (emu->card_capabilities->invert_shared_spdif) in snd_emu10k1_shared_spdif_put()
1884 spin_lock_irq(&emu->emu_lock); in snd_emu10k1_shared_spdif_put()
1885 if ( emu->card_capabilities->i2c_adc) { in snd_emu10k1_shared_spdif_put()
1887 } else if (emu->audigy) { in snd_emu10k1_shared_spdif_put()
1888 reg = inw(emu->port + A_IOCFG); in snd_emu10k1_shared_spdif_put()
1894 outw(reg | val, emu->port + A_IOCFG); in snd_emu10k1_shared_spdif_put()
1897 reg = inl(emu->port + HCFG); in snd_emu10k1_shared_spdif_put()
1903 outl(reg | val, emu->port + HCFG); in snd_emu10k1_shared_spdif_put()
1905 spin_unlock_irq(&emu->emu_lock); in snd_emu10k1_shared_spdif_put()
1927 /* workaround for too low volume on Audigy due to 16bit/24bit conversion */
1938 val = snd_ac97_read(emu->ac97, AC97_REC_GAIN); in snd_audigy_capture_boost_get()
1939 ucontrol->value.integer.value[0] = !!val; in snd_audigy_capture_boost_get()
1949 if (ucontrol->value.integer.value[0]) in snd_audigy_capture_boost_put()
1953 return snd_ac97_update(emu->ac97, AC97_REC_GAIN, val); in snd_audigy_capture_boost_put()
1970 struct snd_emu10k1 *emu = ac97->private_data; in snd_emu10k1_mixer_free_ac97()
1971 emu->ac97 = NULL; in snd_emu10k1_mixer_free_ac97()
1992 return -ENOENT; in rename_ctl()
2000 struct snd_card *card = emu->card; in snd_emu10k1_mixer()
2005 "Master Mono Playback Volume", in snd_emu10k1_mixer()
2006 "PCM Out Path & Mute", in snd_emu10k1_mixer()
2009 "Surround Playback Volume", in snd_emu10k1_mixer()
2011 "Center Playback Volume", in snd_emu10k1_mixer()
2013 "LFE Playback Volume", in snd_emu10k1_mixer()
2017 "Surround Digital Playback Volume", "Surround Playback Volume", in snd_emu10k1_mixer()
2018 "Center Digital Playback Volume", "Center Playback Volume", in snd_emu10k1_mixer()
2019 "LFE Digital Playback Volume", "LFE Playback Volume", in snd_emu10k1_mixer()
2027 "PCM Playback Volume", in snd_emu10k1_mixer()
2029 "Master Playback Volume", in snd_emu10k1_mixer()
2030 "PCM Out Path & Mute", in snd_emu10k1_mixer()
2035 "Capture Volume", in snd_emu10k1_mixer()
2038 "Headphone Playback Volume", in snd_emu10k1_mixer()
2039 "3D Control - Center", in snd_emu10k1_mixer()
2040 "3D Control - Depth", in snd_emu10k1_mixer()
2041 "3D Control - Switch", in snd_emu10k1_mixer()
2043 "Video Playback Volume", in snd_emu10k1_mixer()
2045 "Mic Playback Volume", in snd_emu10k1_mixer()
2051 "Wave Playback Volume", "PCM Playback Volume", in snd_emu10k1_mixer()
2052 /* "Wave Capture Volume", "PCM Capture Volume", */ in snd_emu10k1_mixer()
2053 "Wave Master Playback Volume", "Master Playback Volume", in snd_emu10k1_mixer()
2054 "AMic Playback Volume", "Mic Playback Volume", in snd_emu10k1_mixer()
2056 "Master Mono Playback Volume", "Phone Output Playback Volume", in snd_emu10k1_mixer()
2060 //"Analog Mix Capture Volume","OLD Analog Mix Capture Volume", in snd_emu10k1_mixer()
2061 "Line Capture Volume", "Analog Mix Capture Volume", in snd_emu10k1_mixer()
2062 "Wave Playback Volume", "OLD PCM Playback Volume", in snd_emu10k1_mixer()
2063 "Wave Master Playback Volume", "Master Playback Volume", in snd_emu10k1_mixer()
2064 "AMic Playback Volume", "Old Mic Playback Volume", in snd_emu10k1_mixer()
2065 "CD Capture Volume", "IEC958 Optical Capture Volume", in snd_emu10k1_mixer()
2071 "Mic Capture Volume", in snd_emu10k1_mixer()
2072 "Analog Mix Capture Volume", in snd_emu10k1_mixer()
2073 "Aux Capture Volume", in snd_emu10k1_mixer()
2074 "IEC958 Optical Capture Volume", in snd_emu10k1_mixer()
2081 "PCM Playback Volume", in snd_emu10k1_mixer()
2084 "Capture Volume", in snd_emu10k1_mixer()
2085 "Mic Capture Volume", in snd_emu10k1_mixer()
2087 "Headphone Playback Volume", in snd_emu10k1_mixer()
2088 "3D Control - Center", in snd_emu10k1_mixer()
2089 "3D Control - Depth", in snd_emu10k1_mixer()
2090 "3D Control - Switch", in snd_emu10k1_mixer()
2091 "Line2 Playback Volume", in snd_emu10k1_mixer()
2092 "Line2 Capture Volume", in snd_emu10k1_mixer()
2097 "Master Playback Volume", "Master Capture Volume", in snd_emu10k1_mixer()
2098 "Wave Master Playback Volume", "Master Playback Volume", in snd_emu10k1_mixer()
2100 "Beep Playback Volume", "Beep Capture Volume", in snd_emu10k1_mixer()
2102 "Phone Playback Volume", "Phone Capture Volume", in snd_emu10k1_mixer()
2104 "Mic Playback Volume", "Mic Capture Volume", in snd_emu10k1_mixer()
2106 "Line Playback Volume", "Line Capture Volume", in snd_emu10k1_mixer()
2108 "CD Playback Volume", "CD Capture Volume", in snd_emu10k1_mixer()
2110 "Aux Playback Volume", "Aux Capture Volume", in snd_emu10k1_mixer()
2112 "Video Playback Volume", "Video Capture Volume", in snd_emu10k1_mixer()
2114 "Master Mono Playback Volume", "Phone Output Playback Volume", in snd_emu10k1_mixer()
2118 if (emu->card_capabilities->ac97_chip) { in snd_emu10k1_mixer()
2126 err = snd_ac97_bus(emu->card, 0, &ops, NULL, &pbus); in snd_emu10k1_mixer()
2129 pbus->no_vra = 1; /* we don't need VRA */ in snd_emu10k1_mixer()
2135 err = snd_ac97_mixer(pbus, &ac97, &emu->ac97); in snd_emu10k1_mixer()
2137 if (emu->card_capabilities->ac97_chip == 1) in snd_emu10k1_mixer()
2139 dev_info(emu->card->dev, in snd_emu10k1_mixer()
2141 dev_info(emu->card->dev, in snd_emu10k1_mixer()
2143 snd_device_free(emu->card, pbus); in snd_emu10k1_mixer()
2146 if (emu->audigy) { in snd_emu10k1_mixer()
2147 /* set master volume to 0 dB */ in snd_emu10k1_mixer()
2148 snd_ac97_write_cache(emu->ac97, AC97_MASTER, 0x0000); in snd_emu10k1_mixer()
2150 snd_ac97_write_cache(emu->ac97, AC97_REC_SEL, 0x0000); in snd_emu10k1_mixer()
2152 snd_ac97_update_bits(emu->ac97, AC97_GENERAL_PURPOSE, in snd_emu10k1_mixer()
2154 if (emu->card_capabilities->adc_1361t) in snd_emu10k1_mixer()
2161 * James Courtier-Dutton <James@superbug.demon.co.uk> in snd_emu10k1_mixer()
2164 if (emu->ac97->id == AC97_ID_STAC9758) { in snd_emu10k1_mixer()
2165 emu->rear_ac97 = 1; in snd_emu10k1_mixer()
2167 snd_ac97_write_cache(emu->ac97, AC97_HEADPHONE, 0x0202); in snd_emu10k1_mixer()
2168 remove_ctl(card,"Front Playback Volume"); in snd_emu10k1_mixer()
2172 snd_ac97_write_cache(emu->ac97, AC97_SURROUND_MASTER, 0x0202); in snd_emu10k1_mixer()
2173 snd_ac97_write_cache(emu->ac97, AC97_CENTER_LFE_MASTER, 0x0202); in snd_emu10k1_mixer()
2178 } else if (emu->card_capabilities->i2c_adc) { in snd_emu10k1_mixer()
2184 if (emu->card_capabilities->ecard) in snd_emu10k1_mixer()
2185 strcpy(emu->card->mixername, "EMU APS"); in snd_emu10k1_mixer()
2186 else if (emu->audigy) in snd_emu10k1_mixer()
2187 strcpy(emu->card->mixername, "SB Audigy"); in snd_emu10k1_mixer()
2189 strcpy(emu->card->mixername, "Emu10k1"); in snd_emu10k1_mixer()
2192 if (emu->audigy) in snd_emu10k1_mixer()
2193 if (emu->card_capabilities->adc_1361t) in snd_emu10k1_mixer()
2195 else if (emu->card_capabilities->i2c_adc) in snd_emu10k1_mixer()
2204 if (emu->card_capabilities->subsystem == 0x80401102) { /* SB Live! Platinum CT4760P */ in snd_emu10k1_mixer()
2205 remove_ctl(card, "Center Playback Volume"); in snd_emu10k1_mixer()
2206 remove_ctl(card, "LFE Playback Volume"); in snd_emu10k1_mixer()
2207 remove_ctl(card, "Wave Center Playback Volume"); in snd_emu10k1_mixer()
2208 remove_ctl(card, "Wave LFE Playback Volume"); in snd_emu10k1_mixer()
2210 if (emu->card_capabilities->subsystem == 0x20071102) { /* Audigy 4 Pro */ in snd_emu10k1_mixer()
2211 rename_ctl(card, "Line2 Capture Volume", "Line1/Mic Capture Volume"); in snd_emu10k1_mixer()
2212 rename_ctl(card, "Analog Mix Capture Volume", "Line2 Capture Volume"); in snd_emu10k1_mixer()
2213 rename_ctl(card, "Aux2 Capture Volume", "Line3 Capture Volume"); in snd_emu10k1_mixer()
2214 rename_ctl(card, "Mic Capture Volume", "Unknown1 Capture Volume"); in snd_emu10k1_mixer()
2216 kctl = emu->ctl_send_routing = snd_ctl_new1(&snd_emu10k1_send_routing_control, emu); in snd_emu10k1_mixer()
2218 return -ENOMEM; in snd_emu10k1_mixer()
2219 kctl->id.device = pcm_device; in snd_emu10k1_mixer()
2223 kctl = emu->ctl_send_volume = snd_ctl_new1(&snd_emu10k1_send_volume_control, emu); in snd_emu10k1_mixer()
2225 return -ENOMEM; in snd_emu10k1_mixer()
2226 kctl->id.device = pcm_device; in snd_emu10k1_mixer()
2230 kctl = emu->ctl_attn = snd_ctl_new1(&snd_emu10k1_attn_control, emu); in snd_emu10k1_mixer()
2232 return -ENOMEM; in snd_emu10k1_mixer()
2233 kctl->id.device = pcm_device; in snd_emu10k1_mixer()
2238 kctl = emu->ctl_efx_send_routing = snd_ctl_new1(&snd_emu10k1_efx_send_routing_control, emu); in snd_emu10k1_mixer()
2240 return -ENOMEM; in snd_emu10k1_mixer()
2241 kctl->id.device = multi_device; in snd_emu10k1_mixer()
2246 kctl = emu->ctl_efx_send_volume = snd_ctl_new1(&snd_emu10k1_efx_send_volume_control, emu); in snd_emu10k1_mixer()
2248 return -ENOMEM; in snd_emu10k1_mixer()
2249 kctl->id.device = multi_device; in snd_emu10k1_mixer()
2254 kctl = emu->ctl_efx_attn = snd_ctl_new1(&snd_emu10k1_efx_attn_control, emu); in snd_emu10k1_mixer()
2256 return -ENOMEM; in snd_emu10k1_mixer()
2257 kctl->id.device = multi_device; in snd_emu10k1_mixer()
2262 if (!emu->card_capabilities->ecard && !emu->card_capabilities->emu_model) { in snd_emu10k1_mixer()
2266 return -ENOMEM; in snd_emu10k1_mixer()
2267 if (!emu->audigy) in snd_emu10k1_mixer()
2268 kctl->id.device = emu->pcm_efx->device; in snd_emu10k1_mixer()
2274 return -ENOMEM; in snd_emu10k1_mixer()
2275 if (!emu->audigy) in snd_emu10k1_mixer()
2276 kctl->id.device = emu->pcm_efx->device; in snd_emu10k1_mixer()
2282 if (emu->card_capabilities->emu_model) { in snd_emu10k1_mixer()
2284 } else if (emu->audigy) { in snd_emu10k1_mixer()
2287 return -ENOMEM; in snd_emu10k1_mixer()
2294 return -ENOMEM; in snd_emu10k1_mixer()
2299 } else if (! emu->card_capabilities->ecard) { in snd_emu10k1_mixer()
2303 return -ENOMEM; in snd_emu10k1_mixer()
2308 if (emu->card_capabilities->ca0151_chip) { /* P16V */ in snd_emu10k1_mixer()
2314 if (emu->card_capabilities->emu_model) { in snd_emu10k1_mixer()
2320 for (i = 0; i < emu_ri->n_ins; i++) in snd_emu10k1_mixer()
2321 emu->emu1010.input_source[i] = in snd_emu10k1_mixer()
2322 emu1010_map_source(emu_ri, emu_ri->in_dflts[i]); in snd_emu10k1_mixer()
2323 for (i = 0; i < emu_ri->n_outs; i++) in snd_emu10k1_mixer()
2324 emu->emu1010.output_source[i] = in snd_emu10k1_mixer()
2325 emu1010_map_source(emu_ri, emu_ri->out_dflts[i]); in snd_emu10k1_mixer()
2328 kctl = emu->ctl_clock_source = snd_ctl_new1(&snd_emu1010_clock_source, emu); in snd_emu10k1_mixer()
2338 emu_pi->adc_ctls, emu_pi->n_adc_ctls); in snd_emu10k1_mixer()
2342 emu_pi->dac_ctls, emu_pi->n_dac_ctls); in snd_emu10k1_mixer()
2346 if (!emu->card_capabilities->no_adat) { in snd_emu10k1_mixer()
2362 if ( emu->card_capabilities->i2c_adc) { in snd_emu10k1_mixer()
2374 if (emu->card_capabilities->ac97_chip && emu->audigy) { in snd_emu10k1_mixer()