Lines Matching refs:emu
27 static int add_ctls(struct snd_emu10k1 *emu, const struct snd_kcontrol_new *tpl,
36 err = snd_ctl_add(emu->card, snd_ctl_new1(&kctl, emu));
54 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
57 /* Limit: emu->spdif_bits */
60 ucontrol->value.iec958.status[0] = (emu->spdif_bits[idx] >> 0) & 0xff;
61 ucontrol->value.iec958.status[1] = (emu->spdif_bits[idx] >> 8) & 0xff;
62 ucontrol->value.iec958.status[2] = (emu->spdif_bits[idx] >> 16) & 0xff;
63 ucontrol->value.iec958.status[3] = (emu->spdif_bits[idx] >> 24) & 0xff;
576 static unsigned emu1010_idx(struct snd_emu10k1 *emu)
578 return emu->card_capabilities->emu_model - 1;
581 static void snd_emu1010_output_source_apply(struct snd_emu10k1 *emu,
585 &emu1010_routing_info[emu1010_idx(emu)];
587 snd_emu1010_fpga_link_dst_src_write(emu,
591 static void snd_emu1010_input_source_apply(struct snd_emu10k1 *emu,
595 &emu1010_routing_info[emu1010_idx(emu)];
597 snd_emu1010_fpga_link_dst_src_write(emu,
601 static void snd_emu1010_apply_sources(struct snd_emu10k1 *emu)
604 &emu1010_routing_info[emu1010_idx(emu)];
608 emu, i, emu->emu1010.output_source[i]);
611 emu, i, emu->emu1010.input_source[i]);
626 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
628 &emu1010_routing_info[emu1010_idx(emu)];
636 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
638 &emu1010_routing_info[emu1010_idx(emu)];
643 ucontrol->value.enumerated.item[0] = emu->emu1010.output_source[channel];
650 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
652 &emu1010_routing_info[emu1010_idx(emu)];
661 change = (emu->emu1010.output_source[channel] != val);
663 emu->emu1010.output_source[channel] = val;
664 snd_emu1010_output_source_apply(emu, channel, val);
680 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
682 &emu1010_routing_info[emu1010_idx(emu)];
687 ucontrol->value.enumerated.item[0] = emu->emu1010.input_source[channel];
694 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
696 &emu1010_routing_info[emu1010_idx(emu)];
705 change = (emu->emu1010.input_source[channel] != val);
707 emu->emu1010.input_source[channel] = val;
708 snd_emu1010_input_source_apply(emu, channel, val);
721 static int add_emu1010_source_mixers(struct snd_emu10k1 *emu)
724 &emu1010_routing_info[emu1010_idx(emu)];
727 err = add_ctls(emu, &emu1010_output_source_ctl,
731 err = add_ctls(emu, &emu1010_input_source_ctl,
755 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
758 ucontrol->value.integer.value[0] = (emu->emu1010.adc_pads & mask) ? 1 : 0;
764 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
770 cache = emu->emu1010.adc_pads;
775 change = (cache != emu->emu1010.adc_pads);
777 snd_emu1010_fpga_write(emu, EMU_HANA_ADC_PADS, cache );
778 emu->emu1010.adc_pads = cache;
813 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
816 ucontrol->value.integer.value[0] = (emu->emu1010.dac_pads & mask) ? 1 : 0;
822 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
828 cache = emu->emu1010.dac_pads;
833 change = (cache != emu->emu1010.dac_pads);
835 snd_emu1010_fpga_write(emu, EMU_HANA_DAC_PADS, cache );
836 emu->emu1010.dac_pads = cache;
955 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
957 &emu1010_clock_info[emu1010_idx(emu)];
965 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
967 ucontrol->value.enumerated.item[0] = emu->emu1010.clock_source;
974 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
976 &emu1010_clock_info[emu1010_idx(emu)];
983 spin_lock_irq(&emu->reg_lock);
984 change = (emu->emu1010.clock_source != val);
986 emu->emu1010.clock_source = val;
987 emu->emu1010.wclock = emu_ci->vals[val];
988 snd_emu1010_update_clock(emu);
990 snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_MUTE);
991 snd_emu1010_fpga_write(emu, EMU_HANA_WCLOCK, emu->emu1010.wclock);
992 spin_unlock_irq(&emu->reg_lock);
995 snd_emu1010_fpga_write(emu, EMU_HANA_UNMUTE, EMU_UNMUTE);
997 spin_unlock_irq(&emu->reg_lock);
1026 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1028 ucontrol->value.enumerated.item[0] = emu->emu1010.clock_fallback;
1035 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1041 change = (emu->emu1010.clock_fallback != val);
1043 emu->emu1010.clock_fallback = val;
1044 snd_emu1010_fpga_write(emu, EMU_HANA_DEFCLOCK, 1 - val);
1073 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1075 ucontrol->value.enumerated.item[0] = emu->emu1010.optical_out;
1082 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1091 change = (emu->emu1010.optical_out != val);
1093 emu->emu1010.optical_out = val;
1094 tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : EMU_HANA_OPTICAL_IN_SPDIF) |
1095 (emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : EMU_HANA_OPTICAL_OUT_SPDIF);
1096 snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, tmp);
1124 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1126 ucontrol->value.enumerated.item[0] = emu->emu1010.optical_in;
1133 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1142 change = (emu->emu1010.optical_in != val);
1144 emu->emu1010.optical_in = val;
1145 tmp = (emu->emu1010.optical_in ? EMU_HANA_OPTICAL_IN_ADAT : EMU_HANA_OPTICAL_IN_SPDIF) |
1146 (emu->emu1010.optical_out ? EMU_HANA_OPTICAL_OUT_ADAT : EMU_HANA_OPTICAL_OUT_SPDIF);
1147 snd_emu1010_fpga_write(emu, EMU_HANA_OPTICAL_TYPE, tmp);
1180 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1182 ucontrol->value.enumerated.item[0] = emu->i2c_capture_source;
1189 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1201 /* emu->i2c_capture_volume */
1204 change = (emu->i2c_capture_source != source_id);
1206 snd_emu10k1_i2c_write(emu, ADC_MUX, 0); /* Mute input */
1207 spin_lock_irq(&emu->emu_lock);
1208 gpio = inw(emu->port + A_IOCFG);
1210 outw(gpio | 0x4, emu->port + A_IOCFG);
1212 outw(gpio & ~0x4, emu->port + A_IOCFG);
1213 spin_unlock_irq(&emu->emu_lock);
1215 ngain = emu->i2c_capture_volume[source_id][0]; /* Left */
1216 ogain = emu->i2c_capture_volume[emu->i2c_capture_source][0]; /* Left */
1218 snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCL, ((ngain) & 0xff));
1219 ngain = emu->i2c_capture_volume[source_id][1]; /* Right */
1220 ogain = emu->i2c_capture_volume[emu->i2c_capture_source][1]; /* Right */
1222 snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCR, ((ngain) & 0xff));
1225 snd_emu10k1_i2c_write(emu, ADC_MUX, source); /* Set source */
1226 emu->i2c_capture_source = source_id;
1253 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1257 /* Limit: emu->i2c_capture_volume */
1262 ucontrol->value.integer.value[0] = emu->i2c_capture_volume[source_id][0];
1263 ucontrol->value.integer.value[1] = emu->i2c_capture_volume[source_id][1];
1270 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1277 /* Limit: emu->i2c_capture_volume */
1287 ogain = emu->i2c_capture_volume[source_id][0]; /* Left */
1289 if (emu->i2c_capture_source == source_id)
1290 snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCL, ngain0);
1291 emu->i2c_capture_volume[source_id][0] = ngain0;
1294 ogain = emu->i2c_capture_volume[source_id][1]; /* Right */
1296 if (emu->i2c_capture_source == source_id)
1297 snd_emu10k1_i2c_write(emu, ADC_ATTEN_ADCR, ngain1);
1298 emu->i2c_capture_volume[source_id][1] = ngain1;
1331 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1334 tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
1354 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1374 spin_lock_irq(&emu->reg_lock);
1375 reg = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, 0);
1380 snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, 0, tmp);
1381 spin_unlock_irq(&emu->reg_lock);
1400 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1405 /* Limit: emu->spdif_bits */
1412 change = val != emu->spdif_bits[idx];
1414 snd_emu10k1_ptr_write(emu, SPCS0 + idx, 0, val);
1415 emu->spdif_bits[idx] = val;
1441 static void update_emu10k1_fxrt(struct snd_emu10k1 *emu, int voice, unsigned char *route)
1443 if (emu->audigy) {
1444 snd_emu10k1_ptr_write_multiple(emu, voice,
1449 snd_emu10k1_ptr_write(emu, FXRT, voice,
1454 static void update_emu10k1_send_volume(struct snd_emu10k1 *emu, int voice, unsigned char *volume)
1456 snd_emu10k1_ptr_write(emu, PTRX_FXSENDAMOUNT_A, voice, volume[0]);
1457 snd_emu10k1_ptr_write(emu, PTRX_FXSENDAMOUNT_B, voice, volume[1]);
1458 snd_emu10k1_ptr_write(emu, PSST_FXSENDAMOUNT_C, voice, volume[2]);
1459 snd_emu10k1_ptr_write(emu, DSL_FXSENDAMOUNT_D, voice, volume[3]);
1460 if (emu->audigy) {
1461 snd_emu10k1_ptr_write(emu, A_SENDAMOUNTS, voice,
1470 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1472 uinfo->count = emu->audigy ? 3*8 : 3*4;
1474 uinfo->value.integer.max = emu->audigy ? 0x3f : 0x0f;
1481 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1483 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)];
1485 int num_efx = emu->audigy ? 8 : 4;
1486 int mask = emu->audigy ? 0x3f : 0x0f;
1498 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1500 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)];
1502 int num_efx = emu->audigy ? 8 : 4;
1503 int mask = emu->audigy ? 0x3f : 0x0f;
1505 spin_lock_irq(&emu->reg_lock);
1516 update_emu10k1_fxrt(emu, mix->epcm->voices[0]->number,
1518 update_emu10k1_fxrt(emu, mix->epcm->voices[0]->number + 1,
1521 update_emu10k1_fxrt(emu, mix->epcm->voices[0]->number,
1525 spin_unlock_irq(&emu->reg_lock);
1542 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1544 uinfo->count = emu->audigy ? 3*8 : 3*4;
1553 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1555 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)];
1557 int num_efx = emu->audigy ? 8 : 4;
1567 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1569 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)];
1571 int num_efx = emu->audigy ? 8 : 4;
1573 spin_lock_irq(&emu->reg_lock);
1583 update_emu10k1_send_volume(emu, mix->epcm->voices[0]->number,
1585 update_emu10k1_send_volume(emu, mix->epcm->voices[0]->number + 1,
1588 update_emu10k1_send_volume(emu, mix->epcm->voices[0]->number,
1592 spin_unlock_irq(&emu->reg_lock);
1619 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1621 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)];
1632 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1634 &emu->pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)];
1637 spin_lock_irq(&emu->reg_lock);
1648 snd_emu10k1_ptr_write(emu, VTFT_VOLUMETARGET, mix->epcm->voices[0]->number, mix->attn[1]);
1649 snd_emu10k1_ptr_write(emu, VTFT_VOLUMETARGET, mix->epcm->voices[0]->number + 1, mix->attn[2]);
1651 snd_emu10k1_ptr_write(emu, VTFT_VOLUMETARGET, mix->epcm->voices[0]->number, mix->attn[0]);
1654 spin_unlock_irq(&emu->reg_lock);
1673 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1675 uinfo->count = emu->audigy ? 8 : 4;
1677 uinfo->value.integer.max = emu->audigy ? 0x3f : 0x0f;
1684 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1686 &emu->efx_pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)];
1688 int num_efx = emu->audigy ? 8 : 4;
1689 int mask = emu->audigy ? 0x3f : 0x0f;
1700 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1702 struct snd_emu10k1_pcm_mixer *mix = &emu->efx_pcm_mixer[ch];
1704 int num_efx = emu->audigy ? 8 : 4;
1705 int mask = emu->audigy ? 0x3f : 0x0f;
1707 spin_lock_irq(&emu->reg_lock);
1718 update_emu10k1_fxrt(emu, mix->epcm->voices[ch]->number,
1722 spin_unlock_irq(&emu->reg_lock);
1739 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1741 uinfo->count = emu->audigy ? 8 : 4;
1750 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1752 &emu->efx_pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)];
1754 int num_efx = emu->audigy ? 8 : 4;
1764 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1766 struct snd_emu10k1_pcm_mixer *mix = &emu->efx_pcm_mixer[ch];
1768 int num_efx = emu->audigy ? 8 : 4;
1770 spin_lock_irq(&emu->reg_lock);
1780 update_emu10k1_send_volume(emu, mix->epcm->voices[ch]->number,
1784 spin_unlock_irq(&emu->reg_lock);
1812 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1814 &emu->efx_pcm_mixer[snd_ctl_get_ioffidx(kcontrol, &ucontrol->id)];
1823 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1825 struct snd_emu10k1_pcm_mixer *mix = &emu->efx_pcm_mixer[ch];
1829 spin_lock_irq(&emu->reg_lock);
1838 snd_emu10k1_ptr_write(emu, VTFT_VOLUMETARGET, mix->epcm->voices[ch]->number, mix->attn[0]);
1841 spin_unlock_irq(&emu->reg_lock);
1861 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1863 if (emu->audigy)
1864 ucontrol->value.integer.value[0] = inw(emu->port + A_IOCFG) & A_IOCFG_GPOUT0 ? 1 : 0;
1866 ucontrol->value.integer.value[0] = inl(emu->port + HCFG) & HCFG_GPOUT0 ? 1 : 0;
1867 if (emu->card_capabilities->invert_shared_spdif)
1877 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1882 if (emu->card_capabilities->invert_shared_spdif)
1884 spin_lock_irq(&emu->emu_lock);
1885 if ( emu->card_capabilities->i2c_adc) {
1887 } else if (emu->audigy) {
1888 reg = inw(emu->port + A_IOCFG);
1894 outw(reg | val, emu->port + A_IOCFG);
1897 reg = inl(emu->port + HCFG);
1903 outl(reg | val, emu->port + HCFG);
1905 spin_unlock_irq(&emu->emu_lock);
1934 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1938 val = snd_ac97_read(emu->ac97, AC97_REC_GAIN);
1946 struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
1953 return snd_ac97_update(emu->ac97, AC97_REC_GAIN, val);
1970 struct snd_emu10k1 *emu = ac97->private_data;
1971 emu->ac97 = NULL;
1995 int snd_emu10k1_mixer(struct snd_emu10k1 *emu,
2000 struct snd_card *card = emu->card;
2118 if (emu->card_capabilities->ac97_chip) {
2126 err = snd_ac97_bus(emu->card, 0, &ops, NULL, &pbus);
2132 ac97.private_data = emu;
2135 err = snd_ac97_mixer(pbus, &ac97, &emu->ac97);
2137 if (emu->card_capabilities->ac97_chip == 1)
2139 dev_info(emu->card->dev,
2141 dev_info(emu->card->dev,
2143 snd_device_free(emu->card, pbus);
2146 if (emu->audigy) {
2148 snd_ac97_write_cache(emu->ac97, AC97_MASTER, 0x0000);
2150 snd_ac97_write_cache(emu->ac97, AC97_REC_SEL, 0x0000);
2152 snd_ac97_update_bits(emu->ac97, AC97_GENERAL_PURPOSE,
2154 if (emu->card_capabilities->adc_1361t)
2164 if (emu->ac97->id == AC97_ID_STAC9758) {
2165 emu->rear_ac97 = 1;
2166 snd_emu10k1_ptr_write(emu, AC97SLOT, 0, AC97SLOT_CNTR|AC97SLOT_LFE|AC97SLOT_REAR_LEFT|AC97SLOT_REAR_RIGHT);
2167 snd_ac97_write_cache(emu->ac97, AC97_HEADPHONE, 0x0202);
2172 snd_ac97_write_cache(emu->ac97, AC97_SURROUND_MASTER, 0x0202);
2173 snd_ac97_write_cache(emu->ac97, AC97_CENTER_LFE_MASTER, 0x0202);
2178 } else if (emu->card_capabilities->i2c_adc) {
2184 if (emu->card_capabilities->ecard)
2185 strcpy(emu->card->mixername, "EMU APS");
2186 else if (emu->audigy)
2187 strcpy(emu->card->mixername, "SB Audigy");
2189 strcpy(emu->card->mixername, "Emu10k1");
2192 if (emu->audigy)
2193 if (emu->card_capabilities->adc_1361t)
2195 else if (emu->card_capabilities->i2c_adc)
2204 if (emu->card_capabilities->subsystem == 0x80401102) { /* SB Live! Platinum CT4760P */
2210 if (emu->card_capabilities->subsystem == 0x20071102) { /* Audigy 4 Pro */
2216 kctl = emu->ctl_send_routing = snd_ctl_new1(&snd_emu10k1_send_routing_control, emu);
2223 kctl = emu->ctl_send_volume = snd_ctl_new1(&snd_emu10k1_send_volume_control, emu);
2230 kctl = emu->ctl_attn = snd_ctl_new1(&snd_emu10k1_attn_control, emu);
2238 kctl = emu->ctl_efx_send_routing = snd_ctl_new1(&snd_emu10k1_efx_send_routing_control, emu);
2246 kctl = emu->ctl_efx_send_volume = snd_ctl_new1(&snd_emu10k1_efx_send_volume_control, emu);
2254 kctl = emu->ctl_efx_attn = snd_ctl_new1(&snd_emu10k1_efx_attn_control, emu);
2262 if (!emu->card_capabilities->ecard && !emu->card_capabilities->emu_model) {
2264 kctl = snd_ctl_new1(&snd_emu10k1_spdif_mask_control, emu);
2267 if (!emu->audigy)
2268 kctl->id.device = emu->pcm_efx->device;
2272 kctl = snd_ctl_new1(&snd_emu10k1_spdif_control, emu);
2275 if (!emu->audigy)
2276 kctl->id.device = emu->pcm_efx->device;
2282 if (emu->card_capabilities->emu_model) {
2284 } else if (emu->audigy) {
2285 kctl = snd_ctl_new1(&snd_audigy_shared_spdif, emu);
2292 kctl = snd_ctl_new1(&snd_audigy_spdif_output_rate, emu);
2299 } else if (! emu->card_capabilities->ecard) {
2301 kctl = snd_ctl_new1(&snd_emu10k1_shared_spdif, emu);
2308 if (emu->card_capabilities->ca0151_chip) { /* P16V */
2309 err = snd_p16v_mixer(emu);
2314 if (emu->card_capabilities->emu_model) {
2315 unsigned i, emu_idx = emu1010_idx(emu);
2321 emu->emu1010.input_source[i] =
2324 emu->emu1010.output_source[i] =
2326 snd_emu1010_apply_sources(emu);
2328 kctl = emu->ctl_clock_source = snd_ctl_new1(&snd_emu1010_clock_source, emu);
2333 snd_ctl_new1(&snd_emu1010_clock_fallback, emu));
2337 err = add_ctls(emu, &emu1010_adc_pads_ctl,
2341 err = add_ctls(emu, &emu1010_dac_pads_ctl,
2346 if (!emu->card_capabilities->no_adat) {
2348 snd_ctl_new1(&snd_emu1010_optical_out, emu));
2352 snd_ctl_new1(&snd_emu1010_optical_in, emu));
2357 err = add_emu1010_source_mixers(emu);
2362 if ( emu->card_capabilities->i2c_adc) {
2363 err = snd_ctl_add(card, snd_ctl_new1(&snd_audigy_i2c_capture_source, emu));
2367 err = add_ctls(emu, &i2c_volume_ctl,
2374 if (emu->card_capabilities->ac97_chip && emu->audigy) {
2376 emu));