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()
685 unsigned channel = kcontrol->private_value; in snd_emu1010_input_source_get()
687 if (channel >= emu_ri->n_ins) in snd_emu1010_input_source_get()
688 return -EINVAL; in snd_emu1010_input_source_get()
689 ucontrol->value.enumerated.item[0] = emu->emu1010.input_source[channel]; in snd_emu1010_input_source_get()
699 unsigned val = ucontrol->value.enumerated.item[0]; in snd_emu1010_input_source_put()
700 unsigned channel = kcontrol->private_value; in snd_emu1010_input_source_put()
703 if (val >= emu_ri->n_srcs) in snd_emu1010_input_source_put()
704 return -EINVAL; in snd_emu1010_input_source_put()
705 if (channel >= emu_ri->n_ins) in snd_emu1010_input_source_put()
706 return -EINVAL; in snd_emu1010_input_source_put()
707 change = (emu->emu1010.input_source[channel] != val); in snd_emu1010_input_source_put()
709 emu->emu1010.input_source[channel] = val; in snd_emu1010_input_source_put()
732 emu_ri->out_texts, emu_ri->n_outs); in add_emu1010_source_mixers()
736 emu1010_input_texts, emu_ri->n_ins); in add_emu1010_source_mixers()
760 unsigned int mask = snd_emu1010_adc_pad_regs[kcontrol->private_value]; in snd_emu1010_adc_pads_get()
762 ucontrol->value.integer.value[0] = (emu->emu1010.adc_pads & mask) ? 1 : 0; in snd_emu1010_adc_pads_get()
769 unsigned int mask = snd_emu1010_adc_pad_regs[kcontrol->private_value]; in snd_emu1010_adc_pads_put()
773 val = ucontrol->value.integer.value[0]; in snd_emu1010_adc_pads_put()
774 cache = emu->emu1010.adc_pads; in snd_emu1010_adc_pads_put()
779 change = (cache != emu->emu1010.adc_pads); in snd_emu1010_adc_pads_put()
782 emu->emu1010.adc_pads = cache; in snd_emu1010_adc_pads_put()
818 unsigned int mask = snd_emu1010_dac_regs[kcontrol->private_value]; in snd_emu1010_dac_pads_get()
820 ucontrol->value.integer.value[0] = (emu->emu1010.dac_pads & mask) ? 1 : 0; in snd_emu1010_dac_pads_get()
827 unsigned int mask = snd_emu1010_dac_regs[kcontrol->private_value]; in snd_emu1010_dac_pads_put()
831 val = ucontrol->value.integer.value[0]; in snd_emu1010_dac_pads_put()
832 cache = emu->emu1010.dac_pads; in snd_emu1010_dac_pads_put()
837 change = (cache != emu->emu1010.dac_pads); in snd_emu1010_dac_pads_put()
840 emu->emu1010.dac_pads = cache; in snd_emu1010_dac_pads_put()
871 .n_adc_ctls = ARRAY_SIZE(snd_emu1010_adc_pads) - 1,
873 .n_dac_ctls = ARRAY_SIZE(snd_emu1010_dac_pads) - 1,
878 .n_adc_ctls = ARRAY_SIZE(snd_emu1010_adc_pads) - 2,
880 .n_dac_ctls = ARRAY_SIZE(snd_emu1010_dac_pads) - 2,
932 .num = ARRAY_SIZE(emu1010_clock_vals) - 1,
941 // can mean two things: either E-MU mapped the dock's sources to
963 return snd_ctl_enum_info(uinfo, 1, emu_ci->num, emu_ci->texts); in snd_emu1010_clock_source_info()
971 ucontrol->value.enumerated.item[0] = emu->emu1010.clock_source; in snd_emu1010_clock_source_get()
984 val = ucontrol->value.enumerated.item[0] ; in snd_emu1010_clock_source_put()
985 if (val >= emu_ci->num) in snd_emu1010_clock_source_put()
986 return -EINVAL; in snd_emu1010_clock_source_put()
988 spin_lock_irq(&emu->reg_lock); in snd_emu1010_clock_source_put()
989 change = (emu->emu1010.clock_source != val); in snd_emu1010_clock_source_put()
991 emu->emu1010.clock_source = val; in snd_emu1010_clock_source_put()
992 emu->emu1010.wclock = emu_ci->vals[val]; in snd_emu1010_clock_source_put()
996 snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, emu->emu1010.wclock); in snd_emu1010_clock_source_put()
997 spin_unlock_irq(&emu->reg_lock); in snd_emu1010_clock_source_put()
1002 spin_unlock_irq(&emu->reg_lock); in snd_emu1010_clock_source_put()
1034 ucontrol->value.enumerated.item[0] = emu->emu1010.clock_fallback; in snd_emu1010_clock_fallback_get()
1042 unsigned int val = ucontrol->value.enumerated.item[0]; in snd_emu1010_clock_fallback_put()
1046 return -EINVAL; in snd_emu1010_clock_fallback_put()
1047 change = (emu->emu1010.clock_fallback != val); in snd_emu1010_clock_fallback_put()
1049 emu->emu1010.clock_fallback = val; in snd_emu1010_clock_fallback_put()
1050 snd_emu1010_fpga_write_lock(emu, EMU_HANA_DEFCLOCK, 1 - val); in snd_emu1010_clock_fallback_put()
1081 ucontrol->value.enumerated.item[0] = emu->emu1010.optical_out; in snd_emu1010_optical_out_get()
1093 val = ucontrol->value.enumerated.item[0]; in snd_emu1010_optical_out_put()
1094 /* Limit: uinfo->value.enumerated.items = 2; */ in snd_emu1010_optical_out_put()
1096 return -EINVAL; in snd_emu1010_optical_out_put()
1097 change = (emu->emu1010.optical_out != val); in snd_emu1010_optical_out_put()
1099 emu->emu1010.optical_out = val; in snd_emu1010_optical_out_put()
1100 tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : EMU_HANA_OPTICAL_IN_SPDIF) | in snd_emu1010_optical_out_put()
1101 (emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : EMU_HANA_OPTICAL_OUT_SPDIF); in snd_emu1010_optical_out_put()
1132 ucontrol->value.enumerated.item[0] = emu->emu1010.optical_in; in snd_emu1010_optical_in_get()
1144 val = ucontrol->value.enumerated.item[0]; in snd_emu1010_optical_in_put()
1145 /* Limit: uinfo->value.enumerated.items = 2; */ in snd_emu1010_optical_in_put()
1147 return -EINVAL; in snd_emu1010_optical_in_put()
1148 change = (emu->emu1010.optical_in != val); in snd_emu1010_optical_in_put()
1150 emu->emu1010.optical_in = val; in snd_emu1010_optical_in_put()
1151 tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : EMU_HANA_OPTICAL_IN_SPDIF) | in snd_emu1010_optical_in_put()
1152 (emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : EMU_HANA_OPTICAL_OUT_SPDIF); in snd_emu1010_optical_in_put()
1188 ucontrol->value.enumerated.item[0] = emu->i2c_capture_source; in snd_audigy_i2c_capture_source_get()
1202 * update the capture volume from the cached value in snd_audigy_i2c_capture_source_put()
1205 source_id = ucontrol->value.enumerated.item[0]; in snd_audigy_i2c_capture_source_put()
1206 /* Limit: uinfo->value.enumerated.items = 2; */ in snd_audigy_i2c_capture_source_put()
1207 /* emu->i2c_capture_volume */ in snd_audigy_i2c_capture_source_put()
1209 return -EINVAL; in snd_audigy_i2c_capture_source_put()
1210 change = (emu->i2c_capture_source != source_id); in snd_audigy_i2c_capture_source_put()
1213 spin_lock_irq(&emu->emu_lock); in snd_audigy_i2c_capture_source_put()
1214 gpio = inw(emu->port + A_IOCFG); in snd_audigy_i2c_capture_source_put()
1216 outw(gpio | 0x4, emu->port + A_IOCFG); in snd_audigy_i2c_capture_source_put()
1218 outw(gpio & ~0x4, emu->port + A_IOCFG); in snd_audigy_i2c_capture_source_put()
1219 spin_unlock_irq(&emu->emu_lock); in snd_audigy_i2c_capture_source_put()
1221 ngain = emu->i2c_capture_volume[source_id][0]; /* Left */ in snd_audigy_i2c_capture_source_put()
1222 ogain = emu->i2c_capture_volume[emu->i2c_capture_source][0]; /* Left */ in snd_audigy_i2c_capture_source_put()
1225 ngain = emu->i2c_capture_volume[source_id][1]; /* Right */ in snd_audigy_i2c_capture_source_put()
1226 ogain = emu->i2c_capture_volume[emu->i2c_capture_source][1]; /* Right */ in snd_audigy_i2c_capture_source_put()
1232 emu->i2c_capture_source = source_id; in snd_audigy_i2c_capture_source_put()
1249 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_audigy_i2c_volume_info()
1250 uinfo->count = 2; in snd_audigy_i2c_volume_info()
1251 uinfo->value.integer.min = 0; in snd_audigy_i2c_volume_info()
1252 uinfo->value.integer.max = 255; in snd_audigy_i2c_volume_info()
1262 source_id = kcontrol->private_value; in snd_audigy_i2c_volume_get()
1263 /* Limit: emu->i2c_capture_volume */ in snd_audigy_i2c_volume_get()
1264 /* capture_source: uinfo->value.enumerated.items = 2 */ in snd_audigy_i2c_volume_get()
1266 return -EINVAL; in snd_audigy_i2c_volume_get()
1268 ucontrol->value.integer.value[0] = emu->i2c_capture_volume[source_id][0]; in snd_audigy_i2c_volume_get()
1269 ucontrol->value.integer.value[1] = emu->i2c_capture_volume[source_id][1]; in snd_audigy_i2c_volume_get()
1282 source_id = kcontrol->private_value; in snd_audigy_i2c_volume_put()
1283 /* Limit: emu->i2c_capture_volume */ in snd_audigy_i2c_volume_put()
1284 /* capture_source: uinfo->value.enumerated.items = 2 */ in snd_audigy_i2c_volume_put()
1286 return -EINVAL; in snd_audigy_i2c_volume_put()
1287 ngain0 = ucontrol->value.integer.value[0]; in snd_audigy_i2c_volume_put()
1288 ngain1 = ucontrol->value.integer.value[1]; in snd_audigy_i2c_volume_put()
1290 return -EINVAL; in snd_audigy_i2c_volume_put()
1292 return -EINVAL; in snd_audigy_i2c_volume_put()
1293 ogain = emu->i2c_capture_volume[source_id][0]; /* Left */ in snd_audigy_i2c_volume_put()
1295 if (emu->i2c_capture_source == source_id) in snd_audigy_i2c_volume_put()
1297 emu->i2c_capture_volume[source_id][0] = ngain0; in snd_audigy_i2c_volume_put()
1300 ogain = emu->i2c_capture_volume[source_id][1]; /* Right */ in snd_audigy_i2c_volume_put()
1302 if (emu->i2c_capture_source == source_id) in snd_audigy_i2c_volume_put()
1304 emu->i2c_capture_volume[source_id][1] = ngain1; in snd_audigy_i2c_volume_put()
1322 "Mic Capture Volume",
1323 "Line Capture Volume",
1343 ucontrol->value.enumerated.item[0] = 0;
1346 ucontrol->value.enumerated.item[0] = 1;
1349 ucontrol->value.enumerated.item[0] = 2;
1352 ucontrol->value.enumerated.item[0] = 1;
1364 switch(ucontrol->value.enumerated.item[0]) {
1380 spin_lock_irq(&emu->reg_lock);
1387 spin_unlock_irq(&emu->reg_lock);
1407 unsigned int idx = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_emu10k1_spdif_put()
1411 /* Limit: emu->spdif_bits */ in snd_emu10k1_spdif_put()
1413 return -EINVAL; in snd_emu10k1_spdif_put()
1414 val = (ucontrol->value.iec958.status[0] << 0) | in snd_emu10k1_spdif_put()
1415 (ucontrol->value.iec958.status[1] << 8) | in snd_emu10k1_spdif_put()
1416 (ucontrol->value.iec958.status[2] << 16) | in snd_emu10k1_spdif_put()
1417 (ucontrol->value.iec958.status[3] << 24); in snd_emu10k1_spdif_put()
1418 change = val != emu->spdif_bits[idx]; in snd_emu10k1_spdif_put()
1421 emu->spdif_bits[idx] = val; in snd_emu10k1_spdif_put()
1449 if (emu->audigy) { in update_emu10k1_fxrt()
1460 static void update_emu10k1_send_volume(struct snd_emu10k1 *emu, int voice, unsigned char *volume) in update_emu10k1_send_volume() argument
1462 snd_emu10k1_ptr_write(emu, PTRX_FXSENDAMOUNT_A, voice, volume[0]); in update_emu10k1_send_volume()
1463 snd_emu10k1_ptr_write(emu, PTRX_FXSENDAMOUNT_B, voice, volume[1]); in update_emu10k1_send_volume()
1464 snd_emu10k1_ptr_write(emu, PSST_FXSENDAMOUNT_C, voice, volume[2]); in update_emu10k1_send_volume()
1465 snd_emu10k1_ptr_write(emu, DSL_FXSENDAMOUNT_D, voice, volume[3]); in update_emu10k1_send_volume()
1466 if (emu->audigy) { in update_emu10k1_send_volume()
1468 snd_emu10k1_compose_audigy_sendamounts(volume)); in update_emu10k1_send_volume()
1477 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_emu10k1_send_routing_info()
1478 uinfo->count = emu->audigy ? 3*8 : 3*4; in snd_emu10k1_send_routing_info()
1479 uinfo->value.integer.min = 0; in snd_emu10k1_send_routing_info()
1480 uinfo->value.integer.max = emu->audigy ? 0x3f : 0x0f; in snd_emu10k1_send_routing_info()
1489 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; in snd_emu10k1_send_routing_get()
1491 int num_efx = emu->audigy ? 8 : 4; in snd_emu10k1_send_routing_get()
1492 int mask = emu->audigy ? 0x3f : 0x0f; in snd_emu10k1_send_routing_get()
1496 ucontrol->value.integer.value[(voice * num_efx) + idx] = in snd_emu10k1_send_routing_get()
1497 mix->send_routing[voice][idx] & mask; in snd_emu10k1_send_routing_get()
1506 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; in snd_emu10k1_send_routing_put()
1508 int num_efx = emu->audigy ? 8 : 4; in snd_emu10k1_send_routing_put()
1509 int mask = emu->audigy ? 0x3f : 0x0f; in snd_emu10k1_send_routing_put()
1511 spin_lock_irq(&emu->reg_lock); in snd_emu10k1_send_routing_put()
1514 val = ucontrol->value.integer.value[(voice * num_efx) + idx] & mask; in snd_emu10k1_send_routing_put()
1515 if (mix->send_routing[voice][idx] != val) { in snd_emu10k1_send_routing_put()
1516 mix->send_routing[voice][idx] = val; in snd_emu10k1_send_routing_put()
1520 if (change && mix->epcm && mix->epcm->voices[0]) { in snd_emu10k1_send_routing_put()
1521 if (!mix->epcm->voices[0]->last) { in snd_emu10k1_send_routing_put()
1522 update_emu10k1_fxrt(emu, mix->epcm->voices[0]->number, in snd_emu10k1_send_routing_put()
1523 &mix->send_routing[1][0]); in snd_emu10k1_send_routing_put()
1524 update_emu10k1_fxrt(emu, mix->epcm->voices[0]->number + 1, in snd_emu10k1_send_routing_put()
1525 &mix->send_routing[2][0]); in snd_emu10k1_send_routing_put()
1527 update_emu10k1_fxrt(emu, mix->epcm->voices[0]->number, in snd_emu10k1_send_routing_put()
1528 &mix->send_routing[0][0]); in snd_emu10k1_send_routing_put()
1531 spin_unlock_irq(&emu->reg_lock); in snd_emu10k1_send_routing_put()
1549 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_emu10k1_send_volume_info()
1550 uinfo->count = emu->audigy ? 3*8 : 3*4; in snd_emu10k1_send_volume_info()
1551 uinfo->value.integer.min = 0; in snd_emu10k1_send_volume_info()
1552 uinfo->value.integer.max = 255; in snd_emu10k1_send_volume_info()
1561 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; in snd_emu10k1_send_volume_get()
1563 int num_efx = emu->audigy ? 8 : 4; in snd_emu10k1_send_volume_get()
1566 ucontrol->value.integer.value[idx] = mix->send_volume[idx/num_efx][idx%num_efx]; in snd_emu10k1_send_volume_get()
1575 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; in snd_emu10k1_send_volume_put()
1577 int num_efx = emu->audigy ? 8 : 4; in snd_emu10k1_send_volume_put()
1579 spin_lock_irq(&emu->reg_lock); in snd_emu10k1_send_volume_put()
1581 val = ucontrol->value.integer.value[idx] & 255; in snd_emu10k1_send_volume_put()
1582 if (mix->send_volume[idx/num_efx][idx%num_efx] != val) { in snd_emu10k1_send_volume_put()
1583 mix->send_volume[idx/num_efx][idx%num_efx] = val; in snd_emu10k1_send_volume_put()
1587 if (change && mix->epcm && mix->epcm->voices[0]) { in snd_emu10k1_send_volume_put()
1588 if (!mix->epcm->voices[0]->last) { in snd_emu10k1_send_volume_put()
1589 update_emu10k1_send_volume(emu, mix->epcm->voices[0]->number, in snd_emu10k1_send_volume_put()
1590 &mix->send_volume[1][0]); in snd_emu10k1_send_volume_put()
1591 update_emu10k1_send_volume(emu, mix->epcm->voices[0]->number + 1, in snd_emu10k1_send_volume_put()
1592 &mix->send_volume[2][0]); in snd_emu10k1_send_volume_put()
1594 update_emu10k1_send_volume(emu, mix->epcm->voices[0]->number, in snd_emu10k1_send_volume_put()
1595 &mix->send_volume[0][0]); in snd_emu10k1_send_volume_put()
1598 spin_unlock_irq(&emu->reg_lock); in snd_emu10k1_send_volume_put()
1606 .name = "EMU10K1 PCM Send Volume",
1615 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_emu10k1_attn_info()
1616 uinfo->count = 3; in snd_emu10k1_attn_info()
1617 uinfo->value.integer.min = 0; in snd_emu10k1_attn_info()
1618 uinfo->value.integer.max = 0x1fffd; in snd_emu10k1_attn_info()
1627 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; in snd_emu10k1_attn_get()
1631 ucontrol->value.integer.value[idx] = mix->attn[idx] * 0xffffU / 0x8000U; in snd_emu10k1_attn_get()
1640 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; in snd_emu10k1_attn_put()
1643 spin_lock_irq(&emu->reg_lock); in snd_emu10k1_attn_put()
1645 unsigned uval = ucontrol->value.integer.value[idx] & 0x1ffff; in snd_emu10k1_attn_put()
1647 if (mix->attn[idx] != val) { in snd_emu10k1_attn_put()
1648 mix->attn[idx] = val; in snd_emu10k1_attn_put()
1652 if (change && mix->epcm && mix->epcm->voices[0]) { in snd_emu10k1_attn_put()
1653 if (!mix->epcm->voices[0]->last) { in snd_emu10k1_attn_put()
1654 snd_emu10k1_ptr_write(emu, VTFT_VOLUMETARGET, mix->epcm->voices[0]->number, mix->attn[1]); in snd_emu10k1_attn_put()
1655 snd_emu10k1_ptr_write(emu, VTFT_VOLUMETARGET, mix->epcm->voices[0]->number + 1, mix->attn[2]); in snd_emu10k1_attn_put()
1657 snd_emu10k1_ptr_write(emu, VTFT_VOLUMETARGET, mix->epcm->voices[0]->number, mix->attn[0]); in snd_emu10k1_attn_put()
1660 spin_unlock_irq(&emu->reg_lock); in snd_emu10k1_attn_put()
1668 .name = "EMU10K1 PCM Volume",
1680 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_emu10k1_efx_send_routing_info()
1681 uinfo->count = emu->audigy ? 8 : 4; in snd_emu10k1_efx_send_routing_info()
1682 uinfo->value.integer.min = 0; in snd_emu10k1_efx_send_routing_info()
1683 uinfo->value.integer.max = emu->audigy ? 0x3f : 0x0f; in snd_emu10k1_efx_send_routing_info()
1692 &emu->efx_pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; in snd_emu10k1_efx_send_routing_get()
1694 int num_efx = emu->audigy ? 8 : 4; in snd_emu10k1_efx_send_routing_get()
1695 int mask = emu->audigy ? 0x3f : 0x0f; in snd_emu10k1_efx_send_routing_get()
1698 ucontrol->value.integer.value[idx] = in snd_emu10k1_efx_send_routing_get()
1699 mix->send_routing[0][idx] & mask; in snd_emu10k1_efx_send_routing_get()
1707 int ch = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_emu10k1_efx_send_routing_put()
1708 struct snd_emu10k1_pcm_mixer *mix = &emu->efx_pcm_mixer[ch]; in snd_emu10k1_efx_send_routing_put()
1710 int num_efx = emu->audigy ? 8 : 4; in snd_emu10k1_efx_send_routing_put()
1711 int mask = emu->audigy ? 0x3f : 0x0f; in snd_emu10k1_efx_send_routing_put()
1713 spin_lock_irq(&emu->reg_lock); in snd_emu10k1_efx_send_routing_put()
1715 val = ucontrol->value.integer.value[idx] & mask; in snd_emu10k1_efx_send_routing_put()
1716 if (mix->send_routing[0][idx] != val) { in snd_emu10k1_efx_send_routing_put()
1717 mix->send_routing[0][idx] = val; in snd_emu10k1_efx_send_routing_put()
1722 if (change && mix->epcm) { in snd_emu10k1_efx_send_routing_put()
1723 if (mix->epcm->voices[ch]) { in snd_emu10k1_efx_send_routing_put()
1724 update_emu10k1_fxrt(emu, mix->epcm->voices[ch]->number, in snd_emu10k1_efx_send_routing_put()
1725 &mix->send_routing[0][0]); in snd_emu10k1_efx_send_routing_put()
1728 spin_unlock_irq(&emu->reg_lock); in snd_emu10k1_efx_send_routing_put()
1746 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_emu10k1_efx_send_volume_info()
1747 uinfo->count = emu->audigy ? 8 : 4; in snd_emu10k1_efx_send_volume_info()
1748 uinfo->value.integer.min = 0; in snd_emu10k1_efx_send_volume_info()
1749 uinfo->value.integer.max = 255; in snd_emu10k1_efx_send_volume_info()
1758 &emu->efx_pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; in snd_emu10k1_efx_send_volume_get()
1760 int num_efx = emu->audigy ? 8 : 4; in snd_emu10k1_efx_send_volume_get()
1763 ucontrol->value.integer.value[idx] = mix->send_volume[0][idx]; in snd_emu10k1_efx_send_volume_get()
1771 int ch = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_emu10k1_efx_send_volume_put()
1772 struct snd_emu10k1_pcm_mixer *mix = &emu->efx_pcm_mixer[ch]; in snd_emu10k1_efx_send_volume_put()
1774 int num_efx = emu->audigy ? 8 : 4; in snd_emu10k1_efx_send_volume_put()
1776 spin_lock_irq(&emu->reg_lock); in snd_emu10k1_efx_send_volume_put()
1778 val = ucontrol->value.integer.value[idx] & 255; in snd_emu10k1_efx_send_volume_put()
1779 if (mix->send_volume[0][idx] != val) { in snd_emu10k1_efx_send_volume_put()
1780 mix->send_volume[0][idx] = val; in snd_emu10k1_efx_send_volume_put()
1784 if (change && mix->epcm) { in snd_emu10k1_efx_send_volume_put()
1785 if (mix->epcm->voices[ch]) { in snd_emu10k1_efx_send_volume_put()
1786 update_emu10k1_send_volume(emu, mix->epcm->voices[ch]->number, in snd_emu10k1_efx_send_volume_put()
1787 &mix->send_volume[0][0]); in snd_emu10k1_efx_send_volume_put()
1790 spin_unlock_irq(&emu->reg_lock); in snd_emu10k1_efx_send_volume_put()
1799 .name = "Multichannel PCM Send Volume",
1808 uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER; in snd_emu10k1_efx_attn_info()
1809 uinfo->count = 1; in snd_emu10k1_efx_attn_info()
1810 uinfo->value.integer.min = 0; in snd_emu10k1_efx_attn_info()
1811 uinfo->value.integer.max = 0x1fffd; in snd_emu10k1_efx_attn_info()
1820 &emu->efx_pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)]; in snd_emu10k1_efx_attn_get()
1822 ucontrol->value.integer.value[0] = mix->attn[0] * 0xffffU / 0x8000U; in snd_emu10k1_efx_attn_get()
1830 int ch = snd_ctl_get_ioffidx(kcontrol, &ucontrol->id); in snd_emu10k1_efx_attn_put()
1831 struct snd_emu10k1_pcm_mixer *mix = &emu->efx_pcm_mixer[ch]; in snd_emu10k1_efx_attn_put()
1835 spin_lock_irq(&emu->reg_lock); in snd_emu10k1_efx_attn_put()
1836 uval = ucontrol->value.integer.value[0] & 0x1ffff; in snd_emu10k1_efx_attn_put()
1838 if (mix->attn[0] != val) { in snd_emu10k1_efx_attn_put()
1839 mix->attn[0] = val; in snd_emu10k1_efx_attn_put()
1842 if (change && mix->epcm) { in snd_emu10k1_efx_attn_put()
1843 if (mix->epcm->voices[ch]) { in snd_emu10k1_efx_attn_put()
1844 snd_emu10k1_ptr_write(emu, VTFT_VOLUMETARGET, mix->epcm->voices[ch]->number, mix->attn[0]); in snd_emu10k1_efx_attn_put()
1847 spin_unlock_irq(&emu->reg_lock); in snd_emu10k1_efx_attn_put()
1855 .name = "Multichannel PCM Volume",
1869 if (emu->audigy) in snd_emu10k1_shared_spdif_get()
1870 ucontrol->value.integer.value[0] = inw(emu->port + A_IOCFG) & A_IOCFG_GPOUT0 ? 1 : 0; in snd_emu10k1_shared_spdif_get()
1872 ucontrol->value.integer.value[0] = inl(emu->port + HCFG) & HCFG_GPOUT0 ? 1 : 0; in snd_emu10k1_shared_spdif_get()
1873 if (emu->card_capabilities->invert_shared_spdif) in snd_emu10k1_shared_spdif_get()
1874 ucontrol->value.integer.value[0] = in snd_emu10k1_shared_spdif_get()
1875 !ucontrol->value.integer.value[0]; in snd_emu10k1_shared_spdif_get()
1887 sw = ucontrol->value.integer.value[0]; in snd_emu10k1_shared_spdif_put()
1888 if (emu->card_capabilities->invert_shared_spdif) in snd_emu10k1_shared_spdif_put()
1890 spin_lock_irq(&emu->emu_lock); in snd_emu10k1_shared_spdif_put()
1891 if ( emu->card_capabilities->i2c_adc) { in snd_emu10k1_shared_spdif_put()
1893 } else if (emu->audigy) { in snd_emu10k1_shared_spdif_put()
1894 reg = inw(emu->port + A_IOCFG); in snd_emu10k1_shared_spdif_put()
1900 outw(reg | val, emu->port + A_IOCFG); in snd_emu10k1_shared_spdif_put()
1903 reg = inl(emu->port + HCFG); in snd_emu10k1_shared_spdif_put()
1909 outl(reg | val, emu->port + HCFG); in snd_emu10k1_shared_spdif_put()
1911 spin_unlock_irq(&emu->emu_lock); in snd_emu10k1_shared_spdif_put()
1933 /* workaround for too low volume on Audigy due to 16bit/24bit conversion */
1944 val = snd_ac97_read(emu->ac97, AC97_REC_GAIN); in snd_audigy_capture_boost_get()
1945 ucontrol->value.integer.value[0] = !!val; in snd_audigy_capture_boost_get()
1955 if (ucontrol->value.integer.value[0]) in snd_audigy_capture_boost_put()
1959 return snd_ac97_update(emu->ac97, AC97_REC_GAIN, val); in snd_audigy_capture_boost_put()
1976 struct snd_emu10k1 *emu = ac97->private_data; in snd_emu10k1_mixer_free_ac97()
1977 emu->ac97 = NULL; in snd_emu10k1_mixer_free_ac97()
1998 return -ENOENT; in rename_ctl()
2006 struct snd_card *card = emu->card; in snd_emu10k1_mixer()
2011 "Master Mono Playback Volume", in snd_emu10k1_mixer()
2012 "PCM Out Path & Mute", in snd_emu10k1_mixer()
2015 "Surround Playback Volume", in snd_emu10k1_mixer()
2017 "Center Playback Volume", in snd_emu10k1_mixer()
2019 "LFE Playback Volume", in snd_emu10k1_mixer()
2023 "Surround Digital Playback Volume", "Surround Playback Volume", in snd_emu10k1_mixer()
2024 "Center Digital Playback Volume", "Center Playback Volume", in snd_emu10k1_mixer()
2025 "LFE Digital Playback Volume", "LFE Playback Volume", in snd_emu10k1_mixer()
2033 "PCM Playback Volume", in snd_emu10k1_mixer()
2035 "Master Playback Volume", in snd_emu10k1_mixer()
2036 "PCM Out Path & Mute", in snd_emu10k1_mixer()
2041 "Capture Volume", in snd_emu10k1_mixer()
2044 "Headphone Playback Volume", in snd_emu10k1_mixer()
2045 "3D Control - Center", in snd_emu10k1_mixer()
2046 "3D Control - Depth", in snd_emu10k1_mixer()
2047 "3D Control - Switch", in snd_emu10k1_mixer()
2049 "Video Playback Volume", in snd_emu10k1_mixer()
2051 "Mic Playback Volume", in snd_emu10k1_mixer()
2057 "Wave Playback Volume", "PCM Playback Volume", in snd_emu10k1_mixer()
2058 /* "Wave Capture Volume", "PCM Capture Volume", */ in snd_emu10k1_mixer()
2059 "Wave Master Playback Volume", "Master Playback Volume", in snd_emu10k1_mixer()
2060 "AMic Playback Volume", "Mic Playback Volume", in snd_emu10k1_mixer()
2062 "Master Mono Playback Volume", "Phone Output Playback Volume", in snd_emu10k1_mixer()
2066 //"Analog Mix Capture Volume","OLD Analog Mix Capture Volume", in snd_emu10k1_mixer()
2067 "Line Capture Volume", "Analog Mix Capture Volume", in snd_emu10k1_mixer()
2068 "Wave Playback Volume", "OLD PCM Playback Volume", in snd_emu10k1_mixer()
2069 "Wave Master Playback Volume", "Master Playback Volume", in snd_emu10k1_mixer()
2070 "AMic Playback Volume", "Old Mic Playback Volume", in snd_emu10k1_mixer()
2071 "CD Capture Volume", "IEC958 Optical Capture Volume", in snd_emu10k1_mixer()
2077 "Mic Capture Volume", in snd_emu10k1_mixer()
2078 "Analog Mix Capture Volume", in snd_emu10k1_mixer()
2079 "Aux Capture Volume", in snd_emu10k1_mixer()
2080 "IEC958 Optical Capture Volume", in snd_emu10k1_mixer()
2087 "PCM Playback Volume", in snd_emu10k1_mixer()
2090 "Capture Volume", in snd_emu10k1_mixer()
2091 "Mic Capture Volume", in snd_emu10k1_mixer()
2093 "Headphone Playback Volume", in snd_emu10k1_mixer()
2094 "3D Control - Center", in snd_emu10k1_mixer()
2095 "3D Control - Depth", in snd_emu10k1_mixer()
2096 "3D Control - Switch", in snd_emu10k1_mixer()
2097 "Line2 Playback Volume", in snd_emu10k1_mixer()
2098 "Line2 Capture Volume", in snd_emu10k1_mixer()
2103 "Master Playback Volume", "Master Capture Volume", in snd_emu10k1_mixer()
2104 "Wave Master Playback Volume", "Master Playback Volume", in snd_emu10k1_mixer()
2106 "Beep Playback Volume", "Beep Capture Volume", in snd_emu10k1_mixer()
2108 "Phone Playback Volume", "Phone Capture Volume", in snd_emu10k1_mixer()
2110 "Mic Playback Volume", "Mic Capture Volume", in snd_emu10k1_mixer()
2112 "Line Playback Volume", "Line Capture Volume", in snd_emu10k1_mixer()
2114 "CD Playback Volume", "CD Capture Volume", in snd_emu10k1_mixer()
2116 "Aux Playback Volume", "Aux Capture Volume", in snd_emu10k1_mixer()
2118 "Video Playback Volume", "Video Capture Volume", in snd_emu10k1_mixer()
2120 "Master Mono Playback Volume", "Phone Output Playback Volume", in snd_emu10k1_mixer()
2124 if (emu->card_capabilities->ac97_chip) { in snd_emu10k1_mixer()
2132 err = snd_ac97_bus(emu->card, 0, &ops, NULL, &pbus); in snd_emu10k1_mixer()
2135 pbus->no_vra = 1; /* we don't need VRA */ in snd_emu10k1_mixer()
2141 err = snd_ac97_mixer(pbus, &ac97, &emu->ac97); in snd_emu10k1_mixer()
2143 if (emu->card_capabilities->ac97_chip == 1) in snd_emu10k1_mixer()
2145 dev_info(emu->card->dev, in snd_emu10k1_mixer()
2147 dev_info(emu->card->dev, in snd_emu10k1_mixer()
2149 snd_device_free(emu->card, pbus); in snd_emu10k1_mixer()
2152 if (emu->audigy) { in snd_emu10k1_mixer()
2153 /* set master volume to 0 dB */ in snd_emu10k1_mixer()
2154 snd_ac97_write_cache(emu->ac97, AC97_MASTER, 0x0000); in snd_emu10k1_mixer()
2156 snd_ac97_write_cache(emu->ac97, AC97_REC_SEL, 0x0000); in snd_emu10k1_mixer()
2158 snd_ac97_update_bits(emu->ac97, AC97_GENERAL_PURPOSE, in snd_emu10k1_mixer()
2160 if (emu->card_capabilities->adc_1361t) in snd_emu10k1_mixer()
2167 * James Courtier-Dutton <James@superbug.demon.co.uk> in snd_emu10k1_mixer()
2170 if (emu->ac97->id == AC97_ID_STAC9758) { in snd_emu10k1_mixer()
2171 emu->rear_ac97 = 1; in snd_emu10k1_mixer()
2173 snd_ac97_write_cache(emu->ac97, AC97_HEADPHONE, 0x0202); in snd_emu10k1_mixer()
2174 remove_ctl(card,"Front Playback Volume"); in snd_emu10k1_mixer()
2178 snd_ac97_write_cache(emu->ac97, AC97_SURROUND_MASTER, 0x0202); in snd_emu10k1_mixer()
2179 snd_ac97_write_cache(emu->ac97, AC97_CENTER_LFE_MASTER, 0x0202); in snd_emu10k1_mixer()
2184 } else if (emu->card_capabilities->i2c_adc) { in snd_emu10k1_mixer()
2190 if (emu->card_capabilities->ecard) in snd_emu10k1_mixer()
2191 strcpy(emu->card->mixername, "EMU APS"); in snd_emu10k1_mixer()
2192 else if (emu->audigy) in snd_emu10k1_mixer()
2193 strcpy(emu->card->mixername, "SB Audigy"); in snd_emu10k1_mixer()
2195 strcpy(emu->card->mixername, "Emu10k1"); in snd_emu10k1_mixer()
2198 if (emu->audigy) in snd_emu10k1_mixer()
2199 if (emu->card_capabilities->adc_1361t) in snd_emu10k1_mixer()
2201 else if (emu->card_capabilities->i2c_adc) in snd_emu10k1_mixer()
2210 if (emu->card_capabilities->subsystem == 0x80401102) { /* SB Live! Platinum CT4760P */ in snd_emu10k1_mixer()
2211 remove_ctl(card, "Center Playback Volume"); in snd_emu10k1_mixer()
2212 remove_ctl(card, "LFE Playback Volume"); in snd_emu10k1_mixer()
2213 remove_ctl(card, "Wave Center Playback Volume"); in snd_emu10k1_mixer()
2214 remove_ctl(card, "Wave LFE Playback Volume"); in snd_emu10k1_mixer()
2216 if (emu->card_capabilities->subsystem == 0x20071102) { /* Audigy 4 Pro */ in snd_emu10k1_mixer()
2217 rename_ctl(card, "Line2 Capture Volume", "Line1/Mic Capture Volume"); in snd_emu10k1_mixer()
2218 rename_ctl(card, "Analog Mix Capture Volume", "Line2 Capture Volume"); in snd_emu10k1_mixer()
2219 rename_ctl(card, "Aux2 Capture Volume", "Line3 Capture Volume"); in snd_emu10k1_mixer()
2220 rename_ctl(card, "Mic Capture Volume", "Unknown1 Capture Volume"); in snd_emu10k1_mixer()
2222 kctl = emu->ctl_send_routing = snd_ctl_new1(&snd_emu10k1_send_routing_control, emu); in snd_emu10k1_mixer()
2224 return -ENOMEM; in snd_emu10k1_mixer()
2225 kctl->id.device = pcm_device; in snd_emu10k1_mixer()
2229 kctl = emu->ctl_send_volume = snd_ctl_new1(&snd_emu10k1_send_volume_control, emu); in snd_emu10k1_mixer()
2231 return -ENOMEM; in snd_emu10k1_mixer()
2232 kctl->id.device = pcm_device; in snd_emu10k1_mixer()
2236 kctl = emu->ctl_attn = snd_ctl_new1(&snd_emu10k1_attn_control, emu); in snd_emu10k1_mixer()
2238 return -ENOMEM; in snd_emu10k1_mixer()
2239 kctl->id.device = pcm_device; in snd_emu10k1_mixer()
2244 kctl = emu->ctl_efx_send_routing = snd_ctl_new1(&snd_emu10k1_efx_send_routing_control, emu); in snd_emu10k1_mixer()
2246 return -ENOMEM; in snd_emu10k1_mixer()
2247 kctl->id.device = multi_device; in snd_emu10k1_mixer()
2252 kctl = emu->ctl_efx_send_volume = snd_ctl_new1(&snd_emu10k1_efx_send_volume_control, emu); in snd_emu10k1_mixer()
2254 return -ENOMEM; in snd_emu10k1_mixer()
2255 kctl->id.device = multi_device; in snd_emu10k1_mixer()
2260 kctl = emu->ctl_efx_attn = snd_ctl_new1(&snd_emu10k1_efx_attn_control, emu); in snd_emu10k1_mixer()
2262 return -ENOMEM; in snd_emu10k1_mixer()
2263 kctl->id.device = multi_device; in snd_emu10k1_mixer()
2268 if (!emu->card_capabilities->ecard && !emu->card_capabilities->emu_model) { in snd_emu10k1_mixer()
2272 return -ENOMEM; in snd_emu10k1_mixer()
2273 if (!emu->audigy) in snd_emu10k1_mixer()
2274 kctl->id.device = emu->pcm_efx->device; in snd_emu10k1_mixer()
2280 return -ENOMEM; in snd_emu10k1_mixer()
2281 if (!emu->audigy) in snd_emu10k1_mixer()
2282 kctl->id.device = emu->pcm_efx->device; in snd_emu10k1_mixer()
2288 if (emu->card_capabilities->emu_model) { in snd_emu10k1_mixer()
2290 } else if (emu->audigy) { in snd_emu10k1_mixer()
2293 return -ENOMEM; in snd_emu10k1_mixer()
2300 return -ENOMEM; in snd_emu10k1_mixer()
2305 } else if (! emu->card_capabilities->ecard) { in snd_emu10k1_mixer()
2309 return -ENOMEM; in snd_emu10k1_mixer()
2314 if (emu->card_capabilities->ca0151_chip) { /* P16V */ in snd_emu10k1_mixer()
2320 if (emu->card_capabilities->emu_model) { in snd_emu10k1_mixer()
2326 for (i = 0; i < emu_ri->n_ins; i++) in snd_emu10k1_mixer()
2327 emu->emu1010.input_source[i] = in snd_emu10k1_mixer()
2328 emu1010_map_source(emu_ri, emu_ri->in_dflts[i]); in snd_emu10k1_mixer()
2329 for (i = 0; i < emu_ri->n_outs; i++) in snd_emu10k1_mixer()
2330 emu->emu1010.output_source[i] = in snd_emu10k1_mixer()
2331 emu1010_map_source(emu_ri, emu_ri->out_dflts[i]); in snd_emu10k1_mixer()
2336 kctl = emu->ctl_clock_source = snd_ctl_new1(&snd_emu1010_clock_source, emu); in snd_emu10k1_mixer()
2346 emu_pi->adc_ctls, emu_pi->n_adc_ctls); in snd_emu10k1_mixer()
2350 emu_pi->dac_ctls, emu_pi->n_dac_ctls); in snd_emu10k1_mixer()
2354 if (!emu->card_capabilities->no_adat) { in snd_emu10k1_mixer()
2370 if ( emu->card_capabilities->i2c_adc) { in snd_emu10k1_mixer()
2382 if (emu->card_capabilities->ac97_chip && emu->audigy) { in snd_emu10k1_mixer()